RSeries astromech firmware
AudioPlayer Class Reference

#include <audio/AudioPlayer.h>

+ Inheritance diagram for AudioPlayer:
+ Collaboration diagram for AudioPlayer:

Public Member Functions

 AudioPlayer ()
 
 ~AudioPlayer ()
 
bool connecttoFS (fs::FS &fs, const char *file)
 
bool connecttoSD (const char *sdfile)
 
bool setFileLoop (bool input)
 
bool connecttohost (const char *host, const char *user="", const char *pwd="")
 
bool connecttospeech (const char *speech, const char *lang)
 
bool connecttonull ()
 
void loop ()
 
uint32_t getFileSize ()
 
uint32_t getFilePos ()
 
uint32_t getSampleRate ()
 
uint8_t getBitsPerSample ()
 
uint8_t getChannels ()
 
uint32_t getAudioFileDuration ()
 Get the audio file duration in seconds. More...
 
uint32_t getAudioCurrentTime ()
 Get the current plying time in seconds. More...
 
bool setFilePos (uint32_t pos)
 
bool audioFileSeek (const int8_t speed)
 audioFileSeek seeks the file in both directions More...
 
bool setPinout (uint8_t BCLK, uint8_t LRC, uint8_t DOUT, int8_t DIN=I2S_PIN_NO_CHANGE)
 
void stopSong ()
 
bool pauseResume ()
 pauseResume pauses current playback More...
 
void forceMono (bool m)
 
void setBalance (int8_t bal=0)
 
void setVolume (uint8_t vol)
 
uint8_t getVolume ()
 
uint8_t getDatamode ()
 
void setDatamode (uint8_t dm)
 
uint32_t streamavail ()
 
bool isRunning ()
 
bool isNullStream ()
 
bool isLocalFile ()
 
bool isWebStream ()
 
esp_err_t i2s_mclk_pin_select (const uint8_t pin)
 
uint32_t inBufferFilled ()
 
uint32_t inBufferFree ()
 
void setTone (uint8_t l_type=0, uint16_t l_freq=0, uint8_t r_type=0, uint16_t r_freq=0)
 
void setInternalDAC (bool internalDAC)
 
void setI2SCommFMT_LSB (bool commFMT)
 
void setSampleFilter (AudioSampleFilter filter)
 

Constructor & Destructor Documentation

◆ AudioPlayer()

AudioPlayer::AudioPlayer ( )

◆ ~AudioPlayer()

AudioPlayer::~AudioPlayer ( )

Member Function Documentation

◆ audioFileSeek()

bool AudioPlayer::audioFileSeek ( const int8_t  speed)

audioFileSeek seeks the file in both directions

Parameters
[in]speedspeed > 0 : fast-forward speed < 0 : fast-rewind
Returns
true if audio file active and speed is valid, otherwise false

◆ connecttoFS()

bool AudioPlayer::connecttoFS ( fs::FS &  fs,
const char *  file 
)

◆ connecttohost()

bool AudioPlayer::connecttohost ( const char *  host,
const char *  user = "",
const char *  pwd = "" 
)

◆ connecttonull()

bool AudioPlayer::connecttonull ( )

◆ connecttoSD()

bool AudioPlayer::connecttoSD ( const char *  sdfile)

◆ connecttospeech()

bool AudioPlayer::connecttospeech ( const char *  speech,
const char *  lang 
)

◆ forceMono()

void AudioPlayer::forceMono ( bool  m)

◆ getAudioCurrentTime()

uint32_t AudioPlayer::getAudioCurrentTime ( )

Get the current plying time in seconds.

Returns
uint32_t current second of audio file, 0 if no file active

◆ getAudioFileDuration()

uint32_t AudioPlayer::getAudioFileDuration ( )

Get the audio file duration in seconds.

Returns
uint32_t file duration in seconds, 0 if no file active

◆ getBitsPerSample()

uint8_t AudioPlayer::getBitsPerSample ( )

◆ getChannels()

uint8_t AudioPlayer::getChannels ( )

◆ getDatamode()

uint8_t AudioPlayer::getDatamode ( )
inline

◆ getFilePos()

uint32_t AudioPlayer::getFilePos ( )

◆ getFileSize()

uint32_t AudioPlayer::getFileSize ( )

◆ getSampleRate()

uint32_t AudioPlayer::getSampleRate ( )

◆ getVolume()

uint8_t AudioPlayer::getVolume ( )

◆ i2s_mclk_pin_select()

esp_err_t AudioPlayer::i2s_mclk_pin_select ( const uint8_t  pin)

◆ inBufferFilled()

uint32_t AudioPlayer::inBufferFilled ( )

◆ inBufferFree()

uint32_t AudioPlayer::inBufferFree ( )

◆ isLocalFile()

bool AudioPlayer::isLocalFile ( )
inline

◆ isNullStream()

bool AudioPlayer::isNullStream ( )
inline

◆ isRunning()

bool AudioPlayer::isRunning ( )
inline

◆ isWebStream()

bool AudioPlayer::isWebStream ( )
inline

◆ loop()

void AudioPlayer::loop ( )

◆ pauseResume()

bool AudioPlayer::pauseResume ( )

pauseResume pauses current playback

Returns
true if audio file or stream is active, false otherwise

◆ setBalance()

void AudioPlayer::setBalance ( int8_t  bal = 0)

◆ setDatamode()

void AudioPlayer::setDatamode ( uint8_t  dm)
inline

◆ setFileLoop()

bool AudioPlayer::setFileLoop ( bool  input)

◆ setFilePos()

bool AudioPlayer::setFilePos ( uint32_t  pos)

◆ setI2SCommFMT_LSB()

void AudioPlayer::setI2SCommFMT_LSB ( bool  commFMT)

◆ setInternalDAC()

void AudioPlayer::setInternalDAC ( bool  internalDAC)

◆ setPinout()

bool AudioPlayer::setPinout ( uint8_t  BCLK,
uint8_t  LRC,
uint8_t  DOUT,
int8_t  DIN = I2S_PIN_NO_CHANGE 
)

◆ setSampleFilter()

void AudioPlayer::setSampleFilter ( AudioSampleFilter  filter)
inline

◆ setTone()

void AudioPlayer::setTone ( uint8_t  l_type = 0,
uint16_t  l_freq = 0,
uint8_t  r_type = 0,
uint16_t  r_freq = 0 
)

◆ setVolume()

void AudioPlayer::setVolume ( uint8_t  vol)

◆ stopSong()

void AudioPlayer::stopSong ( )

◆ streamavail()

uint32_t AudioPlayer::streamavail ( )
inline

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