feat: remove hard limit on number of channels

Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-10 10:38:59 +00:00
parent 3a4aac3356
commit 5739ff8019
4 changed files with 140 additions and 79 deletions

View File

@@ -35,7 +35,7 @@ void midi_handle_events(void *port_buffer, jack_nframes_t nframes) {
int ck = atomic_load(&control_key_active);
if (ck) {
atomic_store(&control_key_active, 0);
if (note < 16) {
if (note < 16 && note < atomic_load(&channel_capacity)) {
command_t cmd = {
.type = CMD_BIND_CHANNEL, .channel = -1, .data = note};
queue_push(&cmd_queue, cmd);
@@ -53,7 +53,7 @@ void midi_handle_events(void *port_buffer, jack_nframes_t nframes) {
} break;
case 62: {
int bch = atomic_load(&bind_channel);
if (bch >= 0 && bch < MAX_CHANNELS) {
if (bch >= 0 && bch < atomic_load(&channel_capacity)) {
command_t cmd = {.type = CMD_CYCLE, .channel = bch, .data = 0};
queue_push(&cmd_queue, cmd);
}