arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
audio_tools::DefaultSynthesizerChannel< EffectsT > Class Template Reference

Default implementation for a Channel. You can provide the Sound Generator as parameter to the effects: e.g. DefaultSynthesizerChannel<AudioEffects<SineWaveGenerator<int16_t>>> *channel = new DefaultSynthesizerChannel<AudioEffects<SineWaveGenerator<int16_t>>>();. More...

#include <Synthesizer.h>

Inheritance diagram for audio_tools::DefaultSynthesizerChannel< EffectsT >:
audio_tools::AbstractSynthesizerChannel

Public Member Functions

 DefaultSynthesizerChannel ()=default
 Default constructor.
 
 DefaultSynthesizerChannel (DefaultSynthesizerChannel< EffectsT > &ch)=default
 Copy constructor.
 
void addEffect (AudioEffect *ptr)
 
virtual void begin (AudioBaseInfo config) override
 Start the sound generation. More...
 
DefaultSynthesizerChannel< EffectsT > * clone () override
 
virtual bool isActive () override
 Checks if the ADSR is still active - and generating sound. More...
 
virtual void keyOff () override
 Provides the key off event to ADSR to stop the sound. More...
 
virtual void keyOn (int note, float tgt) override
 start to play a note - note expects the frequency of the note! More...
 
virtual int note () override
 Provides the actual midi note that is played. More...
 
virtual int16_t readSample () override
 Provides the next sample. More...
 
virtual void begin (AudioBaseInfo config)
 Start the sound generation. More...
 
virtual AbstractSynthesizerChannelclone ()=0
 
virtual bool isActive ()=0
 Checks if the ADSR is still active - and generating sound. More...
 
virtual void keyOff ()=0
 Provides the key off event to ADSR to stop the sound. More...
 
virtual void keyOn (int nte, float tgt)=0
 Provides the key on event to ADSR to start the sound. More...
 
virtual int note ()=0
 Provides the actual midi note that is played. More...
 
virtual int16_t readSample ()=0
 Provides the next sample. More...
 

Protected Attributes

int actual_note = 0
 
EffectsT audio_effects
 
AudioBaseInfo config
 
ADSRGainp_adsr = nullptr
 

Detailed Description

template<class EffectsT>
class audio_tools::DefaultSynthesizerChannel< EffectsT >

Default implementation for a Channel. You can provide the Sound Generator as parameter to the effects: e.g. DefaultSynthesizerChannel<AudioEffects<SineWaveGenerator<int16_t>>> *channel = new DefaultSynthesizerChannel<AudioEffects<SineWaveGenerator<int16_t>>>();.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

template<class EffectsT >
virtual void audio_tools::DefaultSynthesizerChannel< EffectsT >::begin ( AudioBaseInfo  config)
inlineoverridevirtual

Start the sound generation.

Reimplemented from audio_tools::AbstractSynthesizerChannel.

Reimplemented in audio_tools::DefaultGuitarChannel.

◆ clone()

template<class EffectsT >
DefaultSynthesizerChannel< EffectsT > * audio_tools::DefaultSynthesizerChannel< EffectsT >::clone ( )
inlineoverridevirtual

◆ isActive()

template<class EffectsT >
virtual bool audio_tools::DefaultSynthesizerChannel< EffectsT >::isActive ( )
inlineoverridevirtual

Checks if the ADSR is still active - and generating sound.

Implements audio_tools::AbstractSynthesizerChannel.

Reimplemented in audio_tools::DefaultGuitarChannel.

◆ keyOff()

template<class EffectsT >
virtual void audio_tools::DefaultSynthesizerChannel< EffectsT >::keyOff ( )
inlineoverridevirtual

Provides the key off event to ADSR to stop the sound.

Implements audio_tools::AbstractSynthesizerChannel.

Reimplemented in audio_tools::DefaultGuitarChannel.

◆ keyOn()

template<class EffectsT >
virtual void audio_tools::DefaultSynthesizerChannel< EffectsT >::keyOn ( int  note,
float  tgt 
)
inlineoverridevirtual

start to play a note - note expects the frequency of the note!

Implements audio_tools::AbstractSynthesizerChannel.

Reimplemented in audio_tools::DefaultGuitarChannel.

◆ note()

template<class EffectsT >
virtual int audio_tools::DefaultSynthesizerChannel< EffectsT >::note ( )
inlineoverridevirtual

Provides the actual midi note that is played.

Implements audio_tools::AbstractSynthesizerChannel.

Reimplemented in audio_tools::DefaultGuitarChannel.

◆ readSample()

template<class EffectsT >
virtual int16_t audio_tools::DefaultSynthesizerChannel< EffectsT >::readSample ( )
inlineoverridevirtual

Provides the next sample.

Implements audio_tools::AbstractSynthesizerChannel.

Reimplemented in audio_tools::DefaultGuitarChannel.


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