From 756639f5f608bd507fcaeecd160ceca8d4ce6983 Mon Sep 17 00:00:00 2001 From: yuquanjun Date: Fri, 16 Oct 2026 20:37:36 +0800 Subject: [PATCH] fix(accomp): limit the eight-note sequence to the first rhythm Other rhythms send several notes at once, so walking that arpeggio list turned their chords into the wrong pitches. Co-authored-by: Cursor --- MyCode/App_Auto.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/MyCode/App_Auto.c b/MyCode/App_Auto.c index 445aac2..66af296 100644 --- a/MyCode/App_Auto.c +++ b/MyCode/App_Auto.c @@ -79,6 +79,37 @@ static void App_Auto_GridReset(void) s_pending_hold_ms = 0; } +static void App_Auto_QueueAllNotesOffMelodic(void); + +/* 离开八音顺序时清掉步数和未配对的音,避免下一首接着上一首的相位。 */ +static void App_Auto_SeqClear(void) +{ + uint8_t i; + uint8_t was = s_seq_on; + s_seq_on = 0; + s_seq_ready = 0; + App_Auto_GridReset(); + for (i = 0u; i < 16u; i++) + s_seq_step[i] = 0; + for (i = 0u; i < SEQ_SLOTS; i++) + { + s_seq_slot[i].used = 0; + s_slot_hold4[i] = 0; + } + if (was) + App_Auto_QueueAllNotesOffMelodic(); +} + +/* 八音表只对应第 1 首分解(1.bin 序号 0)。其他节奏保持曲库音高。 */ +static int App_Auto_UseArpSeq(void) +{ + if ((uint32_t)ADDRESS != EXTFLASH_BIN1_RHYTHM_ADDR) + return 0; + if (ParamGuiData[SONG_MODE_PARAM].Current != 0) + return 0; + return 1; +} + /* 当前速度的八分音符,单位 ms。速度范围 40..260。 */ static uint16_t App_Auto_EighthMs(void) { @@ -183,6 +214,12 @@ static int App_Auto_MapSeq(int channel, int key, int is_on, int *out) s_pending_hold_ms = 0; s_seq_drop = 0; + if (!App_Auto_UseArpSeq()) + { + if (s_seq_on) + App_Auto_SeqClear(); + return 0; + } App_Auto_SeqRefresh(); if (!s_seq_on || channel == BASS_CH || channel == DRUM_CH) return 0; @@ -725,6 +762,7 @@ static volatile uint8_t s_preset_ready = 0; int App_Auto_LoadPresetFromFlash(int presetIndex) { + App_Auto_SeqClear(); int ret = AutoBandTop1_LoadPresetItemFromFlash(presetIndex); if (ret == 0) {