FabGL
ESP32 Display Controller and Graphics Library
SoundGenerator Class Reference

SoundGenerator handles audio output. More...

#include <soundgen.h>

Public Member Functions

 SoundGenerator (int sampleRate=16000)
 Creates an instance of the sound generator. Only one instance is allowed. More...
 
void attach (WaveformGenerator *value)
 Attaches a waveform generator. More...
 
void clear ()
 Stops playing and removes all attached waveform generators. More...
 
void detach (WaveformGenerator *value)
 Detaches a waveform generator. More...
 
bool play (bool value)
 Starts or stops playing. More...
 
bool playing ()
 Determines whether sound generator is playing. More...
 
SamplesGeneratorplaySamples (int8_t const *data, int length, int volume=100, int durationMS=0)
 Plays the specified samples. More...
 
template<typename T >
void playSound (T const &waveform, int frequency, int durationMS, int volume=100)
 Plays the specified waveform. More...
 
void setVolume (int value)
 Sets the overall volume. More...
 
int volume ()
 Determines current overall volume. More...
 

Detailed Description

SoundGenerator handles audio output.

Applications attach waveform generators (like SineWaveformGenerator, SquareWaveformGenerator, etc...) and call SoundGenerator.play() to start audio generation.

The GPIO used for audio output is GPIO-25. See Configuring Audio port for audio connection sample schema.

Here is a list of supported sound generators:

Definition at line 344 of file soundgen.h.


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