arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
AudioBoardStream Class Reference

New functionality which replaces the AudioKitStream that is based on the legacy AudioKit library. This functionality uses the new arduino-audio-driver library! It is the same as I2SCodecStream extended by some AudioActions and some method calls to determine defined pin values. See https://github.com/pschatzmann/arduino-audio-driver. More...

#include <AudioBoardStream.h>

Inheritance diagram for AudioBoardStream:
Inheritance graph
[legend]
Collaboration diagram for AudioBoardStream:
Collaboration graph
[legend]

Public Member Functions

 AudioBoardStream (audio_driver::AudioBoard &board)
 Default constructor: for available AudioBoard values check the audioboard variables in https://pschatzmann.github.io/arduino-audio-driver/html/group__audio__driver.html Further information can be found in https://github.com/pschatzmann/arduino-audio-driver/wiki.
 
float actionVolumeIncrementValue ()
 
void addAction (AudioDriverKey key, void(*action)(bool, digital_pin_t, void *), void *ref=nullptr)
 Defines a new action that is executed when the Button is pressed.
 
void addAction (AudioDriverKey key, void(*actionOn)(bool, digital_pin_t, void *), void(*actionOff)(bool, digital_pin_t, void *), void *ref=nullptr)
 Defines a new action that is executed when the Button is pressed and released.
 
void addAction (digital_pin_t pin, void(*action)(bool, digital_pin_t, void *), AudioActions::ActiveLogic activeLogic, void *ref=nullptr)
 Defines a new action that is executed when the indicated pin is active.
 
void addAction (digital_pin_t pin, void(*action)(bool, digital_pin_t, void *), void *ref=nullptr)
 Defines a new action that is executed when the indicated pin is active.
 
void addDefaultActions ()
 Setup the supported default actions (volume, start/stop, headphone detection)
 
void addHeadphoneDetectionAction ()
 Adds headphone determination.
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
void addStartStopAction ()
 add start/stop on inputMode
 
void addVolumeActions ()
 add volume up and volume down action
 
AudioActions & audioActions ()
 Provides access to the AudioActions.
 
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 
virtual int available () override
 Provides the available audio data.
 
virtual int availableForWrite () override
 Provides the available audio data.
 
bool begin () override
 
bool begin (I2SCodecConfig cfg) override
 Starts the I2S interface.
 
bool begin (MiniAudioConfig info)
 
AudioBoard & board ()
 Provides the board.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
I2SCodecConfig defaultConfig (RxTxMode mode=TX_MODE)
 
I2SCodecConfig defaultConfig (RxTxMode mode=TX_MODE)
 Provides the default configuration.
 
bool digitalRead (digital_pin_t pin)
 get value of digital pin
 
void digitalWrite (digital_pin_t pin, bool value)
 set value of digital pin
 
I2SDriverBase * driver ()
 Provides the i2s driver.
 
void end ()
 Stops the I2S interface.
 
virtual void flush () override
 
AudioActions & getActions ()
 
digital_pin_t getKey (int pos)
 Provides the gpio for the indicated key pos.
 
digital_pin_t getPinID (PinFunction function)
 Provides the gpio for the indicated function.
 
digital_pin_t getPinID (PinFunction function, int pos)
 Provides the gpio for the indicated function.
 
DriverDeviceInfo & getPins ()
 Provides access to the pin information.
 
float getVolume ()
 
float getVolume ()
 legacy: same as volume()
 
bool hasBoard ()
 
bool hasBoard ()
 checks if a board has been defined
 
bool headphoneStatus ()
 Returns true if the headphone was detected.
 
void incrementVolume (float inc)
 Relative volume control.
 
bool isKeyPressed (int key)
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
bool isPlaying () const
 Check if playback is currently active.
 
virtual operator bool ()
 
digital_pin_t pinAuxin ()
 Get the gpio number for auxin detection.
 
digital_pin_t pinHeadphoneDetect ()
 Get the gpio number for headphone detection.
 
digital_pin_t pinInputMode ()
 Get the number for mode-button.
 
digital_pin_t pinInputPlay ()
 Get number for play function.
 
digital_pin_t pinInputRec ()
 Get the record-button id for adc-button.
 
digital_pin_t pinInputSet ()
 Get number for set function.
 
digital_pin_t pinLed (int idx)
 Get LED pin.
 
digital_pin_t pinPaEnable ()
 Get the gpio number for PA enable.
 
digital_pin_t pinVolumeDown ()
 Get number for volume down function.
 
digital_pin_t pinVolumeUp ()
 number for volume up function
 
void processActions ()
 Process input keys and pins.
 
virtual size_t readBytes (uint8_t *data, size_t len) override
 Reads the audio data.
 
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 restartPlayback ()
 Manually restart playback (useful after long delays)
 
void setActionVolumeIncrementValue (float value)
 Defines the increment value used by actionVolumeDown/actionVolumeUp.
 
void setActive (bool active)
 The oposite of setMute(): setActive(true) calls setMute(false)
 
virtual void setAudioInfo (AudioInfo info)
 updates the sample rate dynamically
 
void setBoard (AudioBoard &board)
 (re)defines the board
 
void setBoard (AudioBoard *board)
 (re)defines the board
 
template<class Board >
void setBoard (Board &board)
 
template<class Board >
void setBoard (Board *board)
 
bool setInputVolume (float vol)
 
bool setInputVolume (float vol)
 Sets the volume of the microphone (if available)
 
bool setMute (bool mute)
 
bool setMute (bool mute)
 Mute / unmote.
 
bool setMute (bool mute, int line)
 
bool setMute (bool mute, int line)
 Mute / unmute of an individual line (codec)
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
bool setPAPower (bool active)
 
bool setPAPower (bool active)
 Sets the output of the PA Power Pin.
 
void setSpeakerActive (bool active)
 the same as setPAPower()
 
void setUsePinInterrupt (bool active)
 Defines if we use pin interrupts for audio actions (default: false)
 
bool setVolume (float vol) override
 define the actual volume in the range of 0.0f to 1.0f
 
bool setVolume (float vol) override
 sets the volume (range 0.0f - 1.0f)
 
void setWriteBufferSize (int size)
 
void setWriteBufferSize (int size)
 
bool stopDevice ()
 
float volume () override
 Provides the actual volume (0.0f - 1.0f)
 
virtual size_t write (const uint8_t *data, size_t len)
 Writes the audio data to I2S.
 
size_t write (const uint8_t *data, size_t len) override
 Writes the samples with the volume applied.
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 Writes len bytes of silence (=0).
 

Static Public Member Functions

static void actionHeadphoneDetection (bool, digital_pin_t, void *ref)
 Switch off the PA if the headphone in plugged in and switch it on again if the headphone is unplugged. This method complies with the.
 
static void actionStart (bool, digital_pin_t, void *ref)
 Start.
 
static void actionStartStop (bool, digital_pin_t, void *ref)
 Toggle start stop.
 
static void actionStop (bool, digital_pin_t, void *ref)
 Stop.
 
static void actionVolumeDown (bool, digital_pin_t, void *ref)
 Decrease the volume.
 
static void actionVolumeUp (bool, digital_pin_t, void *ref)
 Increase the volume.
 

Protected Member Functions

bool begin1 ()
 
bool beginCodec (I2SCodecConfig info)
 
void doWait ()
 
AudioActions::ActiveLogic getActionLogic (digital_pin_t pin)
 Determines the action logic (ActiveLow or ActiveTouch) for the pin.
 
audio_driver_local::Optional< PinsI2S > getI2SPins ()
 
digital_pin_t getSdCsPin ()
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
 
void refillReadBuffer ()
 Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
 
void setupBuffers (int size=1200)
 
void setupI2SFunction ()
 if the cfg.i2s_function was not defined we determine the "correct" default value
 
void setupI2SPins ()
 We use the board pins if they are available.
 
sample_bits_t toCodecBits (int bits)
 
i2s_format_t toFormat (I2SFormat fmt)
 
samplerate_t toRate (int rate)
 

Static Protected Member Functions

static void data_callback (ma_device *pDevice, void *pOutput, const void *pInput, ma_uint32 frameCount)
 
static bool readPinCB (digital_pin_t pin, void *ref)
 

Protected Attributes

int _timeout = 10
 
int _timeout = 10
 
float action_increment_value = 0.02
 
AudioActions actions
 
bool active = true
 
Vector< int16_t > buffer
 
RingBuffer< uint8_t > buffer_in {0}
 
RingBuffer< uint8_t > buffer_out {0}
 
std::atomic< int > buffer_size {0}
 
I2SCodecConfig cfg
 
CodecConfig codec_cfg
 
MiniAudioConfig config
 
ma_device_config config_ma
 
ma_device device_ma
 
bool headphoneIsConnected = false
 
I2SStream i2s
 
AudioInfo info
 
AudioInfo info
 
bool is_active = false
 
std::atomic< bool > is_buffers_setup {false}
 
bool is_muted = false
 
bool is_notify_active = true
 
bool is_notify_active = true
 
std::atomic< bool > is_playing {false}
 
Vector< AudioInfoSupport * > notify_vector
 
Vector< AudioInfoSupport * > notify_vector
 
AudioBoard * p_board = nullptr
 
std::mutex read_mtx
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
float volume_value = 1.0f
 
int write_buffer_size = MAX_SINGLE_CHARS
 
int write_buffer_size = MAX_SINGLE_CHARS
 
std::mutex write_mtx
 

Detailed Description

New functionality which replaces the AudioKitStream that is based on the legacy AudioKit library. This functionality uses the new arduino-audio-driver library! It is the same as I2SCodecStream extended by some AudioActions and some method calls to determine defined pin values. See https://github.com/pschatzmann/arduino-audio-driver.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AudioBoardStream()

AudioBoardStream ( audio_driver::AudioBoard &  board)
inline

Default constructor: for available AudioBoard values check the audioboard variables in https://pschatzmann.github.io/arduino-audio-driver/html/group__audio__driver.html Further information can be found in https://github.com/pschatzmann/arduino-audio-driver/wiki.

Member Function Documentation

◆ actionHeadphoneDetection()

static void actionHeadphoneDetection ( bool  ,
digital_pin_t  ,
void *  ref 
)
inlinestatic

Switch off the PA if the headphone in plugged in and switch it on again if the headphone is unplugged. This method complies with the.

◆ actionStart()

static void actionStart ( bool  ,
digital_pin_t  ,
void *  ref 
)
inlinestatic

Start.

◆ actionStartStop()

static void actionStartStop ( bool  ,
digital_pin_t  ,
void *  ref 
)
inlinestatic

Toggle start stop.

◆ actionStop()

static void actionStop ( bool  ,
digital_pin_t  ,
void *  ref 
)
inlinestatic

Stop.

◆ actionVolumeDown()

static void actionVolumeDown ( bool  ,
digital_pin_t  ,
void *  ref 
)
inlinestatic

Decrease the volume.

◆ actionVolumeIncrementValue()

float actionVolumeIncrementValue ( )
inline

◆ actionVolumeUp()

static void actionVolumeUp ( bool  ,
digital_pin_t  ,
void *  ref 
)
inlinestatic

Increase the volume.

◆ addAction() [1/4]

void addAction ( AudioDriverKey  key,
void(*)(bool, digital_pin_t, void *)  action,
void *  ref = nullptr 
)
inline

Defines a new action that is executed when the Button is pressed.

◆ addAction() [2/4]

void addAction ( AudioDriverKey  key,
void(*)(bool, digital_pin_t, void *)  actionOn,
void(*)(bool, digital_pin_t, void *)  actionOff,
void *  ref = nullptr 
)
inline

Defines a new action that is executed when the Button is pressed and released.

◆ addAction() [3/4]

void addAction ( digital_pin_t  pin,
void(*)(bool, digital_pin_t, void *)  action,
AudioActions::ActiveLogic  activeLogic,
void *  ref = nullptr 
)
inline

Defines a new action that is executed when the indicated pin is active.

Parameters
pin
action
activeLogic
ref

◆ addAction() [4/4]

void addAction ( digital_pin_t  pin,
void(*)(bool, digital_pin_t, void *)  action,
void *  ref = nullptr 
)
inline

Defines a new action that is executed when the indicated pin is active.

Parameters
pin
action
ref

◆ addDefaultActions()

void addDefaultActions ( )
inline

Setup the supported default actions (volume, start/stop, headphone detection)

◆ addHeadphoneDetectionAction()

void addHeadphoneDetectionAction ( )
inline

Adds headphone determination.

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport &  bi)
inlinevirtualinherited

◆ addStartStopAction()

void addStartStopAction ( )
inline

add start/stop on inputMode

◆ addVolumeActions()

void addVolumeActions ( )
inline

add volume up and volume down action

◆ audioActions()

AudioActions & audioActions ( )
inline

Provides access to the AudioActions.

◆ audioInfo()

virtual AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ available()

virtual int available ( )
inlineoverridevirtualinherited

Provides the available audio data.

Reimplemented from BaseStream.

◆ availableForWrite()

virtual int availableForWrite ( )
inlineoverridevirtualinherited

Provides the available audio data.

Reimplemented from BaseStream.

◆ begin() [1/3]

bool begin ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ begin() [2/3]

bool begin ( I2SCodecConfig  cfg)
inlineoverridevirtual

Starts the I2S interface.

Reimplemented from I2SCodecStream.

◆ begin() [3/3]

bool begin ( MiniAudioConfig  info)
inlineinherited

◆ begin1()

bool begin1 ( )
inlineprotectedinherited

◆ beginCodec()

bool beginCodec ( I2SCodecConfig  info)
inlineprotectedinherited

◆ board()

AudioBoard & board ( )
inlineinherited

Provides the board.

◆ clearNotifyAudioChange()

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

Deletes all change notify subscriptions.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ data_callback()

static void data_callback ( ma_device *  pDevice,
void *  pOutput,
const void *  pInput,
ma_uint32  frameCount 
)
inlinestaticprotectedinherited

◆ defaultConfig() [1/2]

I2SCodecConfig defaultConfig ( RxTxMode  mode = TX_MODE)
inlineinherited

◆ defaultConfig() [2/2]

I2SCodecConfig defaultConfig ( RxTxMode  mode = TX_MODE)
inlineinherited

Provides the default configuration.

◆ digitalRead()

bool digitalRead ( digital_pin_t  pin)
inlineinherited

get value of digital pin

◆ digitalWrite()

void digitalWrite ( digital_pin_t  pin,
bool  value 
)
inlineinherited

set value of digital pin

◆ doWait()

void doWait ( )
inlineprotectedinherited

◆ driver()

I2SDriverBase * driver ( )
inlineinherited

Provides the i2s driver.

◆ end()

void end ( )
inlinevirtualinherited

Stops the I2S interface.

Reimplemented from BaseStream.

◆ flush()

virtual void flush ( )
inlineoverridevirtualinherited

◆ getActionLogic()

AudioActions::ActiveLogic getActionLogic ( digital_pin_t  pin)
inlineprotected

Determines the action logic (ActiveLow or ActiveTouch) for the pin.

◆ getActions()

AudioActions & getActions ( )
inline

◆ getI2SPins()

audio_driver_local::Optional< PinsI2S > getI2SPins ( )
inlineprotectedinherited

◆ getKey()

digital_pin_t getKey ( int  pos)
inlineinherited

Provides the gpio for the indicated key pos.

◆ getPinID() [1/2]

digital_pin_t getPinID ( PinFunction  function)
inlineinherited

Provides the gpio for the indicated function.

◆ getPinID() [2/2]

digital_pin_t getPinID ( PinFunction  function,
int  pos 
)
inlineinherited

Provides the gpio for the indicated function.

◆ getPins()

DriverDeviceInfo & getPins ( )
inlineinherited

Provides access to the pin information.

◆ getSdCsPin()

digital_pin_t getSdCsPin ( )
inlineprotected

◆ getVolume() [1/2]

float getVolume ( )
inlineinherited

◆ getVolume() [2/2]

float getVolume ( )
inlineinherited

legacy: same as volume()

◆ hasBoard() [1/2]

bool hasBoard ( )
inlineinherited

◆ hasBoard() [2/2]

bool hasBoard ( )
inlineinherited

checks if a board has been defined

◆ headphoneStatus()

bool headphoneStatus ( )
inline

Returns true if the headphone was detected.

Returns
true
false

◆ incrementVolume()

void incrementVolume ( float  inc)
inline

Relative volume control.

Parameters
vol

◆ isKeyPressed()

bool isKeyPressed ( int  key)
inline

◆ isNotifyActive() [1/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isNotifyActive() [2/2]

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isPlaying()

bool isPlaying ( ) const
inlineinherited

Check if playback is currently active.

◆ not_supported()

virtual int not_supported ( int  out,
const char *  msg = "" 
)
inlineprotectedvirtualinherited

◆ notifyAudioChange() [1/2]

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ notifyAudioChange() [2/2]

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ operator bool()

virtual operator bool ( )
inlinevirtualinherited

◆ pinAuxin()

digital_pin_t pinAuxin ( )
inline

Get the gpio number for auxin detection.

Returns
-1 non-existent Others gpio number

◆ pinHeadphoneDetect()

digital_pin_t pinHeadphoneDetect ( )
inline

Get the gpio number for headphone detection.

Returns
-1 non-existent Others gpio number

◆ pinInputMode()

digital_pin_t pinInputMode ( )
inline

Get the number for mode-button.

Returns
-1 non-existent Others number

◆ pinInputPlay()

digital_pin_t pinInputPlay ( )
inline

Get number for play function.

Returns
-1 non-existent Others number

◆ pinInputRec()

digital_pin_t pinInputRec ( )
inline

Get the record-button id for adc-button.

Returns
-1 non-existent Others button id

◆ pinInputSet()

digital_pin_t pinInputSet ( )
inline

Get number for set function.

Returns
-1 non-existent Others number

◆ pinLed()

digital_pin_t pinLed ( int  idx)
inline

Get LED pin.

Returns
-1 non-existent Others gpio number

◆ pinPaEnable()

digital_pin_t pinPaEnable ( )
inline

Get the gpio number for PA enable.

Returns
-1 non-existent Others gpio number

◆ pinVolumeDown()

digital_pin_t pinVolumeDown ( )
inline

Get number for volume down function.

Returns
-1 non-existent Others number

◆ pinVolumeUp()

digital_pin_t pinVolumeUp ( )
inline

number for volume up function

Returns
-1 non-existent Others number

◆ processActions()

void processActions ( )
inline

Process input keys and pins.

◆ readBytes()

virtual size_t readBytes ( uint8_t *  data,
size_t  len 
)
inlineoverridevirtualinherited

Reads the audio data.

Reimplemented from AudioStream.

◆ readPinCB()

static bool readPinCB ( digital_pin_t  pin,
void *  ref 
)
inlinestaticprotected

◆ readSilence()

virtual size_t readSilence ( uint8_t *  buffer,
size_t  length 
)
inlinevirtualinherited

Source to generate silence: just sets the buffer to 0.

◆ refillReadBuffer() [1/2]

void refillReadBuffer ( )
inlineprotectedinherited

Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()

◆ refillReadBuffer() [2/2]

void refillReadBuffer ( )
inlineprotectedinherited

Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()

◆ removeNotifyAudioChange()

virtual bool removeNotifyAudioChange ( AudioInfoSupport &  bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ restartPlayback()

void restartPlayback ( )
inlineinherited

Manually restart playback (useful after long delays)

◆ setActionVolumeIncrementValue()

void setActionVolumeIncrementValue ( float  value)
inline

Defines the increment value used by actionVolumeDown/actionVolumeUp.

◆ setActive()

void setActive ( bool  active)
inline

The oposite of setMute(): setActive(true) calls setMute(false)

◆ setAudioInfo()

virtual void setAudioInfo ( AudioInfo  info)
inlinevirtualinherited

updates the sample rate dynamically

Reimplemented from AudioStream.

◆ setBoard() [1/4]

void setBoard ( AudioBoard &  board)
inlineinherited

(re)defines the board

◆ setBoard() [2/4]

void setBoard ( AudioBoard *  board)
inlineinherited

(re)defines the board

◆ setBoard() [3/4]

template<class Board >
void setBoard ( Board &  board)
inlineinherited

◆ setBoard() [4/4]

template<class Board >
void setBoard ( Board *  board)
inlineinherited

◆ setInputVolume() [1/2]

bool setInputVolume ( float  vol)
inlineinherited

◆ setInputVolume() [2/2]

bool setInputVolume ( float  vol)
inlineinherited

Sets the volume of the microphone (if available)

◆ setMute() [1/4]

bool setMute ( bool  mute)
inlineinherited

◆ setMute() [2/4]

bool setMute ( bool  mute)
inlineinherited

Mute / unmote.

◆ setMute() [3/4]

bool setMute ( bool  mute,
int  line 
)
inlineinherited

◆ setMute() [4/4]

bool setMute ( bool  mute,
int  line 
)
inlineinherited

Mute / unmute of an individual line (codec)

◆ setNotifyActive() [1/2]

void setNotifyActive ( bool  flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active)

◆ setNotifyActive() [2/2]

void setNotifyActive ( bool  flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active)

◆ setPAPower() [1/2]

bool setPAPower ( bool  active)
inlineinherited

◆ setPAPower() [2/2]

bool setPAPower ( bool  active)
inlineinherited

Sets the output of the PA Power Pin.

◆ setSpeakerActive()

void setSpeakerActive ( bool  active)
inline

the same as setPAPower()

◆ setupBuffers()

void setupBuffers ( int  size = 1200)
inlineprotectedinherited

◆ setupI2SFunction()

void setupI2SFunction ( )
inlineprotectedinherited

if the cfg.i2s_function was not defined we determine the "correct" default value

◆ setupI2SPins()

void setupI2SPins ( )
inlineprotectedinherited

We use the board pins if they are available.

◆ setUsePinInterrupt()

void setUsePinInterrupt ( bool  active)
inline

Defines if we use pin interrupts for audio actions (default: false)

◆ setVolume() [1/2]

bool setVolume ( float  volume)
inlineoverridevirtualinherited

define the actual volume in the range of 0.0f to 1.0f

Reimplemented from VolumeSupport.

◆ setVolume() [2/2]

bool setVolume ( float  vol)
inlineoverridevirtualinherited

sets the volume (range 0.0f - 1.0f)

Reimplemented from VolumeSupport.

◆ setWriteBufferSize() [1/2]

void setWriteBufferSize ( int  size)
inlineinherited

◆ setWriteBufferSize() [2/2]

void setWriteBufferSize ( int  size)
inlineinherited

◆ stopDevice()

bool stopDevice ( )
inlineinherited

Stops and releases the device if it was started: returns true if it was active. Not done for a device that was never started: e.g. the destructor calls end() also if begin() was never called

◆ toCodecBits()

sample_bits_t toCodecBits ( int  bits)
inlineprotectedinherited

◆ toFormat()

i2s_format_t toFormat ( I2SFormat  fmt)
inlineprotectedinherited

◆ toRate()

samplerate_t toRate ( int  rate)
inlineprotectedinherited

◆ volume()

float volume ( )
inlineoverridevirtualinherited

Provides the actual volume (0.0f - 1.0f)

Reimplemented from VolumeSupport.

◆ write() [1/3]

virtual size_t write ( const uint8_t *  data,
size_t  len 
)
inlinevirtualinherited

Writes the audio data to I2S.

Reimplemented from AudioStream.

◆ write() [2/3]

size_t write ( const uint8_t *  data,
size_t  len 
)
inlineoverridevirtualinherited

Writes the samples with the volume applied.

Reimplemented from AudioStream.

◆ write() [3/3]

virtual size_t write ( uint8_t  ch)
inlineoverridevirtualinherited

◆ writeSilence()

virtual void writeSilence ( size_t  len)
inlinevirtualinherited

Writes len bytes of silence (=0).

Member Data Documentation

◆ _timeout [1/2]

int _timeout = 10
protectedinherited

◆ _timeout [2/2]

int _timeout = 10
protectedinherited

◆ action_increment_value

float action_increment_value = 0.02
protected

◆ actions

AudioActions actions
protected

◆ active

bool active = true
protected

◆ buffer

Vector<int16_t> buffer
protectedinherited

◆ buffer_in

RingBuffer<uint8_t> buffer_in {0}
protectedinherited

◆ buffer_out

RingBuffer<uint8_t> buffer_out {0}
protectedinherited

◆ buffer_size

std::atomic<int> buffer_size {0}
protectedinherited

◆ cfg

I2SCodecConfig cfg
protectedinherited

◆ codec_cfg

CodecConfig codec_cfg
protectedinherited

◆ config

MiniAudioConfig config
protectedinherited

◆ config_ma

ma_device_config config_ma
protectedinherited

◆ device_ma

ma_device device_ma
protectedinherited

◆ headphoneIsConnected

bool headphoneIsConnected = false
protected

◆ i2s

I2SStream i2s
protectedinherited

◆ info [1/2]

AudioInfo info
protectedinherited

◆ info [2/2]

AudioInfo info
protectedinherited

◆ is_active

bool is_active = false
protectedinherited

◆ is_buffers_setup

std::atomic<bool> is_buffers_setup {false}
protectedinherited

◆ is_muted

bool is_muted = false
protectedinherited

◆ is_notify_active [1/2]

bool is_notify_active = true
protectedinherited

◆ is_notify_active [2/2]

bool is_notify_active = true
protectedinherited

◆ is_playing

std::atomic<bool> is_playing {false}
protectedinherited

◆ notify_vector [1/2]

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ notify_vector [2/2]

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ p_board

AudioBoard* p_board = nullptr
protectedinherited

◆ read_mtx

std::mutex read_mtx
protectedinherited

◆ tmp_in [1/2]

RingBuffer<uint8_t> tmp_in {0}
protectedinherited

◆ tmp_in [2/2]

RingBuffer<uint8_t> tmp_in {0}
protectedinherited

◆ tmp_out [1/2]

RingBuffer<uint8_t> tmp_out {0}
protectedinherited

◆ tmp_out [2/2]

RingBuffer<uint8_t> tmp_out {0}
protectedinherited

◆ volume_value

float volume_value = 1.0f
protectedinherited

◆ write_buffer_size [1/2]

int write_buffer_size = MAX_SINGLE_CHARS
protectedinherited

◆ write_buffer_size [2/2]

int write_buffer_size = MAX_SINGLE_CHARS
protectedinherited

◆ write_mtx

std::mutex write_mtx
protectedinherited

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