|
arduino-audio-tools
|
CallbackStream: A Stream that allows to register callback methods for accessing and providing data. The callbacks can be lambda expressions. Warning: this class does not propagate audio info changes to the target stream. You need to do this manually. More...
#include <AudioStreams.h>
Public Member Functions | |
| CallbackStream ()=default | |
| CallbackStream (Print &out, size_t(*cb_update)(uint8_t *data, size_t len)) | |
| Allows to change the audio before sending it to the output. | |
| CallbackStream (size_t(*cb_read)(uint8_t *data, size_t len), size_t(*cb_write)(const uint8_t *data, size_t len)) | |
| CallbackStream (Stream &io, size_t(*cb_update)(uint8_t *data, size_t len)) | |
| 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 () |
| int | available () override |
| virtual int | availableForWrite () override |
| virtual bool | begin () override |
| virtual bool | begin (AudioInfo info) |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| void | end () override |
| virtual void | flush () override |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| virtual | operator bool () |
| 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. | |
| void | setAudioInfo (AudioInfo info) override |
| Updates the audio info and calls the callback. | |
| void | setAudioInfoCallback (void(*cb)(AudioInfo info)) |
| defines the callback to receive the actual audio info | |
| void | setAvailable (int val) |
| optioinally define available bytes for next read | |
| void | setAvailableCallback (int(*cb)()) |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| virtual void | setOutput (AudioOutput &out) |
| Defines/Changes the output target and registers for audio change notifications. | |
| void | setOutput (Print &out) override |
| Defines/Changes the output target. | |
| void | setOutput (Stream &in) |
| same as setStream | |
| void | setReadCallback (size_t(*cb_read)(uint8_t *data, size_t len)) |
| virtual void | setStream (AudioStream &io) |
| Defines/Changes the input & output and registers for audio change notifications. | |
| void | setStream (Print &out) |
| same as set Output | |
| void | setStream (Stream &in) override |
| Defines/Changes the input & output. | |
| void | setUpdateCallback (size_t(*cb_update)(uint8_t *data, size_t len)) |
| void | setWriteBufferSize (int size) |
| void | setWriteCallback (size_t(*cb_write)(const uint8_t *data, size_t len)) |
| size_t | write (const uint8_t *data, size_t len) override |
| virtual size_t | write (uint8_t ch) override |
| virtual void | writeSilence (size_t len) |
| Writes len bytes of silence (=0). | |
Protected Member Functions | |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
Protected Attributes | |
| int | _timeout = 10 |
| bool | active = true |
| int | available_bytes = -1 |
| void(* | cb_audio_info )(AudioInfo info) = nullptr |
| int(* | cb_available )() = nullptr |
| size_t(* | cb_read )(uint8_t *data, size_t len) = nullptr |
| size_t(* | cb_update )(uint8_t *data, size_t len) = nullptr |
| size_t(* | cb_write )(const uint8_t *data, size_t len) = nullptr |
| AudioInfo | info |
| bool | is_notify_active = true |
| Vector< AudioInfoSupport * > | notify_vector |
| Print * | p_out = nullptr |
| Stream * | p_stream = nullptr |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | write_buffer_size = MAX_SINGLE_CHARS |
CallbackStream: A Stream that allows to register callback methods for accessing and providing data. The callbacks can be lambda expressions. Warning: this class does not propagate audio info changes to the target stream. You need to do this manually.
|
default |
|
inline |
Allows to change the audio before sending it to the output or before getting it from the original input
|
inline |
Allows to change the audio before sending it to the output.
|
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 MP3EncoderShine, PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
Reimplemented from Print.
Reimplemented in AudioLoRa, UDPStream, VBANStream, AudioStreamWrapper, ConverterStream< T >, LoRaStream, EncodedAudioStream, FaustStream< DSP >, AudioFFTBase, I2SCodecStream, MiniAudioStream, StdioStream, A2DPStream, ESPNowStream, HammingFEC< bytecount, block_t >, AbstractURLStream, URLStreamESP32, ReedSolomonFEC< bytecount, additional_bytes >, SPIAudioSlave, AnalogAudioStream, AudioEffectStreamT< T >, Equalizer3Bands, Equalizer3BandsPerChannel, I2SStream, ReformatBaseStream, TimedStream, MemoryStream, RingBufferStream, MeasuringStream, ProgressStream, Throttle, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, FadeStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, Pipeline, VolumeStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, and AudioBLEServer.
Reimplemented from BaseStream.
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, ReformatBaseStream, AudioStreamWrapper, ResampleStream, EncodedAudioStream, URLStream, BufferedTaskStream, I2SStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and BufferedStream.
Reimplemented from AudioStream.
Source to generate silence: just sets the buffer to 0.
|
inlineprotectedinherited |
Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
Updates the audio info and calls the callback.
Reimplemented from AudioStream.
defines the callback to receive the actual audio info
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
|
inlinevirtualinherited |
Defines/Changes the output target and registers for audio change notifications.
Reimplemented in TimedStream, VolumeMeter, AudioInputMonitor, ReformatBaseStream, FormatConverterStream, and EncodedAudioStream.
Defines/Changes the output target.
Implements ModifyingStream.
|
inlinevirtualinherited |
Defines/Changes the input & output and registers for audio change notifications.
Reimplemented in VolumeMeter, AudioInputMonitor, FormatConverterStream, ReformatBaseStream, TimedStream, and EncodedAudioStream.
Defines/Changes the input & output.
Implements ModifyingStream.
Reimplemented from AudioStream.
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |