fix: split main command queue into per-source SPSC queues
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
30
src/midi.c
30
src/midi.c
@@ -10,7 +10,7 @@
|
||||
extern atomic_int control_key_active;
|
||||
extern atomic_int bind_channel;
|
||||
extern spsc_queue_t cmd_queue;
|
||||
extern spsc_queue_t cmd_queue_main;
|
||||
extern spsc_queue_t cmd_queue_main_midi;
|
||||
|
||||
void midi_handle_events(void *port_buffer, jack_nframes_t nframes) {
|
||||
(void)nframes;
|
||||
@@ -40,10 +40,16 @@ void midi_handle_events(void *port_buffer, jack_nframes_t nframes) {
|
||||
queue_push(&cmd_queue, cmd);
|
||||
} else {
|
||||
switch (note) {
|
||||
case 60: /* add channel not rt‑safe, moved to FIFO pipe */
|
||||
case 61: /* remove channel not rt‑safe, moved to FIFO pipe */
|
||||
/* no operation here */
|
||||
break;
|
||||
case 60:
|
||||
{
|
||||
command_t cmd = { .type = CMD_ADD_CHANNEL, .channel = -1, .data = 0 };
|
||||
queue_push(&cmd_queue_main_midi, cmd);
|
||||
} break;
|
||||
case 61:
|
||||
{
|
||||
command_t cmd = { .type = CMD_REMOVE_CHANNEL, .channel = -1, .data = 0 };
|
||||
queue_push(&cmd_queue_main_midi, cmd);
|
||||
} break;
|
||||
case 62:
|
||||
{
|
||||
int bch = atomic_load(&bind_channel);
|
||||
@@ -69,10 +75,16 @@ void midi_handle_events(void *port_buffer, jack_nframes_t nframes) {
|
||||
command_t cmd = { .type = CMD_CYCLE, .channel = 0, .data = 0 };
|
||||
queue_push(&cmd_queue, cmd);
|
||||
} break;
|
||||
case 60: /* add channel not rt‑safe, moved to FIFO pipe */
|
||||
case 61: /* remove channel not rt‑safe, moved to FIFO pipe */
|
||||
/* no operation here */
|
||||
break;
|
||||
case 60:
|
||||
{
|
||||
command_t cmd = { .type = CMD_ADD_CHANNEL, .channel = -1, .data = 0 };
|
||||
queue_push(&cmd_queue_main_midi, cmd);
|
||||
} break;
|
||||
case 61:
|
||||
{
|
||||
command_t cmd = { .type = CMD_REMOVE_CHANNEL, .channel = -1, .data = 0 };
|
||||
queue_push(&cmd_queue_main_midi, cmd);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user