mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
FilterDesign: Add assertions to catch misuse of design functions
This commit is contained in:
parent
e02a09da0c
commit
c41f64111f
1 changed files with 8 additions and 5 deletions
|
|
@ -386,16 +386,19 @@ ReferenceCountedArray<IIR::Coefficients<FloatType>>
|
|||
FloatType passbandAmplitudedB,
|
||||
FloatType stopbandAmplitudedB)
|
||||
{
|
||||
jassert (sampleRate > 0);
|
||||
jassert (frequency > 0 && frequency <= sampleRate * 0.5);
|
||||
jassert (normalisedTransitionWidth > 0 && normalisedTransitionWidth <= 0.5);
|
||||
jassert (passbandAmplitudedB > -20 && passbandAmplitudedB < 0);
|
||||
jassert (stopbandAmplitudedB > -300 && stopbandAmplitudedB < -20);
|
||||
jassert (0 < sampleRate);
|
||||
jassert (0 < frequency && frequency <= sampleRate * 0.5);
|
||||
jassert (0 < normalisedTransitionWidth && normalisedTransitionWidth <= 0.5);
|
||||
jassert (-20 < passbandAmplitudedB && passbandAmplitudedB < 0);
|
||||
jassert (-300 < stopbandAmplitudedB && stopbandAmplitudedB < -20);
|
||||
|
||||
auto normalisedFrequency = frequency / sampleRate;
|
||||
|
||||
auto fp = normalisedFrequency - normalisedTransitionWidth / 2;
|
||||
jassert (0.0 < fp && fp < 0.5);
|
||||
|
||||
auto fs = normalisedFrequency + normalisedTransitionWidth / 2;
|
||||
jassert (0.0 < fs && fs < 0.5);
|
||||
|
||||
double Ap = passbandAmplitudedB;
|
||||
double As = stopbandAmplitudedB;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue