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

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

#include <AudioKit.h>

Inheritance diagram for audio_tools::AudioKitStream:
audio_tools::AudioStreamX audio_tools::AudioStream Stream audio_tools::AudioBaseInfoDependent audio_tools::AudioBaseInfoSource 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...
 
AudioActionsaudioActions ()
 Provides access to the AudioActions.
 
int available ()
 We get the data via I2S - we expect to fill one buffer size. More...
 
bool begin () override
 
bool begin (AudioKitStreamConfig config)
 Starts the processing.
 
AudioKitStreamConfig config ()
 
AudioKitStreamConfig defaultConfig (RxTxMode mode=RXTX_MODE)
 Provides the default configuration.
 
void end () override
 Stops the processing. More...
 
void incrementVolume (int vol)
 Relative volume control. More...
 
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. More...
 
virtual size_t readBytes (uint8_t *data, size_t length) override
 Reads the audio data. More...
 
bool setActive (bool active)
 Sets the codec active / inactive.
 
virtual void setAudioInfo (AudioBaseInfo info)
 
bool setMute (bool mute)
 Mutes the output.
 
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.
 
virtual size_t write (const uint8_t *buffer, size_t size) override
 
- Public Member Functions inherited from audio_tools::AudioStreamX
virtual int available () override
 
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 ()
 
 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)=0
 
virtual void setAudioInfo (AudioBaseInfo info)
 
virtual void setNotifyAudioChange (AudioBaseInfoDependent &bi)
 
virtual size_t write (const uint8_t *buffer, size_t size)=0
 
- Public Member Functions inherited from Stream
virtual int available ()=0
 
bool find (char target)
 
bool find (const char *target)
 
bool find (const char *target, size_t length)
 
bool find (const uint8_t *target)
 
bool find (const uint8_t *target, size_t length)
 
bool findUntil (const char *target, const char *terminator)
 
bool findUntil (const char *target, size_t targetLen, const char *terminate, size_t termLen)
 
bool findUntil (const uint8_t *target, const char *terminator)
 
bool findUntil (const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen)
 
unsigned long getTimeout (void)
 
float parseFloat (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
long parseInt (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR)
 
virtual int peek ()=0
 
virtual int read ()=0
 
size_t readBytes (char *buffer, size_t length)
 
size_t readBytes (uint8_t *buffer, size_t length)
 
size_t readBytesUntil (char terminator, char *buffer, size_t length)
 
size_t readBytesUntil (char terminator, uint8_t *buffer, size_t length)
 
String readString ()
 
String readStringUntil (char terminator)
 
void setTimeout (unsigned long timeout)
 
- Public Member Functions inherited from Print
virtual int availableForWrite ()
 
void clearWriteError ()
 
virtual void flush ()
 
int getWriteError ()
 
size_t print (char)
 
size_t print (const __FlashStringHelper *)
 
size_t print (const char[])
 
size_t print (const Printable &)
 
size_t print (const String &)
 
size_t print (double, int=2)
 
size_t print (int, int=DEC)
 
size_t print (long long, int=DEC)
 
size_t print (long, int=DEC)
 
size_t print (unsigned char, int=DEC)
 
size_t print (unsigned int, int=DEC)
 
size_t print (unsigned long long, int=DEC)
 
size_t print (unsigned long, int=DEC)
 
size_t println (char)
 
size_t println (const __FlashStringHelper *)
 
size_t println (const char[])
 
size_t println (const Printable &)
 
size_t println (const String &s)
 
size_t println (double, int=2)
 
size_t println (int, int=DEC)
 
size_t println (long long, int=DEC)
 
size_t println (long, int=DEC)
 
size_t println (unsigned char, int=DEC)
 
size_t println (unsigned int, int=DEC)
 
size_t println (unsigned long long, int=DEC)
 
size_t println (unsigned long, int=DEC)
 
size_t println (void)
 
size_t write (const char *buffer, size_t size)
 
size_t write (const char *str)
 
virtual size_t write (const uint8_t *buffer, size_t size)
 
virtual size_t write (uint8_t)=0
 
- 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
 

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. More...
 
static void actionStartStop (bool, int, void *)
 Toggle start stop. More...
 
static void actionStop (bool, int, void *)
 Stop. More...
 
static void actionVolumeDown (bool, int, void *)
 Decrease the volume. More...
 
static void actionVolumeUp (bool, int, void *)
 Increase the volume. More...
 

Protected Member Functions

AudioActions::ActiveLogic getActionLogic (int pin)
 Determines the action logic (ActiveLow or ActiveTouch) for the pin.
 
void setupActions ()
 Setup the supported default actions.
 
- Protected Member Functions inherited from audio_tools::AudioStream
virtual int not_supported (int out)
 
- Protected Member Functions inherited from Stream
int findMulti (struct MultiTarget *targets, int tCount)
 
float parseFloat (char ignore)
 
long parseInt (char ignore)
 
int peekNextDigit (LookaheadMode lookahead, bool detectDecimal)
 
int timedPeek ()
 
int timedRead ()
 
- Protected Member Functions inherited from Print
void setWriteError (int err=1)
 

Protected Attributes

AudioActions actions
 
bool active = true
 
AudioKitStreamConfig cfg
 
ChannelFormatConverterStream converter {kit_stream}
 
bool is_started = false
 
AudioKit kit
 
AudioKitStreamAdapter kit_stream {&kit}
 
int volume_value = 40
 
- Protected Attributes inherited from audio_tools::AudioStream
AudioBaseInfo info
 
AudioBaseInfoDependentp_notify =nullptr
 
- Protected Attributes inherited from Stream
unsigned long _startMillis
 
unsigned long _timeout
 

Detailed Description

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

Author
Phil Schatzmann

Member Function Documentation

◆ actionStart()

static void audio_tools::AudioKitStream::actionStart ( bool  ,
int  ,
void *   
)
inlinestatic

Start.

◆ actionStartStop()

static void audio_tools::AudioKitStream::actionStartStop ( bool  ,
int  ,
void *   
)
inlinestatic

Toggle start stop.

◆ actionStop()

static void audio_tools::AudioKitStream::actionStop ( bool  ,
int  ,
void *   
)
inlinestatic

Stop.

◆ actionVolumeDown()

static void audio_tools::AudioKitStream::actionVolumeDown ( bool  ,
int  ,
void *   
)
inlinestatic

Decrease the volume.

◆ actionVolumeUp()

static void audio_tools::AudioKitStream::actionVolumeUp ( bool  ,
int  ,
void *   
)
inlinestatic

Increase the volume.

◆ addAction() [1/2]

void audio_tools::AudioKitStream::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 audio_tools::AudioKitStream::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

◆ available()

int audio_tools::AudioKitStream::available ( )
inlinevirtual

We get the data via I2S - we expect to fill one buffer size.

Reimplemented from audio_tools::AudioStreamX.

◆ begin()

bool audio_tools::AudioKitStream::begin ( )
inlineoverridevirtual

Reimplemented from audio_tools::AudioStream.

◆ end()

void audio_tools::AudioKitStream::end ( )
inlineoverridevirtual

Stops the processing.

Reimplemented from audio_tools::AudioStream.

◆ incrementVolume()

void audio_tools::AudioKitStream::incrementVolume ( int  vol)
inline

Relative volume control.

Parameters
vol

◆ pinAdcDetect()

int8_t audio_tools::AudioKitStream::pinAdcDetect ( )
inline

Get the gpio number for adc detection.

Returns
-1 non-existent Others gpio number

◆ pinAuxin()

int8_t audio_tools::AudioKitStream::pinAuxin ( )
inline

Get the gpio number for auxin detection.

Returns
-1 non-existent Others gpio number

◆ pinBlueLed()

int8_t audio_tools::AudioKitStream::pinBlueLed ( )
inline

Get green led gpio number.

Returns
-1 non-existent Others gpio number

◆ pinEs7243Mclk()

int8_t audio_tools::AudioKitStream::pinEs7243Mclk ( )
inline

Get the mclk gpio number of es7243.

Returns
-1 non-existent Others gpio number

◆ pinGreenLed()

int8_t audio_tools::AudioKitStream::pinGreenLed ( )
inline

Get DSP reset gpio number.

Returns
-1 non-existent Others gpio number

◆ pinHeadphoneDetect()

int8_t audio_tools::AudioKitStream::pinHeadphoneDetect ( )
inline

Get the gpio number for headphone detection.

Returns
-1 non-existent Others gpio number

◆ pinInputMode()

int8_t audio_tools::AudioKitStream::pinInputMode ( )
inline

Get the number for mode-button.

Returns
-1 non-existent Others number

◆ pinInputPlay()

int8_t audio_tools::AudioKitStream::pinInputPlay ( )
inline

Get number for play function.

Returns
-1 non-existent Others number

◆ pinInputRec()

int8_t audio_tools::AudioKitStream::pinInputRec ( )
inline

Get the record-button id for adc-button.

Returns
-1 non-existent Others button id

◆ pinInputSet()

int8_t audio_tools::AudioKitStream::pinInputSet ( )
inline

Get number for set function.

Returns
-1 non-existent Others number

◆ pinPaEnable()

int8_t audio_tools::AudioKitStream::pinPaEnable ( )
inline

Get the gpio number for PA enable.

Returns
-1 non-existent Others gpio number

◆ pinResetBoard()

int8_t audio_tools::AudioKitStream::pinResetBoard ( )
inline

Get DSP reset gpio number.

Returns
-1 non-existent Others gpio number

◆ pinResetCodec()

int8_t audio_tools::AudioKitStream::pinResetCodec ( )
inline

Get green led gpio number.

Returns
-1 non-existent Others gpio number

◆ pinVolumeDown()

int8_t audio_tools::AudioKitStream::pinVolumeDown ( )
inline

Get number for volume down function.

Returns
-1 non-existent Others number

◆ pinVolumeUp()

int8_t audio_tools::AudioKitStream::pinVolumeUp ( )
inline

number for volume up function

Returns
-1 non-existent Others number

◆ processActions()

void audio_tools::AudioKitStream::processActions ( )
inline

Process input keys and pins.

◆ readBytes()

virtual size_t audio_tools::AudioKitStream::readBytes ( uint8_t *  data,
size_t  length 
)
inlineoverridevirtual

Reads the audio data.

Reimplemented from audio_tools::AudioStreamX.

◆ setAudioInfo()

virtual void audio_tools::AudioKitStream::setAudioInfo ( AudioBaseInfo  info)
inlinevirtual

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

Reimplemented from audio_tools::AudioStream.

◆ write()

virtual size_t audio_tools::AudioKitStream::write ( const uint8_t *  buffer,
size_t  size 
)
inlineoverridevirtual

Reimplemented from audio_tools::AudioStreamX.


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