fix: reset channel state on stop to prevent burst continuation

Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-10 10:45:33 +00:00
parent 595a35ec32
commit b7827e7311

View File

@@ -82,11 +82,20 @@ static void apply_command(command_t cmd) {
}
break;
case CMD_STOP:
if (cmd.channel >= 0 && cmd.channel < cap)
if (cmd.channel >= 0 && cmd.channel < cap) {
atomic_store(&cur[cmd.channel].state, STATE_IDLE);
else {
for (int i = 0; i < cap; i++)
cur[cmd.channel].loop_count = 0;
cur[cmd.channel].record_pos = 0;
cur[cmd.channel].playback_pos = 0;
cur[cmd.channel].prev_state = -1;
} else {
for (int i = 0; i < cap; i++) {
atomic_store(&cur[i].state, STATE_IDLE);
cur[i].loop_count = 0;
cur[i].record_pos = 0;
cur[i].playback_pos = 0;
cur[i].prev_state = -1;
}
}
break;
case CMD_BIND_CHANNEL: