|
arduino-audio-tools
|
A simple Stream implementation which is backed by allocated memory. More...
#include <AudioStreams.h>
Public Member Functions | |
| MemoryStream ()=default | |
| MemoryStream (const uint8_t *buffer, int buffer_size, bool isActive=true, MemoryType memoryType=FLASH_RAM) | |
| MemoryStream (int buffer_size, MemoryType memoryType) | |
| Constructor for alloction in RAM. | |
| MemoryStream (MemoryStream &&source) | |
| Move Constructor. | |
| MemoryStream (MemoryStream &source) | |
| Copy Constructor. | |
| ~MemoryStream () | |
| virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
| Adds target to be notified about audio changes. | |
| virtual AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| virtual AudioInfo | audioInfoOut () |
| virtual int | available () override |
| virtual int | availableForWrite () override |
| bool | begin () override |
| resets the read pointer | |
| bool | begin (AudioInfo info) |
| Define some audio info and start the processing. | |
| virtual void | clear (bool reset=false) |
| clears the audio data: sets all values to 0 | |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| virtual uint8_t * | data () |
| Provides access to the data array. | |
| virtual void | end () override |
| virtual void | flush () override |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| operator bool () override | |
| Returns true if there is still some more data. | |
| MemoryStream & | operator= (MemoryStream &other) |
| copy assignement operator | |
| virtual int | peek () override |
| virtual int | read () override |
| virtual size_t | readBytes (uint8_t *data, size_t len) override |
| virtual size_t | readSilence (uint8_t *buffer, size_t length) |
| Source to generate silence: just sets the buffer to 0. | |
| virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
| Removes a target in order not to be notified about audio changes. | |
| virtual bool | resize (size_t size) |
| virtual void | setAudioInfo (AudioInfo newInfo) override |
| Defines the input AudioInfo. | |
| virtual void | setAvailable (size_t len) |
| update the write_pos (e.g. when we used data() to update the array) | |
| virtual void | setLoop (bool loop) |
| virtual void | setLoop (bool loop, int rewindPos) |
| Automatically rewinds to the indicated position when reaching the end. | |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| void | setRewindCallback (void(*cb)()) |
| Callback which is executed when we rewind (in loop mode) to the beginning. | |
| void | setValue (const uint8_t *buffer, int buffer_size, MemoryType memoryType=FLASH_RAM) |
| Update the values (buffer and size) | |
| void | setWriteBufferSize (int size) |
| virtual size_t | write (const uint8_t *data, size_t len) override |
| virtual size_t | write (uint8_t byte) override |
| virtual void | writeSilence (size_t len) |
| Writes len bytes of silence (=0). | |
Protected Member Functions | |
| void | copy (MemoryStream &source) |
| bool | memoryCanChange () |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | refillReadBuffer () |
Protected Attributes | |
| int | _timeout = 10 |
| uint8_t * | buffer = nullptr |
| int | buffer_size = 0 |
| AudioInfo | info |
| bool | is_active = false |
| bool | is_loop = false |
| bool | is_notify_active = true |
| MemoryType | memory_type = RAM |
| Vector< AudioInfoSupport * > | notify_vector |
| bool | owns_memory = true |
| int | read_pos = 0 |
| void(* | rewind )() = nullptr |
| int | rewind_pos = 0 |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | write_buffer_size = MAX_SINGLE_CHARS |
| int | write_pos = 0 |
A simple Stream implementation which is backed by allocated memory.
|
default |
|
inline |
Constructor for alloction in RAM.
|
inline |
Constructor for data from Progmem, active is set to true automatically by default.
|
inline |
Copy Constructor.
|
inline |
Move Constructor.
|
inline |
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, RTSPClient< TcpClient, UdpSocket >, Pipeline, and Pipeline::ModifyingStreamAdapter.
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, EncodedAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
Reimplemented from BaseStream.
Reimplemented from BaseStream.
|
inlineoverridevirtual |
resets the read pointer
Reimplemented from BaseStream.
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineprotected |
Reimplemented from BaseStream.
Reimplemented from BaseStream.
|
inlineprotected |
Returns true if there is still some more data.
Reimplemented from AudioStream.
|
inline |
copy assignement operator
Reimplemented from AudioStream.
Source to generate silence: just sets the buffer to 0.
|
inlineprotectedinherited |
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
Resizes the available memory. Returns false for PROGMEM or when allocation failed
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in VS1053Stream, WM8960Stream, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, VolumeStream, MiniAudioStream, PortAudioStream, I2SCodecStream, MozziStream, SPDIFOutput, AudioLoRa, AnalogAudioStream, I2SStream, TimerCallbackAudioStream, AudioBLEStream, LoRaStream, AudioFFTBase, AudioKitStream, VBANStream, AnalogAudioArduino, Equalizer3Bands, Equalizer3BandsPerChannel, AdapterAudioOutputToAudioStream, TimedStream, MeasuringStream, ProgressStream, CallbackStream, VolumeMeter, AudioInputMonitor, FormatConverterStream, FadeStream, GoertzelStream, Pipeline::ModifyingStreamAdapter, MDFEchoCancellationStream< Allocator >, EncodedAudioStream, PureDataStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
update the write_pos (e.g. when we used data() to update the array)
Automatically rewinds to the beginning when reaching the end. For wav files we move to pos 44 to ignore the header!
Automatically rewinds to the indicated position when reaching the end.
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
Callback which is executed when we rewind (in loop mode) to the beginning.
Update the values (buffer and size)
Reimplemented from AudioStream.
Reimplemented from BaseStream.
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |