arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
NumberFormatConverterStream Class Reference

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>

Inheritance diagram for NumberFormatConverterStream:
ReformatBaseStream ModifyingStream AudioStream BaseStream AudioInfoSupport AudioInfoSource Stream Print

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 PrintgetPrint ()
 
virtual StreamgetStream ()
 
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 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
 
Printp_print = nullptr
 
Streamp_stream = nullptr
 
TransformationReader< ReformatBaseStreamreader
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
int to_bit_per_samples = 0
 

Detailed Description

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.

Author
Phil Schatzmann

The documentation for this class was generated from the following file: