FabGL
ESP32 VGA Controller and Graphics Library
fabgl::WaveformGenerator Class Referenceabstract

Base abstract class for waveform generators. A waveform generator can be seen as an audio channel that will be mixed by SoundGenerator. More...

#include <soundgen.h>

Inheritance diagram for fabgl::WaveformGenerator:
Collaboration diagram for fabgl::WaveformGenerator:

Public Member Functions

void enable (bool value)
 Enables or disabled this generator. More...
 
bool enabled ()
 Determines whether this generator is enabled or disabled. More...
 
virtual int getSample ()=0
 Gets next sample. More...
 
uint16_t sampleRate ()
 Determines the sample rate. More...
 
virtual void setFrequency (int value)=0
 Sets output frequency. More...
 
void setSampleRate (int value)
 Sets the sample rate. More...
 
void setVolume (int value)
 Sets volume of this generator. More...
 
int volume ()
 Determines current volume. More...
 

Detailed Description

Base abstract class for waveform generators. A waveform generator can be seen as an audio channel that will be mixed by SoundGenerator.

Member Function Documentation

◆ enable()

void fabgl::WaveformGenerator::enable ( bool  value)
inline

Enables or disabled this generator.

A generator is disabled for default and must be enabled in order to play sound

Parameters
valueTrue to enable the generator, False to disable

◆ enabled()

bool fabgl::WaveformGenerator::enabled ( )
inline

Determines whether this generator is enabled or disabled.

Returns
True if this generator is enabled

◆ getSample()

virtual int fabgl::WaveformGenerator::getSample ( )
pure virtual

◆ sampleRate()

uint16_t fabgl::WaveformGenerator::sampleRate ( )
inline

Determines the sample rate.

Returns
Current sample rate in Hertz

◆ setFrequency()

virtual void fabgl::WaveformGenerator::setFrequency ( int  value)
pure virtual

◆ setSampleRate()

void fabgl::WaveformGenerator::setSampleRate ( int  value)
inline

Sets the sample rate.

Default sample rate is 160000 Hertz.

Parameters
valueSample rate in Hertz

◆ setVolume()

void fabgl::WaveformGenerator::setVolume ( int  value)
inline

Sets volume of this generator.

Parameters
valueVolume value. Minimum is 0, maximum is 127.

◆ volume()

int fabgl::WaveformGenerator::volume ( )
inline

Determines current volume.

Returns
Current volume of this generator (0 = minimum, 127 = maximum)

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