ESP32 Display Controller and Graphics Library

◆ SoundGenerator()

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.

sampleRateSample rate in Hertz.
gpioGPIO to use. DAC mode can be set on 25 or 26. Value GPIO_AUTO will set GPIO 25 when genMethod is DAC and GPIO 23 when genMethod is SigmaDelta.
genMethodSound generation method. Can be DAC, sigma-delta or automatic. If automatic then DAC is selected when VGA is used, otherwise SigmaDelta is selected when Composite is used.


// creates sound generator with automatic values (depends by selected video output, VGA or CVBS)
SoundGenerator soundGenerator;

// creates sound generator using 16Khz sample rate, GPIO 25 in DAC mode
SoundGenerator soundGenerator(16000, GPIO_NUM_25, SoundGenMethod::DAC);

// creates sound generator using 16Khz sample rate, GPIO 23 in sigma-delta mode
SoundGenerator soundGenerator(16000, GPIO_NUM_23, SoundGenMethod::SigmaDelta);

Definition at line 454 of file soundgen.cpp.