|
arduino-audio-tools
|
Queues SoundGenerators and plays them sequentially. Queued SoundGenerators must be limited (eg: setPlayTime()) or no later Generator will ever be played. More...
#include <SoundGenerator.h>
Classes | |
| struct | QNode |
Public Member Functions | |
| virtual AudioInfo | audioInfo () |
| Provides the AudioInfo. | |
| virtual size_t | available () |
| virtual size_t | availableForWrite () |
| virtual bool | begin () |
| Starts the processing. | |
| virtual bool | begin (AudioInfo info) |
| Starts the processing with the provided AudioInfo. | |
| virtual bool | begin (uint16_t queue_size=256) |
| virtual bool | clear () |
| virtual AudioInfo | defaultConfig () |
| Provides the default configuration. | |
| virtual bool | empty () |
| virtual void | end () override |
| virtual void | end (bool allow_rampdown) |
| virtual bool | isActive () |
| Checks if the begin method has been called - after end() isActive is false. | |
| virtual SoundGenerator< T > * | peek () |
| virtual bool | pushGenerator (SoundGenerator< T > *gen, void(*start_cb)(SoundGenerator< T > *, const void *)=nullptr, void(*end_cb)(SoundGenerator< T > *, const void *)=nullptr, const void *cb_data=nullptr) |
| virtual size_t | readBytes (uint8_t *buffer, size_t buf_len) override |
| Provides the data as byte array with the requested number of channels. | |
| virtual T | readSample () override |
| Provides a single sample. | |
| virtual size_t | readSamples (T *data, size_t len) override |
| virtual void | restart () |
| Restarts the generator, e.g. after a play time has been defined and reached. | |
| virtual void | setAudioInfo (AudioInfo info) |
| Defines/updates the AudioInfo. | |
| virtual void | setFrequency (float f) override |
| Abstract method: not implemented! Just provides an error message... | |
| virtual void | setPlayTime (uint32_t p, uint8_t u=20, uint8_t d=30) override |
| Defines the play time in ms and the ramp up and ramp down time in percent. | |
| virtual void | setRampTimes (uint32_t playMs, uint32_t upMs=5, uint32_t downMs=5) |
| virtual size_t | size () |
Protected Member Functions | |
| T | applyRamp (T sample) |
| SoundGenerator< T > * | getCurrentGenerator () |
| size_t | readBytesFrames (uint8_t *buffer, size_t lengthBytes, int frames, int channels) |
| size_t | readBytesFromBuffer (uint8_t *buffer, size_t lengthBytes, int frame_size, int channels) |
| void | recalculatePlayTime () |
| bool | removeCurrentGenerator () |
Protected Attributes | |
| bool | active = false |
| bool | activeWarningIssued = false |
| uint32_t | currentSample = 0 |
| uint32_t | downMs = 0 |
| uint8_t | downPercent = 40 |
| uint32_t | downSamples = 0 |
| float | factor = 1.0f |
| AudioInfo | info |
| uint32_t | playMs = 0 |
| uint32_t | playSamples = 0 |
| RingBufferSPSC< QNode * > | queue |
| float | rampDownDec = 0.0 |
| float | rampUpInc = 0.0 |
| RingBuffer< uint8_t > | ring_buffer {0} |
| uint32_t | upMs = 0 |
| uint8_t | upPercent = 5 |
| uint32_t | upSamples = 0 |
Queues SoundGenerators and plays them sequentially. Queued SoundGenerators must be limited (eg: setPlayTime()) or no later Generator will ever be played.
| T |
|
inlineprotectedinherited |
|
inlinevirtualinherited |
Provides the AudioInfo.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtualinherited |
Starts the processing.
Reimplemented in SineFromTable< T >, FloatSineGenerator< T >, FloatSineGenerator< int16_t >, FastIntSineGenerator< T >, SquareWaveGenerator< T >, SawToothGenerator< T >, GeneratorFromArray< T >, and GeneratorFixedValue< T >.
|
inlinevirtualinherited |
Starts the processing with the provided AudioInfo.
Reimplemented in STKGenerator< StkCls, T >, STKGenerator< stk::Instrmnt, int16_t >, STKGenerator< StkCls, int16_t >, Synthesizer, GeneratorFixedValue< T >, SoundGeneratorModulation< T, effectsuite_t >, FloatSineGenerator< T >, FloatSineGenerator< int16_t >, FastIntSineGenerator< T >, SquareWaveGenerator< T >, SawToothGenerator< T >, and GeneratorFromArray< T >.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtualinherited |
Provides the default configuration.
Reimplemented in STKGenerator< StkCls, T >, STKGenerator< stk::Instrmnt, int16_t >, STKGenerator< StkCls, int16_t >, FloatSineGenerator< T >, and FloatSineGenerator< int16_t >.
|
inlinevirtual |
|
inlineoverridevirtual |
Reimplemented from SoundGenerator< T >.
|
inlinevirtualinherited |
Ends the processing. If either setPlayTime() or setRampTimes() have been set, then allow_rampdown=true will start a ramp-down instead of stopping immediately.
|
inlineprotected |
|
inlinevirtualinherited |
Checks if the begin method has been called - after end() isActive is false.
|
inlinevirtual |
|
inlinevirtual |
|
inlineoverridevirtual |
Provides the data as byte array with the requested number of channels.
Reimplemented from SoundGenerator< T >.
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineoverridevirtual |
Provides a single sample.
Implements SoundGenerator< T >.
|
inlineoverridevirtual |
Provides the data as T array (interleaved by channel) with the requested number of samples (values, not frames)
Reimplemented from SoundGenerator< T >.
|
inlineprotectedinherited |
|
inlineprotected |
|
inlinevirtualinherited |
Restarts the generator, e.g. after a play time has been defined and reached.
|
inlinevirtualinherited |
Defines/updates the AudioInfo.
Reimplemented in FloatSineGenerator< T >, FloatSineGenerator< int16_t >, FastIntSineGenerator< T >, SquareWaveGenerator< T >, and SawToothGenerator< T >.
|
inlineoverridevirtual |
Abstract method: not implemented! Just provides an error message...
Reimplemented from SoundGenerator< T >.
|
inlineoverridevirtual |
Defines the play time in ms and the ramp up and ramp down time in percent.
Reimplemented from SoundGenerator< T >.
|
inlinevirtualinherited |
|
inlinevirtual |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |