FabGL
ESP32 Display Controller and Graphics Library
|
SoundGenerator handles audio output. More...
#include <soundgen.h>
Public Member Functions | |
SoundGenerator (int sampleRate=16384, gpio_num_t gpio=GPIO_AUTO, SoundGenMethod genMethod=SoundGenMethod::Auto) | |
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... | |
SamplesGenerator * | playSamples (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... | |
SoundGenerator handles audio output.
SoundGenerator generates audio samples using DAC or Sigma-Delta modulation. Use constructor to specify GPIO and generation method. Applications attach waveform generators (like SineWaveformGenerator, SquareWaveformGenerator, etc...) and call SoundGenerator.play() to start audio generation.
Here is a list of supported sound generators:
Definition at line 350 of file soundgen.h.