mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added some assertions to StateVariableFilter
This commit is contained in:
parent
43cff0ce48
commit
30a97ec91b
1 changed files with 5 additions and 0 deletions
|
|
@ -148,6 +148,7 @@ namespace StateVariableFilter
|
|||
void processBlock (const SampleType* input, SampleType* output, size_t n) noexcept
|
||||
{
|
||||
auto state = *parameters;
|
||||
|
||||
for (size_t i = 0 ; i < n; ++i)
|
||||
output[i] = processLoop<type> (input[i], state);
|
||||
|
||||
|
|
@ -187,6 +188,10 @@ namespace StateVariableFilter
|
|||
void setCutOffFrequency (double sampleRate, NumericType frequency,
|
||||
NumericType resonance = static_cast<NumericType> (1.0 / std::sqrt (2.0))) noexcept
|
||||
{
|
||||
jassert (sampleRate > 0);
|
||||
jassert (resonance > NumericType (0));
|
||||
jassert (frequency > NumericType (0) && frequency <= NumericType (sampleRate * 0.5));
|
||||
|
||||
g = static_cast<NumericType> (std::tan (MathConstants<double>::pi * frequency / sampleRate));
|
||||
R2 = static_cast<NumericType> (1.0 / resonance);
|
||||
h = static_cast<NumericType> (1.0 / (1.0 + R2 * g + g * g));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue