arduino-audio-tools
|
ESP32: A very fast ADC and DAC using the ESP32 I2S interface. For all other architectures we support reading of audio only using analog input with a timer. More...
#include <AnalogAudioStream.h>
Public Member Functions | |
AnalogAudioStream ()=default | |
Default constructor. | |
AnalogAudioStream (AnalogDriverBase &driver) | |
Constructor to define a custom driver. | |
virtual | ~AnalogAudioStream () |
Destructor. | |
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 | |
int | available () override |
int | availableForWrite () override |
bool | begin () override |
Reopen with last config. | |
bool | begin (AnalogConfig cfg) |
starts the DAC | |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
AnalogConfig & | config () |
AnalogConfig | defaultConfig (RxTxMode mode=TX_MODE) |
Provides the default configuration. | |
AnalogDriverBase * | driver () |
Provides access to the driver. | |
void | end () override |
stops the I2S and unistalls the analog | |
virtual void | flush () override |
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. | |
virtual void | setAudioInfo (AudioInfo info) |
updates the sample rate dynamically | |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
size_t | write (const uint8_t *data, size_t len) override |
ESP32 only: writes the data to the I2S interface. | |
virtual size_t | write (uint8_t ch) override |
virtual void | writeSilence (size_t len) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
virtual int | not_supported (int out, const char *msg="") |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
Protected Attributes | |
int | _timeout = 10 |
AnalogConfig | adc_config |
AnalogDriver | default_analog |
AudioInfo | info |
bool | is_notify_active = true |
Vector< AudioInfoSupport * > | notify_vector |
AnalogDriverBase * | p_analog = &default_analog |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
ESP32: A very fast ADC and DAC using the ESP32 I2S interface. For all other architectures we support reading of audio only using analog input with a timer.