diff --git a/test_audio_routing.c b/test_audio_routing.c index f65689c..6cc5d16 100644 --- a/test_audio_routing.c +++ b/test_audio_routing.c @@ -42,7 +42,9 @@ static atomic_int tests_passed; static atomic_int tests_failed; // Shared buffers for test audio input (written by test thread, read by JACK callback) -static float test_audio_input[MAX_CHANNELS][TEST_NFRAMES * TEST_DURATION_SECONDS]; +// Max samples = sample_rate * max_duration_seconds (sample_rate is typically 48000) +#define MAX_SAMPLES (48000 * TEST_DURATION_SECONDS) +static float test_audio_input[MAX_CHANNELS][MAX_SAMPLES]; static atomic_size_t test_audio_input_count[MAX_CHANNELS]; static atomic_size_t test_audio_input_read[MAX_CHANNELS]; @@ -51,7 +53,7 @@ static uint8_t test_midi_buffer[3]; // status, note, velocity static atomic_bool test_midi_pending; // Test audio output buffers (written by JACK callback, read by test thread) -static float test_output_buffer[MAX_CHANNELS][TEST_NFRAMES * TEST_DURATION_SECONDS]; +static float test_output_buffer[MAX_CHANNELS][MAX_SAMPLES]; static atomic_size_t test_output_count[MAX_CHANNELS]; // ============================================================ @@ -100,7 +102,7 @@ static int test_process_callback(jack_nframes_t nframes, void *arg) { jack_port_get_buffer(test_audio_in[ch], nframes); size_t count = atomic_load(&test_output_count[ch]); - if (count + nframes <= TEST_NFRAMES * TEST_DURATION_SECONDS) { + if (count + nframes <= MAX_SAMPLES) { for (jack_nframes_t i = 0; i < nframes; i++) { test_output_buffer[ch][count + i] = in[i]; }