|
arduino-audio-tools
|
MixerStream is mixing the input from Multiple Input Streams. All streams must have the same audo format (sample rate, channels, bits per sample). More...
#include <AudioStreams.h>
Public Member Functions | |
| InputMixer ()=default | |
| int | add (Stream &in, int weight=100) |
| Adds a new input stream and returns it's actual index position. | |
| 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 |
| virtual bool | begin () |
| virtual bool | begin (AudioInfo info) |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| void | end () override |
| Remove all input streams. | |
| virtual void | flush () override |
| int | indexOf (Stream &stream) |
| Provides the actual index of the stream. | |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| int | nextEmptyIndex () |
| Provides you the index of the next empty stream. -1 when none is found. | |
| virtual | operator bool () |
| Stream * | operator[] (int idx) |
| Provides the stream pointer at the indicated index. | |
| size_t | readBytes (uint8_t *data, size_t len) override |
| Provides the data from all streams mixed together. | |
| virtual size_t | readSilence (uint8_t *buffer, size_t length) |
| Source to generate silence: just sets the buffer to 0. | |
| bool | remove () |
| Removes all streams which have no data available. | |
| bool | remove (int idx) |
| Removes a stream by index position. | |
| virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
| Removes a target in order not to be notified about audio changes. | |
| bool | set (int index, Stream &in) |
| Replaces a stream at the indicated index. | |
| virtual void | setAudioInfo (AudioInfo newInfo) override |
| Defines the input AudioInfo. | |
| void | setLimitToAvailableData (bool flag) |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| void | setRetryCount (int retry) |
| void | setWeight (int index, int weight) |
| void | setWriteBufferSize (int size) |
| int | size () |
| Number of stremams to which are mixed together. | |
| virtual 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 | |
| int | availableBytes () |
| Provides the available bytes from the first stream with data. | |
| virtual int | not_supported (int out, const char *msg="") |
| void | notifyAudioChange (AudioInfo info) |
| int | readBytesVector (T *p_data, int byteCount) |
| mixing using a vector of samples | |
| void | recalculateWeights () |
| Recalculate the weights. | |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
| void | resultAdd (float fact) |
| void | resultClear () |
Protected Attributes | |
| int | _timeout = 10 |
| Vector< T > | current_vect |
| int | frame_size = 4 |
| AudioInfo | info |
| bool | is_notify_active = true |
| bool | limit_available_data = false |
| Vector< AudioInfoSupport * > | notify_vector |
| Vector< int > | result_vect |
| int | retry_count = 5 |
| Vector< Stream * > | streams {0} |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | total_weights = 0 |
| Vector< int > | weights {0} |
| int | write_buffer_size = MAX_SINGLE_CHARS |
MixerStream is mixing the input from Multiple Input Streams. All streams must have the same audo format (sample rate, channels, bits per sample).
|
default |
Adds a new input stream and returns it's actual index position.
|
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 Stream.
Reimplemented in AudioKitStream, AudioLoRa, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, VBANStream, AudioStreamWrapper, LoRaStream, FaustStream< DSP >, AudioFFTBase, AudioMP34DT05, I2SCodecStream, MiniAudioStream, StdioStream, TfLiteAudioStream, A2DPStream, ESPNowStream, HammingFEC< bytecount, block_t >, HLSStreamT< URLStream >, HttpRequest, ICYStreamT< T >, URLStream, BufferedTaskStream, ReedSolomonFEC< bytecount, additional_bytes >, UDPStream, AnalogAudioArduino, AnalogAudioStream, AudioEffectStreamT< T >, Equalizer3Bands, Equalizer3BandsPerChannel, I2SStream, ReformatBaseStream, TimedStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, BufferedStream, ConverterStream< T >, MeasuringStream, ProgressStream, Throttle, InputMerge< T >, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, CatStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, FadeStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, Pipeline, Pipeline::ModifyingStreamAdapter, VolumeStream, FileLoopT< FileType >, FileLoopT< File >, AudioBLEClient, AudioBLEClient, AudioBLEServer, and AudioBLEServer.
Provides the available bytes from the first stream with data.
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 >, AnalogAudioArduino, 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 in AudioOutputWithCallback, AudioMP34DT05, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, VS1053Stream, WM8960Stream, AdaptiveResamplingStream, AudioLoRa, ESPNowStream, VBANStream, AudioEffectStreamT< T >, Equalizer3Bands, Equalizer3BandsPerChannel, I2SStream, AudioStreamWrapper, TimerCallbackAudioStream, FrequencyDetectorAutoCorrelation, GoertzelStream, ResampleStreamT< TInterpolator >, FileLoopT< FileType >, FileLoopT< File >, LoRaStream, EncodedAudioStream, AudioBoardStream, AudioFFTBase, AudioKitStream, MiniAudioStream, PortAudioStream, StdioStream, HLSStreamT< URLStream >, AnalogAudioArduino, AnalogAudioStream, AdapterAudioOutputToAudioStream, TimedStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, MeasuringStream, ProgressStream, Throttle, InputMerge< T >, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, VolumeMeter, AudioInputMonitor, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, CatStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, Pipeline, Pipeline::ModifyingStreamAdapter, ResampleStream, VolumeStream, and EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >.
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
Remove all input streams.
Reimplemented from BaseStream.
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, AudioStreamWrapper, ResampleStream, URLStream, BufferedTaskStream, I2SStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and BufferedStream.
Provides the actual index of the stream.
Provides you the index of the next empty stream. -1 when none is found.
Provides the stream pointer at the indicated index.
Provides the data from all streams mixed together.
Reimplemented from AudioStream.
mixing using a vector of samples
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 >.
Replaces a stream at the indicated index.
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 >.
Limit the copy to the available data of all streams: stops to provide data when any stream has ended
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
Defines the maximum number of retrys to get data from an input before we abort the read and provide empty data
Dynamically update the new weight for the indicated channel: If you set it to 0 it is muted (and the stream is not read any more). We recommend to use values between 1 and 100
Implements BaseStream.
Reimplemented in URLStream, LMSEchoCancellationStream< T >, MDFEchoCancellationStream< Allocator >, AudioBLEServer, ESP3288AudioOutput, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, AudioLoRa, I2SStream, AudioStreamWrapper, ConverterStream< T >, LoRaStream, EncodedAudioStream, FaustStream< DSP >, AudioFFTBase, AudioKitStream, MiniAudioStream, PortAudioStream, TfLiteAudioStream, VS1053Stream, A2DPStream, AdaptiveResamplingStream, BufferedTaskStream, URLStreamESP32, VBANStream, AnalogAudioArduino, AnalogAudioStream, AudioEffectStreamT< T >, Equalizer3Bands, Equalizer3BandsPerChannel, AdapterAudioOutputToAudioStream, TimedStream, MemoryStream, RingBufferStream, BufferedStream, MeasuringStream, ProgressStream, Throttle, CallbackStream, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, VolumeMeter, AudioInputMonitor, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, FadeStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, GoertzelStream, Pipeline, Pipeline::ModifyingStreamAdapter, ResampleStream, ResampleStreamT< TInterpolator >, VolumeStream, AudioBLEClient, AudioBLEClient, AudioBLEServer, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, TfLiteAudioStreamBase, WM8960Stream, AnalogDriverESP32V1::IO16Bit, and AnalogDriverESP32V2::IO16Bit.
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |