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

AudioKit Stream which uses the https://github.com/pschatzmann/arduino-audiokit library. More...

#include <AudioKit.h>

Inheritance diagram for AudioKitStream:
AudioStream BaseStream AudioInfoSupport AudioInfoSource Stream Print

Public Member Functions

void addAction (int pin, void(*action)(bool, int, void *), AudioActions::ActiveLogic activeLogic, void *ref=nullptr)
 Defines a new action that is executed when the indicated pin is active. More...
 
void addAction (int pin, void(*action)(bool, int, void *), void *ref=nullptr)
 Defines a new action that is executed when the indicated pin is active. More...
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
AudioActionsaudioActions ()
 Provides access to the AudioActions.
 
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 ()
 We get the data via I2S - we expect to fill one buffer size.
 
virtual int availableForWrite () override
 
bool begin () override
 
bool begin (AudioKitStreamConfig config)
 Starts the processing.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
AudioKitStreamConfigconfig ()
 
AudioKitStreamConfig defaultConfig (RxTxMode mode=RXTX_MODE)
 Provides the default configuration.
 
void end () override
 Stops the processing.
 
virtual void flush () override
 
bool headphoneStatus ()
 Returns true if the headphone was detected. More...
 
void incrementVolume (int vol)
 Relative volume control. More...
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual operator bool ()
 
int8_t pinAdcDetect ()
 Get the gpio number for adc detection. More...
 
int8_t pinAuxin ()
 Get the gpio number for auxin detection. More...
 
int8_t pinBlueLed ()
 Get green led gpio number. More...
 
int8_t pinEs7243Mclk ()
 Get the mclk gpio number of es7243. More...
 
int8_t pinGreenLed ()
 Get DSP reset gpio number. More...
 
int8_t pinHeadphoneDetect ()
 Get the gpio number for headphone detection. More...
 
int8_t pinInputMode ()
 Get the number for mode-button. More...
 
int8_t pinInputPlay ()
 Get number for play function. More...
 
int8_t pinInputRec ()
 Get the record-button id for adc-button. More...
 
int8_t pinInputSet ()
 Get number for set function. More...
 
int8_t pinPaEnable ()
 Get the gpio number for PA enable. More...
 
int8_t pinResetBoard ()
 Get DSP reset gpio number. More...
 
int8_t pinResetCodec ()
 Get green led gpio number. More...
 
int8_t pinVolumeDown ()
 Get number for volume down function. More...
 
int8_t pinVolumeUp ()
 number for volume up function More...
 
void processActions ()
 Process input keys and pins.
 
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.
 
bool setActive (bool active)
 Sets the codec active / inactive.
 
void setAudioInfo (AudioInfo info) override
 
bool setMute (bool mute)
 Mutes the output.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
void setSpeakerActive (bool active)
 
bool setVolume (double vol)
 Defines the Volume: Range 0 to 1.0.
 
bool setVolume (float vol)
 Defines the Volume: Range 0 to 1.0.
 
bool setVolume (int vol)
 Defines the Volume: Range 0 to 100.
 
int volume ()
 Determines the volume.
 
size_t write (const uint8_t *data, size_t len) override
 
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, int, void *)
 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, int, void *)
 Start.
 
static void actionStartStop (bool, int, void *)
 Toggle start stop.
 
static void actionStop (bool, int, void *)
 Stop.
 
static void actionVolumeDown (bool, int, void *)
 Decrease the volume.
 
static void actionVolumeUp (bool, int, void *)
 Increase the volume.
 

Protected Member Functions

AudioActions::ActiveLogic getActionLogic (int pin)
 Determines the action logic (ActiveLow or ActiveTouch) for the pin.
 
virtual int not_supported (int out, const char *msg="")
 
void notifyAudioChange (AudioInfo info)
 
void refillReadBuffer ()
 
void setupActions ()
 Setup the supported default actions.
 

Protected Attributes

int _timeout = 10
 
AudioActions actions
 
bool active = true
 
AudioKitStreamConfig cfg = defaultConfig(RXTX_MODE)
 
I2SStream i2s_stream
 
AudioInfo info
 
bool is_notify_active = true
 
bool is_started = false
 
AudioKit kit
 
Vector< AudioInfoSupport * > notify_vector
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
int volume_value = 40
 

Detailed Description

AudioKit Stream which uses the https://github.com/pschatzmann/arduino-audiokit library.

Author
Phil Schatzmann

Member Function Documentation

◆ addAction() [1/2]

void addAction ( int  pin,
void(*)(bool, int, 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() [2/2]

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

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

Parameters
pin
action
ref

◆ headphoneStatus()

bool headphoneStatus ( )
inline

Returns true if the headphone was detected.

Returns

◆ incrementVolume()

void incrementVolume ( int  vol)
inline

Relative volume control.

Parameters
vol

◆ pinAdcDetect()

int8_t pinAdcDetect ( )
inline

Get the gpio number for adc detection.

Returns
-1 non-existent Others gpio number

◆ pinAuxin()

int8_t pinAuxin ( )
inline

Get the gpio number for auxin detection.

Returns
-1 non-existent Others gpio number

◆ pinBlueLed()

int8_t pinBlueLed ( )
inline

Get green led gpio number.

Returns
-1 non-existent Others gpio number

◆ pinEs7243Mclk()

int8_t pinEs7243Mclk ( )
inline

Get the mclk gpio number of es7243.

Returns
-1 non-existent Others gpio number

◆ pinGreenLed()

int8_t pinGreenLed ( )
inline

Get DSP reset gpio number.

Returns
-1 non-existent Others gpio number

◆ pinHeadphoneDetect()

int8_t pinHeadphoneDetect ( )
inline

Get the gpio number for headphone detection.

Returns
-1 non-existent Others gpio number

◆ pinInputMode()

int8_t pinInputMode ( )
inline

Get the number for mode-button.

Returns
-1 non-existent Others number

◆ pinInputPlay()

int8_t pinInputPlay ( )
inline

Get number for play function.

Returns
-1 non-existent Others number

◆ pinInputRec()

int8_t pinInputRec ( )
inline

Get the record-button id for adc-button.

Returns
-1 non-existent Others button id

◆ pinInputSet()

int8_t pinInputSet ( )
inline

Get number for set function.

Returns
-1 non-existent Others number

◆ pinPaEnable()

int8_t pinPaEnable ( )
inline

Get the gpio number for PA enable.

Returns
-1 non-existent Others gpio number

◆ pinResetBoard()

int8_t pinResetBoard ( )
inline

Get DSP reset gpio number.

Returns
-1 non-existent Others gpio number

◆ pinResetCodec()

int8_t pinResetCodec ( )
inline

Get green led gpio number.

Returns
-1 non-existent Others gpio number

◆ pinVolumeDown()

int8_t pinVolumeDown ( )
inline

Get number for volume down function.

Returns
-1 non-existent Others number

◆ pinVolumeUp()

int8_t pinVolumeUp ( )
inline

number for volume up function

Returns
-1 non-existent Others number

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  info)
inlineoverridevirtual

Update the audio info with new values: e.g. new sample_rate, bits_per_samples or channels.

Reimplemented from AudioStream.

◆ setSpeakerActive()

void setSpeakerActive ( bool  active)
inline

Activates/Deactives the speaker

Parameters
active

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