arduino-audio-tools
|
Generates a square wave sound. More...
#include <SoundGenerator.h>
Public Member Functions | |
SquareWaveGenerator (float amplitude=32767.0f, float phase=0.0f) | |
virtual AudioInfo | audioInfo () |
Provides the AudioInfo. | |
bool | begin () override |
bool | begin (AudioInfo info) override |
bool | begin (AudioInfo info, float frequency) |
bool | begin (int channels, int sample_rate, float frequency) |
virtual AudioInfo | defaultConfig () override |
Provides the default configuration. | |
virtual void | end () |
ends the processing | |
virtual bool | isActive () |
virtual size_t | readBytes (uint8_t *data, size_t len) |
Provides the data as byte array with the requested number of channels. | |
virtual T | readSample () |
Provides a single sample. | |
void | setAmplitude (float amp) |
virtual void | setAudioInfo (AudioInfo info) override |
Defines/updates the AudioInfo. | |
void | setFrequency (float frequency) override |
Defines the frequency - after the processing has been started. | |
Protected Attributes | |
bool | active = false |
bool | activeWarningIssued = false |
const float | double_Pi = 2.0f * PI |
AudioInfo | info |
float | m_amplitude = 1.0f |
float | m_cycles = 0.0f |
float | m_deltaTime = 0.0f |
volatile float | m_frequency = 0.0f |
float | m_phase = 0.0f |
RingBuffer< uint8_t > | ring_buffer {0} |
Generates a square wave sound.
|
inlineoverridevirtualinherited |
Reimplemented from SoundGenerator< T >.
|
inlineoverridevirtualinherited |
Reimplemented from SoundGenerator< T >.
|
inlineoverridevirtualinherited |
Provides the default configuration.
Reimplemented from SoundGenerator< T >.
|
inlinevirtualinherited |
ends the processing
Reimplemented in GeneratorFromArray< T >.
|
inlinevirtualinherited |
Checks if the begin method has been called - after end() isActive returns false
|
inlinevirtual |
Provides a single sample.
Reimplemented from FastSineGenerator< T >.
|
inlineoverridevirtualinherited |
Defines/updates the AudioInfo.
Reimplemented from SoundGenerator< T >.
|
inlineoverridevirtualinherited |
Defines the frequency - after the processing has been started.
Reimplemented from SoundGenerator< T >.