1-multichannel #1

Merged
boomjacky merged 31 commits from 1-multichannel into multichannel 2026-05-09 15:47:09 -04:00
2 changed files with 9 additions and 7 deletions
Showing only changes of commit 20c0820910 - Show all commits

View File

@@ -79,11 +79,13 @@ int process_callback(jack_nframes_t nframes, void *arg) {
switch (state) { switch (state) {
case STATE_RECORD: case STATE_RECORD:
if (in) { if (in) {
float *f_out = (float *)out;
const float *f_in = (const float *)in;
for (i = 0; i < nframes; i++) { for (i = 0; i < nframes; i++) {
if (channels[c].record_pos < LOOP_BUF_SIZE) if (channels[c].record_pos < LOOP_BUF_SIZE)
channels[c].loop_buffer[channels[c].record_pos++] = channels[c].loop_buffer[channels[c].record_pos++] =
((const float *)in)[i]; f_in[i];
((float *)out)[i] = ((const float *)in)[i]; // cppcheck-suppress unreadVariable f_out[i] = f_in[i];
} }
} else { } else {
memset(out, 0, sizeof(jack_default_audio_sample_t) * nframes); memset(out, 0, sizeof(jack_default_audio_sample_t) * nframes);

View File

@@ -68,8 +68,8 @@ static int passthrough_process(jack_nframes_t nframes, void *arg) {
const jack_default_audio_sample_t *in = const jack_default_audio_sample_t *in =
(const jack_default_audio_sample_t *)jack_port_get_buffer(passthrough_input_port, nframes); (const jack_default_audio_sample_t *)jack_port_get_buffer(passthrough_input_port, nframes);
if (!out || !in) return 0; if (!out || !in) return 0;
float *outf = out; float *f_out = (float *)out;
const float *inf = in; const float *f_in = (const float *)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 or continuous sine */ /* generate beep while beep_remaining > 0 or continuous sine */
float out_val; float out_val;
@@ -82,17 +82,17 @@ static int passthrough_process(jack_nframes_t nframes, void *arg) {
} else { } else {
out_val = 0.0f; out_val = 0.0f;
} }
outf[i] = out_val; f_out[i] = out_val;
/* detect bursts on the input (looper output) */ /* detect bursts on the input (looper output) */
float sample = inf[i]; float sample = f_in[i];
int above = (fabsf(sample) > 0.05f); int above = (fabsf(sample) > 0.05f);
if (above && !prev_above) { if (above && !prev_above) {
bursts++; bursts++;
} }
prev_above = above; prev_above = above;
passthrough_sum_sq += (double)inf[i] * (double)inf[i]; passthrough_sum_sq += (double)f_in[i] * (double)f_in[i];
passthrough_total_samples++; passthrough_total_samples++;
} }
if (passthrough_total_samples >= passthrough_sample_rate * 2) { if (passthrough_total_samples >= passthrough_sample_rate * 2) {