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

Converter which converts bits_per_sample, channels and the sample_rate. The conversion is supported both on the input and output side. More...

#include <AudioStreamsConverter.h>

Inheritance diagram for FormatConverterStream:
ReformatBaseStream AudioStream Stream AudioInfoSupport AudioInfoSource Print

Public Member Functions

 FormatConverterStream (AudioOutput &print)
 
 FormatConverterStream (AudioStream &stream)
 
 FormatConverterStream (Print &print)
 
 FormatConverterStream (Stream &stream)
 
virtual AudioInfo audioInfo () override
 
int available () override
 
int availableForWrite () override
 
virtual bool begin ()
 
bool begin (AudioInfo from, AudioInfo to)
 
bool begin (AudioInfo to)
 
virtual void end ()
 
virtual void flush () override
 
virtual PrintgetPrint ()
 
virtual StreamgetStream ()
 
 operator bool ()
 
size_t readBytes (uint8_t *data, size_t size) override
 
virtual size_t readSilence (uint8_t *buffer, size_t length)
 Source to generate silence: just sets the buffer to 0.
 
virtual void setAudioInfo (AudioInfo info) override
 
virtual void setNotifyAudioChange (AudioInfoSupport &bi) override
 
void setSourceAudioInfo (AudioInfo from)
 
void setStream (Print &print) override
 
void setStream (Stream &io) override
 
void setupReader ()
 
virtual bool validate (AudioInfo &info)
 
virtual size_t write (const uint8_t *data, size_t size) override
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

float byteFactor ()
 
virtual int not_supported (int out, const char *msg="")
 
void refillReadBuffer ()
 

Protected Attributes

ChannelFormatConverterStream channelFormatConverter
 
float factor
 
AudioInfo from_cfg
 
AudioInfo info
 
NumberFormatConverterStream numberFormatConverter
 
AudioInfoSupportp_notify =nullptr
 
Printp_print = nullptr
 
Streamp_stream = nullptr
 
TransformationReader< ReformatBaseStreamreader
 
ResampleStream sampleRateConverter
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
AudioInfo to_cfg
 

Detailed Description

Converter which converts bits_per_sample, channels and the sample_rate. The conversion is supported both on the input and output side.

Author
Phil Schatzmann

Member Function Documentation

◆ byteFactor()

float byteFactor ( )
inlineprotected

e.g if we do channels 2->1 we nead to double the input data

Returns

◆ setSourceAudioInfo()

void setSourceAudioInfo ( AudioInfo  from)
inline

Defines the audio info of the stream which has been defined in the constructor


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