fix: remove blocking fprintf from real-time callback and zero output buffer
Co-authored-by: aider (deepseek/deepseek-reasoner) <aider@aider.chat>
This commit is contained in:
10
src/main.c
10
src/main.c
@@ -25,8 +25,12 @@ static int process(jack_nframes_t nframes, void *arg)
|
||||
jack_default_audio_sample_t *in = (jack_default_audio_sample_t *) jack_port_get_buffer(input_port, nframes);
|
||||
jack_default_audio_sample_t *out = (jack_default_audio_sample_t *) jack_port_get_buffer(output_port, nframes);
|
||||
|
||||
if (in && out) {
|
||||
if (out) {
|
||||
if (in) {
|
||||
memcpy(out, in, sizeof(jack_default_audio_sample_t) * nframes);
|
||||
} else {
|
||||
memset(out, 0, sizeof(jack_default_audio_sample_t) * nframes);
|
||||
}
|
||||
}
|
||||
|
||||
void *midi_ctrl_buf = jack_port_get_buffer(midi_control_port, nframes);
|
||||
@@ -42,19 +46,15 @@ static int process(jack_nframes_t nframes, void *arg)
|
||||
switch (current_state) {
|
||||
case STATE_IDLE:
|
||||
current_state = STATE_RECORD;
|
||||
fprintf(stderr, "[looper] -> record\n");
|
||||
break;
|
||||
case STATE_RECORD:
|
||||
current_state = STATE_LOOPING;
|
||||
fprintf(stderr, "[looper] -> looping\n");
|
||||
break;
|
||||
case STATE_LOOPING:
|
||||
current_state = STATE_PAUSED;
|
||||
fprintf(stderr, "[looper] -> paused\n");
|
||||
break;
|
||||
case STATE_PAUSED:
|
||||
current_state = STATE_LOOPING;
|
||||
fprintf(stderr, "[looper] -> looping\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user