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 <cursoragent@cursor.com>
This commit is contained in:
yuquanjun 2026-10-16 20:37:36 +08:00
parent 1dfa0991a5
commit 756639f5f6
1 changed files with 38 additions and 0 deletions

View File

@ -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)
{