arduino-audio-tools
|
Converter which converts between bits_per_sample and 16 bits. The templated NumberFormatConverterStreamT class is used based on the information provided by the bits_per_sample in the configuration. More...
#include <AudioStreamsConverter.h>
Public Member Functions | |
NumberFormatConverterStream (AudioOutput &print) | |
NumberFormatConverterStream (AudioStream &stream) | |
NumberFormatConverterStream (Print &print) | |
NumberFormatConverterStream (Stream &stream) | |
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 |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream | |
virtual int | available () override |
virtual int | availableForWrite () override |
bool | begin () |
bool | begin (AudioInfo info, AudioInfo to, float gain=1.0f) |
bool | begin (AudioInfo info, int toBits, float gain=1.0f) |
bool | begin (int from_bit_per_samples, int to_bit_per_samples, float gain=1.0) |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
void | end () override |
virtual void | flush () override |
float | getByteFactor () |
virtual Print * | getPrint () |
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 | setAudioInfo (AudioInfo newInfo) override |
Defines the input AudioInfo. | |
void | setBuffered (bool flag) |
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. | |
virtual void | setStream (AudioStream &stream) |
virtual void | setStream (Stream &stream) override |
Defines/Changes the input & output. | |
void | setToBits (uint8_t bits) |
virtual TransformationReader< ReformatBaseStream > & | transformationReader () |
Provides access to the TransformationReader. | |
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 | |
template<typename TFrom , typename TTo > | |
NumberFormatConverterStreamT< TFrom, TTo > * | getConverter () |
virtual int | not_supported (int out, const char *msg="") |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
void | setupReader () |
void | setupStream () |
Protected Attributes | |
int | _timeout = 10 |
void * | converter = nullptr |
int | from_bit_per_samples = 16 |
float | gain = 1.0 |
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 | to_bit_per_samples = 0 |
Converter which converts between bits_per_sample and 16 bits. The templated NumberFormatConverterStreamT class is used based on the information provided by the bits_per_sample in the configuration.