1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

WDSP: more Sonar fixes

This commit is contained in:
f4exb 2024-08-10 23:46:47 +02:00
parent ef0255f2bb
commit eaa5445702
10 changed files with 214 additions and 207 deletions

View File

@ -41,31 +41,41 @@ namespace WDSP {
void EMPH::calc() void EMPH::calc()
{ {
infilt = new float[2 * size * 2]; infilt.resize(2 * size * 2);
product = new float[2 * size * 2]; product.resize(2 * size * 2);
FCurve::fc_mults( FCurve::fc_mults(
mults, mults,
size, size,
f_low, (float) f_low,
f_high, (float) f_high,
-20.0 * log10(f_high / f_low), (float) (-20.0 * log10(f_high / f_low)),
0.0, 0.0,
ctype, ctype,
rate, (float) rate,
1.0 / (2.0 * size), (float) (1.0 / (2.0 * size)),
0, 0,
0 0
); );
CFor = fftwf_plan_dft_1d(2 * size, (fftwf_complex *)infilt, (fftwf_complex *)product, FFTW_FORWARD, FFTW_PATIENT); CFor = fftwf_plan_dft_1d(
CRev = fftwf_plan_dft_1d(2 * size, (fftwf_complex *)product, (fftwf_complex *)out, FFTW_BACKWARD, FFTW_PATIENT); 2 * size,
(fftwf_complex *)infilt.data(),
(fftwf_complex *)product.data(),
FFTW_FORWARD,
FFTW_PATIENT)
;
CRev = fftwf_plan_dft_1d(
2 * size,
(fftwf_complex *)product.data(),
(fftwf_complex *)out,
FFTW_BACKWARD,
FFTW_PATIENT
);
} }
void EMPH::decalc() void EMPH::decalc()
{ {
fftwf_destroy_plan(CRev); fftwf_destroy_plan(CRev);
fftwf_destroy_plan(CFor); fftwf_destroy_plan(CFor);
delete[] product;
delete[] infilt;
} }
EMPH::EMPH( EMPH::EMPH(
@ -99,7 +109,7 @@ EMPH::~EMPH()
void EMPH::flush() void EMPH::flush()
{ {
std::fill(infilt, infilt + 2 * size * 2, 0); std::fill(infilt.begin(), infilt.end(), 0);
} }
void EMPH::execute(int _position) void EMPH::execute(int _position)
@ -118,7 +128,7 @@ void EMPH::execute(int _position)
product[2 * i + 1] = (float) (I * mults[2 * i + 1] + Q * mults[2 * i + 0]); product[2 * i + 1] = (float) (I * mults[2 * i + 1] + Q * mults[2 * i + 0]);
} }
fftwf_execute (CRev); fftwf_execute (CRev);
std::copy(&(infilt[2 * size]), &(infilt[2 * size]) + size * 2, infilt); std::copy(&(infilt[2 * size]), &(infilt[2 * size]) + size * 2, infilt.begin());
} }
else if (in != out) else if (in != out)
std::copy( in, in + size * 2, out); std::copy( in, in + size * 2, out);

View File

@ -52,8 +52,8 @@ public:
int ctype; int ctype;
double f_low; double f_low;
double f_high; double f_high;
float* infilt; std::vector<float> infilt;
float* product; std::vector<float> product;
std::vector<float> mults; std::vector<float> mults;
double rate; double rate;
fftwf_plan CFor; fftwf_plan CFor;

View File

@ -82,7 +82,7 @@ EMPHP::EMPHP(
EMPHP::~EMPHP() EMPHP::~EMPHP()
{ {
delete (p); delete p;
} }
void EMPHP::flush() void EMPHP::flush()
@ -112,13 +112,13 @@ void EMPHP::setSamplerate(int _rate)
FCurve::fc_impulse ( FCurve::fc_impulse (
impulse, impulse,
nc, nc,
f_low, (float) f_low,
f_high, (float) f_high,
-20.0 * log10(f_high / f_low), (float) (-20.0 * log10(f_high / f_low)),
0.0, 0.0,
ctype, ctype,
rate, (float) rate,
1.0 / (2.0 * size), (float) (1.0 / (2.0 * size)),
0, 0 0, 0
); );
p->setImpulse(impulse, 1); p->setImpulse(impulse, 1);
@ -132,13 +132,13 @@ void EMPHP::setSize(int _size)
FCurve::fc_impulse ( FCurve::fc_impulse (
impulse, impulse,
nc, nc,
f_low, (float) f_low,
f_high, (float) f_high,
-20.0 * log10(f_high / f_low), (float) (-20.0 * log10(f_high / f_low)),
0.0, 0.0,
ctype, ctype,
rate, (float) rate,
1.0 / (2.0 * size), (float) (1.0 / (2.0 * size)),
0, 0,
0 0
); );
@ -198,13 +198,13 @@ void EMPHP::setFreqs(double low, double high)
FCurve::fc_impulse ( FCurve::fc_impulse (
impulse, impulse,
nc, nc,
f_low, (float) f_low,
f_high, (float) f_high,
-20.0 * log10(f_high / f_low), (float) (-20.0 * log10(f_high / f_low)),
0.0, 0.0,
ctype, ctype,
rate, (float) rate,
1.0 / (2.0 * size), (float) (1.0 / (2.0 * size)),
0, 0,
0 0
); );

View File

@ -94,7 +94,7 @@ void GEN::calc_pulse ()
pulse.pcount = pulse.pnoff; pulse.pcount = pulse.pnoff;
pulse.state = PState::OFF; pulse.state = PState::OFF;
pulse.ctrans = new double[pulse.pntrans + 1]; pulse.ctrans.resize(pulse.pntrans + 1);
delta = PI / (float)pulse.pntrans; delta = PI / (float)pulse.pntrans;
theta = 0.0; theta = 0.0;
for (int i = 0; i <= pulse.pntrans; i++) for (int i = 0; i <= pulse.pntrans; i++)
@ -114,11 +114,6 @@ void GEN::calc()
calc_pulse(); calc_pulse();
} }
void GEN::decalc()
{
delete[] (pulse.ctrans);
}
GEN::GEN( GEN::GEN(
int _run, int _run,
int _size, int _size,
@ -165,11 +160,6 @@ GEN::GEN(
calc(); calc();
} }
GEN::~GEN()
{
decalc();
}
void GEN::flush() void GEN::flush()
{ {
pulse.state = PState::OFF; pulse.state = PState::OFF;
@ -365,7 +355,6 @@ void GEN::setBuffers(float* _in, float* _out)
void GEN::setSamplerate(int _rate) void GEN::setSamplerate(int _rate)
{ {
decalc();
rate = _rate; rate = _rate;
calc(); calc();
} }

View File

@ -28,6 +28,8 @@ warren@wpratt.com
#ifndef wdsp_gen_h #ifndef wdsp_gen_h
#define wdsp_gen_h #define wdsp_gen_h
#include <vector>
#include "export.h" #include "export.h"
namespace WDSP { namespace WDSP {
@ -120,7 +122,7 @@ public:
double pf; double pf;
double pdutycycle; double pdutycycle;
double ptranstime; double ptranstime;
double* ctrans; std::vector<double> ctrans;
int pcount; int pcount;
int pnon; int pnon;
int pntrans; int pntrans;
@ -143,7 +145,9 @@ public:
int rate, int rate,
int mode int mode
); );
~GEN(); GEN(const GEN&) = delete;
GEN& operator=(const GEN& other) = delete;
~GEN() = default;
void flush(); void flush();
void execute(); void execute();
@ -197,7 +201,6 @@ private:
void calc_triangle(); void calc_triangle();
void calc_pulse(); void calc_pulse();
void calc(); void calc();
void decalc();
}; };
} // namespace WDSP } // namespace WDSP

View File

@ -25,6 +25,8 @@ warren@pratt.one
*/ */
#include <vector>
#include "comm.hpp" #include "comm.hpp"
#include "fircore.hpp" #include "fircore.hpp"
#include "fir.hpp" #include "fir.hpp"
@ -32,35 +34,35 @@ warren@pratt.one
namespace WDSP { namespace WDSP {
void ICFIR::calc_icfir (ICFIR *a) void ICFIR::calc()
{ {
std::vector<float> impulse; std::vector<float> impulse;
a->scale = 1.0f / (float)(2 * a->size); scale = 1.0f / (float)(2 * size);
icfir_impulse (impulse, a->nc, a->DD, a->R, a->Pairs, (float) a->runrate, (float) a->cicrate, a->cutoff, a->xtype, a->xbw, 1, a->scale, a->wintype); icfir_impulse (impulse, nc, DD, R, Pairs, (float) runrate, (float) cicrate, cutoff, xtype, xbw, 1, scale, wintype);
a->p = new FIRCORE(a->size, a->in, a->out, a->mp, impulse); p = new FIRCORE(size, in, out, mp, impulse);
} }
void ICFIR::decalc_icfir (ICFIR *a) void ICFIR::decalc()
{ {
delete (a->p); delete p;
} }
ICFIR* ICFIR::create_icfir ( ICFIR::ICFIR(
int run, int _run,
int size, int _size,
int nc, int _nc,
int mp, int _mp,
float* in, float* _in,
float* out, float* _out,
int runrate, int _runrate,
int cicrate, int _cicrate,
int DD, int _DD,
int R, int _R,
int Pairs, int _Pairs,
float cutoff, float _cutoff,
int xtype, int _xtype,
float xbw, float _xbw,
int wintype int _wintype
) )
// run: 0 - no action; 1 - operate // run: 0 - no action; 1 - operate
// size: number of complex samples in an input buffer to the CFIR filter // size: number of complex samples in an input buffer to the CFIR filter
@ -76,88 +78,85 @@ ICFIR* ICFIR::create_icfir (
// xtype: 0 - fourth power transition; 1 - raised cosine transition // xtype: 0 - fourth power transition; 1 - raised cosine transition
// xbw: width of raised cosine transition // xbw: width of raised cosine transition
{ {
ICFIR *a = new ICFIR; run = _run;
a->run = run; size = _size;
a->size = size; nc = _nc;
a->nc = nc; mp = _mp;
a->mp = mp; in = _in;
a->in = in; out = _out;
a->out = out; runrate = _runrate;
a->runrate = runrate; cicrate = _cicrate;
a->cicrate = cicrate; DD = _DD;
a->DD = DD; R = _R;
a->R = R; Pairs = _Pairs;
a->Pairs = Pairs; cutoff = _cutoff;
a->cutoff = cutoff; xtype = _xtype;
a->xtype = xtype; xbw = _xbw;
a->xbw = xbw; wintype = _wintype;
a->wintype = wintype; calc();
calc_icfir (a);
return a;
} }
void ICFIR::destroy_icfir (ICFIR *a) ICFIR::~ICFIR()
{ {
decalc_icfir (a); decalc();
delete[] (a);
} }
void ICFIR::flush_icfir (ICFIR *a) void ICFIR::flush()
{ {
a->p->flush(); p->flush();
} }
void ICFIR::xicfir (ICFIR *a) void ICFIR::execute()
{ {
if (a->run) if (run)
a->p->execute(); p->execute();
else if (a->in != a->out) else if (in != out)
std::copy( a->in, a->in + a->size * 2, a->out); std::copy( in, in + size * 2, out);
} }
void ICFIR::setBuffers_icfir (ICFIR *a, float* in, float* out) void ICFIR::setBuffers(float* _in, float* _out)
{ {
decalc_icfir (a); decalc();
a->in = in; in = _in;
a->out = out; out = _out;
calc_icfir (a); calc();
} }
void ICFIR::setSamplerate_icfir (ICFIR *a, int rate) void ICFIR::setSamplerate(int _rate)
{ {
decalc_icfir (a); decalc();
a->runrate = rate; runrate = _rate;
calc_icfir (a); calc();
} }
void ICFIR::setSize_icfir (ICFIR *a, int size) void ICFIR::setSize(int _size)
{ {
decalc_icfir (a); decalc();
a->size = size; size = _size;
calc_icfir (a); calc();
} }
void ICFIR::setOutRate_icfir (ICFIR *a, int rate) void ICFIR::setOutRate(int _rate)
{ {
decalc_icfir (a); decalc();
a->cicrate = rate; cicrate = _rate;
calc_icfir (a); calc();
} }
void ICFIR::icfir_impulse ( void ICFIR::icfir_impulse (
std::vector<float>& impulse, std::vector<float>& _impulse,
int N, int _N,
int DD, int _DD,
int R, int _R,
int Pairs, int _Pairs,
float runrate, float _runrate,
float cicrate, float _cicrate,
float cutoff, float _cutoff,
int xtype, int _xtype,
float xbw, float _xbw,
int rtype, int _rtype,
float scale, float _scale,
int wintype int _wintype
) )
{ {
// N: number of impulse response samples // N: number of impulse response samples
@ -173,75 +172,73 @@ void ICFIR::icfir_impulse (
// scale: scale factor to be applied to the output // scale: scale factor to be applied to the output
int i; int i;
int j; int j;
float tmp; double tmp;
float local_scale; double local_scale;
float ri; double ri;
float mag; double mag = 0;
float fn; double fn;
auto* A = new float[N]; std::vector<float> A(_N);
float ft = cutoff / cicrate; // normalized cutoff frequency double ft = _cutoff / _cicrate; // normalized cutoff frequency
int u_samps = (N + 1) / 2; // number of unique samples, OK for odd or even N int u_samps = (_N + 1) / 2; // number of unique samples, OK for odd or even N
int c_samps = (int)(cutoff / runrate * N) + (N + 1) / 2 - N / 2; // number of unique samples within bandpass, OK for odd or even N int c_samps = (int)(_cutoff / _runrate * _N) + (_N + 1) / 2 - _N / 2; // number of unique samples within bandpass, OK for odd or even N
auto x_samps = (int)(xbw / runrate * N); // number of unique samples in transition region, OK for odd or even N auto x_samps = (int)(_xbw / _runrate * _N); // number of unique samples in transition region, OK for odd or even N
float offset = 0.5f - 0.5f * (float)((N + 1) / 2 - N / 2); // sample offset from center, OK for odd or even N double offset = 0.5f - 0.5f * (float)((_N + 1) / 2 - _N / 2); // sample offset from center, OK for odd or even N
auto* xistion = new float[x_samps + 1]; std::vector<double> xistion(x_samps + 1);
float delta = PI / (float)x_samps; double delta = PI / (float)x_samps;
float L = cicrate / runrate; double L = _cicrate / _runrate;
float phs = 0.0; double phs = 0.0;
for (i = 0; i <= x_samps; i++) for (i = 0; i <= x_samps; i++)
{ {
xistion[i] = 0.5 * (cos (phs) + 1.0); xistion[i] = 0.5 * (cos (phs) + 1.0);
phs += delta; phs += delta;
} }
if ((tmp = DD * R * sin (PI * ft / R) / sin (PI * DD * ft)) < 0.0) //normalize by peak gain if ((tmp = _DD * _R * sin (PI * ft / _R) / sin (PI * _DD * ft)) < 0.0) //normalize by peak gain
tmp = -tmp; tmp = -tmp;
local_scale = scale / pow (tmp, Pairs); local_scale = _scale / pow (tmp, _Pairs);
if (xtype == 0) if (_xtype == 0)
{ {
for (i = 0, ri = offset; i < u_samps; i++, ri += 1.0) for (i = 0, ri = offset; i < u_samps; i++, ri += 1.0)
{ {
fn = ri / (L * (float)N); fn = ri / (L * (float)_N);
if (fn <= ft) if (fn <= ft)
{ {
if (fn == 0.0) tmp = 1.0; if (fn == 0.0) tmp = 1.0;
else if ((tmp = sin (PI * DD * fn) / (DD * R * sin (PI * fn / R))) < 0.0) else if ((tmp = sin (PI * _DD * fn) / (_DD * _R * sin (PI * fn / _R))) < 0.0)
tmp = -tmp; tmp = -tmp;
mag = pow (tmp, Pairs) * local_scale; mag = pow (tmp, _Pairs) * local_scale;
} }
else else
mag *= (ft * ft * ft * ft) / (fn * fn * fn * fn); mag *= (ft * ft * ft * ft) / (fn * fn * fn * fn);
A[i] = mag; A[i] = (float) mag;
} }
} }
else if (xtype == 1) else if (_xtype == 1)
{ {
for (i = 0, ri = offset; i < u_samps; i++, ri += 1.0) for (i = 0, ri = offset; i < u_samps; i++, ri += 1.0)
{ {
fn = ri / (L *(float)N); fn = ri / (L *(float)_N);
if (i < c_samps) if (i < c_samps)
{ {
if (fn == 0.0) tmp = 1.0; if (fn == 0.0) tmp = 1.0;
else if ((tmp = sin (PI * DD * fn) / (DD * R * sin (PI * fn / R))) < 0.0) else if ((tmp = sin (PI * _DD * fn) / (_DD * _R * sin (PI * fn / _R))) < 0.0)
tmp = -tmp; tmp = -tmp;
mag = pow (tmp, Pairs) * local_scale; mag = pow (tmp, _Pairs) * local_scale;
A[i] = mag; A[i] = (float) mag;
} }
else if ( i >= c_samps && i <= c_samps + x_samps) else if ( i >= c_samps && i <= c_samps + x_samps)
A[i] = mag * xistion[i - c_samps]; A[i] = (float) (mag * xistion[i - c_samps]);
else else
A[i] = 0.0; A[i] = 0.0;
} }
} }
if (N & 1) if (_N & 1)
for (i = u_samps, j = 2; i < N; i++, j++) for (i = u_samps, j = 2; i < _N; i++, j++)
A[i] = A[u_samps - j]; A[i] = A[u_samps - j];
else else
for (i = u_samps, j = 1; i < N; i++, j++) for (i = u_samps, j = 1; i < _N; i++, j++)
A[i] = A[u_samps - j]; A[i] = A[u_samps - j];
impulse.resize(2 * N); _impulse.resize(2 * _N);
FIR::fir_fsamp (impulse, N, A, rtype, 1.0, wintype); FIR::fir_fsamp (_impulse, _N, A.data(), _rtype, 1.0, _wintype);
delete[] (A);
delete[] xistion;
} }

View File

@ -55,7 +55,7 @@ public:
int wintype; int wintype;
FIRCORE *p; FIRCORE *p;
static ICFIR* create_icfir ( ICFIR(
int run, int run,
int size, int size,
int nc, int nc,
@ -72,14 +72,17 @@ public:
float xbw, float xbw,
int wintype int wintype
); );
static void destroy_icfir (ICFIR *a); ICFIR(const ICFIR&) = delete;
static void flush_icfir (ICFIR *a); ICFIR& operator=(const ICFIR& other) = delete;
static void xicfir (ICFIR *a); ~ICFIR();
static void setBuffers_icfir (ICFIR *a, float* in, float* out);
static void setSamplerate_icfir (ICFIR *a, int rate); void flush();
static void setSize_icfir (ICFIR *a, int size); void execute();
static void setOutRate_icfir (ICFIR *a, int rate); void setBuffers(float* in, float* out);
static void icfir_impulse ( void setSamplerate(int rate);
void setSize(int size);
void setOutRate(int rate);
static void icfir_impulse(
std::vector<float>& impulse, std::vector<float>& impulse,
int N, int N,
int DD, int DD,
@ -96,8 +99,8 @@ public:
); );
private: private:
static void calc_icfir (ICFIR *a); void calc();
static void decalc_icfir (ICFIR *a); void decalc();
}; };
} // namespace WDSP } // namespace WDSP

View File

@ -39,7 +39,14 @@ namespace WDSP {
* * * *
************************************************************************************************/ ************************************************************************************************/
RESAMPLEF* RESAMPLEF::create_resampleF ( int run, int size, float* in, float* out, int in_rate, int out_rate) RESAMPLEF* RESAMPLEF::create_resampleF (
int _run,
int _size,
float* _in,
float* _out,
int _in_rate,
int _out_rate
)
{ {
auto *a = new RESAMPLEF; auto *a = new RESAMPLEF;
int x; int x;
@ -51,12 +58,12 @@ RESAMPLEF* RESAMPLEF::create_resampleF ( int run, int size, float* in, float* ou
float fc; float fc;
float fc_norm; float fc_norm;
std::vector<float> impulse; std::vector<float> impulse;
a->run = run; a->run = _run;
a->size = size; a->size = _size;
a->in = in; a->in = _in;
a->out = out; a->out = _out;
x = in_rate; x = _in_rate;
y = out_rate; y = _out_rate;
while (y != 0) while (y != 0)
{ {
@ -65,19 +72,19 @@ RESAMPLEF* RESAMPLEF::create_resampleF ( int run, int size, float* in, float* ou
x = z; x = z;
} }
a->L = out_rate / x; a->L = _out_rate / x;
a->M = in_rate / x; a->M = _in_rate / x;
a->L = a->L <= 0 ? 1 : a->L; a->L = a->L <= 0 ? 1 : a->L;
a->M = a->M <= 0 ? 1 : a->M; a->M = a->M <= 0 ? 1 : a->M;
if (in_rate < out_rate) if (_in_rate < _out_rate)
min_rate = in_rate; min_rate = _in_rate;
else else
min_rate = out_rate; min_rate = _out_rate;
fc = 0.45f * (float)min_rate; fc = 0.45f * (float)min_rate;
full_rate = (float)(in_rate * a->L); full_rate = (float)(_in_rate * a->L);
fc_norm = fc / full_rate; fc_norm = fc / full_rate;
a->ncoef = (int)(60.0 / fc_norm); a->ncoef = (int)(60.0 / fc_norm);
a->ncoef = (a->ncoef / a->L + 1) * a->L; a->ncoef = (a->ncoef / a->L + 1) * a->L;
@ -164,25 +171,25 @@ int RESAMPLEF::xresampleF (RESAMPLEF *a)
// Exported calls // Exported calls
void* RESAMPLEF::create_resampleFV (int in_rate, int out_rate) void* RESAMPLEF::create_resampleFV (int _in_rate, int _out_rate)
{ {
return (void *) create_resampleF (1, 0, nullptr, nullptr, in_rate, out_rate); return (void *) create_resampleF (1, 0, nullptr, nullptr, _in_rate, _out_rate);
} }
void RESAMPLEF::xresampleFV (float* input, float* output, int numsamps, int* outsamps, void* ptr) void RESAMPLEF::xresampleFV (float* _input, float* _output, int _numsamps, int* _outsamps, void* _ptr)
{ {
auto *a = (RESAMPLEF*) ptr; auto *a = (RESAMPLEF*) _ptr;
a->in = input; a->in = _input;
a->out = output; a->out = _output;
a->size = numsamps; a->size = _numsamps;
*outsamps = xresampleF(a); *_outsamps = xresampleF(a);
} }
void RESAMPLEF::destroy_resampleFV (void* ptr) void RESAMPLEF::destroy_resampleFV (void* _ptr)
{ {
destroy_resampleF ( (RESAMPLEF*) ptr ); destroy_resampleF ( (RESAMPLEF*) _ptr );
} }
} // namespace WDSP } // namespace WDSP

View File

@ -114,8 +114,8 @@ void SNBA::calc()
else else
isize = bsize * (internalrate / inrate); isize = bsize * (internalrate / inrate);
inbuff = new float[isize * 2]; inbuff.resize(isize * 2);
outbuff = new float[isize * 2]; outbuff.resize(isize * 2);
if (inrate != internalrate) if (inrate != internalrate)
resamprun = 1; resamprun = 1;
@ -126,7 +126,7 @@ void SNBA::calc()
resamprun, resamprun,
bsize, bsize,
in, in,
inbuff, inbuff.data(),
inrate, inrate,
internalrate, internalrate,
0.0, 0.0,
@ -137,7 +137,7 @@ void SNBA::calc()
outresamp = new RESAMPLE( outresamp = new RESAMPLE(
resamprun, resamprun,
isize, isize,
outbuff, outbuff.data(),
out, out,
internalrate, internalrate,
inrate, inrate,
@ -217,8 +217,6 @@ SNBA::SNBA(
isize(0), isize(0),
inresamp(nullptr), inresamp(nullptr),
outresamp(nullptr), outresamp(nullptr),
inbuff(nullptr),
outbuff(nullptr),
out_low_cut(_out_low_cut), out_low_cut(_out_low_cut),
out_high_cut(_out_high_cut), out_high_cut(_out_high_cut),
exec(_xsize, _asize, _npasses), exec(_xsize, _asize, _npasses),
@ -237,8 +235,6 @@ void SNBA::decalc()
{ {
delete outresamp; delete outresamp;
delete inresamp; delete inresamp;
delete[] outbuff;
delete[] inbuff;
} }
SNBA::~SNBA() SNBA::~SNBA()
@ -259,8 +255,8 @@ void SNBA::flush()
std::fill(inaccum.begin(), inaccum.end(), 0); std::fill(inaccum.begin(), inaccum.end(), 0);
std::fill(outaccum.begin(), outaccum.end(), 0); std::fill(outaccum.begin(), outaccum.end(), 0);
std::fill(xaux, xaux + xsize, 0); std::fill(xaux, xaux + xsize, 0);
std::fill(inbuff, inbuff + isize * 2, 0); std::fill(inbuff.begin(), inbuff.end(), 0);
std::fill(outbuff, outbuff + isize * 2, 0); std::fill(outbuff.begin(), outbuff.end(), 0);
inresamp->flush(); inresamp->flush();
outresamp->flush(); outresamp->flush();

View File

@ -64,8 +64,8 @@ public:
int isize; int isize;
RESAMPLE *inresamp; RESAMPLE *inresamp;
RESAMPLE *outresamp; RESAMPLE *outresamp;
float* inbuff; std::vector<float> inbuff;
float* outbuff; std::vector<float> outbuff;
double out_low_cut; double out_low_cut;
double out_high_cut; double out_high_cut;
static const int MAXIMP = 256; static const int MAXIMP = 256;
@ -155,6 +155,8 @@ public:
double out_low_cut, double out_low_cut,
double out_high_cut double out_high_cut
); );
SNBA(const SNBA&) = delete;
SNBA& operator=(const SNBA& other) = delete;
~SNBA(); ~SNBA();
void flush(); void flush();