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

base class for effects that use LFOs. More...

#include <ModulationEffect.h>

Inheritance diagram for HephAudio::ModulationEffect:
HephAudio::DoubleBufferedAudioEffect HephAudio::AudioEffect HephAudio::Flanger HephAudio::Tremolo HephAudio::Vibrato HephAudio::Chorus

Public Member Functions

virtual ~ModulationEffect ()=default
 
virtual void Process (AudioBuffer &buffer, size_t startIndex, size_t frameCount) override
 
virtual void SetOscillator (const Oscillator &lfo)
 
virtual double GetDepth () const
 
virtual void SetDepth (double depth)
 
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 CalculateRequiredFrameCount (size_t outputFrameCount, const AudioFormatInfo &formatInfo) const
 
virtual size_t CalculateOutputFrameCount (const AudioBuffer &buffer) const
 

Protected Member Functions

 ModulationEffect ()
 
 ModulationEffect (double depth, const Oscillator &lfo)
 
- Protected Member Functions inherited from HephAudio::DoubleBufferedAudioEffect
 DoubleBufferedAudioEffect ()
 
- 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

Heph::DoubleBuffer lfoBuffer
 
size_t lfoIndex
 
double depth
 
- Protected Attributes inherited from HephAudio::AudioEffect
size_t threadCount
 

Detailed Description

base class for effects that use LFOs.

Constructor & Destructor Documentation

◆ ModulationEffect() [1/2]

HephAudio::ModulationEffect::ModulationEffect ( )
protected

creates a new instance and initializes it with default values.

◆ ModulationEffect() [2/2]

HephAudio::ModulationEffect::ModulationEffect ( double depth,
const Oscillator & lfo )
protected

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

Parameters
depthcontrols the dry/wet mix ratio. Ranges between 0 and 1.
lfolow-frequency oscillator.

◆ ~ModulationEffect()

virtual HephAudio::ModulationEffect::~ModulationEffect ( )
virtualdefault

releases the resources and destroys the instance.

Member Function Documentation

◆ Process() [1/3]

virtual void HephAudio::ModulationEffect::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::Flanger, HephAudio::Tremolo, and HephAudio::Vibrato.

◆ SetOscillator()

virtual void HephAudio::ModulationEffect::SetOscillator ( const Oscillator & lfo)
virtual

sets the lfo.

Parameters
lfolow-frequency oscillator.

◆ GetDepth()

virtual double HephAudio::ModulationEffect::GetDepth ( ) const
virtual

gets the depth.

◆ SetDepth()

virtual void HephAudio::ModulationEffect::SetDepth ( double depth)
virtual

sets the depth.

Parameters
depthcontrols the dry/wet mix ratio. Ranges between 0 and 1.

◆ 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.

Reimplemented in HephAudio::Tremolo, and HephAudio::Vibrato.

◆ 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.

Reimplemented in HephAudio::Tremolo, and HephAudio::Vibrato.

Member Data Documentation

◆ lfoBuffer

Heph::DoubleBuffer HephAudio::ModulationEffect::lfoBuffer
protected

contains one period long data.

◆ lfoIndex

size_t HephAudio::ModulationEffect::lfoIndex
protected

index of the last accessed sample.

◆ depth

double HephAudio::ModulationEffect::depth
protected

controls the dry/wet mix ratio. Ranges between 0 and 1.