|
arduino-audio-tools
|
AudioStream class that can define a start and (an optional) stop time Usually it is used to wrap an Audio Sink (e.g. I2SStream), but wrapping an Audio Source is supported as well. Only wrap classes which represent PCM data! More...
#include <AudioIO.h>
Public Member Functions | |
| TimedStream ()=default | |
| TimedStream (AudioOutput &o, long startSeconds=0, long endSeconds=-1) | |
| TimedStream (AudioStream &io, long startSeconds=0, long endSeconds=-1) | |
| TimedStream (Print &o, long startSeconds=0, long endSeconds=-1) | |
| TimedStream (Stream &io, long startSeconds=0, long endSeconds=-1) | |
| virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
| Adds target to be notified about audio changes. | |
| virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
| Adds target to be notified about audio changes. | |
| virtual AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| virtual AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| virtual AudioInfo | audioInfoOut () |
| virtual AudioInfo | audioInfoOut () |
| int | available () override |
| Provides the available bytes until the end time has reached. | |
| int | availableForWrite () override |
| bool | begin () override |
| bool | begin (AudioInfo info) |
| int | bytesPerSecond () |
| Calculates the bytes per second from the AudioInfo. | |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| virtual void | end () |
| virtual void | end () |
| void | flush () override |
| bool | isActive () |
| Returns true if we are not past the end time;. | |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| bool | isPlaying () |
| Returns true if we are in a valid time range and are still playing sound. | |
| operator bool () override | |
| 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 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 | removeNotifyAudioChange (AudioInfoSupport &bi) |
| Removes a target in order not to be notified about audio changes. | |
| virtual void | setAudioInfo (AudioInfo newInfo) override |
| Defines the input AudioInfo. | |
| void | setAudioInfo (AudioInfo info) override |
| Updates the AudioInfo in the current object and in the source or target. | |
| void | setCompressionRatio (float ratio) |
| void | setEndMs (uint32_t ms) |
| Defines the (optional) end time in milliseconds. | |
| void | setEndSec (uint32_t endSeconds) |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active). | |
| 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 (AudioOutput &out) |
| void | setOutput (Print &out) override |
| Defines/Changes the output target. | |
| void | setStartMs (uint32_t ms) |
| Defines the start time in milliseconds. | |
| void | setStartSec (uint32_t startSeconds) |
| virtual void | setStream (AudioStream &io) |
| Defines/Changes the input & output and registers for audio change notifications. | |
| void | setStream (AudioOutput &out) |
| void | setStream (AudioStream &stream) |
| void | setStream (Stream &stream) override |
| Defines/Changes the input & output. | |
| void | setWriteBufferSize (int size) |
| void | setWriteBufferSize (int size) |
| size_t | size () |
| virtual size_t | write (uint8_t ch) override |
| size_t | write (const uint8_t *data, size_t len) override |
| Plays only data for the indiated start and end time. | |
| virtual void | writeSilence (size_t len) |
| Writes len bytes of silence (=0). | |
| virtual void | writeSilence (size_t len) |
| Writes len bytes of silence (=0). | |
Protected Member Functions | |
| void | calculateByteLimits () |
| void | consumeBytes (uint32_t len) |
| virtual int | not_supported (int out, const char *msg="") |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| void | notifyAudioChange (AudioInfo info) |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read(). | |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read(). | |
Protected Attributes | |
| int | _timeout = 10 |
| float | compression_ratio = 1.0 |
| uint32_t | current_bytes = 0 |
| uint32_t | end_bytes = UINT32_MAX |
| uint32_t | end_ms = UINT32_MAX |
| AudioInfo | info |
| bool | is_notify_active = true |
| Vector< AudioInfoSupport * > | notify_vector |
| AudioInfoSupport * | p_info = nullptr |
| Stream * | p_io = nullptr |
| Print * | p_out = nullptr |
| uint32_t | start_bytes = 0 |
| uint32_t | start_ms = 0 |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | write_buffer_size = 8 |
AudioStream class that can define a start and (an optional) stop time Usually it is used to wrap an Audio Sink (e.g. I2SStream), but wrapping an Audio Source is supported as well. Only wrap classes which represent PCM data!
|
default |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, CodecNOP, EncodedAudioOutput, and EncodedAudioStream.
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, CodecNOP, EncodedAudioOutput, and EncodedAudioStream.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in AdapterAudioOutputToAudioStream, AdapterAudioOutputToAudioStream, EncodedAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMerge< T >, InputMerge< T >, TimerCallbackAudioStream, TimerCallbackAudioStream, EncodedAudioStream, GeneratedSoundStream< T >, InputMerge< T >, JupyterAudioT< T >, JupyterAudioT< int16_t >, MozziStream, PureDataStream, and TimerCallbackAudioStream.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in AdapterAudioOutputToAudioStream, AdapterAudioOutputToAudioStream, EncodedAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMerge< T >, InputMerge< T >, TimerCallbackAudioStream, TimerCallbackAudioStream, EncodedAudioStream, GeneratedSoundStream< T >, InputMerge< T >, JupyterAudioT< T >, JupyterAudioT< int16_t >, MozziStream, PureDataStream, and TimerCallbackAudioStream.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in ChannelFormatConverterStream, ChannelFormatConverterStreamT< T >, FormatConverterStream, MP3EncoderShine, NumberFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, Pipeline, PureDataStream, PWMAudioOutput< PWMDriverT >, ResampleStream, ResampleStreamT< TInterpolator >, and SupportedRatesStream.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in ChannelFormatConverterStream, ChannelFormatConverterStreamT< T >, FormatConverterStream, MP3EncoderShine, NumberFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, Pipeline, PureDataStream, PWMAudioOutput< PWMDriverT >, ResampleStream, ResampleStreamT< TInterpolator >, and SupportedRatesStream.
|
inlineoverridevirtual |
Provides the available bytes until the end time has reached.
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inline |
|
inline |
Calculates the bytes per second from the AudioInfo.
|
inlineprotected |
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >, RTSPClient< EthernetClient, EthernetUDP >, and RTSPClient< WiFiClient, WiFiUDP >.
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >, RTSPClient< EthernetClient, EthernetUDP >, and RTSPClient< WiFiClient, WiFiUDP >.
|
inlineprotected |
|
inlinevirtualinherited |
Reimplemented in A2DPStream, AbstractURLStream, AdapterAudioOutputToAudioStream, AdaptiveResamplingStream, AnalogAudioStream, AdapterAudioOutputToAudioStream, AudioStreamWrapper, AudioStreamWrapper, CallbackStream, CallbackStream, CatStream, CatStream, DynamicMemoryStream, DynamicMemoryStream, EncodedAudioStream, FilteredStream< T, TF >, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMerge< T >, InputMerge< T >, InputMixer< T, SumT >, InputMixer< T, SumT >, MemoryStream, MemoryStream, QueueStream< T >, QueueStream< T >, QueueStream< uint8_t >, ReformatBaseStream, TimerCallbackAudioStream, TimerCallbackAudioStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AudioBLEStream, AudioEffectStream, AudioEffectStreamT< T >, AudioFFTBase, AudioKitStream, AudioLoRa, AudioMP34DT05, AudioStreamWrapper, AutomaticGainControlStream, BufferedTaskStream, CallbackStream, CatStream, ChannelFormatConverterStream, DynamicMemoryStream, EncodedAudioStream, Equalizer3BandsPerChannelT< T >, Equalizer3BandsPerChannelT< float >, Equalizer3BandsT< T >, Equalizer3BandsT< float >, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, ESPNowStream, FaustStream< DSP >, FileLoopT< FileType >, FileLoopT< File >, FilteredStream< T, TF >, FormatConverterStream, GeneratedSoundStream< T >, GoertzelStream, HLSStreamT< URLStream >, HLSStreamT< URLStreamESP32 >, HttpRequest, I2SCodecStream, I2SStream, ICYStreamT< T >, ICYStreamT< URLStream >, ICYStreamT< URLStreamESP32 >, InputMerge< T >, InputMixer< T, SumT >, MemoryStream, MiniAudioStream, MozziStream, NRF24Stream, NumberFormatConverterStream, Pipeline, Pipeline::ModifyingStreamAdapter, PortAudioStream, PureDataStream, QueueStream< T >, ReformatBaseStream, SPDIFOutput, SPIAudioSlave, StdioStream, SupportedRatesStream, TimerCallbackAudioStream, URLStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, URLStreamBufferedT< ICYStreamESP32 >, URLStreamBufferedT< URLStream >, URLStreamBufferedT< URLStreamESP32 >, URLStreamESP32, USBAudioDeviceBase, USBAudioHostBase, VolumeStream, VS1053Stream, and WM8960Stream.
|
inlinevirtualinherited |
Reimplemented in A2DPStream, AbstractURLStream, AdapterAudioOutputToAudioStream, AdaptiveResamplingStream, AnalogAudioStream, AdapterAudioOutputToAudioStream, AudioStreamWrapper, AudioStreamWrapper, CallbackStream, CallbackStream, CatStream, CatStream, DynamicMemoryStream, DynamicMemoryStream, EncodedAudioStream, FilteredStream< T, TF >, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, InputMerge< T >, InputMerge< T >, InputMixer< T, SumT >, InputMixer< T, SumT >, MemoryStream, MemoryStream, QueueStream< T >, QueueStream< T >, QueueStream< uint8_t >, ReformatBaseStream, TimerCallbackAudioStream, TimerCallbackAudioStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, AudioBLEServer, AudioBLEStream, AudioEffectStream, AudioEffectStreamT< T >, AudioFFTBase, AudioKitStream, AudioLoRa, AudioMP34DT05, AudioStreamWrapper, AutomaticGainControlStream, BufferedTaskStream, CallbackStream, CatStream, ChannelFormatConverterStream, DynamicMemoryStream, EncodedAudioStream, Equalizer3BandsPerChannelT< T >, Equalizer3BandsPerChannelT< float >, Equalizer3BandsT< T >, Equalizer3BandsT< float >, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, ESPNowStream, FaustStream< DSP >, FileLoopT< FileType >, FileLoopT< File >, FilteredStream< T, TF >, FormatConverterStream, GeneratedSoundStream< T >, GoertzelStream, HLSStreamT< URLStream >, HLSStreamT< URLStreamESP32 >, HttpRequest, I2SCodecStream, I2SStream, ICYStreamT< T >, ICYStreamT< URLStream >, ICYStreamT< URLStreamESP32 >, InputMerge< T >, InputMixer< T, SumT >, MemoryStream, MiniAudioStream, MozziStream, NRF24Stream, NumberFormatConverterStream, Pipeline, Pipeline::ModifyingStreamAdapter, PortAudioStream, PureDataStream, QueueStream< T >, ReformatBaseStream, SPDIFOutput, SPIAudioSlave, StdioStream, SupportedRatesStream, TimerCallbackAudioStream, URLStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, URLStreamBufferedT< ICYStreamESP32 >, URLStreamBufferedT< URLStream >, URLStreamBufferedT< URLStreamESP32 >, URLStreamESP32, USBAudioDeviceBase, USBAudioHostBase, VolumeStream, VS1053Stream, and WM8960Stream.
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inline |
Returns true if we are not past the end time;.
|
inlineinherited |
Checks if the automatic AudioInfo update is active.
|
inlineinherited |
Checks if the automatic AudioInfo update is active.
|
inline |
Returns true if we are in a valid time range and are still playing sound.
|
inlineprotectedvirtualinherited |
|
inlineprotectedvirtualinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlineoverridevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtual |
Provides only data for the indicated start and end time. Only supported for data which does not contain any heder information: so PCM, mp3 should work!
Reimplemented from AudioStream.
|
inlinevirtualinherited |
Source to generate silence: just sets the buffer to 0.
|
inlinevirtualinherited |
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().
|
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.
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
|
inlineoverridevirtualinherited |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in AdapterAudioOutputToAudioStream, AudioInputMonitor, AudioInputMonitor, CallbackStream, CallbackStream, EncodedAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, ProgressStream, ProgressStream, TimedStream, TimerCallbackAudioStream, TimerCallbackAudioStream, VolumeMeter, and VolumeMeter.
|
inlineoverride |
Updates the AudioInfo in the current object and in the source or target.
|
inline |
Experimental: if used on mp3 you can set the compression ratio e.g. to 11 which will be used to approximate the time
|
inline |
Defines the (optional) end time in milliseconds.
|
inline |
Defines (an optional) the end time in seconds. After the end time no audio is played and available() will return 0
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active).
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active).
|
inlinevirtualinherited |
Defines/Changes the output target and registers for audio change notifications.
Reimplemented in AudioInputMonitor, AudioInputMonitor, EncodedAudioStream, ReformatBaseStream, TimedStream, VolumeMeter, and VolumeMeter.
|
inline |
|
inlineoverridevirtual |
Defines/Changes the output target.
Implements ModifyingStream.
|
inline |
Defines the start time in milliseconds.
|
inline |
Defines the start time in seconds. The audio before the start time will be skipped
|
inlinevirtualinherited |
Defines/Changes the input & output and registers for audio change notifications.
Reimplemented in AudioInputMonitor, AudioInputMonitor, EncodedAudioStream, ReformatBaseStream, TimedStream, VolumeMeter, and VolumeMeter.
|
inline |
|
inline |
|
inlineoverridevirtual |
Defines/Changes the input & output.
Implements ModifyingStream.
|
inlineinherited |
|
inlineinherited |
|
inline |
|
inlineoverridevirtualinherited |
|
inlineoverridevirtual |
Plays only data for the indiated start and end time.
Reimplemented from AudioStream.
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |