fix: add null-checks for MIDI ports and use atomic access for channel active flag

Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-09 09:57:36 +00:00
parent 74a190c70c
commit c0a0a6e968
4 changed files with 36 additions and 31 deletions

View File

@@ -23,7 +23,7 @@ void channel_add(jack_client_t *client, int idx)
return;
}
channels[idx].active = 1;
atomic_store(&channels[idx].active, 1);
atomic_store(&channels[idx].state, STATE_IDLE);
channels[idx].prev_state = -1;
channels[idx].loop_count = 0;
@@ -38,6 +38,6 @@ void channel_remove(jack_client_t *client, int idx)
{
jack_port_unregister(client, channels[idx].audio_in);
jack_port_unregister(client, channels[idx].audio_out);
channels[idx].active = 0;
atomic_store(&channels[idx].active, 0);
channel_count--;
}