mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Made the dsp::Filter copy constructor reset the state. Also added a couple of missing move constructors to that class
This commit is contained in:
parent
e0b0920819
commit
82073da570
2 changed files with 20 additions and 6 deletions
|
|
@ -45,6 +45,12 @@ IIR::Coefficients<NumericType>::Coefficients (const Coefficients& other)
|
|||
{
|
||||
}
|
||||
|
||||
template <typename NumericType>
|
||||
IIR::Coefficients<NumericType>::Coefficients (Coefficients&& other)
|
||||
: coefficients (static_cast<Array<NumericType>&&> (other.coefficients))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename NumericType>
|
||||
IIR::Coefficients<NumericType>& IIR::Coefficients<NumericType>::operator= (const Coefficients& other)
|
||||
{
|
||||
|
|
@ -52,6 +58,13 @@ IIR::Coefficients<NumericType>& IIR::Coefficients<NumericType>::operator= (const
|
|||
return *this;
|
||||
}
|
||||
|
||||
template <typename NumericType>
|
||||
IIR::Coefficients<NumericType>& IIR::Coefficients<NumericType>::operator= (Coefficients&& other)
|
||||
{
|
||||
coefficients = static_cast<Array<NumericType>&&> (other.coefficients);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename NumericType>
|
||||
IIR::Coefficients<NumericType>::Coefficients (NumericType b0, NumericType b1,
|
||||
NumericType a0, NumericType a1)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,10 @@ namespace IIR
|
|||
Filter (Coefficients<NumericType>* coefficientsToUse);
|
||||
|
||||
/** Creates a copy of another filter. */
|
||||
Filter (const Filter&) = default;
|
||||
Filter (const Filter& other) : coefficients (other.coefficients) { reset(); }
|
||||
|
||||
/** Creates a copy of another filter. */
|
||||
Filter& operator= (const Filter& other) { coefficients = other.coefficients; reset(); }
|
||||
|
||||
/** Move constructor. */
|
||||
Filter (Filter&&) = default;
|
||||
|
|
@ -89,10 +92,9 @@ namespace IIR
|
|||
Note that this clears the processing state, but the type of filter and
|
||||
its coefficients aren't changed.
|
||||
*/
|
||||
void reset() { reset (SampleType {0}); }
|
||||
void reset() { reset ({}); }
|
||||
|
||||
/** Resets the filter's processing pipeline to a specific value.
|
||||
|
||||
@see reset
|
||||
*/
|
||||
void reset (SampleType resetToValue);
|
||||
|
|
@ -156,11 +158,10 @@ namespace IIR
|
|||
Coefficients (NumericType b0, NumericType, NumericType b2, NumericType b3,
|
||||
NumericType a0, NumericType a1, NumericType a2, NumericType a3);
|
||||
|
||||
/** Creates a copy of another filter. */
|
||||
Coefficients (const Coefficients&);
|
||||
|
||||
/** Creates a copy of another filter. */
|
||||
Coefficients (Coefficients&&);
|
||||
Coefficients& operator= (const Coefficients&);
|
||||
Coefficients& operator= (Coefficients&&);
|
||||
|
||||
/** The Coefficients structure is ref-counted, so this is a handy type that can be used
|
||||
as a pointer to one.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue