OpenShot Audio Library | OpenShotAudio 0.4.0
 
Loading...
Searching...
No Matches
juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType > Struct Template Referenceabstract
Inheritance diagram for juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >:
juce::dsp::Oversampling2TimesEquirippleFIR< SampleType > juce::dsp::Oversampling2TimesPolyphaseIIR< SampleType > juce::dsp::OversamplingDummy< SampleType >

Public Types

enum  FilterType
 

Public Member Functions

 OversamplingStage (size_t numChans, size_t newFactor)
 
virtual SampleType getLatencyInSamples () const =0
 
virtual void initProcessing (size_t maximumNumberOfSamplesBeforeOversampling)
 
virtual void reset ()
 
AudioBlock< SampleType > getProcessedSamples (size_t numSamples)
 
virtual void processSamplesUp (const AudioBlock< const SampleType > &)=0
 
virtual void processSamplesDown (AudioBlock< SampleType > &)=0
 
 Oversampling (size_t numChannels=1)
 
 Oversampling (size_t numChannels, size_t factor, FilterType type, bool isMaxQuality=true, bool useIntegerLatency=false)
 
 ~Oversampling ()
 
void setUsingIntegerLatency (bool shouldUseIntegerLatency) noexcept
 
SampleType getLatencyInSamples () const noexcept
 
size_t getOversamplingFactor () const noexcept
 
void initProcessing (size_t maximumNumberOfSamplesBeforeOversampling)
 
void reset () noexcept
 
AudioBlock< SampleType > processSamplesUp (const AudioBlock< const SampleType > &inputBlock) noexcept
 
void processSamplesDown (AudioBlock< SampleType > &outputBlock) noexcept
 
void addOversamplingStage (FilterType, float normalisedTransitionWidthUp, float stopbandAmplitudedBUp, float normalisedTransitionWidthDown, float stopbandAmplitudedBDown)
 
void addDummyOversamplingStage ()
 
void clearOversamplingStages ()
 

Public Attributes

AudioBuffer< SampleType > buffer
 
size_t numChannels
 
size_t factor
 
size_t factorOversampling
 
size_t numChannels
 

Detailed Description

template<typename SampleType>
template<typename SampleType>
struct juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >

Abstract class for the provided oversampling stages used internally in the Oversampling class.

Definition at line 33 of file juce_Oversampling.cpp.

Member Enumeration Documentation

◆ FilterType

The type of filter that can be used for the oversampling processing.

Definition at line 57 of file juce_Oversampling.h.

Constructor & Destructor Documentation

◆ OversamplingStage()

template<typename SampleType>
template<typename SampleType>
juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::OversamplingStage ( size_t numChans,
size_t newFactor )
inline

Definition at line 35 of file juce_Oversampling.cpp.

◆ ~OversamplingStage()

template<typename SampleType>
template<typename SampleType>
virtual juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::~OversamplingStage ( )
inlinevirtual

Definition at line 36 of file juce_Oversampling.cpp.

◆ ~Oversampling()

Destructor.

Definition at line 96 of file juce_Oversampling.cpp.

Member Function Documentation

◆ addDummyOversamplingStage()

void juce::dsp::Oversampling< SampleType >::addDummyOversamplingStage ( )

Adds a new "dummy" oversampling stage, which does nothing to the signal. Using one can be useful if your application features a customisable oversampling factor and if you want to select the current one from an OwnedArray without changing anything in the processing code.

See also
OwnedArray, clearOversamplingStages, addOversamplingStage

Definition at line 179 of file juce_Oversampling.cpp.

◆ addOversamplingStage()

void juce::dsp::Oversampling< SampleType >::addOversamplingStage ( FilterType type,
float normalisedTransitionWidthUp,
float stopbandAmplitudedBUp,
float normalisedTransitionWidthDown,
float stopbandAmplitudedBDown )

Adds a new oversampling stage to the Oversampling class, multiplying the current oversampling factor by two. This is used with the default constructor to create custom oversampling chains, requiring a call to the clearOversamplingStages before any addition.

Note: Upsampling and downsampling filtering have different purposes, the former removes upsampling artefacts while the latter removes useless frequency content created by the oversampled process, so usually the attenuation is increased when upsampling compared to downsampling.

Parameters
normalisedTransitionWidthUpa value between 0 and 0.5 which specifies how much the transition between passband and stopband is steep, for upsampling filtering (the lower the better)
stopbandAmplitudedBUpthe amplitude in dB in the stopband for upsampling filtering, must be negative
normalisedTransitionWidthDowna value between 0 and 0.5 which specifies how much the transition between passband and stopband is steep, for downsampling filtering (the lower the better)
stopbandAmplitudedBDownthe amplitude in dB in the stopband for downsampling filtering, must be negative
See also
clearOversamplingStages

Definition at line 168 of file juce_Oversampling.cpp.

◆ clearOversamplingStages()

void juce::dsp::Oversampling< SampleType >::clearOversamplingStages ( )

Removes all the previously registered oversampling stages, so you can add your own from scratch.

See also
addOversamplingStage, addDummyOversamplingStage

Definition at line 186 of file juce_Oversampling.cpp.

◆ getLatencyInSamples()

SampleType juce::dsp::Oversampling< SampleType >::getLatencyInSamples ( ) const
noexcept

Returns the latency in samples of the overall processing. You can use this information in your main processor to compensate the additional latency involved with the oversampling, for example with a dry / wet mixer, and to report the latency to the DAW.

Note: If you have not opted to use an integer latency then the latency may not be integer, so you might need to round its value or to compensate it properly in your processing code since plug-ins can only report integer latency values in samples to the DAW.

Definition at line 114 of file juce_Oversampling.cpp.

◆ getOversamplingFactor()

size_t juce::dsp::Oversampling< SampleType >::getOversamplingFactor ( ) const
noexcept

Returns the current oversampling factor.

Definition at line 117 of file juce_Oversampling.cpp.

◆ getProcessedSamples()

template<typename SampleType>
template<typename SampleType>
AudioBlock< SampleType > juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::getProcessedSamples ( size_t numSamples)
inline

Definition at line 53 of file juce_Oversampling.cpp.

◆ initProcessing() [1/2]

template<typename SampleType>
template<typename SampleType>
virtual void juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::initProcessing ( size_t maximumNumberOfSamplesBeforeOversampling)
inlinevirtual

Definition at line 41 of file juce_Oversampling.cpp.

◆ initProcessing() [2/2]

void juce::dsp::Oversampling< SampleType >::initProcessing ( size_t maximumNumberOfSamplesBeforeOversampling)

Must be called before any processing, to set the buffer sizes of the internal buffers of the oversampling processing.

Definition at line 123 of file juce_Oversampling.cpp.

◆ Oversampling() [1/2]

juce::dsp::Oversampling< SampleType >::Oversampling ( size_t numChannels,
size_t factor,
FilterType type,
bool isMaxQuality = true,
bool useIntegerLatency = false )

Constructor.

Parameters
numChannelsthe number of channels to process with this object
factorthe processing will perform 2 ^ factor times oversampling
typethe type of filter design employed for filtering during oversampling
isMaxQualityif the oversampling is done using the maximum quality, where the filters will be more efficient but the CPU load will increase as well
useIntegerLatencyif true this processor will add some fractional delay at the end of the signal path to ensure that the overall latency of the oversampling is an integer

Definition at line 89 of file juce_Oversampling.cpp.

◆ Oversampling() [2/2]

juce::dsp::Oversampling< SampleType >::Oversampling ( size_t numChannels = 1)
explicit

The default constructor.

Note: This creates a "dummy" oversampling stage, which needs to be removed before adding proper oversampling stages.

Parameters
numChannelsthe number of channels to process with this object
See also
clearOversamplingStages, addOversamplingStage

Definition at line 74 of file juce_Oversampling.cpp.

◆ processSamplesDown()

void juce::dsp::Oversampling< SampleType >::processSamplesDown ( AudioBlock< SampleType > & outputBlock)
noexcept

Must be called to perform the downsampling, after the upsampling and the non-linear processing. The output signal is probably delayed by the internal latency of the whole oversampling behaviour, so don't forget to take this into account.

Definition at line 142 of file juce_Oversampling.cpp.

◆ processSamplesUp()

AudioBlock< SampleType > juce::dsp::Oversampling< SampleType >::processSamplesUp ( const AudioBlock< const SampleType > & inputBlock)
noexcept

Must be called to perform the upsampling, prior to any oversampled processing.

Returns an AudioBlock referencing the oversampled input signal, which must be used to perform the non-linear processing which needs the higher sample rate. Don't forget to set the sample rate of that processing to N times the original sample rate.

Definition at line 135 of file juce_Oversampling.cpp.

◆ reset() [1/2]

template<typename SampleType>
template<typename SampleType>
virtual void juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::reset ( )
inlinevirtual

Definition at line 48 of file juce_Oversampling.cpp.

◆ reset() [2/2]

void juce::dsp::Oversampling< SampleType >::reset ( )
noexcept

Resets the processing pipeline, ready to oversample a new stream of data.

Definition at line 126 of file juce_Oversampling.cpp.

◆ setUsingIntegerLatency()

void juce::dsp::Oversampling< SampleType >::setUsingIntegerLatency ( bool shouldUseIntegerLatency)
noexcept

Definition at line 102 of file juce_Oversampling.cpp.

Member Data Documentation

◆ buffer

template<typename SampleType>
template<typename SampleType>
AudioBuffer<SampleType> juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::buffer

Definition at line 61 of file juce_Oversampling.cpp.

◆ factor

template<typename SampleType>
template<typename SampleType>
size_t juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::factor

Definition at line 62 of file juce_Oversampling.cpp.

◆ factorOversampling

size_t juce::dsp::Oversampling< SampleType >::factorOversampling

Definition at line 189 of file juce_Oversampling.h.

◆ numChannels [1/2]

template<typename SampleType>
template<typename SampleType>
size_t juce::dsp::Oversampling< SampleType >::OversamplingStage< SampleType >::numChannels

Definition at line 62 of file juce_Oversampling.cpp.

◆ numChannels [2/2]

size_t juce::dsp::Oversampling< SampleType >::numChannels

Definition at line 190 of file juce_Oversampling.h.


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