refactor: remove extern declarations and unused test function

Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-07 21:42:48 +00:00
parent d4b3c2334b
commit 99c4e033f0

View File

@@ -19,6 +19,9 @@ static int passthrough_sample_rate = 0;
static long passthrough_total_samples = 0; static long passthrough_total_samples = 0;
static double passthrough_sum_sq = 0.0; static double passthrough_sum_sq = 0.0;
static volatile int passthrough_done = 0; static volatile int passthrough_done = 0;
static volatile int beep_remaining = 0;
static volatile int bursts = 0;
static volatile int prev_above = 0;
/* The test code uses this callback in two ways: /* The test code uses this callback in two ways:
- For the audio passthrough test (existing function) it still works. - For the audio passthrough test (existing function) it still works.
@@ -36,7 +39,6 @@ static int passthrough_process(jack_nframes_t nframes, void *arg) {
const float *inf = in; const float *inf = in;
for (jack_nframes_t i = 0; i < nframes; i++) { for (jack_nframes_t i = 0; i < nframes; i++) {
/* generate beep while beep_remaining > 0 */ /* generate beep while beep_remaining > 0 */
extern int beep_remaining; /* defined in test_looper_looping */
float out_val; float out_val;
if (beep_remaining > 0) { if (beep_remaining > 0) {
out_val = sinf(passthrough_phase); out_val = sinf(passthrough_phase);
@@ -50,8 +52,6 @@ static int passthrough_process(jack_nframes_t nframes, void *arg) {
outf[i] = out_val; outf[i] = out_val;
/* detect bursts on the input (looper output) */ /* detect bursts on the input (looper output) */
extern int bursts;
extern int prev_above;
float sample = inf[i]; float sample = inf[i];
int above = (fabsf(sample) > 0.05f); int above = (fabsf(sample) > 0.05f);
if (above && !prev_above) { if (above && !prev_above) {
@@ -313,22 +313,6 @@ static int test_audio_pass_through(void) {
return 0; return 0;
} }
/*
* Test that the looper does NOT actually loop yet (feature not implemented).
* It should still pass audio through unchanged even after state changes.
* This is a "successful failure" we expect the feature to be missing.
*/
static void test_looping_not_implemented(void) {
printf("Test: loop recording feature (expect MISSING intentional)\n");
/* We no longer require jack_sine, jack_capture or python3.
The only way to verify no looping functionality is to check
that after the appropriate MIDI signals the process does not
crash and the ports remain connected. We leave this as an
intentional placeholder for future tests. */
printf(" SUCCESS: nothing was measured (looping feature not implemented)\n");
}
/* Helper: open a transient JACK client, send a MIDI noteon, close */ /* Helper: open a transient JACK client, send a MIDI noteon, close */
static int send_jack_note_on(const char *target_port, unsigned char note, unsigned char velocity) { static int send_jack_note_on(const char *target_port, unsigned char note, unsigned char velocity) {
@@ -403,11 +387,6 @@ static int test_looper_looping(void) {
return 1; return 1;
} }
/* state variables used by the process callback */
static volatile int beep_remaining = 0;
static volatile int bursts = 0;
static volatile int prev_above = 0;
/* first noteon: IDLE -> RECORD */ /* first noteon: IDLE -> RECORD */
if (send_jack_note_on("looper:control", 1, 127) != 0) { if (send_jack_note_on("looper:control", 1, 127) != 0) {
jack_client_close(client); jack_client_close(client);