JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::dsp::IIR::Coefficients< NumericType > Struct Template Reference

A set of coefficients for use in an Filter object. More...

#include <juce_IIRFilter.h>

Inheritance diagram for juce::dsp::IIR::Coefficients< NumericType >:
Collaboration diagram for juce::dsp::IIR::Coefficients< NumericType >:

Public Types

using Ptr = ReferenceCountedObjectPtr< Coefficients >
 The Coefficients structure is ref-counted, so this is a handy type that can be used as a pointer to one. More...
 

Public Member Functions

 Coefficients ()
 Creates a null set of coefficients (which will produce silence). More...
 
 Coefficients (Coefficients &&)=default
 
 Coefficients (const Coefficients &)=default
 
template<size_t Num>
 Coefficients (const std::array< NumericType, Num > &values)
 Constructs from an array. More...
 
 Coefficients (NumericType b0, NumericType b1, NumericType a0, NumericType a1)
 Directly constructs an object from the raw coefficients. More...
 
 Coefficients (NumericType b0, NumericType b1, NumericType b2, NumericType a0, NumericType a1, NumericType a2)
 
 Coefficients (NumericType b0, NumericType b1, NumericType b2, NumericType b3, NumericType a0, NumericType a1, NumericType a2, NumericType a3)
 
void decReferenceCount () noexcept
 Decreases the object's reference count. More...
 
bool decReferenceCountWithoutDeleting () noexcept
 Decreases the object's reference count. More...
 
size_t getFilterOrder () const noexcept
 Returns the filter order associated with the coefficients. More...
 
double getMagnitudeForFrequency (double frequency, double sampleRate) const noexcept
 Returns the magnitude frequency response of the filter for a given frequency and sample rate. More...
 
void getMagnitudeForFrequencyArray (const double *frequencies, double *magnitudes, size_t numSamples, double sampleRate) const noexcept
 Returns the magnitude frequency response of the filter for a given frequency array and sample rate. More...
 
double getPhaseForFrequency (double frequency, double sampleRate) const noexcept
 Returns the phase frequency response of the filter for a given frequency and sample rate. More...
 
void getPhaseForFrequencyArray (double *frequencies, double *phases, size_t numSamples, double sampleRate) const noexcept
 Returns the phase frequency response of the filter for a given frequency array and sample rate. More...
 
const NumericType * getRawCoefficients () const noexcept
 Returns a raw data pointer to the coefficients. More...
 
NumericType * getRawCoefficients () noexcept
 Returns a raw data pointer to the coefficients. More...
 
int getReferenceCount () const noexcept
 Returns the object's current reference count. More...
 
void incReferenceCount () noexcept
 Increments the object's reference count. More...
 
Coefficientsoperator= (Coefficients &&)=default
 
Coefficientsoperator= (const Coefficients &)=default
 
template<size_t Num>
Coefficientsoperator= (const std::array< NumericType, Num > &values)
 Assigns contents from an array. More...
 

Static Public Member Functions

static Ptr makeAllPass (double sampleRate, NumericType frequency)
 Returns the coefficients for an all-pass filter. More...
 
static Ptr makeAllPass (double sampleRate, NumericType frequency, NumericType Q)
 Returns the coefficients for an all-pass filter with variable Q. More...
 
static Ptr makeBandPass (double sampleRate, NumericType frequency)
 Returns the coefficients for a band-pass filter. More...
 
static Ptr makeBandPass (double sampleRate, NumericType frequency, NumericType Q)
 Returns the coefficients for a band-pass filter with variable Q. More...
 
static Ptr makeFirstOrderAllPass (double sampleRate, NumericType frequency)
 Returns the coefficients for a first order all-pass filter. More...
 
static Ptr makeFirstOrderHighPass (double sampleRate, NumericType frequency)
 Returns the coefficients for a first order high-pass filter. More...
 
static Ptr makeFirstOrderLowPass (double sampleRate, NumericType frequency)
 Returns the coefficients for a first order low-pass filter. More...
 
static Ptr makeHighPass (double sampleRate, NumericType frequency)
 Returns the coefficients for a high-pass filter. More...
 
static Ptr makeHighPass (double sampleRate, NumericType frequency, NumericType Q)
 Returns the coefficients for a high-pass filter with variable Q. More...
 
static Ptr makeHighShelf (double sampleRate, NumericType cutOffFrequency, NumericType Q, NumericType gainFactor)
 Returns the coefficients for a high-pass shelf filter with variable Q and gain. More...
 
static Ptr makeLowPass (double sampleRate, NumericType frequency)
 Returns the coefficients for a low-pass filter. More...
 
static Ptr makeLowPass (double sampleRate, NumericType frequency, NumericType Q)
 Returns the coefficients for a low-pass filter with variable Q. More...
 
static Ptr makeLowShelf (double sampleRate, NumericType cutOffFrequency, NumericType Q, NumericType gainFactor)
 Returns the coefficients for a low-pass shelf filter with variable Q and gain. More...
 
static Ptr makeNotch (double sampleRate, NumericType frequency)
 Returns the coefficients for a notch filter. More...
 
static Ptr makeNotch (double sampleRate, NumericType frequency, NumericType Q)
 Returns the coefficients for a notch filter with variable Q. More...
 
static Ptr makePeakFilter (double sampleRate, NumericType centreFrequency, NumericType Q, NumericType gainFactor)
 Returns the coefficients for a peak filter centred around a given frequency, with a variable Q and gain. More...
 

Public Attributes

Array< NumericType > coefficients
 The raw coefficients. More...
 

Protected Member Functions

void resetReferenceCount () noexcept
 Resets the reference count to zero without deleting the object. More...
 

Private Types

using ArrayCoeffs = ArrayCoefficients< NumericType >
 

Private Member Functions

template<size_t Num>
Coefficientsassign (const NumericType(&values)[Num])
 
template<size_t Num>
CoefficientsassignImpl (const NumericType *values)
 

Private Attributes

Atomic< intrefCount { 0 }
 

Detailed Description

template<typename NumericType>
struct juce::dsp::IIR::Coefficients< NumericType >

A set of coefficients for use in an Filter object.

See also
IIR::Filter

@tags{DSP}

Member Typedef Documentation

◆ ArrayCoeffs

template<typename NumericType >
using juce::dsp::IIR::Coefficients< NumericType >::ArrayCoeffs = ArrayCoefficients<NumericType>
private

◆ Ptr

template<typename NumericType >
using juce::dsp::IIR::Coefficients< NumericType >::Ptr = ReferenceCountedObjectPtr<Coefficients>

The Coefficients structure is ref-counted, so this is a handy type that can be used as a pointer to one.

Constructor & Destructor Documentation

◆ Coefficients() [1/7]

template<typename NumericType >
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( )

Creates a null set of coefficients (which will produce silence).

◆ Coefficients() [2/7]

template<typename NumericType >
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( NumericType  b0,
NumericType  b1,
NumericType  a0,
NumericType  a1 
)

Directly constructs an object from the raw coefficients.

Most people will want to use the static methods instead of this, but the constructor is public to allow tinkerers to create their own custom filters!

◆ Coefficients() [3/7]

template<typename NumericType >
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( NumericType  b0,
NumericType  b1,
NumericType  b2,
NumericType  a0,
NumericType  a1,
NumericType  a2 
)

◆ Coefficients() [4/7]

template<typename NumericType >
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( NumericType  b0,
NumericType  b1,
NumericType  b2,
NumericType  b3,
NumericType  a0,
NumericType  a1,
NumericType  a2,
NumericType  a3 
)

◆ Coefficients() [5/7]

template<typename NumericType >
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( const Coefficients< NumericType > &  )
default

◆ Coefficients() [6/7]

template<typename NumericType >
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( Coefficients< NumericType > &&  )
default

◆ Coefficients() [7/7]

template<typename NumericType >
template<size_t Num>
juce::dsp::IIR::Coefficients< NumericType >::Coefficients ( const std::array< NumericType, Num > &  values)
inlineexplicit

Constructs from an array.

References juce::UnitTestCategories::values.

Member Function Documentation

◆ assign()

template<typename NumericType >
template<size_t Num>
Coefficients& juce::dsp::IIR::Coefficients< NumericType >::assign ( const NumericType(&)  values[Num])
inlineprivate

◆ assignImpl()

template<typename NumericType >
template<size_t Num>
Coefficients& juce::dsp::IIR::Coefficients< NumericType >::assignImpl ( const NumericType *  values)
private

◆ decReferenceCount()

void juce::ReferenceCountedObject::decReferenceCount ( )
inlinenoexceptinherited

Decreases the object's reference count.

If the count gets to zero, the object will be deleted.

References jassert.

◆ decReferenceCountWithoutDeleting()

bool juce::ReferenceCountedObject::decReferenceCountWithoutDeleting ( )
inlinenoexceptinherited

Decreases the object's reference count.

If the count gets to zero, the object will not be deleted, but this method will return true, allowing the caller to take care of deletion.

References jassert.

◆ getFilterOrder()

template<typename NumericType >
size_t juce::dsp::IIR::Coefficients< NumericType >::getFilterOrder ( ) const
noexcept

Returns the filter order associated with the coefficients.

◆ getMagnitudeForFrequency()

template<typename NumericType >
double juce::dsp::IIR::Coefficients< NumericType >::getMagnitudeForFrequency ( double  frequency,
double  sampleRate 
) const
noexcept

Returns the magnitude frequency response of the filter for a given frequency and sample rate.

◆ getMagnitudeForFrequencyArray()

template<typename NumericType >
void juce::dsp::IIR::Coefficients< NumericType >::getMagnitudeForFrequencyArray ( const double *  frequencies,
double *  magnitudes,
size_t  numSamples,
double  sampleRate 
) const
noexcept

Returns the magnitude frequency response of the filter for a given frequency array and sample rate.

◆ getPhaseForFrequency()

template<typename NumericType >
double juce::dsp::IIR::Coefficients< NumericType >::getPhaseForFrequency ( double  frequency,
double  sampleRate 
) const
noexcept

Returns the phase frequency response of the filter for a given frequency and sample rate.

◆ getPhaseForFrequencyArray()

template<typename NumericType >
void juce::dsp::IIR::Coefficients< NumericType >::getPhaseForFrequencyArray ( double *  frequencies,
double *  phases,
size_t  numSamples,
double  sampleRate 
) const
noexcept

Returns the phase frequency response of the filter for a given frequency array and sample rate.

◆ getRawCoefficients() [1/2]

template<typename NumericType >
const NumericType* juce::dsp::IIR::Coefficients< NumericType >::getRawCoefficients ( ) const
inlinenoexcept

◆ getRawCoefficients() [2/2]

template<typename NumericType >
NumericType* juce::dsp::IIR::Coefficients< NumericType >::getRawCoefficients ( )
inlinenoexcept

◆ getReferenceCount()

int juce::ReferenceCountedObject::getReferenceCount ( ) const
inlinenoexceptinherited

Returns the object's current reference count.

◆ incReferenceCount()

void juce::ReferenceCountedObject::incReferenceCount ( )
inlinenoexceptinherited

Increments the object's reference count.

This is done automatically by the smart pointer, but is public just in case it's needed for nefarious purposes.

Referenced by juce::ReferenceCountedObjectPtr< juce::ReferenceCountedObject >::operator=().

◆ makeAllPass() [1/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeAllPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for an all-pass filter.

◆ makeAllPass() [2/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeAllPass ( double  sampleRate,
NumericType  frequency,
NumericType  Q 
)
static

Returns the coefficients for an all-pass filter with variable Q.

◆ makeBandPass() [1/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeBandPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a band-pass filter.

◆ makeBandPass() [2/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeBandPass ( double  sampleRate,
NumericType  frequency,
NumericType  Q 
)
static

Returns the coefficients for a band-pass filter with variable Q.

◆ makeFirstOrderAllPass()

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeFirstOrderAllPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a first order all-pass filter.

◆ makeFirstOrderHighPass()

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeFirstOrderHighPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a first order high-pass filter.

◆ makeFirstOrderLowPass()

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeFirstOrderLowPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a first order low-pass filter.

◆ makeHighPass() [1/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeHighPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a high-pass filter.

◆ makeHighPass() [2/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeHighPass ( double  sampleRate,
NumericType  frequency,
NumericType  Q 
)
static

Returns the coefficients for a high-pass filter with variable Q.

◆ makeHighShelf()

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeHighShelf ( double  sampleRate,
NumericType  cutOffFrequency,
NumericType  Q,
NumericType  gainFactor 
)
static

Returns the coefficients for a high-pass shelf filter with variable Q and gain.

The gain is a scale factor that the high frequencies are multiplied by, so values greater than 1.0 will boost the high frequencies, values less than 1.0 will attenuate them.

◆ makeLowPass() [1/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeLowPass ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a low-pass filter.

◆ makeLowPass() [2/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeLowPass ( double  sampleRate,
NumericType  frequency,
NumericType  Q 
)
static

Returns the coefficients for a low-pass filter with variable Q.

◆ makeLowShelf()

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeLowShelf ( double  sampleRate,
NumericType  cutOffFrequency,
NumericType  Q,
NumericType  gainFactor 
)
static

Returns the coefficients for a low-pass shelf filter with variable Q and gain.

The gain is a scale factor that the low frequencies are multiplied by, so values greater than 1.0 will boost the low frequencies, values less than 1.0 will attenuate them.

◆ makeNotch() [1/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeNotch ( double  sampleRate,
NumericType  frequency 
)
static

Returns the coefficients for a notch filter.

◆ makeNotch() [2/2]

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makeNotch ( double  sampleRate,
NumericType  frequency,
NumericType  Q 
)
static

Returns the coefficients for a notch filter with variable Q.

◆ makePeakFilter()

template<typename NumericType >
static Ptr juce::dsp::IIR::Coefficients< NumericType >::makePeakFilter ( double  sampleRate,
NumericType  centreFrequency,
NumericType  Q,
NumericType  gainFactor 
)
static

Returns the coefficients for a peak filter centred around a given frequency, with a variable Q and gain.

The gain is a scale factor that the centre frequencies are multiplied by, so values greater than 1.0 will boost the centre frequencies, values less than 1.0 will attenuate them.

◆ operator=() [1/3]

template<typename NumericType >
Coefficients& juce::dsp::IIR::Coefficients< NumericType >::operator= ( Coefficients< NumericType > &&  )
default

◆ operator=() [2/3]

template<typename NumericType >
Coefficients& juce::dsp::IIR::Coefficients< NumericType >::operator= ( const Coefficients< NumericType > &  )
default

◆ operator=() [3/3]

template<typename NumericType >
template<size_t Num>
Coefficients& juce::dsp::IIR::Coefficients< NumericType >::operator= ( const std::array< NumericType, Num > &  values)
inline

Assigns contents from an array.

References juce::UnitTestCategories::values.

◆ resetReferenceCount()

void juce::ReferenceCountedObject::resetReferenceCount ( )
inlineprotectednoexceptinherited

Resets the reference count to zero without deleting the object.

You should probably never need to use this!

Member Data Documentation

◆ coefficients

template<typename NumericType >
Array<NumericType> juce::dsp::IIR::Coefficients< NumericType >::coefficients

The raw coefficients.

You should leave these numbers alone unless you really know what you're doing.

Referenced by juce::dsp::IIR::Coefficients< NumericType >::getRawCoefficients().

◆ refCount

Atomic<int> juce::ReferenceCountedObject::refCount { 0 }
privateinherited

The documentation for this struct was generated from the following file: