|
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 () |
| 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, int samples_eff) |
| void | resultClear (int samples) |
Protected Attributes | |
| int | _timeout = 10 |
| Vector< T > | current_vect |
| int | frame_size = 4 |
| Vector< float > | gains {0} |
| AudioInfo | info |
| bool | is_notify_active = true |
| bool | limit_available_data = false |
| Vector< AudioInfoSupport * > | notify_vector |
| Vector< SumT > | 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 |
|
inline |
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.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, EncodedAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
|
inlineoverridevirtual |
Reports 0 when no streams are mixed in, otherwise the combined available bytes (bounded by the least-available stream when limit_available_data is set)
Reimplemented from BaseStream.
|
inlineprotected |
Provides the available bytes from the first stream with data.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in AudioLoRa, UDPStream, VBANStream, AudioStreamWrapper, ConverterStream< T >, EncodedAudioStream, FaustStream< DSP >, I2SCodecStream, MiniAudioStream, StdioStream, A2DPStream, ESPNowStream, HammingFEC< bytecount, block_t >, AbstractURLStream, URLStreamESP32, NRF24Stream, ReedSolomonFEC< bytecount, additional_bytes >, SPIAudioSlave, USBAudioDeviceBase, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, 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, QualityAnalysisStream, VolumeStream, AudioFFTBase, AudioBLEClient, AudioBLEClient, AudioBLEServer, and AudioBLEServer.
|
inlinevirtualinherited |
Reimplemented in AudioOutputWithCallback, AudioMP34DT05, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, VS1053Stream, WM8960Stream, AdaptiveResamplingStream, AudioLoRa, ESPNowStream, USBAudioDeviceBase, VBANStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3Bands, Equalizer3BandsPerChannel, I2SStream, AudioStreamWrapper, TimerCallbackAudioStream, FrequencyDetectorAutoCorrelation, GoertzelStream, ResampleStreamT< TInterpolator >, FileLoopT< FileType >, FileLoopT< File >, EncodedAudioStream, AudioBoardStream, AudioKitStream, MiniAudioStream, PortAudioStream, StdioStream, HLSStreamT< URLStream >, NRF24Stream, 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, QualityAnalysisStream, ResampleStream, VolumeStream, AudioFFTBase, and EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >.
|
inlinevirtual |
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtual |
Remove all input streams.
Reimplemented from BaseStream.
|
inlineoverridevirtualinherited |
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.
|
inline |
Provides the actual index of the stream.
|
inlineinherited |
Checks if the automatic AudioInfo update is active.
|
inline |
Provides you the index of the next empty stream. -1 when none is found.
|
inlineprotectedvirtualinherited |
|
inlineprotectedinherited |
|
inlinevirtualinherited |
|
inline |
Provides the stream pointer at the indicated index.
|
inlineoverridevirtual |
Provides the data from all streams mixed together.
Reimplemented from AudioStream.
|
inlineprotected |
mixing using a vector of samples
|
inlinevirtualinherited |
Source to generate silence: just sets the buffer to 0.
|
inlineprotected |
Recalculate the weights.
|
inlineprotectedinherited |
Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
|
inline |
Removes all streams which have no data available.
|
inline |
Removes a stream by index position.
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineprotected |
|
inlineprotected |
|
inline |
Replaces a stream at the indicated index.
|
inlineoverridevirtualinherited |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in VS1053Stream, WM8960Stream, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, VolumeStream, MiniAudioStream, PortAudioStream, I2SCodecStream, MozziStream, SPDIFOutput, AudioLoRa, AnalogAudioStream, I2SStream, TimerCallbackAudioStream, AudioBLEStream, MDFEchoCancellationStream< T, SampleType >, AudioKitStream, NRF24Stream, SPIAudioSlave, USBAudioDeviceBase, VBANStream, Equalizer3Bands, Equalizer3BandsPerChannel, AdapterAudioOutputToAudioStream, TimedStream, MeasuringStream, ProgressStream, CallbackStream, VolumeMeter, AudioInputMonitor, FormatConverterStream, FadeStream, GoertzelStream, Pipeline::ModifyingStreamAdapter, QualityAnalysisStream, AudioFFTBase, EncodedAudioStream, PureDataStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
|
inline |
Limit the copy to the available data of all streams: stops to provide data when any stream has ended
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
|
inline |
Defines the maximum number of retrys to get data from an input before we abort the read and provide empty data
|
inline |
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
|
inlineinherited |
|
inline |
Number of stremams to which are mixed together.
|
inlineoverridevirtualinherited |
Implements BaseStream.
Reimplemented in URLStream, LMSEchoCancellationStream< T >, MDFEchoCancellationStream< T, SampleType >, AudioBLEServer, ESP3288AudioOutput, I2SCodecStream, MozziStream, PureDataStream, SPDIFOutput, AudioLoRa, USBAudioDeviceBase, I2SStream, AudioStreamWrapper, ConverterStream< T >, EncodedAudioStream, FaustStream< DSP >, AudioKitStream, MiniAudioStream, PortAudioStream, TfLiteAudioStream, VS1053Stream, A2DPStream, AdaptiveResamplingStream, BufferedTaskStream, URLStreamESP32, NRF24Stream, SPIAudioSlave, VBANStream, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, 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, QualityAnalysisStream, ResampleStream, ResampleStreamT< TInterpolator >, VolumeStream, AudioFFTBase, AudioBLEClient, AudioBLEClient, AudioBLEServer, EqualizerNBands< SampleT, AccT, NUM_TAPS, NUM_BANDS >, TfLiteAudioStreamBase, WM8960Stream, AnalogDriverESP32V1::IO16Bit, and AnalogDriverESP32V2::IO16Bit.
|
inlineoverridevirtualinherited |
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
inlinevirtualinherited |
Writes len bytes of silence (=0).
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |
|
protectedinherited |