|
arduino-audio-tools
|
An Adapter Class which lets you use any Stream as a Generator. More...
#include <SoundGenerator.h>
Public Member Functions | |
| GeneratorFromStream () | |
| GeneratorFromStream (Stream &input, int channels=1, float volume=1.0) | |
| Constructs a new Generator from a Stream object that can be used e.g. as input for AudioEffectss. | |
| virtual AudioInfo | audioInfo () |
| Provides the AudioInfo. | |
| virtual bool | begin () |
| Starts the processing. | |
| virtual bool | begin (AudioInfo info) |
| Starts the processing with the provided AudioInfo. | |
| virtual AudioInfo | defaultConfig () |
| Provides the default configuration. | |
| virtual void | end () |
| Ends the processing. | |
| virtual bool | isActive () |
| Checks if the begin method has been called - after end() isActive is false. | |
| virtual size_t | readBytes (uint8_t *data, size_t len) |
| Provides the data as byte array with the requested number of channels. | |
| T | readSample () |
| Provides a single sample from the stream. | |
| virtual void | setAudioInfo (AudioInfo info) |
| Defines/updates the AudioInfo. | |
| void | setChannels (int channels) |
| virtual void | setFrequency (float frequency) |
| Abstract method: not implemented! Just provides an error message... | |
| void | setPlayTime (uint32_t playMs, uint8_t upPercent=20, uint8_t downPercent=30) |
| Defines the play time in ms and the ramp up and ramp down time in percent. | |
| void | setStream (Stream &input) |
| (Re-)Assigns a stream to the Adapter class | |
| virtual bool | setVolume (float volume) |
| define the actual volume in the range of 0.0f to 1.0f | |
| virtual float | volume () |
| provides the actual volume in the range of 0.0f to 1.0f | |
Protected Member Functions | |
| T | applyRamp (T sample) |
| 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 () |
Protected Attributes | |
| bool | active = false |
| bool | activeWarningIssued = false |
| int | channels = 1 |
| uint32_t | currentSample = 0 |
| uint8_t | downPercent = 40 |
| float | factor = 1.0f |
| AudioInfo | info |
| float | maxValue |
| Stream * | p_stream = nullptr |
| uint32_t | playMs = 0 |
| uint32_t | playSamples = 0 |
| float | rampDownDec = 0.0 |
| uint32_t | rampDownSamples = 0 |
| float | rampUpInc = 0.0 |
| RingBuffer< uint8_t > | ring_buffer {0} |
| uint8_t | upPercent = 5 |
| uint32_t | upSamples = 0 |
| float | volume_value = 1.0f |
An Adapter Class which lets you use any Stream as a Generator.
| T |
|
inline |
|
inline |
|
inlineprotectedinherited |
|
inlinevirtualinherited |
Provides the AudioInfo.
|
inlinevirtualinherited |
Starts the processing.
Reimplemented in SineFromTable< T >, SineGenerator< T >, SineGenerator< int16_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 >, SineGenerator< T >, SineGenerator< int16_t >, and GeneratorFromArray< T >.
|
inlinevirtualinherited |
Provides the default configuration.
Reimplemented in STKGenerator< StkCls, T >, STKGenerator< stk::Instrmnt, int16_t >, STKGenerator< StkCls, int16_t >, SineGenerator< T >, and SineGenerator< int16_t >.
|
inlinevirtualinherited |
Ends the processing.
Reimplemented in GeneratorFromArray< T >.
|
inlinevirtualinherited |
Checks if the begin method has been called - after end() isActive is false.
|
inlinevirtualinherited |
Provides the data as byte array with the requested number of channels.
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlinevirtual |
Provides a single sample from the stream.
Implements SoundGenerator< T >.
|
inlineprotectedinherited |
|
inlinevirtualinherited |
Defines/updates the AudioInfo.
Reimplemented in SineGenerator< T >, and SineGenerator< int16_t >.
|
inline |
|
inlinevirtualinherited |
Abstract method: not implemented! Just provides an error message...
Reimplemented in SineFromTable< T >, STKInstrument< StkCls, T >, SineGenerator< T >, SineGenerator< int16_t >, and GeneratorFromArray< T >.
|
inlineinherited |
Defines the play time in ms and the ramp up and ramp down time in percent.
|
inline |
(Re-)Assigns a stream to the Adapter class
|
inlinevirtualinherited |
define the actual volume in the range of 0.0f to 1.0f
Reimplemented in Maximilian, I2SCodecStream, VS1053Stream, VolumeStream, A2DPStream, USBAudioDeviceBase, and AudioPlayer.
|
inlinevirtualinherited |
provides the actual volume in the range of 0.0f to 1.0f
Reimplemented in I2SCodecStream, VS1053Stream, USBAudioDeviceBase, AudioPlayer, and VolumeStream.
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |