// most of what little we know here about the inner loop,
// functionally speaking
-extern void process_samples(float *, float *, int);
+extern void process_samples(float *, float *, float *, float *, int);
extern void setup_workspace(void);
extern void destroy_workspace(void);
jack_ringbuffer_reset(top.jack.ring.i.r);
memset((char *) top.hold.buf.l, 0, top.hold.size.bytes);
memset((char *) top.hold.buf.r, 0, top.hold.size.bytes);
+ jack_ringbuffer_reset(top.jack.auxr.i.l);
+ jack_ringbuffer_reset(top.jack.auxr.i.r);
+ memset((char *) top.hold.aux.l, 0, top.hold.size.bytes);
+ memset((char *) top.hold.aux.r, 0, top.hold.size.bytes);
top.jack.blow.rb.i++;
} else {
jack_ringbuffer_read(top.jack.ring.i.l,
jack_ringbuffer_read(top.jack.ring.i.r,
(char *) top.hold.buf.r,
top.hold.size.bytes);
+ jack_ringbuffer_read(top.jack.auxr.i.l,
+ (char *) top.hold.aux.l,
+ top.hold.size.bytes);
+ jack_ringbuffer_read(top.jack.auxr.i.r,
+ (char *) top.hold.aux.r,
+ top.hold.size.bytes);
}
}
run_mute(void) {
memset((char *) top.hold.buf.l, 0, top.hold.size.bytes);
memset((char *) top.hold.buf.r, 0, top.hold.size.bytes);
+ memset((char *) top.hold.aux.l, 0, top.hold.size.bytes);
+ memset((char *) top.hold.aux.r, 0, top.hold.size.bytes);
uni.tick++;
}
PRIVATE void
run_play(void) {
- process_samples(top.hold.buf.l, top.hold.buf.r, top.hold.size.frames);
+ process_samples(top.hold.buf.l, top.hold.buf.r,
+ top.hold.aux.l, top.hold.aux.r,
+ top.hold.size.frames);
}
// NB do not set RUN_SWCH directly via setRunState;
jack_ringbuffer_reset(top.jack.ring.o.r);
}
- process_samples(top.hold.buf.l, top.hold.buf.r, top.hold.size.frames);
+ process_samples(top.hold.buf.l, top.hold.buf.r,
+ top.hold.aux.l, top.hold.aux.r,
+ top.hold.size.frames);
}
//========================================================================
rp = (float *) jack_port_get_buffer(top.jack.port.i.r, nframes);
jack_ringbuffer_write(top.jack.ring.i.l, (char *) lp, nbytes);
jack_ringbuffer_write(top.jack.ring.i.r, (char *) rp, nbytes);
+ lp = (float *) jack_port_get_buffer(top.jack.auxp.i.l, nframes);
+ rp = (float *) jack_port_get_buffer(top.jack.auxp.i.r, nframes);
+ jack_ringbuffer_write(top.jack.auxr.i.l, (char *) lp, nbytes);
+ jack_ringbuffer_write(top.jack.auxr.i.r, (char *) rp, nbytes);
} else { // rb pathology
jack_ringbuffer_reset(top.jack.ring.i.l);
jack_ringbuffer_reset(top.jack.ring.i.r);
clear_jack_ringbuffer(top.jack.ring.i.l, nbytes);
clear_jack_ringbuffer(top.jack.ring.i.r, nbytes);
+ jack_ringbuffer_reset(top.jack.auxr.i.l);
+ jack_ringbuffer_reset(top.jack.auxr.i.r);
+ clear_jack_ringbuffer(top.jack.auxr.i.l, nbytes);
+ clear_jack_ringbuffer(top.jack.auxr.i.r, nbytes);
top.jack.blow.rb.i++;
}
PRIVATE void
closeup(void) {
+ jack_ringbuffer_free(top.jack.auxr.i.r);
+ jack_ringbuffer_free(top.jack.auxr.i.l);
jack_ringbuffer_free(top.jack.ring.o.r);
jack_ringbuffer_free(top.jack.ring.o.l);
jack_ringbuffer_free(top.jack.ring.i.r);
safefree((char *) top.hold.buf.r);
safefree((char *) top.hold.buf.l);
+ safefree((char *) top.hold.aux.r);
+ safefree((char *) top.hold.aux.l);
destroy_workspace();
"main hold buffer left");
top.hold.buf.r = (float *) safealloc(top.hold.size.frames, sizeof(float),
"main hold buffer right");
+ top.hold.aux.l = (float *) safealloc(top.hold.size.frames, sizeof(float),
+ "aux hold buffer left");
+ top.hold.aux.r = (float *) safealloc(top.hold.size.frames, sizeof(float),
+ "aux hold buffer right");
}
PRIVATE void
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput,
0);
+ top.jack.auxp.i.l = jack_port_register(top.jack.client,
+ "al",
+ JACK_DEFAULT_AUDIO_TYPE,
+ JackPortIsInput,
+ 0);
+ top.jack.auxp.i.r = jack_port_register(top.jack.client,
+ "ar",
+ JACK_DEFAULT_AUDIO_TYPE,
+ JackPortIsInput,
+ 0);
top.jack.ring.i.l = jack_ringbuffer_create(top.hold.size.bytes * loc.mult.ring);
top.jack.ring.i.r = jack_ringbuffer_create(top.hold.size.bytes * loc.mult.ring);
top.jack.ring.o.l = jack_ringbuffer_create(top.hold.size.bytes * loc.mult.ring);
top.jack.ring.o.r = jack_ringbuffer_create(top.hold.size.bytes * loc.mult.ring);
+ top.jack.auxr.i.l = jack_ringbuffer_create(top.hold.size.bytes * loc.mult.ring);
+ top.jack.auxr.i.r = jack_ringbuffer_create(top.hold.size.bytes * loc.mult.ring);
clear_jack_ringbuffer(top.jack.ring.o.l, top.jack.size * sizeof(float));
clear_jack_ringbuffer(top.jack.ring.o.r, top.jack.size * sizeof(float));
}
uni.multirx.lis = 0;
uni.multirx.nrx = loc.def.nrx;
+
+ uni.mix.rx = uni.mix.tx = 1.0;
+
uni.tick = 0;
}
REAL pos = 0.5, // 0 <= pos <= 1, left->right
theta = (1.0 - pos) * M_PI / 2.0;
rx[k].azim = Cmplx(cos(theta), sin(theta));
+ fprintf(stderr, "azim %f %f\n", rx[k].azim.re, rx[k].azim.im);
}
rx[k].tick = 0;
come here when there are buffers to work on */
void
-process_samples(float *bufl, float *bufr, int n) {
+process_samples(float *bufl, float *bufr,
+ float *auxl, float *auxr,
+ int n) {
int i, k;
switch (uni.mode.trx) {
CXBhave(rx[k].buf.o) = n;
}
+ for (i = 0; i < n; i++)
+ bufl[i] += auxl[i] * uni.mix.rx,
+ bufr[i] += auxr[i] * uni.mix.rx;
+
break;
case TX:
+
+ for (i = 0; i < n; i++)
+ bufl[i] += auxl[i] * uni.mix.tx,
+ bufr[i] += auxr[i] * uni.mix.tx;
+
for (i = 0; i < n; i++)
CXBimag(tx.buf.i, i) = bufl[i], CXBreal(tx.buf.i, i) = bufr[i];
CXBhave(tx.buf.i) = n;
+
do_tx(), tx.tick++;
+
for (i = 0; i < n; i++)
bufl[i] = (float) CXBimag(tx.buf.o, i), bufr[i] = (float) CXBreal(tx.buf.o, i);
CXBhave(tx.buf.o) = n;
+
break;
}