mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
DSP: snapToZero is now a public method of the IIR and StateVariable filters so that they can be called manually after sample by sample processing
This commit is contained in:
parent
bab3ce9759
commit
74c7633aab
2 changed files with 13 additions and 4 deletions
|
|
@ -114,9 +114,14 @@ namespace IIR
|
|||
*/
|
||||
SampleType JUCE_VECTOR_CALLTYPE processSample (SampleType sample) noexcept;
|
||||
|
||||
/** Ensure that the state variables are rounded to zero if the state
|
||||
variables are denormals. This is only needed if you are doing
|
||||
sample by sample processing.
|
||||
*/
|
||||
void snapToZero() noexcept;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
void snapToZero() noexcept;
|
||||
void check();
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -74,6 +74,12 @@ namespace StateVariableFilter
|
|||
/** Resets the filter's processing pipeline. */
|
||||
void reset() noexcept { s1 = s2 = SampleType {0}; }
|
||||
|
||||
/** Ensure that the state variables are rounded to zero if the state
|
||||
variables are denormals. This is only needed if you are doing
|
||||
sample by sample processing.
|
||||
*/
|
||||
void snapToZero() noexcept { util::snapToZero (s1); util::snapToZero (s2); }
|
||||
|
||||
//==============================================================================
|
||||
/** The parameters of the state variable filter. It's up to the called to ensure
|
||||
that these parameters are modified in a thread-safe way. */
|
||||
|
|
@ -145,9 +151,7 @@ namespace StateVariableFilter
|
|||
for (size_t i = 0 ; i < n; ++i)
|
||||
output[i] = processLoop<type> (input[i], state);
|
||||
|
||||
util::snapToZero (s1);
|
||||
util::snapToZero (s2);
|
||||
|
||||
snapToZero();
|
||||
*parameters = state;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue