From 6c8a3a3d3bff112852da523614f6c54c4c08d13b Mon Sep 17 00:00:00 2001 From: yuquanjun Date: Thu, 17 Sep 2026 16:05:13 +0800 Subject: [PATCH] fix(play): stop accompaniment fully on mode and song switch Use Stop_AutoBand (engine stop + all-channel AllNotesOff) when changing nav mode, reloading tone presets, switching songs/progressions, or returning to mode select. Also fix AllNotesOff to address all 16 MIDI channels. Co-authored-by: Cursor --- Global/Global.c | 4 ++-- UI/UI_Idle.c | 3 +-- UI/UI_SongMode.c | 4 ++++ UI/UI_global.c | 7 ++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Global/Global.c b/Global/Global.c index fb92917..1b8bbff 100644 --- a/Global/Global.c +++ b/Global/Global.c @@ -746,9 +746,9 @@ void Stop_AutoBand() AutoBandTop1_Stop(); for(uint8_t i = 0;i < 16;i++) { - uint8_t AllNoteOff_buff[3] = {0xB0,0x7B,0x00}; + uint8_t AllNoteOff_buff[3] = {(uint8_t)(0xB0 | i),0x7B,0x00}; SendMidiDataToDreamDSP(AllNoteOff_buff,sizeof(AllNoteOff_buff)); - uint8_t AllControlOff_buff[3] = {0xB0,0x79,0x00}; + uint8_t AllControlOff_buff[3] = {(uint8_t)(0xB0 | i),0x79,0x00}; SendMidiDataToDreamDSP(AllControlOff_buff,sizeof(AllControlOff_buff)); } StartFlag = 0; diff --git a/UI/UI_Idle.c b/UI/UI_Idle.c index 04e3229..4bb29c1 100644 --- a/UI/UI_Idle.c +++ b/UI/UI_Idle.c @@ -48,9 +48,8 @@ static void UI_ModeSelect_DrawButtons(void) void UI_ReturnToModeSelect(void) { - StartFlag = 0; InModeFlag = false; - AutoBandTop1_Stop(); + Stop_AutoBand(); /* 长按回模式选择时,清掉万能 LOOP_LIGHT 残留红灯 */ app_tm1629_all_on(LED_COLOR_G); CallUI_Idle(); diff --git a/UI/UI_SongMode.c b/UI/UI_SongMode.c index b41ec5f..4efc507 100644 --- a/UI/UI_SongMode.c +++ b/UI/UI_SongMode.c @@ -177,6 +177,10 @@ void Touch_Action(int8_t FLAG, uint8_t ID, uint8_t areaIndex,uint8_t value) if (!UI_SetFocus(GUI_MODE_PARAM)) show_Param(&UI_Label[GUI_MODE_PARAM], pCurData); + /* 切歌/切走向:先停当前伴奏并静音,避免旧曲尾音残留 */ + if (last_value != pCurData->Current) + Stop_AutoBand(); + UI_ApplyToneAddress(); int ret = 0; if (tab == 0) diff --git a/UI/UI_global.c b/UI/UI_global.c index 49f6fa1..9782364 100644 --- a/UI/UI_global.c +++ b/UI/UI_global.c @@ -164,9 +164,8 @@ void UI_ApplyToneAddress(void) void UI_ReloadTonePreset(void) { UI_ApplyToneAddress(); - /* 换库前先停,避免播放中改 relocate 指针 */ - AutoBandTop1_Stop(); - StartFlag = 0; + /* 换库/切模式前完整停止伴奏(引擎停 + 全通道 AllNotesOff) */ + Stop_AutoBand(); /* 万能:和弦走向 */ if (mGuiData[GUI_TAB_INDEX].Current == 0) { @@ -1013,6 +1012,8 @@ void UI_NavBar_Action(uint8_t value) { /* 离开万能后 LOOP_LIGHT 停更,须显式恢复全绿(旧 GUI_TAB_INDEX 路径曾做) */ app_tm1629_all_on(LED_COLOR_G); + /* 底栏切模式/进设置:立即结束当前伴奏(设置页不走 ReloadTonePreset) */ + Stop_AutoBand(); switch (value) {