1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Fixed: const should have been static constexpr; should probably use new and delete rather than malloc and new.

This commit is contained in:
Thomas Harte 2016-03-15 21:33:18 -04:00
parent a4ec0b023c
commit 5b509e5360
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ static void csfilter_setIdealisedFilterResponse(short *filterCoefficients, float
a = 0.5842f * powf(attenuation - 21.0f, 0.4f) + 0.7886f * (attenuation - 21.0f);
}
float *filterCoefficientsFloat = (float *)malloc(sizeof(float) * numberOfTaps);
float *filterCoefficientsFloat = new float[numberOfTaps];
/* work out the right hand side of the filter coefficients */
unsigned int Np = (numberOfTaps - 1) / 2;
@ -103,7 +103,7 @@ static void csfilter_setIdealisedFilterResponse(short *filterCoefficients, float
filterCoefficients[i] = (short)(filterCoefficientsFloat[i] * kCSKaiserBesselFilterFixedMultiplier * coefficientMultiplier);
}
free(filterCoefficientsFloat);
delete[] filterCoefficientsFloat;
}
FIRFilter::FIRFilter(unsigned int number_of_taps, unsigned int input_sample_rate, float low_frequency, float high_frequency, float attenuation)

View File

@ -49,7 +49,7 @@ class FIRFilter {
~FIRFilter();
/*! A suggested default attenuation value. */
const float DefaultAttenuation = 60.0f;
constexpr static float DefaultAttenuation = 60.0f;
/*!
Applies the filter to one batch of input samples, returning the net result.