arduino-audio-tools
|
We generate the samples from an array which is provided in the constructor. More...
#include <SoundGenerator.h>
Public Member Functions | |
template<size_t arrayLen> | |
GeneratorFromArray (T(&array)[arrayLen], int repeat=0, bool setInactiveAtEnd=false, size_t startIndex=0) | |
Construct a new Generator from an array. | |
virtual AudioInfo | audioInfo () |
Provides the AudioInfo. | |
bool | begin () override |
Starts the generation of samples. | |
virtual bool | begin (AudioInfo info) override |
virtual AudioInfo | defaultConfig () |
Provides the default configuration. | |
void | end () |
ends the processing | |
virtual bool | isActive () |
bool | isRunning () |
virtual size_t | readBytes (uint8_t *data, size_t len) |
Provides the data as byte array with the requested number of channels. | |
T | readSample () override |
Provides a single sample. | |
void | setArray (T *array, size_t size) |
template<int arrayLen> | |
void | setArray (T(&array)[arrayLen]) |
virtual void | setAudioInfo (AudioInfo info) |
Defines/updates the AudioInfo. | |
virtual void | setFrequency (float frequency) |
Abstract method: not implemented! Just provides an error message... | |
void | setIncrement (int inc) |
int | setupSine (int sampleRate, float reqFrequency, float amplitude=1.0) |
Protected Attributes | |
bool | active = false |
bool | activeWarningIssued = false |
bool | inactive_at_end |
int | index_increment = 1 |
AudioInfo | info |
bool | is_running = false |
int | max_repeat = 0 |
bool | owns_data = false |
int | repeat_counter = 0 |
RingBuffer< uint8_t > | ring_buffer {0} |
int | sound_index = 0 |
Vector< T > | table |
We generate the samples from an array which is provided in the constructor.
T |
|
inline |
Construct a new Generator from an array.
array | array of audio data of the the type defined as class template parameter |
repeat | number of repetions the array should be played, set to 0 for endless repeat. (default 0) |
setInactiveAtEnd | defines if the generator is set inactive when the array has played fully. Default is false. |
startIndex | defines if the phase. Default is 0. |
|
inlineoverridevirtual |
Starts the generation of samples.
Reimplemented from SoundGenerator< T >.
|
inlineoverridevirtual |
Reimplemented from SoundGenerator< T >.
|
inlinevirtualinherited |
Provides the default configuration.
Reimplemented in STKGenerator< StkCls, T >, STKGenerator< StkCls, int16_t >, SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.
|
inlinevirtual |
ends the processing
Reimplemented from SoundGenerator< T >.
|
inlinevirtualinherited |
Checks if the begin method has been called - after end() isActive returns false
|
inlineoverridevirtual |
Provides a single sample.
Implements SoundGenerator< T >.
|
inlinevirtualinherited |
Defines/updates the AudioInfo.
Reimplemented in SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.
|
inlinevirtualinherited |
Abstract method: not implemented! Just provides an error message...
Reimplemented in SineFromTable< T >, SineWaveGenerator< T >, and SineWaveGenerator< int16_t >.