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

Stream for reading and writing audio data using the WM8960 Codec Chip You need to install https://github.com/pschatzmann/arduino-wm8960. More...

#include <WM8960Stream.h>

Inheritance diagram for WM8960Stream:
AudioStream Stream AudioInfoSupport AudioInfoSource 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
 
bool begin ()
 Starts with the default config or restarts.
 
bool begin (WM8960Config config)
 Starts with the indicated configuration.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
WM8960Config defaultConfig (RxTxMode mode=TX_MODE)
 
void end ()
 Stops the processing and releases the memory.
 
virtual void flush () override
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
 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 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 (WM8960Config c)
 defines the default configuration that is used with the next begin()
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
bool setVolume (float vol)
 Sets both input and output volume value (from 0 to 1.0)
 
void setVolumeIn (float vol)
 
void setVolumeOut (float vol)
 
float volumeIn ()
 provides the volume
 
float volumeOut ()
 
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

void adjustInputVolume (float vol)
 
bool configure_clocking ()
 
bool init (RxTxMode mode)
 
mtb_wm8960_mode_t modeMasterSlave (bool microcontroller_is_master)
 if microcontroller is master then module is slave
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 
mtb_wm8960_adc_dac_sample_rate_t sampleRate (int rate)
 
void setOutputVolume (float vol)
 
void volumeError (float vol)
 
mtb_wm8960_word_length_t wordLength (int bits)
 

Protected Attributes

int _timeout = 10
 
WM8960Config cfg
 
I2SStream i2s
 
AudioInfo info
 
bool is_notify_active = true
 
Vector< AudioInfoSupport * > notify_vector
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
float volume_in
 
float volume_out
 

Detailed Description

Stream for reading and writing audio data using the WM8960 Codec Chip You need to install https://github.com/pschatzmann/arduino-wm8960.

Author
Phil Schatzmann

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