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 <cursoragent@cursor.com>
This commit is contained in:
yuquanjun 2026-09-17 16:05:13 +08:00
parent bf1a539e44
commit 6c8a3a3d3b
4 changed files with 11 additions and 7 deletions

View File

@ -746,9 +746,9 @@ void Stop_AutoBand()
AutoBandTop1_Stop(); AutoBandTop1_Stop();
for(uint8_t i = 0;i < 16;i++) 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)); 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)); SendMidiDataToDreamDSP(AllControlOff_buff,sizeof(AllControlOff_buff));
} }
StartFlag = 0; StartFlag = 0;

View File

@ -48,9 +48,8 @@ static void UI_ModeSelect_DrawButtons(void)
void UI_ReturnToModeSelect(void) void UI_ReturnToModeSelect(void)
{ {
StartFlag = 0;
InModeFlag = false; InModeFlag = false;
AutoBandTop1_Stop(); Stop_AutoBand();
/* 长按回模式选择时,清掉万能 LOOP_LIGHT 残留红灯 */ /* 长按回模式选择时,清掉万能 LOOP_LIGHT 残留红灯 */
app_tm1629_all_on(LED_COLOR_G); app_tm1629_all_on(LED_COLOR_G);
CallUI_Idle(); CallUI_Idle();

View File

@ -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)) if (!UI_SetFocus(GUI_MODE_PARAM))
show_Param(&UI_Label[GUI_MODE_PARAM], pCurData); show_Param(&UI_Label[GUI_MODE_PARAM], pCurData);
/* 切歌/切走向:先停当前伴奏并静音,避免旧曲尾音残留 */
if (last_value != pCurData->Current)
Stop_AutoBand();
UI_ApplyToneAddress(); UI_ApplyToneAddress();
int ret = 0; int ret = 0;
if (tab == 0) if (tab == 0)

View File

@ -164,9 +164,8 @@ void UI_ApplyToneAddress(void)
void UI_ReloadTonePreset(void) void UI_ReloadTonePreset(void)
{ {
UI_ApplyToneAddress(); UI_ApplyToneAddress();
/* 换库前先停,避免播放中改 relocate 指针 */ /* 换库/切模式前完整停止伴奏(引擎停 + 全通道 AllNotesOff) */
AutoBandTop1_Stop(); Stop_AutoBand();
StartFlag = 0;
/* 万能:和弦走向 */ /* 万能:和弦走向 */
if (mGuiData[GUI_TAB_INDEX].Current == 0) if (mGuiData[GUI_TAB_INDEX].Current == 0)
{ {
@ -1013,6 +1012,8 @@ void UI_NavBar_Action(uint8_t value)
{ {
/* 离开万能后 LOOP_LIGHT 停更,须显式恢复全绿(旧 GUI_TAB_INDEX 路径曾做) */ /* 离开万能后 LOOP_LIGHT 停更,须显式恢复全绿(旧 GUI_TAB_INDEX 路径曾做) */
app_tm1629_all_on(LED_COLOR_G); app_tm1629_all_on(LED_COLOR_G);
/* 底栏切模式/进设置:立即结束当前伴奏(设置页不走 ReloadTonePreset) */
Stop_AutoBand();
switch (value) switch (value)
{ {