fix: enable continuous sine tone in audio pass-through test
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
@@ -23,6 +23,7 @@ static volatile int passthrough_done = 0;
|
||||
static volatile int beep_remaining = 0;
|
||||
static volatile int bursts = 0;
|
||||
static volatile int prev_above = 0;
|
||||
static int continuous_sine = 0;
|
||||
|
||||
/* variables for MIDI injection (used by send_jack_note_on) */
|
||||
static volatile int midi_inject_pending = 0;
|
||||
@@ -61,14 +62,14 @@ static int passthrough_process(jack_nframes_t nframes, void *arg) {
|
||||
float *outf = out;
|
||||
const float *inf = in;
|
||||
for (jack_nframes_t i = 0; i < nframes; i++) {
|
||||
/* generate beep while beep_remaining > 0 */
|
||||
/* generate beep while beep_remaining > 0 or continuous sine */
|
||||
float out_val;
|
||||
if (beep_remaining > 0) {
|
||||
if (continuous_sine || beep_remaining > 0) {
|
||||
out_val = sinf(passthrough_phase);
|
||||
passthrough_phase += 2.0f * (float)M_PI * passthrough_freq / passthrough_sample_rate;
|
||||
if (passthrough_phase > 2.0f * M_PI)
|
||||
passthrough_phase -= 2.0f * M_PI;
|
||||
beep_remaining--;
|
||||
if (beep_remaining > 0) beep_remaining--;
|
||||
} else {
|
||||
out_val = 0.0f;
|
||||
}
|
||||
@@ -183,6 +184,8 @@ static int test_audio_pass_through(void) {
|
||||
passthrough_total_samples = 0;
|
||||
passthrough_sum_sq = 0.0;
|
||||
passthrough_done = 0;
|
||||
continuous_sine = 1; /* enable continuous tone for this test */
|
||||
beep_remaining = 0; /* not needed */
|
||||
jack_set_process_callback(client, passthrough_process, NULL);
|
||||
if (jack_activate(client) != 0) {
|
||||
fprintf(stderr, " FAIL: cannot activate client\n");
|
||||
@@ -309,6 +312,7 @@ static int test_looper_looping(void) {
|
||||
usleep(200000); /* allow state to change */
|
||||
|
||||
int sr = jack_get_sample_rate(client);
|
||||
continuous_sine = 0; /* disable continuous tone */
|
||||
beep_remaining = (int)(0.1f * sr); /* 0.1 second beep */
|
||||
bursts = 0;
|
||||
prev_above = 0;
|
||||
|
||||
Reference in New Issue
Block a user