1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

WDSP: SIPHON rework

This commit is contained in:
f4exb 2024-07-30 22:52:21 +02:00
parent 575fa755f8
commit 350117b9a9
4 changed files with 148 additions and 187 deletions

View File

@ -459,7 +459,7 @@ RXA* RXA::create_rxa (
1.0); // gain 1.0); // gain
// Scope/phase display send - pull phase & scope display data // Scope/phase display send - pull phase & scope display data
rxa->sip1 = SIPHON::create_siphon ( rxa->sip1 = new SIPHON(
0, // run - needed only for phase display 0, // run - needed only for phase display
0, // position 0, // position
0, // mode 0, // mode
@ -569,7 +569,7 @@ void RXA::destroy_rxa (RXA *rxa)
MPEAK::destroy_mpeak (rxa->mpeak); MPEAK::destroy_mpeak (rxa->mpeak);
SPEAK::destroy_speak (rxa->speak); SPEAK::destroy_speak (rxa->speak);
CBL::destroy_cbl (rxa->cbl); CBL::destroy_cbl (rxa->cbl);
SIPHON::destroy_siphon (rxa->sip1); delete (rxa->sip1);
delete (rxa->bp1); delete (rxa->bp1);
delete (rxa->agcmeter); delete (rxa->agcmeter);
delete (rxa->agc); delete (rxa->agc);
@ -624,7 +624,7 @@ void RXA::flush_rxa (RXA *rxa)
rxa->agc->flush(); rxa->agc->flush();
rxa->agcmeter->flush(); rxa->agcmeter->flush();
rxa->bp1->flush(); rxa->bp1->flush();
SIPHON::flush_siphon (rxa->sip1); rxa->sip1->flush();
CBL::flush_cbl (rxa->cbl); CBL::flush_cbl (rxa->cbl);
SPEAK::flush_speak (rxa->speak); SPEAK::flush_speak (rxa->speak);
MPEAK::flush_mpeak (rxa->mpeak); MPEAK::flush_mpeak (rxa->mpeak);
@ -663,7 +663,7 @@ void RXA::xrxa (RXA *rxa)
rxa->emnr->execute(1); rxa->emnr->execute(1);
rxa->bp1->execute(1); rxa->bp1->execute(1);
rxa->agcmeter->execute(); rxa->agcmeter->execute();
SIPHON::xsiphon (rxa->sip1, 0); rxa->sip1->execute(0);
CBL::xcbl (rxa->cbl); CBL::xcbl (rxa->cbl);
SPEAK::xspeak (rxa->speak); SPEAK::xspeak (rxa->speak);
MPEAK::xmpeak (rxa->mpeak); MPEAK::xmpeak (rxa->mpeak);
@ -770,7 +770,7 @@ void RXA::setDSPSamplerate (RXA *rxa, int dsp_rate)
rxa->bp1->setSamplerate(rxa->dsp_rate); rxa->bp1->setSamplerate(rxa->dsp_rate);
rxa->agc->setSamplerate(rxa->dsp_rate); rxa->agc->setSamplerate(rxa->dsp_rate);
rxa->agcmeter->setSamplerate(rxa->dsp_rate); rxa->agcmeter->setSamplerate(rxa->dsp_rate);
SIPHON::setSamplerate_siphon (rxa->sip1, rxa->dsp_rate); rxa->sip1->setSamplerate(rxa->dsp_rate);
CBL::setSamplerate_cbl (rxa->cbl, rxa->dsp_rate); CBL::setSamplerate_cbl (rxa->cbl, rxa->dsp_rate);
SPEAK::setSamplerate_speak (rxa->speak, rxa->dsp_rate); SPEAK::setSamplerate_speak (rxa->speak, rxa->dsp_rate);
MPEAK::setSamplerate_mpeak (rxa->mpeak, rxa->dsp_rate); MPEAK::setSamplerate_mpeak (rxa->mpeak, rxa->dsp_rate);
@ -849,8 +849,8 @@ void RXA::setDSPBuffsize (RXA *rxa, int dsp_size)
rxa->agc->setSize(rxa->dsp_size); rxa->agc->setSize(rxa->dsp_size);
rxa->agcmeter->setBuffers(rxa->midbuff); rxa->agcmeter->setBuffers(rxa->midbuff);
rxa->agcmeter->setSize(rxa->dsp_size); rxa->agcmeter->setSize(rxa->dsp_size);
SIPHON::setBuffers_siphon (rxa->sip1, rxa->midbuff); rxa->sip1->setBuffers(rxa->midbuff);
SIPHON::setSize_siphon (rxa->sip1, rxa->dsp_size); rxa->sip1->setSize(rxa->dsp_size);
CBL::setBuffers_cbl (rxa->cbl, rxa->midbuff, rxa->midbuff); CBL::setBuffers_cbl (rxa->cbl, rxa->midbuff, rxa->midbuff);
CBL::setSize_cbl (rxa->cbl, rxa->dsp_size); CBL::setSize_cbl (rxa->cbl, rxa->dsp_size);
SPEAK::setBuffers_speak (rxa->speak, rxa->midbuff, rxa->midbuff); SPEAK::setBuffers_speak (rxa->speak, rxa->midbuff, rxa->midbuff);

View File

@ -431,7 +431,7 @@ TXA* TXA::create_txa (
TXA_ALC_GAIN, // index for gain value TXA_ALC_GAIN, // index for gain value
&txa->alc->gain); // pointer for gain computation &txa->alc->gain); // pointer for gain computation
txa->sip1 = SIPHON::create_siphon ( txa->sip1 = new SIPHON(
1, // run 1, // run
0, // position 0, // position
0, // mode 0, // mode
@ -526,7 +526,7 @@ void TXA::destroy_txa (TXA *txa)
CFIR::destroy_cfir(txa->cfir); CFIR::destroy_cfir(txa->cfir);
// destroy_calcc (txa->calcc); // destroy_calcc (txa->calcc);
IQC::destroy_iqc (txa->iqc.p0); IQC::destroy_iqc (txa->iqc.p0);
SIPHON::destroy_siphon (txa->sip1); delete (txa->sip1);
delete (txa->alcmeter); delete (txa->alcmeter);
USLEW::destroy_uslew (txa->uslew); USLEW::destroy_uslew (txa->uslew);
delete (txa->gen1); delete (txa->gen1);
@ -588,7 +588,7 @@ void TXA::flush_txa (TXA* txa)
txa->gen1->flush(); txa->gen1->flush();
USLEW::flush_uslew (txa->uslew); USLEW::flush_uslew (txa->uslew);
txa->alcmeter->flush (); txa->alcmeter->flush ();
SIPHON::flush_siphon (txa->sip1); txa->sip1->flush();
IQC::flush_iqc (txa->iqc.p0); IQC::flush_iqc (txa->iqc.p0);
CFIR::flush_cfir(txa->cfir); CFIR::flush_cfir(txa->cfir);
txa->rsmpout->flush(); txa->rsmpout->flush();
@ -624,7 +624,7 @@ void xtxa (TXA* txa)
txa->gen1->execute(); // output signal generator (TUN and Two-tone) txa->gen1->execute(); // output signal generator (TUN and Two-tone)
USLEW::xuslew (txa->uslew); // up-slew for AM, FM, and gens USLEW::xuslew (txa->uslew); // up-slew for AM, FM, and gens
txa->alcmeter->execute (); // ALC Meter txa->alcmeter->execute (); // ALC Meter
SIPHON::xsiphon (txa->sip1, 0); // siphon data for display txa->sip1->execute(0); // siphon data for display
IQC::xiqc (txa->iqc.p0); // PureSignal correction IQC::xiqc (txa->iqc.p0); // PureSignal correction
CFIR::xcfir(txa->cfir); // compensating FIR filter (used Protocol_2 only) CFIR::xcfir(txa->cfir); // compensating FIR filter (used Protocol_2 only)
txa->rsmpout->execute(); // output resampler txa->rsmpout->execute(); // output resampler
@ -720,7 +720,7 @@ void TXA::setDSPSamplerate (TXA *txa, int dsp_rate)
txa->gen1->setSamplerate(txa->dsp_rate); txa->gen1->setSamplerate(txa->dsp_rate);
USLEW::setSamplerate_uslew (txa->uslew, txa->dsp_rate); USLEW::setSamplerate_uslew (txa->uslew, txa->dsp_rate);
txa->alcmeter->setSamplerate (txa->dsp_rate); txa->alcmeter->setSamplerate (txa->dsp_rate);
SIPHON::setSamplerate_siphon (txa->sip1, txa->dsp_rate); txa->sip1->setSamplerate (txa->dsp_rate);
IQC::setSamplerate_iqc (txa->iqc.p0, txa->dsp_rate); IQC::setSamplerate_iqc (txa->iqc.p0, txa->dsp_rate);
CFIR::setSamplerate_cfir (txa->cfir, txa->dsp_rate); CFIR::setSamplerate_cfir (txa->cfir, txa->dsp_rate);
// output resampler // output resampler
@ -804,8 +804,8 @@ void TXA::setDSPBuffsize (TXA *txa, int dsp_size)
USLEW::setSize_uslew (txa->uslew, txa->dsp_size); USLEW::setSize_uslew (txa->uslew, txa->dsp_size);
txa->alcmeter->setBuffers (txa->midbuff); txa->alcmeter->setBuffers (txa->midbuff);
txa->alcmeter->setSize(txa->dsp_size); txa->alcmeter->setSize(txa->dsp_size);
SIPHON::setBuffers_siphon (txa->sip1, txa->midbuff); txa->sip1->setBuffers (txa->midbuff);
SIPHON::setSize_siphon (txa->sip1, txa->dsp_size); txa->sip1->setSize (txa->dsp_size);
IQC::setBuffers_iqc (txa->iqc.p0, txa->midbuff, txa->midbuff); IQC::setBuffers_iqc (txa->iqc.p0, txa->midbuff, txa->midbuff);
IQC::setSize_iqc (txa->iqc.p0, txa->dsp_size); IQC::setSize_iqc (txa->iqc.p0, txa->dsp_size);
CFIR::setBuffers_cfir (txa->cfir, txa->midbuff, txa->midbuff); CFIR::setBuffers_cfir (txa->cfir, txa->midbuff, txa->midbuff);

View File

@ -33,157 +33,150 @@ warren@wpratt.com
namespace WDSP { namespace WDSP {
void SIPHON::build_window (SIPHON *a) void SIPHON::build_window()
{ {
int i; int i;
float arg0, cosphi; double arg0, cosphi;
float sum, scale; double sum, scale;
arg0 = 2.0 * PI / ((float)a->fftsize - 1.0); arg0 = 2.0 * PI / ((double) fftsize - 1.0);
sum = 0.0; sum = 0.0;
for (i = 0; i < a->fftsize; i++) for (i = 0; i < fftsize; i++)
{ {
cosphi = cos (arg0 * (float)i); cosphi = cos (arg0 * (float)i);
a->window[i] = + 6.3964424114390378e-02 window[i] = + 6.3964424114390378e-02
+ cosphi * ( - 2.3993864599352804e-01 + cosphi * ( - 2.3993864599352804e-01
+ cosphi * ( + 3.5015956323820469e-01 + cosphi * ( + 3.5015956323820469e-01
+ cosphi * ( - 2.4774111897080783e-01 + cosphi * ( - 2.4774111897080783e-01
+ cosphi * ( + 8.5438256055858031e-02 + cosphi * ( + 8.5438256055858031e-02
+ cosphi * ( - 1.2320203369293225e-02 + cosphi * ( - 1.2320203369293225e-02
+ cosphi * ( + 4.3778825791773474e-04 )))))); + cosphi * ( + 4.3778825791773474e-04 ))))));
sum += a->window[i]; sum += window[i];
} }
scale = 1.0 / sum; scale = 1.0 / sum;
for (i = 0; i < a->fftsize; i++) for (i = 0; i < fftsize; i++)
a->window[i] *= scale; window[i] *= scale;
} }
SIPHON* SIPHON::create_siphon ( SIPHON::SIPHON(
int run, int _run,
int position, int _position,
int mode, int _mode,
int disp, int _disp,
int insize, int _insize,
float* in, float* _in,
int sipsize, int _sipsize,
int fftsize, int _fftsize,
int specmode int _specmode
) )
{ {
SIPHON *a = new SIPHON; run = _run;
a->run = run; position = _position;
a->position = position; mode = _mode;
a->mode = mode; disp = _disp;
a->disp = disp; insize = _insize;
a->insize = insize; in = _in;
a->in = in; sipsize = _sipsize; // NOTE: sipsize MUST BE A POWER OF TWO!!
a->sipsize = sipsize; // NOTE: sipsize MUST BE A POWER OF TWO!! fftsize = _fftsize;
a->fftsize = fftsize; specmode = _specmode;
a->specmode = specmode; sipbuff.resize(sipsize * 2); // (float *) malloc0 (sipsize * sizeof (complex));
a->sipbuff = new float[a->sipsize * 2]; // (float *) malloc0 (a->sipsize * sizeof (complex)); idx = 0;
a->idx = 0; sipout.resize(sipsize * 2); // (float *) malloc0 (sipsize * sizeof (complex));
a->sipout = new float[a->sipsize * 2]; // (float *) malloc0 (a->sipsize * sizeof (complex)); specout.resize(fftsize * 2); // (float *) malloc0 (fftsize * sizeof (complex));
a->specout = new float[a->fftsize * 2]; // (float *) malloc0 (a->fftsize * sizeof (complex)); sipplan = fftwf_plan_dft_1d (fftsize, (fftwf_complex *) sipout.data(), (fftwf_complex *) specout.data(), FFTW_FORWARD, FFTW_PATIENT);
a->sipplan = fftwf_plan_dft_1d (a->fftsize, (fftwf_complex *)a->sipout, (fftwf_complex *)a->specout, FFTW_FORWARD, FFTW_PATIENT); window.resize(fftsize * 2); // (float *) malloc0 (fftsize * sizeof (complex));
a->window = new float[a->fftsize * 2]; // (float *) malloc0 (a->fftsize * sizeof (complex)); build_window();
build_window (a);
return a;
} }
void SIPHON::destroy_siphon (SIPHON *a) SIPHON::~SIPHON()
{ {
fftwf_destroy_plan (a->sipplan); fftwf_destroy_plan (sipplan);
delete[] (a->window);
delete[] (a->specout);
delete[] (a->sipout);
delete[] (a->sipbuff);
delete (a);
} }
void SIPHON::flush_siphon (SIPHON *a) void SIPHON::flush()
{ {
std::fill(a->sipbuff, a->sipbuff + a->sipsize * 2, 0); std::fill(sipbuff.begin(), sipbuff.end(), 0);
std::fill(a->sipout, a->sipout + a->sipsize * 2, 0); std::fill(sipout.begin(), sipout.end(), 0);
std::fill(a->specout, a->specout + a->fftsize * 2, 0); std::fill(specout.begin(), specout.end(), 0);
a->idx = 0; idx = 0;
} }
void SIPHON::xsiphon (SIPHON *a, int pos) void SIPHON::execute(int pos)
{ {
int first, second; int first, second;
if (a->run && a->position == pos) if (run && position == pos)
{ {
switch (a->mode) switch (mode)
{ {
case 0: case 0:
if (a->insize >= a->sipsize) if (insize >= sipsize)
std::copy(&(a->in[2 * (a->insize - a->sipsize)]), &(a->in[2 * (a->insize - a->sipsize)]) + a->sipsize * 2, a->sipbuff); std::copy(&(in[2 * (insize - sipsize)]), &(in[2 * (insize - sipsize)]) + sipsize * 2, sipbuff.begin());
else else
{ {
if (a->insize > (a->sipsize - a->idx)) if (insize > (sipsize - idx))
{ {
first = a->sipsize - a->idx; first = sipsize - idx;
second = a->insize - first; second = insize - first;
} }
else else
{ {
first = a->insize; first = insize;
second = 0; second = 0;
} }
std::copy(a->in, a->in + first * 2, a->sipbuff + 2 * a->idx); std::copy(in, in + first * 2, sipbuff.begin() + 2 * idx);
std::copy(a->in + 2 * first, a->in + 2 * first + second * 2, a->sipbuff); std::copy(in + 2 * first, in + 2 * first + second * 2, sipbuff.begin());
if ((a->idx += a->insize) >= a->sipsize) a->idx -= a->sipsize; if ((idx += insize) >= sipsize) idx -= sipsize;
} }
break; break;
case 1: case 1:
// Spectrum0 (1, a->disp, 0, 0, a->in); // Spectrum0 (1, disp, 0, 0, in);
break; break;
} }
} }
} }
void SIPHON::setBuffers_siphon (SIPHON *a, float* in) void SIPHON::setBuffers(float* _in)
{ {
a->in = in; in = _in;
} }
void SIPHON::setSamplerate_siphon (SIPHON *a, int) void SIPHON::setSamplerate(int)
{ {
flush_siphon (a); flush();
} }
void SIPHON::setSize_siphon (SIPHON *a, int size) void SIPHON::setSize(int size)
{ {
a->insize = size; insize = size;
flush_siphon (a); flush();
} }
void SIPHON::suck (SIPHON *a) void SIPHON::suck()
{ {
if (a->outsize <= a->sipsize) if (outsize <= sipsize)
{ {
int mask = a->sipsize - 1; int mask = sipsize - 1;
int j = (a->idx - a->outsize) & mask; int j = (idx - outsize) & mask;
int size = a->sipsize - j; int size = sipsize - j;
if (size >= a->outsize) if (size >= outsize)
std::copy(&(a->sipbuff[2 * j]), &(a->sipbuff[2 * j]) + a->outsize * 2, a->sipout); std::copy(&(sipbuff[2 * j]), &(sipbuff[2 * j]) + outsize * 2, sipout.begin());
else else
{ {
std::copy(&(a->sipbuff[2 * j]), &(a->sipbuff[2 * j]) + size * 2, a->sipout); std::copy(&(sipbuff[2 * j]), &(sipbuff[2 * j]) + size * 2, sipout.begin());
std::copy(a->sipbuff, a->sipbuff + (a->outsize - size) * 2, &(a->sipout[2 * size])); std::copy(sipbuff.begin(), sipbuff.begin() + (outsize - size) * 2, &(sipout[2 * size]));
} }
} }
} }
void SIPHON::sip_spectrum (SIPHON *a) void SIPHON::sip_spectrum()
{ {
int i; int i;
for (i = 0; i < a->fftsize; i++) for (i = 0; i < fftsize; i++)
{ {
a->sipout[2 * i + 0] *= a->window[i]; sipout[2 * i + 0] *= window[i];
a->sipout[2 * i + 1] *= a->window[i]; sipout[2 * i + 1] *= window[i];
} }
fftwf_execute (a->sipplan); fftwf_execute (sipplan);
} }
/******************************************************************************************************** /********************************************************************************************************
@ -192,29 +185,25 @@ void SIPHON::sip_spectrum (SIPHON *a)
* * * *
********************************************************************************************************/ ********************************************************************************************************/
void SIPHON::GetaSipF (RXA& rxa, float* out, int size) void SIPHON::getaSipF(float* _out, int _size)
{ // return raw samples as floats { // return raw samples as floats
SIPHON *a=rxa.sip1; outsize = _size;
int i; suck ();
a->outsize = size;
suck (a);
for (i = 0; i < size; i++) { for (int i = 0; i < _size; i++) {
out[i] = (float)a->sipout[2 * i + 0]; _out[i] = (float) sipout[2 * i + 0];
} }
} }
void SIPHON::GetaSipF1 (RXA& rxa, float* out, int size) void SIPHON::getaSipF1(float* _out, int _size)
{ // return raw samples as floats { // return raw samples as floats
SIPHON *a=rxa.sip1; outsize = _size;
int i; suck();
a->outsize = size;
suck (a);
for (i = 0; i < size; i++) for (int i = 0; i < _size; i++)
{ {
out[2 * i + 0] = (float)a->sipout[2 * i + 0]; _out[2 * i + 0] = (float) sipout[2 * i + 0];
out[2 * i + 1] = (float)a->sipout[2 * i + 1]; _out[2 * i + 1] = (float) sipout[2 * i + 1];
} }
} }
@ -224,84 +213,53 @@ void SIPHON::GetaSipF1 (RXA& rxa, float* out, int size)
* * * *
********************************************************************************************************/ ********************************************************************************************************/
void SIPHON::SetSipPosition (TXA& txa, int pos) void SIPHON::setSipPosition(int _pos)
{ {
SIPHON *a = txa.sip1; position = _pos;
a->position = pos;
} }
void SIPHON::SetSipMode (TXA& txa, int mode) void SIPHON::setSipMode(int _mode)
{ {
SIPHON *a = txa.sip1; mode = _mode;
a->mode = mode;
} }
void SIPHON::SetSipDisplay (TXA& txa, int disp) void SIPHON::setSipDisplay(int _disp)
{ {
SIPHON *a = txa.sip1; disp = _disp;
a->disp = disp;
} }
void SIPHON::GetaSipF (TXA& txa, float* out, int size) void SIPHON::setSipSpecmode(int _mode)
{ // return raw samples as floats
SIPHON *a = txa.sip1;
int i;
a->outsize = size;
suck (a);
for (i = 0; i < size; i++) {
out[i] = (float)a->sipout[2 * i + 0];
}
}
void SIPHON::GetaSipF1 (TXA& txa, float* out, int size)
{ // return raw samples as floats
SIPHON *a = txa.sip1;
int i;
a->outsize = size;
suck (a);
for (i = 0; i < size; i++)
{
out[2 * i + 0] = (float)a->sipout[2 * i + 0];
out[2 * i + 1] = (float)a->sipout[2 * i + 1];
}
}
void SIPHON::SetSipSpecmode (TXA& txa, int mode)
{ {
SIPHON *a = txa.sip1; if (_mode == 0)
if (mode == 0) specmode = 0;
a->specmode = 0;
else else
a->specmode = 1; specmode = 1;
} }
void SIPHON::GetSpecF1 (TXA& txa, float* out) void SIPHON::getSpecF1(float* _out)
{ // return spectrum magnitudes in dB { // return spectrum magnitudes in dB
SIPHON *a = txa.sip1;
int i, j, mid, m, n; int i, j, mid, m, n;
a->outsize = a->fftsize; outsize = fftsize;
suck (a); suck();
sip_spectrum (a); sip_spectrum();
mid = a->fftsize / 2; mid = fftsize / 2;
if (a->specmode != 1) if (specmode != 1)
{ {
// swap the halves of the spectrum // swap the halves of the spectrum
for (i = 0, j = mid; i < mid; i++, j++) for (i = 0, j = mid; i < mid; i++, j++)
{ {
out[i] = (float)(10.0 * MemLog::mlog10 (a->specout[2 * j + 0] * a->specout[2 * j + 0] + a->specout[2 * j + 1] * a->specout[2 * j + 1] + 1.0e-60)); _out[i] = (float)(10.0 * MemLog::mlog10 (specout[2 * j + 0] * specout[2 * j + 0] + specout[2 * j + 1] * specout[2 * j + 1] + 1.0e-60));
out[j] = (float)(10.0 * MemLog::mlog10 (a->specout[2 * i + 0] * a->specout[2 * i + 0] + a->specout[2 * i + 1] * a->specout[2 * i + 1] + 1.0e-60)); _out[j] = (float)(10.0 * MemLog::mlog10 (specout[2 * i + 0] * specout[2 * i + 0] + specout[2 * i + 1] * specout[2 * i + 1] + 1.0e-60));
} }
} }
else else
{ {
// mirror each half of the spectrum in-place // mirror each half of the spectrum in-place
for (i = 0, j = mid - 1, m = mid, n = a->fftsize - 1; i < mid; i++, j--, m++, n--) for (i = 0, j = mid - 1, m = mid, n = fftsize - 1; i < mid; i++, j--, m++, n--)
{ {
out[i] = (float)(10.0 * MemLog::mlog10 (a->specout[2 * j + 0] * a->specout[2 * j + 0] + a->specout[2 * j + 1] * a->specout[2 * j + 1] + 1.0e-60)); _out[i] = (float)(10.0 * MemLog::mlog10 (specout[2 * j + 0] * specout[2 * j + 0] + specout[2 * j + 1] * specout[2 * j + 1] + 1.0e-60));
out[m] = (float)(10.0 * MemLog::mlog10 (a->specout[2 * n + 0] * a->specout[2 * n + 0] + a->specout[2 * n + 1] * a->specout[2 * n + 1] + 1.0e-60)); _out[m] = (float)(10.0 * MemLog::mlog10 (specout[2 * n + 0] * specout[2 * n + 0] + specout[2 * n + 1] * specout[2 * n + 1] + 1.0e-60));
} }
} }
} }

View File

@ -31,6 +31,8 @@ warren@wpratt.com
#ifndef wdsp_siphon_h #ifndef wdsp_siphon_h
#define wdsp_siphon_h #define wdsp_siphon_h
#include <vector>
#include "fftw3.h" #include "fftw3.h"
#include "export.h" #include "export.h"
@ -49,17 +51,17 @@ public:
int insize; int insize;
float* in; float* in;
int sipsize; // NOTE: sipsize MUST BE A POWER OF TWO!! int sipsize; // NOTE: sipsize MUST BE A POWER OF TWO!!
float* sipbuff; std::vector<float> sipbuff;
int outsize; int outsize;
int idx; int idx;
float* sipout; std::vector<float> sipout;
int fftsize; int fftsize;
float* specout; std::vector<float> specout;
long specmode; long specmode;
fftwf_plan sipplan; fftwf_plan sipplan;
float* window; std::vector<float> window;
static SIPHON* create_siphon ( SIPHON(
int run, int run,
int position, int position,
int mode, int mode,
@ -70,23 +72,24 @@ public:
int fftsize, int fftsize,
int specmode int specmode
); );
static void destroy_siphon (SIPHON *a); SIPHON(const SIPHON&) = delete;
static void flush_siphon (SIPHON *a); SIPHON& operator=(const SIPHON& other) = delete;
static void xsiphon (SIPHON *a, int pos); ~SIPHON();
static void setBuffers_siphon (SIPHON *a, float* in);
static void setSamplerate_siphon (SIPHON *a, int rate); void flush();
static void setSize_siphon (SIPHON *a, int size); void execute(int pos);
void setBuffers(float* in);
void setSamplerate(int rate);
void setSize(int size);
// RXA Properties // RXA Properties
static void GetaSipF (RXA& rxa, float* out, int size); void getaSipF (float* out, int size);
static void GetaSipF1 (RXA& rxa, float* out, int size); void getaSipF1 (float* out, int size);
// TXA Properties // TXA Properties
static void SetSipPosition (TXA& txa, int pos); void setSipPosition(int pos);
static void SetSipMode (TXA& txa, int mode); void setSipMode(int mode);
static void SetSipDisplay (TXA& txa, int disp); void setSipDisplay(int disp);
static void GetaSipF (TXA& txa, float* out, int size); void getSpecF1(float* out);
static void GetaSipF1 (TXA& txa, float* out, int size); void setSipSpecmode(int mode);
static void GetSpecF1 (TXA& txa, float* out);
static void SetSipSpecmode (TXA& txa, int mode);
// Calls for External Use // Calls for External Use
// static void create_siphonEXT (int id, int run, int insize, int sipsize, int fftsize, int specmode); // static void create_siphonEXT (int id, int run, int insize, int sipsize, int fftsize, int specmode);
// static void destroy_siphonEXT (int id); // static void destroy_siphonEXT (int id);
@ -94,9 +97,9 @@ public:
// static void SetSiphonInsize (int id, int size); // static void SetSiphonInsize (int id, int size);
private: private:
static void build_window (SIPHON *a); void build_window();
static void suck (SIPHON *a); void suck();
static void sip_spectrum (SIPHON *a); void sip_spectrum();
}; };
} // namespace WDSP } // namespace WDSP