No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
audio_tools::AnalogAudioStream Class Reference

Reading Analog Data using a timer and the Arduino analogRead() method. More...

#include <AnalogAudioArduino.h>

Inheritance diagram for audio_tools::AnalogAudioStream:
audio_tools::AudioStreamX audio_tools::AudioStreamX audio_tools::AudioStream audio_tools::AudioStream audio_tools::Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource audio_tools::Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource audio_tools::Print audio_tools::Print

Public Member Functions

 AnalogAudioStream ()
 Default constructor.
 ~AnalogAudioStream ()
virtual int available ()
virtual int available () override
bool begin () override
 Reopen with last config. More...
bool begin (AnalogConfig cfg)
bool begin (AnalogConfig cfg)
 starts the DAC
AnalogConfigconfig ()
AnalogConfig defaultConfig (RxTxMode mode=RX_MODE)
AnalogConfig defaultConfig (RxTxMode mode=TX_MODE)
 Provides the default configuration.
void end () override
 stops the I2S and unistalls the driver More...
size_t read (int16_t(*src)[2], size_t sizeFrames)
 Reads data from I2S.
size_t readBytes (uint8_t *dest, size_t size_bytes) override
size_t readBytes (uint8_t *values, size_t len)
 Provides the sampled audio data. More...
void setAudioInfo (AudioBaseInfo info)
virtual void setAudioInfo (AudioBaseInfo info)
 updates the sample rate dynamically More...
void setMaxSampleRate ()
 Overides the sample rate and uses the max value which is around ~13MHz. Call this methd after begin();.
virtual size_t write (const uint8_t *src, size_t size_bytes) override
 writes the data to the I2S interface More...
- Public Member Functions inherited from audio_tools::AudioStreamX
 AudioStreamX (AudioStreamX const &)=delete
virtual int available () override
AudioStreamXoperator= (AudioStreamX const &)=delete
virtual int peek () override
virtual int read () override
virtual size_t readBytes (uint8_t *buffer, size_t length) override
virtual size_t write (const uint8_t *buffer, size_t size) override
virtual size_t write (uint8_t) override
- Public Member Functions inherited from audio_tools::AudioStream
 AudioStream (AudioStream const &)=delete
virtual AudioBaseInfo audioInfo () override
virtual int availableForWrite () override
virtual bool begin ()
virtual void end ()
virtual void flush () override
 operator bool ()
AudioStreamoperator= (AudioStream const &)=delete
virtual size_t readBytes (char *buffer, size_t length)
virtual size_t readBytes (uint8_t *buffer, size_t length) STREAM_WRITE_OVERRIDE=0
virtual void setAudioInfo (AudioBaseInfo info) override
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi) override
virtual StreamtoStreamPointer ()
virtual size_t write (const uint8_t *buffer, size_t size) override=0
- Public Member Functions inherited from audio_tools::Stream
virtual int available ()
virtual int peek ()
virtual int read ()
virtual size_t readBytes (uint8_t *buffer, size_t len)
virtual void setTimeout (size_t t)
- Public Member Functions inherited from audio_tools::Print
virtual int availableForWrite ()
virtual void flush ()
virtual int print (char c, PrintCharFmt spec)
virtual int print (const char *msg)
virtual int print (int number)
virtual int println (const char *msg="")
virtual size_t write (const char *buffer, size_t size)
virtual size_t write (const char *str)
virtual size_t write (const uint8_t *buffer, size_t size)
virtual size_t write (uint8_t ch)
- Public Member Functions inherited from audio_tools::AudioBaseInfoDependent
virtual AudioBaseInfo audioInfo ()=0
virtual void setAudioInfo (AudioBaseInfo info)=0
virtual bool validate (AudioBaseInfo &info)
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)=0

Protected Member Functions

size_t outputMono (const void *src, size_t size_bytes)
size_t outputStereo (const void *src, size_t size_bytes)
void setupPins ()
 pinmode input for defined analog pins
- Protected Member Functions inherited from audio_tools::AudioStream
virtual int not_supported (int out)

Static Protected Member Functions

static void callback (void *arg)
 Sample data and write to buffer.

Protected Attributes

bool active = false
AnalogConfig adc_config
int16_t avg_value =0
BaseBuffer< int16_t > * buffer = nullptr
AnalogConfig config
bool is_driver_installed = false
i2s_port_t port_no
size_t result =0
TimerAlarmRepeating timer
- Protected Attributes inherited from audio_tools::AudioStream
AudioBaseInfo info
AudioBaseInfoDependentp_notify =nullptr

Detailed Description

Reading Analog Data using a timer and the Arduino analogRead() method.

A very fast ADC and DAC using the ESP32 I2S interface.

Phil Schatzmann

Member Function Documentation

◆ available() [1/2]

virtual int audio_tools::AnalogAudioStream::available ( )

Reimplemented from audio_tools::AudioStreamX.

◆ available() [2/2]

virtual int audio_tools::AnalogAudioStream::available ( )

Reimplemented from audio_tools::AudioStreamX.

◆ begin()

bool audio_tools::AnalogAudioStream::begin ( )

Reopen with last config.

Reimplemented from audio_tools::AudioStream.

◆ end()

void audio_tools::AnalogAudioStream::end ( )

stops the I2S and unistalls the driver

Reimplemented from audio_tools::AudioStream.

◆ readBytes() [1/2]

size_t audio_tools::AnalogAudioStream::readBytes ( uint8_t *  dest,
size_t  size_bytes 

Reimplemented from audio_tools::AudioStreamX.

◆ readBytes() [2/2]

size_t audio_tools::AnalogAudioStream::readBytes ( uint8_t *  values,
size_t  len 

Provides the sampled audio data.

Reimplemented from audio_tools::AudioStreamX.

◆ setAudioInfo() [1/2]

void audio_tools::AnalogAudioStream::setAudioInfo ( AudioBaseInfo  info)

Reimplemented from audio_tools::AudioStream.

◆ setAudioInfo() [2/2]

virtual void audio_tools::AnalogAudioStream::setAudioInfo ( AudioBaseInfo  info)

updates the sample rate dynamically

Reimplemented from audio_tools::AudioStream.

◆ write()

virtual size_t audio_tools::AnalogAudioStream::write ( const uint8_t *  src,
size_t  size_bytes 

writes the data to the I2S interface

Reimplemented from audio_tools::AudioStreamX.

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