status_t Resampler::MakeFilterBySpec(double pbRipple, double sbDecay) { UNUSED(pbRipple); const int length = static_cast<int>(sizeof(g_KaiserStopbandDecay)/sizeof(int)); int index; for ( index = 0; index < length; ++index) { if ( g_KaiserStopbandDecay[index] > sbDecay ) { break; } } if ( index == length ) { return -ERROR_NOT_FOUND; } return UpdateCoefficients(KAISER, static_cast<double>(index + g_KaiserAlphaOffset)); }
status_t Resampler::MakeFilterByWindowType(int windowType, double _alpha) { if ( windowType <= 0 && NUM_WINDOW_TYPE <= windowType ) { return -ERROR_ILLEGAL; } double alpha = _alpha; if ( KAISER == windowType ) { if ( alpha < 2.0 ) { alpha = 2.0; } else if ( alpha > 10.0 ) { alpha = 10.0; } } return UpdateCoefficients(windowType, alpha); }
void Filter12dB::Init() { UpdateCoefficients(); }