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::Equalizer Class Reference

adjusts the volumes of multiple frequency ranges. More...

#include <Equalizer.h>

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

Classes

struct  FrequencyRange
 represents a range of frequencies with volume adjustment. More...
 

Public Member Functions

 Equalizer ()
 
 Equalizer (size_t hopSize, const Window &wnd)
 
 Equalizer (size_t hopSize, const Window &wnd, const std::initializer_list< Equalizer::FrequencyRange > &frequencyRanges)
 
 Equalizer (size_t hopSize, const Window &wnd, const std::vector< Equalizer::FrequencyRange > &frequencyRanges)
 
virtual ~Equalizer ()=default
 
virtual std::string Name () const override
 
virtual const std::vector< Equalizer::FrequencyRange > & GetFrequencyRanges () const
 
virtual void AddFrequencyRange (double f1, double f2, double volume)
 
virtual void AddFrequencyRange (const Equalizer::FrequencyRange &range)
 
virtual void ModifyFrequencyRange (size_t index, const Equalizer::FrequencyRange &range)
 
virtual void RemoveFrequencyRange (size_t index)
 
- Public Member Functions inherited from HephAudio::FrequencyDomainEffect
virtual ~FrequencyDomainEffect ()=default
 
virtual void SetWindow (const Window &wnd) override
 
- Public Member Functions inherited from HephAudio::OlaEffect
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 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 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

virtual void ProcessST (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) override
 
- Protected Member Functions inherited from HephAudio::FrequencyDomainEffect
 FrequencyDomainEffect ()
 
 FrequencyDomainEffect (size_t hopSize)
 
 FrequencyDomainEffect (size_t hopSize, const Window &wnd)
 
- Protected Member Functions inherited from HephAudio::OlaEffect
 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 ProcessMT (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount)
 

Protected Attributes

std::vector< Equalizer::FrequencyRangefrequencyRanges
 
- Protected Attributes inherited from HephAudio::OlaEffect
size_t hopSize
 
Heph::DoubleBuffer wnd
 
size_t currentIndex
 
AudioBuffer pastSamples
 
- Protected Attributes inherited from HephAudio::AudioEffect
size_t threadCount
 

Detailed Description

adjusts the volumes of multiple frequency ranges.

Constructor & Destructor Documentation

◆ Equalizer() [1/4]

HephAudio::Equalizer::Equalizer ( )

creates a new instance and initializes it with default values.

◆ Equalizer() [2/4]

HephAudio::Equalizer::Equalizer ( size_t hopSize,
const Window & wnd )

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.

◆ Equalizer() [3/4]

HephAudio::Equalizer::Equalizer ( size_t hopSize,
const Window & wnd,
const std::initializer_list< Equalizer::FrequencyRange > & frequencyRanges )

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.
frequencyRangesstores the frequency ranges which will be adjusted.

◆ Equalizer() [4/4]

HephAudio::Equalizer::Equalizer ( size_t hopSize,
const Window & wnd,
const std::vector< Equalizer::FrequencyRange > & frequencyRanges )

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.
frequencyRangesstores the frequency ranges which will be adjusted.

◆ ~Equalizer()

virtual HephAudio::Equalizer::~Equalizer ( )
virtualdefault

releases the resources and destroys the instance.

Member Function Documentation

◆ Name()

virtual std::string HephAudio::Equalizer::Name ( ) const
overridevirtual

◆ GetFrequencyRanges()

virtual const std::vector< Equalizer::FrequencyRange > & HephAudio::Equalizer::GetFrequencyRanges ( ) const
virtual

gets a const reference to the internal frequency range vector.

Reimplemented in HephAudio::BandCutFilter, HephAudio::BandPassFilter, HephAudio::HighPassFilter, and HephAudio::LowPassFilter.

◆ AddFrequencyRange() [1/2]

virtual void HephAudio::Equalizer::AddFrequencyRange ( double f1,
double f2,
double volume )
virtual

adds frequency range.

Parameters
f1first frequency.
f2second frequency.
volumevolume adjustment for the frequency range.

Reimplemented in HephAudio::BandCutFilter, HephAudio::BandPassFilter, HephAudio::HighPassFilter, and HephAudio::LowPassFilter.

◆ AddFrequencyRange() [2/2]

virtual void HephAudio::Equalizer::AddFrequencyRange ( const Equalizer::FrequencyRange & range)
virtual

adds frequency range.

Parameters
rangerepresents a range of frequencies with volume adjustment.

Reimplemented in HephAudio::BandCutFilter, HephAudio::BandPassFilter, HephAudio::HighPassFilter, and HephAudio::LowPassFilter.

◆ ModifyFrequencyRange()

virtual void HephAudio::Equalizer::ModifyFrequencyRange ( size_t index,
const Equalizer::FrequencyRange & range )
virtual

modifies the frequency range at the provided index.

Parameters
indexindex of the frequency range that will be modified.
rangerepresents a range of frequencies with volume adjustment.

Reimplemented in HephAudio::BandCutFilter, HephAudio::BandPassFilter, HephAudio::HighPassFilter, and HephAudio::LowPassFilter.

◆ RemoveFrequencyRange()

virtual void HephAudio::Equalizer::RemoveFrequencyRange ( size_t index)
virtual

removes the frequency range at the provided index.

Parameters
indexindex of the frequency range that will be removed.

Reimplemented in HephAudio::BandCutFilter, HephAudio::BandPassFilter, HephAudio::HighPassFilter, and HephAudio::LowPassFilter.

◆ ProcessST()

virtual void HephAudio::Equalizer::ProcessST ( const AudioBuffer & inputBuffer,
AudioBuffer & outputBuffer,
size_t startIndex,
size_t frameCount )
overrideprotectedvirtual

applies the effect using single thread.

Parameters
inputBuffercontains the audio data which will be processed.
outputBuffercontains the processed audio data.
startIndexindex of the first sample to process.
frameCountnumber of frames to process.

Implements HephAudio::AudioEffect.

Member Data Documentation

◆ frequencyRanges

std::vector<Equalizer::FrequencyRange> HephAudio::Equalizer::frequencyRanges
protected

stores the frequency ranges which will be adjusted.