arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
audio_tools::Synthesizer Class Reference

A simple Synthesizer which can generate sound having multiple keys pressed. The main purpose of this class is managing the synthezizer channels. More...

#include <Synthesizer.h>

Inheritance diagram for audio_tools::Synthesizer:
audio_tools::SoundGenerator< int16_t >

Classes

struct  KeyParameter
 
class  SynthAction
 Midi Support. More...
 

Public Member Functions

 Synthesizer (AbstractSynthesizerChannel *ch)
 
 Synthesizer (Synthesizer const &)=delete
 
bool begin (AudioBaseInfo config)
 
void keyOff (int note)
 
void keyOn (int note, float tgt=0)
 
Synthesizeroperator= (Synthesizer const &)=delete
 
int16_t readSample () override
 Provides mixed samples of all channels. More...
 
void setKeys (AudioActions &actions, SynthesizerKey *p_keys, AudioActions::ActiveLogic activeValue)
 Assigns pins to notes - the last SynthesizerKey is marked with an entry containing the note <= 0.
 
void setMidiName (const char *name)
 Defines the midi name.
 
- Public Member Functions inherited from audio_tools::SoundGenerator< int16_t >
virtual AudioBaseInfo audioInfo ()
 
virtual bool begin ()
 
virtual bool begin (AudioBaseInfo info)
 
virtual AudioBaseInfo defaultConfig ()
 
virtual void end ()
 ends the processing
 
virtual bool isActive ()
 Checks if the begin method has been called - after end() isActive returns false.
 
virtual size_t readBytes (uint8_t *buffer, size_t lengthBytes)
 Provides the data as byte array with the requested number of channels.
 
virtual int16_t readSample ()=0
 Provides a single sample. More...
 
virtual size_t readSamples (int16_t *data, size_t sampleCount=512)
 Provides the samples into simple array - which represents 1 channel.
 
virtual size_t readSamples (int16_t src[][2], size_t frameCount)
 Provides the samples into a 2 channel array.
 
virtual void setAudioInfo (AudioBaseInfo info)
 
virtual void setFrequency (uint16_t frequency)
 

Protected Member Functions

AbstractSynthesizerChannelgetFreeChannel ()
 
AbstractSynthesizerChannelgetNoteChannel (int note)
 

Static Protected Member Functions

static void callbackKeyOff (bool active, int pin, void *ref)
 
static void callbackKeyOn (bool active, int pin, void *ref)
 

Protected Attributes

MidiBleServer ble = MidiBleServer(midi_name, p_synth_action)
 
AudioBaseInfo cfg
 
Vector< AbstractSynthesizerChannel * > channels
 
AbstractSynthesizerChanneldefaultChannel
 
const char * midi_name = "Synthesizer"
 
SynthActionp_synth_action = new SynthAction(this)
 
- Protected Attributes inherited from audio_tools::SoundGenerator< int16_t >
bool active
 
bool activeWarningIssued
 
AudioBaseInfo info
 
int output_channels
 

Detailed Description

A simple Synthesizer which can generate sound having multiple keys pressed. The main purpose of this class is managing the synthezizer channels.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

bool audio_tools::Synthesizer::begin ( AudioBaseInfo  config)
inlinevirtual

◆ readSample()

int16_t audio_tools::Synthesizer::readSample ( )
inlineoverridevirtual

Provides mixed samples of all channels.

Implements audio_tools::SoundGenerator< int16_t >.


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