1-multichannel #1

Merged
boomjacky merged 31 commits from 1-multichannel into multichannel 2026-05-09 15:47:09 -04:00
Showing only changes of commit 982dd4dc02 - Show all commits

View File

@@ -168,7 +168,7 @@ static int test_audio_pass_through(void) {
waitpid(pid, NULL, 0); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
const char *looper_input = "looper:input"; const char *looper_input = "looper:input";
const char *looper_output = "looper:output"; const char *looper_output = "looper:output";
char my_output[64], my_input[64]; char my_output[64], my_input[64];
@@ -262,7 +262,7 @@ static int send_jack_note_on(const char *target_port, unsigned char note, unsign
} }
/* wait for the process callback to clear the flag (event delivered) */ /* wait for the process callback to clear the flag (event delivered) */
for (int attempts = 0; attempts < 50; attempts++) { /* ~50 * 10ms = 500ms */ for (int attempts = 0; attempts < 50; attempts++) { /* ~50 * 10ms = 500ms */
usleep(10000); safe_usleep(10000);
if (!midi_inject_pending) break; if (!midi_inject_pending) break;
} }
jack_deactivate(midi_inject_client); jack_deactivate(midi_inject_client);
@@ -306,7 +306,7 @@ static int test_looper_looping(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); /* wait for ports to appear */ safe_usleep(200000); /* wait for ports to appear */
/* connect test:out -> looper:input, looper:output -> test:in */ /* connect test:out -> looper:input, looper:output -> test:in */
char my_out[64], my_in[64]; char my_out[64], my_in[64];
snprintf(my_out, sizeof(my_out), "test_looping:out"); snprintf(my_out, sizeof(my_out), "test_looping:out");
@@ -451,7 +451,7 @@ static int test_control_key_modifier(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
char my_out[64], my_in[64]; char my_out[64], my_in[64];
snprintf(my_out, sizeof(my_out), "test_ctrl_key:out"); snprintf(my_out, sizeof(my_out), "test_ctrl_key:out");
snprintf(my_in, sizeof(my_in), "test_ctrl_key:in"); snprintf(my_in, sizeof(my_in), "test_ctrl_key:in");
@@ -468,7 +468,7 @@ static int test_control_key_modifier(void) {
fprintf(stderr, " FAIL: send note 64 failed\n"); fprintf(stderr, " FAIL: send note 64 failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
/* Now send note 62 (toggle channel 0) */ /* Now send note 62 (toggle channel 0) */
if (send_jack_note_on("looper:control", 62, 127) != 0) { if (send_jack_note_on("looper:control", 62, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -496,7 +496,7 @@ static int test_control_key_modifier(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); /* allow beep */ safe_usleep(200000); /* allow beep */
/* send note 62 again under control key to move RECORD->LOOPING */ /* send note 62 again under control key to move RECORD->LOOPING */
if (send_jack_note_on("looper:control", 64, 127) != 0) { if (send_jack_note_on("looper:control", 64, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -504,7 +504,7 @@ static int test_control_key_modifier(void) {
fprintf(stderr, " FAIL: control key resend\n"); fprintf(stderr, " FAIL: control key resend\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 62, 127) != 0) { if (send_jack_note_on("looper:control", 62, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
@@ -550,7 +550,7 @@ static int test_bind_channel(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
char my_out[64], my_in[64]; char my_out[64], my_in[64];
snprintf(my_out, sizeof(my_out), "test_bind:out"); snprintf(my_out, sizeof(my_out), "test_bind:out");
snprintf(my_in, sizeof(my_in), "test_bind:in"); snprintf(my_in, sizeof(my_in), "test_bind:in");
@@ -567,14 +567,14 @@ static int test_bind_channel(void) {
fprintf(stderr, " FAIL: send control key failed\n"); fprintf(stderr, " FAIL: send control key failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 0, 127) != 0) { if (send_jack_note_on("looper:control", 0, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
fprintf(stderr, " FAIL: send bind note 0 failed\n"); fprintf(stderr, " FAIL: send bind note 0 failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
/* Now toggle using control+note62 should toggle channel 0 */ /* Now toggle using control+note62 should toggle channel 0 */
if (send_jack_note_on("looper:control", 64, 127) != 0) { if (send_jack_note_on("looper:control", 64, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -582,7 +582,7 @@ static int test_bind_channel(void) {
fprintf(stderr, " FAIL: send control key again failed\n"); fprintf(stderr, " FAIL: send control key again failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 62, 127) != 0) { if (send_jack_note_on("looper:control", 62, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
@@ -609,7 +609,7 @@ static int test_bind_channel(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); /* allow beep */ safe_usleep(200000); /* allow beep */
/* send control+note62 again to move RECORD->LOOPING */ /* send control+note62 again to move RECORD->LOOPING */
if (send_jack_note_on("looper:control", 64, 127) != 0) { if (send_jack_note_on("looper:control", 64, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -617,7 +617,7 @@ static int test_bind_channel(void) {
fprintf(stderr, " FAIL: control key for loop\n"); fprintf(stderr, " FAIL: control key for loop\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 62, 127) != 0) { if (send_jack_note_on("looper:control", 62, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
@@ -663,7 +663,7 @@ static int test_bind_unbind(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
char my_out[64], my_in[64]; char my_out[64], my_in[64];
snprintf(my_out, sizeof(my_out), "test_unbind:out"); snprintf(my_out, sizeof(my_out), "test_unbind:out");
snprintf(my_in, sizeof(my_in), "test_unbind:in"); snprintf(my_in, sizeof(my_in), "test_unbind:in");
@@ -680,14 +680,14 @@ static int test_bind_unbind(void) {
fprintf(stderr, " FAIL: send control key failed\n"); fprintf(stderr, " FAIL: send control key failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 5, 127) != 0) { if (send_jack_note_on("looper:control", 5, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
fprintf(stderr, " FAIL: bind to 5 failed\n"); fprintf(stderr, " FAIL: bind to 5 failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
/* Unbind (reset to 0) */ /* Unbind (reset to 0) */
if (send_jack_note_on("looper:control", 64, 127) != 0) { if (send_jack_note_on("looper:control", 64, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -695,14 +695,14 @@ static int test_bind_unbind(void) {
fprintf(stderr, " FAIL: control key for unbind\n"); fprintf(stderr, " FAIL: control key for unbind\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 63, 127) != 0) { if (send_jack_note_on("looper:control", 63, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
fprintf(stderr, " FAIL: send unbind note 63 failed\n"); fprintf(stderr, " FAIL: send unbind note 63 failed\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
/* Now toggle with control+62 should affect channel 0 */ /* Now toggle with control+62 should affect channel 0 */
if (send_jack_note_on("looper:control", 64, 127) != 0) { if (send_jack_note_on("looper:control", 64, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -710,7 +710,7 @@ static int test_bind_unbind(void) {
fprintf(stderr, " FAIL: control key for toggle\n"); fprintf(stderr, " FAIL: control key for toggle\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 62, 127) != 0) { if (send_jack_note_on("looper:control", 62, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
@@ -737,7 +737,7 @@ static int test_bind_unbind(void) {
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);
return 1; return 1;
} }
usleep(200000); /* allow beep */ safe_usleep(200000); /* allow beep */
/* second control+62 -> loop */ /* second control+62 -> loop */
if (send_jack_note_on("looper:control", 64, 127) != 0) { if (send_jack_note_on("looper:control", 64, 127) != 0) {
jack_client_close(client); jack_client_close(client);
@@ -745,7 +745,7 @@ static int test_bind_unbind(void) {
fprintf(stderr, " FAIL: control key for loop\n"); fprintf(stderr, " FAIL: control key for loop\n");
return 1; return 1;
} }
usleep(200000); safe_usleep(200000);
if (send_jack_note_on("looper:control", 62, 127) != 0) { if (send_jack_note_on("looper:control", 62, 127) != 0) {
jack_client_close(client); jack_client_close(client);
kill(pid, SIGTERM); waitpid(pid, NULL, 0); kill(pid, SIGTERM); waitpid(pid, NULL, 0);