arduino-audio-tools
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
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 Synthesizer:
SoundGenerator< int16_t >

Classes

struct  KeyParameter
 

Public Member Functions

 Synthesizer (AbstractSynthesizerChannel *ch)
 
 Synthesizer (Synthesizer const &)=delete
 
virtual AudioInfo audioInfo ()
 Provides the AudioInfo.
 
virtual bool begin ()
 
bool begin (AudioInfo config)
 
virtual AudioInfo defaultConfig ()
 Provides the default configuration.
 
virtual void end ()
 ends the processing
 
virtual bool isActive ()
 
void keyOff (int note)
 
void keyOn (int note, float tgt=0)
 
Synthesizeroperator= (Synthesizer const &)=delete
 
virtual size_t readBytes (uint8_t *data, size_t len)
 Provides the data as byte array with the requested number of channels.
 
int16_t readSample () override
 Provides mixed samples of all channels.
 
virtual void setAudioInfo (AudioInfo info)
 Defines/updates the AudioInfo.
 
virtual void setFrequency (float frequency)
 Abstract method: not implemented! Just provides an error message...
 
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.
 

Protected Member Functions

AbstractSynthesizerChannelgetFreeChannel ()
 
AbstractSynthesizerChannelgetNoteChannel (int note)
 
size_t readBytesFrames (uint8_t *buffer, size_t lengthBytes, int frames, int channels)
 
size_t readBytesFromBuffer (uint8_t *buffer, size_t lengthBytes, int frame_size, int channels)
 

Static Protected Member Functions

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

Protected Attributes

bool active
 
bool activeWarningIssued
 
AudioInfo cfg
 
Vector< AbstractSynthesizerChannel * > channels
 
AbstractSynthesizerChanneldefaultChannel
 
AudioInfo info
 
const char * midi_name = "Synthesizer"
 
RingBuffer< uint8_t > ring_buffer
 

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

◆ isActive()

virtual bool isActive ( )
inlinevirtualinherited

Checks if the begin method has been called - after end() isActive returns false


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