HephAudio v3.1.0
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
HephAudio::OlaEffect Class Reference

base class for effects that use overlap-add method. More...

#include <OlaEffect.h>

Inheritance diagram for HephAudio::OlaEffect:
HephAudio::DoubleBufferedAudioEffect HephAudio::AudioEffect HephAudio::FrequencyDomainEffect HephAudio::PitchShifter HephAudio::TimeStretcher HephAudio::Equalizer HephAudio::Spatializer HephAudio::BandCutFilter HephAudio::BandPassFilter HephAudio::HighPassFilter HephAudio::LowPassFilter

Public Member Functions

virtual ~OlaEffect ()=default
 
virtual size_t CalculateRequiredFrameCount (size_t outputFrameCount, const AudioFormatInfo &formatInfo) const
 
virtual void ResetInternalState () override
 
virtual void Process (AudioBuffer &buffer, size_t startIndex, size_t frameCount) override
 
virtual size_t GetHopSize () const
 
virtual void SetHopSize (size_t hopSize)
 
virtual size_t GetWindowSize () const
 
virtual void SetWindow (const Window &wnd)
 
virtual void Process (AudioBuffer &buffer)
 
virtual void Process (AudioBuffer &buffer, size_t startIndex)
 
- Public Member Functions inherited from HephAudio::DoubleBufferedAudioEffect
virtual ~DoubleBufferedAudioEffect ()=default
 
- Public Member Functions inherited from HephAudio::AudioEffect
virtual ~AudioEffect ()=default
 
virtual std::string Name () const =0
 
virtual bool HasMTSupport () const
 
virtual bool HasRTSupport () const
 
virtual size_t GetThreadCount () const
 
virtual void SetThreadCount (size_t threadCount)
 
virtual size_t CalculateOutputFrameCount (size_t inputFrameCount, const AudioFormatInfo &formatInfo) const
 
virtual size_t CalculateAdvanceSize (size_t renderFrameCount, const AudioFormatInfo &formatInfo) const
 

Protected Member Functions

 OlaEffect ()
 
 OlaEffect (size_t hopSize)
 
 OlaEffect (size_t hopSize, const Window &wnd)
 
virtual size_t CalculateMaxNumberOfOverlaps () const
 
virtual size_t CalculatePastSamplesSize () const
 
- Protected Member Functions inherited from HephAudio::DoubleBufferedAudioEffect
 DoubleBufferedAudioEffect ()
 
virtual AudioBuffer CreateOutputBuffer (const AudioBuffer &inputBuffer, size_t startIndex, size_t frameCount) const
 
virtual void InitializeOutputBuffer (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) const
 
- Protected Member Functions inherited from HephAudio::AudioEffect
 AudioEffect ()
 
virtual void ProcessST (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount)=0
 
virtual void ProcessMT (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount)
 

Protected Attributes

size_t hopSize
 
Heph::DoubleBuffer wnd
 
size_t currentIndex
 
AudioBuffer pastSamples
 
- Protected Attributes inherited from HephAudio::AudioEffect
size_t threadCount
 

Detailed Description

base class for effects that use overlap-add method.

Constructor & Destructor Documentation

◆ OlaEffect() [1/3]

HephAudio::OlaEffect::OlaEffect ( )
protected

creates a new instance and initializes it with default values.

◆ OlaEffect() [2/3]

HephAudio::OlaEffect::OlaEffect ( size_t hopSize)
explicitprotected

creates a new instance and initializes it with the provided values.

Parameters
hopSizenumber of frames to advance each iteration.

◆ OlaEffect() [3/3]

HephAudio::OlaEffect::OlaEffect ( size_t hopSize,
const Window & wnd )
protected

creates a new instance and initializes it with the provided values.

Parameters
hopSizenumber of frames to advance each iteration.
wndwindow that will be applied for overlap-add.

◆ ~OlaEffect()

virtual HephAudio::OlaEffect::~OlaEffect ( )
virtualdefault

releases the resources and destroys the instance.

Member Function Documentation

◆ CalculateRequiredFrameCount()

virtual size_t HephAudio::OlaEffect::CalculateRequiredFrameCount ( size_t outputFrameCount,
const AudioFormatInfo & formatInfo ) const
virtual

calculates the number of frames required to obtain the number of frames desired for the output buffer.

Parameters
outputFrameCountthe number of frames desired for the output buffer.
formatInfothe format info of the input buffer.

Reimplemented from HephAudio::AudioEffect.

Reimplemented in HephAudio::TimeStretcher.

◆ ResetInternalState()

virtual void HephAudio::OlaEffect::ResetInternalState ( )
overridevirtual

resets the variables internally used for processing.

Reimplemented from HephAudio::AudioEffect.

◆ Process() [1/3]

virtual void HephAudio::OlaEffect::Process ( AudioBuffer & buffer,
size_t startIndex,
size_t frameCount )
overridevirtual

Applies the effect.

Parameters
buffercontains the audio data which will be processed.
startIndexindex of the first audio frame to process.
frameCountnumber of frames to process.

Reimplemented from HephAudio::DoubleBufferedAudioEffect.

Reimplemented in HephAudio::Spatializer.

◆ GetHopSize()

virtual size_t HephAudio::OlaEffect::GetHopSize ( ) const
virtual

gets the hop size.

◆ SetHopSize()

virtual void HephAudio::OlaEffect::SetHopSize ( size_t hopSize)
virtual

sets the hop size.

Parameters
hopSizenumber of frames to advance each iteration.

◆ GetWindowSize()

virtual size_t HephAudio::OlaEffect::GetWindowSize ( ) const
virtual

gets the size of the window.

◆ SetWindow()

virtual void HephAudio::OlaEffect::SetWindow ( const Window & wnd)
virtual

sets the window.

Parameters
wndwindow that will be applied for overlap-add.

Reimplemented in HephAudio::FrequencyDomainEffect, and HephAudio::Spatializer.

◆ CalculateMaxNumberOfOverlaps()

virtual size_t HephAudio::OlaEffect::CalculateMaxNumberOfOverlaps ( ) const
protectedvirtual

calculates the maximum number of overlaps

◆ CalculatePastSamplesSize()

virtual size_t HephAudio::OlaEffect::CalculatePastSamplesSize ( ) const
protectedvirtual

calculates the size of the past samples.

◆ Process() [2/3]

virtual void HephAudio::AudioEffect::Process ( AudioBuffer & buffer)
virtual

Applies the effect.

Parameters
buffercontains the audio data which will be processed.

Reimplemented from HephAudio::DoubleBufferedAudioEffect.

◆ Process() [3/3]

virtual void HephAudio::AudioEffect::Process ( AudioBuffer & buffer,
size_t startIndex )
virtual

Applies the effect.

Parameters
buffercontains the audio data which will be processed.
startIndexindex of the first audio frame to process.

Reimplemented from HephAudio::DoubleBufferedAudioEffect.

Member Data Documentation

◆ hopSize

size_t HephAudio::OlaEffect::hopSize
protected

number of frames to advance each iteration.

◆ wnd

Heph::DoubleBuffer HephAudio::OlaEffect::wnd
protected

window that will be applied for overlap-add.

◆ currentIndex

size_t HephAudio::OlaEffect::currentIndex
protected

for real-time processing.

◆ pastSamples

AudioBuffer HephAudio::OlaEffect::pastSamples
protected

past samples for real-time processing.