2-midi-looping #3

Merged
boomjacky merged 17 commits from 2-midi-looping into master 2026-05-10 12:24:23 -04:00
2 changed files with 19 additions and 3 deletions
Showing only changes of commit df181b117e - Show all commits

View File

@@ -143,10 +143,18 @@ int process_callback(jack_nframes_t nframes, void *arg) {
continue; continue;
/* Guard against NULL ports (e.g. if port registration failed) */ /* Guard against NULL ports (e.g. if port registration failed) */
if (active_channels[c].type == CHANNEL_AUDIO) {
if (!active_channels[c].audio_in || !active_channels[c].audio_out) { if (!active_channels[c].audio_in || !active_channels[c].audio_out) {
fprintf(stderr, "WARN: channel %d has NULL audio port(s), skipping\n", c); fprintf(stderr, "WARN: channel %d has NULL audio port(s), skipping\n", c);
continue; continue;
} }
} else {
/* CHANNEL_MIDI */
if (!active_channels[c].midi_in || !active_channels[c].midi_out) {
fprintf(stderr, "WARN: channel %d has NULL MIDI port(s), skipping\n", c);
continue;
}
}
const jack_default_audio_sample_t *in = const jack_default_audio_sample_t *in =
(const jack_default_audio_sample_t *)jack_port_get_buffer( (const jack_default_audio_sample_t *)jack_port_get_buffer(
@@ -507,6 +515,10 @@ void looper_process_commands(jack_client_t *client) {
jack_port_unregister(client, cur[idx].audio_in); jack_port_unregister(client, cur[idx].audio_in);
if (cur[idx].audio_out) if (cur[idx].audio_out)
jack_port_unregister(client, cur[idx].audio_out); jack_port_unregister(client, cur[idx].audio_out);
if (cur[idx].midi_in)
jack_port_unregister(client, cur[idx].midi_in);
if (cur[idx].midi_out)
jack_port_unregister(client, cur[idx].midi_out);
pending_unregister_idx = -1; pending_unregister_idx = -1;
} }
} }

View File

@@ -66,6 +66,10 @@ void midi_handle_events(void *port_buffer, jack_nframes_t nframes) {
command_t cmd = {.type = CMD_STOP, .channel = -1, .data = 0}; command_t cmd = {.type = CMD_STOP, .channel = -1, .data = 0};
queue_push(&cmd_queue, cmd); queue_push(&cmd_queue, cmd);
} break; } break;
case 66: {
command_t cmd = {.type = CMD_ADD_MIDI_CHANNEL, .channel = -1, .data = 0};
queue_push(&cmd_queue_main_midi, cmd);
} break;
default: default:
break; break;
} }