From: dttsp Date: Mon, 2 May 2005 12:50:41 +0000 (+0000) Subject: added on/off switching for aux input port mix X-Git-Url: https://git.rkrishnan.org/about.html?a=commitdiff_plain;h=289f928c573999790be7eebe865c0c47d22cdc29;p=dttsp.git added on/off switching for aux input port mix --- diff --git a/jDttSP/sdr.c b/jDttSP/sdr.c index 8201b9d..b3b2818 100644 --- a/jDttSP/sdr.c +++ b/jDttSP/sdr.c @@ -76,7 +76,8 @@ setup_all(void) { uni.multirx.lis = 0; uni.multirx.nrx = loc.def.nrx; - uni.mix.rx = uni.mix.tx = 1.0; + uni.mix.rx.flag = uni.mix.tx.flag = FALSE; + uni.mix.rx.gain = uni.mix.tx.gain = 1.0; uni.tick = 0; } @@ -739,17 +740,19 @@ process_samples(float *bufl, float *bufr, 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; + if (uni.mix.rx.flag) + for (i = 0; i < n; i++) + bufl[i] += auxl[i] * uni.mix.rx.gain, + bufr[i] += auxr[i] * uni.mix.rx.gain; break; case TX: - for (i = 0; i < n; i++) - bufl[i] += auxl[i] * uni.mix.tx, - bufr[i] += auxr[i] * uni.mix.tx; + if (uni.mix.tx.flag) + for (i = 0; i < n; i++) + bufl[i] += auxl[i] * uni.mix.tx.gain, + bufr[i] += auxr[i] * uni.mix.tx.gain; for (i = 0; i < n; i++) CXBimag(tx.buf.i, i) = bufl[i], CXBreal(tx.buf.i, i) = bufr[i]; diff --git a/jDttSP/sdrexport.h b/jDttSP/sdrexport.h index 477f112..9900339 100644 --- a/jDttSP/sdrexport.h +++ b/jDttSP/sdrexport.h @@ -102,7 +102,10 @@ extern struct _uni { } multirx; struct { - REAL rx, tx; + struct { + BOOLEAN flag; + REAL gain; + } rx, tx; } mix; long tick; diff --git a/jDttSP/update.c b/jDttSP/update.c index 5962cb1..4552cd2 100644 --- a/jDttSP/update.c +++ b/jDttSP/update.c @@ -744,20 +744,39 @@ setRXPan(int n, char **p) { } PRIVATE int -setAuxMix(int n, char **p) { +setAuxMixSt(int n, char **p) { if (n < 1) { - uni.mix.rx = uni.mix.tx = 1.0; + uni.mix.rx.flag = uni.mix.tx.flag = FALSE; + return 0; + } else { + BOOLEAN flag = atoi(p[0]); + if (n > 1) { + switch (atoi(p[1])) { + case TX: uni.mix.tx.flag = flag; break; + case RX: + default: uni.mix.rx.flag = flag; break; + } + } else + uni.mix.rx.flag = uni.mix.tx.flag = flag; + return 0; + } +} + +PRIVATE int +setAuxMixGain(int n, char **p) { + if (n < 1) { + uni.mix.rx.gain = uni.mix.tx.gain = 1.0; return 0; } else { REAL gain = dB2lin(atof(p[0])); if (n > 1) { switch (atoi(p[1])) { - case TX: uni.mix.tx = gain; break; + case TX: uni.mix.tx.gain = gain; break; case RX: - default: uni.mix.rx = gain; break; + default: uni.mix.rx.gain = gain; break; } } else - uni.mix.rx = uni.mix.tx = gain; + uni.mix.rx.gain = uni.mix.tx.gain = gain; return 0; } } @@ -819,7 +838,8 @@ CTE update_cmds[] = { {"setRXOn", setRXOn}, {"setRXOff", setRXOff}, {"setRXPan", setRXPan}, - {"setAuxMix", setAuxMix}, + {"setAuxMixSt", setAuxMixSt}, + {"setAuxMixGain", setAuxMixGain}, { 0, 0 } };