|
arduino-audio-tools
|
A Stream implementation for resamping using a specified interpolation algorithm. More...
#include <ResampleStreamT.h>
Public Member Functions | |
| ResampleStreamT ()=default | |
| Default constructor. | |
| ResampleStreamT (AudioOutput &out) | |
| Constructor for output to an AudioOutput interface. | |
| ResampleStreamT (AudioStream &io) | |
| Constructor for input/output via an AudioStream interface. | |
| ResampleStreamT (Print &out) | |
| Constructor for output to a Print interface. | |
| ResampleStreamT (Stream &io) | |
| Constructor for input/output via a Stream interface. | |
| virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
| Adds target to be notified about audio changes. | |
| virtual AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| AudioInfo | audioInfoOut () override |
| Returns the output audio information, adjusting the sample rate according to the step size. | |
| int | available () override |
| int | availableForWrite () override |
| bool | begin () |
| bool | begin (AudioInfo info, float step) |
| Initializes the resampler with audio info and a step size. | |
| bool | begin (ResampleConfig cfg) |
| Initializes the resampler with the given configuration. | |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| ResampleConfig | defaultConfig () |
| void | end () override |
| virtual void | flush () override |
| float | getByteFactor () override |
| virtual Print * | getPrint () |
| float | getStepSize () const |
| Gets the current resampling step size. | |
| virtual Stream * | getStream () |
| 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 | resizeReadResultQueue (int size) |
| Define the size of the interal read result queue: same as transformationReader().resizeResultQueue(size) | |
| void | setAudioInfo (AudioInfo newInfo) override |
| Sets the audio format information and updates the channel count. | |
| void | setNotifyActive (bool flag) |
| Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
| virtual void | setOutput (AudioOutput &print) |
| virtual void | setOutput (Print &print) override |
| Defines/Changes the output target. | |
| void | setStepSize (float step) |
| Sets the resampling step size for all channels. | |
| virtual void | setStream (AudioStream &stream) |
| virtual void | setStream (Stream &stream) override |
| Defines/Changes the input & output. | |
| void | setWriteBufferSize (int size) |
| virtual TransformationReader< ReformatBaseStream > & | transformationReader () |
| Provides access to the TransformationReader. | |
| size_t | write (const uint8_t *data, size_t len) override |
| Write interleaved samples to the stream. | |
| 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 () |
| void | setupReader () |
| template<typename T > | |
| size_t | writeT (Print *p_out, const uint8_t *buffer, size_t bytes, size_t &written) |
| Writes the buffer to defined output after resampling. | |
Protected Attributes | |
| MultiChannelResampler< TInterpolator > | _resampler |
| int | _timeout = 10 |
| ResampleConfig | cfg |
| AudioInfo | info |
| bool | is_notify_active = true |
| Vector< AudioInfoSupport * > | notify_vector |
| Print * | p_print = nullptr |
| Stream * | p_stream = nullptr |
| TransformationReader< ReformatBaseStream > | reader |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | write_buffer_size = MAX_SINGLE_CHARS |
A Stream implementation for resamping using a specified interpolation algorithm.
| TInterpolator | The resampler type (must derive from BaseInterpolator). |
|
inline |
|
inline |
Constructor for output to an AudioOutput interface.
| out | The AudioOutput interface to write resampled data to. |
|
inline |
|
inline |
Constructor for input/output via an AudioStream interface.
| io | The AudioStream interface to read/write data. |
|
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 >.
|
inlineoverridevirtual |
Returns the output audio information, adjusting the sample rate according to the step size.
Reimplemented from AudioInfoSupport.
|
inlineoverridevirtualinherited |
Reimplemented from BaseStream.
|
inlineoverridevirtualinherited |
Reimplemented from BaseStream.
|
inlinevirtual |
Reimplemented from BaseStream.
|
inline |
Initializes the resampler with audio info and a step size.
| info | The audio format information. |
| step | The resampling step size. |
|
inline |
Initializes the resampler with the given configuration.
| cfg | The resampling configuration. |
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtualinherited |
Reimplemented from BaseStream.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.
|
inlineoverridevirtual |
Implements ReformatBaseStream.
|
inline |
Gets the current resampling step size.
|
inlinevirtualinherited |
Reimplemented in A2DPStream, ICYStreamT< T >, I2SStream, MemoryStream, and Pipeline.
|
inlineoverridevirtualinherited |
Reimplemented from AudioStream.
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtual |
Sets the audio format information and updates the channel count.
| newInfo | The new audio format information. |
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Defines/Changes the output target.
Implements ModifyingStream.
Reimplemented in EncodedAudioStream, and FormatConverterStream.
|
inline |
Sets the resampling step size for all channels.
| step | The new step size. |
|
inlineoverridevirtualinherited |
Defines/Changes the input & output.
Implements ModifyingStream.
Reimplemented in FormatConverterStream, and EncodedAudioStream.
|
inlineoverridevirtual |
Write interleaved samples to the stream.
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Reimplemented in BufferedTaskStream, and BufferedStream.