r8brain-free-src
High-quality pro audio sample rate converter library
 
Loading...
Searching...
No Matches
r8b::CDSPFIRFilterCache Class Reference

FIR filter cache class. More...

#include <CDSPFIRFilter.h>

Inheritance diagram for r8b::CDSPFIRFilterCache:

Static Public Member Functions

static CDSPFIRFiltergetLPFilter (const double ReqNormFreq, const double ReqTransBand, const double ReqAtten, const EDSPFilterPhaseResponse ReqPhase, const double ReqGain, const double *const AttenCorrs=R8B_NULL)
 Calculates or returns reference to a previously calculated (cached) low-pass FIR filter.
 
static int getObjCount ()
 Returns the number of filters present in the cache now. This value can be monitored for debugging "forgotten" filters.
 

Static Protected Member Functions

static int & getObjCountStatic ()
 Returns reference to variable containing cache object count.
 
static CSyncObjectgetStateSync ()
 Returns reference to filter cache sync object.
 

Friends

class CDSPFIRFilter
 

Detailed Description

FIR filter cache class.

Class that implements cache for calculated FIR filters. The required FIR filter should be obtained via the getLPFilter() static function.

Member Function Documentation

◆ getLPFilter()

static CDSPFIRFilter & r8b::CDSPFIRFilterCache::getLPFilter ( const double ReqNormFreq,
const double ReqTransBand,
const double ReqAtten,
const EDSPFilterPhaseResponse ReqPhase,
const double ReqGain,
const double *const AttenCorrs = R8B_NULL )
static

Calculates or returns reference to a previously calculated (cached) low-pass FIR filter.

Note that the real transition band and attenuation achieved by the filter varies with the magnitude of the required attenuation, and are never 100% exact.

Parameters
ReqNormFreqRequired normalized frequency, in the range 0 to 1, inclusive. This is the point after which the stop-band spans.
ReqTransBandRequired transition band, in percent of the 0 to ReqNormFreq spectral bandwidth, in the range CDSPFIRFilter::getLPMinTransBand() to CDSPFIRFilter::getLPMaxTransBand(), inclusive. The transition band specifies the part of the spectrum between the -3 dB and ReqNormFreq points. The real resulting -3 dB point varies in the range from -3.00 to -3.05 dB, but is generally very close to -3 dB.
ReqAttenRequired stop-band attenuation in decibel, in the range CDSPFIRFilter::getLPMinAtten() to CDSPFIRFilter::getLPMaxAtten(), inclusive. Note that the actual stop-band attenuation of the resulting filter may be 0.40-4.46 dB higher.
ReqPhaseRequired filter's phase response.
ReqGainRequired overall filter's gain (1.0 for unity gain).
AttenCorrsAttentuation correction table, to pass to the filter generation function. For internal use.
See also
EDSPFilterPhaseResponse
Returns
A reference to a new or a previously calculated low-pass FIR filter object with the required characteristics. A reference count is incremented in the returned filter object which should be released after use via the CDSPFIRFilter::unref() function.