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

VS1053 Output Interface which processes PCM data by default. If you want to write encoded data set is_encoded_data = true in the configuration;. More...

#include <VS1053Stream.h>

Inheritance diagram for VS1053Stream:
AudioStream VolumeSupport BaseStream AudioInfoSupport AudioInfoSource Stream Print

Public Member Functions

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 ()
 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
 
float balance ()
 Get the currenet balance setting (-1.0..1.0)
 
bool begin ()
 Starts with the default config or restarts.
 
bool begin (VS1053Config cfg)
 Starts with the indicated configuration.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
VS1053Config defaultConfig (RxTxMode mode=TX_MODE)
 
void end ()
 Stops the processing and releases the memory.
 
virtual void flush () override
 
VS1053 & getVS1053 ()
 returns the VS1053 object
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual operator bool ()
 
virtual 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 c)
 Defines the input AudioInfo.
 
void setAudioInfo (VS1053Config c)
 defines the default configuration that is used with the next begin()
 
void setBalance (float bal)
 Adjusting the left and right volume balance, higher to enhance the right side, lower to enhance the left side.
 
bool setEncoder (AudioEncoder *enc)
 Defines an alternative encoder that will be used (e.g. MP3Encoder). It must be allocated on the heap!
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
bool setVolume (float vol) override
 value from 0 to 1.0
 
float volume () override
 provides the volume
 
virtual size_t write (const uint8_t *data, size_t len) override
 Write audio data.
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Protected Member Functions

bool beginTx ()
 
void logError (const char *str)
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 

Protected Attributes

int _timeout = 10
 
VS1053Config cfg
 
CopyEncoder copy
 
AudioInfo info
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
AudioEncoderp_encoder = new WAVEncoder()
 
EncodedAudioStreamp_out = nullptr
 
VS1053 * p_vs1053 = nullptr
 
VS1053StreamOut * p_vs1053_out = nullptr
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
float volume_value = 1.0f
 

Detailed Description

VS1053 Output Interface which processes PCM data by default. If you want to write encoded data set is_encoded_data = true in the configuration;.

Author
Phil Schatzmann

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