Unverified Commit f0f5e83a authored by Wolle's avatar Wolle Committed by GitHub

new function inBufferSize()

and some compiler warnings [-Wmissing-field-initializers] suppressed
support Arduino Version 2.0.8 or higher incl. V30.0-alpha2
parent e74cb584
......@@ -5,8 +5,8 @@
*
* Created on: Oct 26.2018
*
* Version 3.0.7q
* Updated on: Nov 26.2023
* Version 3.0.7r
* Updated on: Dec 01.2023
* Author: Wolle (schreibfaul1)
*
*/
......@@ -35,6 +35,10 @@ void AudioBuffer::setBufsize(int ram, int psram) {
if(psram > -1) m_buffSizePSRAM = psram;
}
int32_t AudioBuffer::getBufsize(){
return m_buffSize;
}
size_t AudioBuffer::init() {
if(m_buffer) free(m_buffer);
m_buffer = NULL;
......@@ -4515,6 +4519,15 @@ void Audio::printDecodeError(int r) {
//---------------------------------------------------------------------------------------------------------------------
bool Audio::setPinout(uint8_t BCLK, uint8_t LRC, uint8_t DOUT, int8_t MCLK) {
esp_err_t result = ESP_OK;
#if(ESP_ARDUINO_VERSION_MAJOR < 2)
log_e("Arduino Version too old!");
#endif
#if(ESP_ARDUINO_VERSION_MAJOR == 2 && ESP_ARDUINO_VERSION_PATCH < 8)
log_e("Arduino Version must be 2.0.8 or higher!");
#endif
#if(ESP_IDF_VERSION_MAJOR == 5)
i2s_std_gpio_config_t gpio_cfg = {};
gpio_cfg.bclk = (gpio_num_t)BCLK;
......@@ -4943,6 +4956,11 @@ uint32_t Audio::inBufferFree() {
return InBuff.freeSpace();
}
//---------------------------------------------------------------------------------------------------------------------
uint32_t Audio::inBufferSize() {
// current audio input buffer size in bytes
return InBuff.getBufsize();
}
//---------------------------------------------------------------------------------------------------------------------
// *** D i g i t a l b i q u a d r a t i c f i l t e r ***
//---------------------------------------------------------------------------------------------------------------------
void Audio::IIR_calculateCoefficients(int8_t G0, int8_t G1, int8_t G2) { // Infinite Impulse Response (IIR) filters
......
......@@ -3,8 +3,8 @@
*
* Created on: Oct 28,2018
*
* Version 3.0.7q
* Updated on: Nov 26.2023
* Version 3.0.7r
* Updated on: Dec 01.2023
* Author: Wolle (schreibfaul1)
*/
......@@ -89,6 +89,7 @@ public:
size_t init(); // set default values
bool isInitialized() { return m_f_init; };
void setBufsize(int ram, int psram);
int32_t getBufsize();
void changeMaxBlockSize(uint16_t mbs); // is default 1600 for mp3 and aac, set 16384 for FLAC
uint16_t getMaxBlockSize(); // returns maxBlockSize
size_t freeSpace(); // number of free bytes to overwrite
......@@ -169,6 +170,7 @@ public:
uint32_t inBufferFilled(); // returns the number of stored bytes in the inputbuffer
uint32_t inBufferFree(); // returns the number of free bytes in the inputbuffer
uint32_t inBufferSize(); // returns the size of the inputbuffer in bytes
void setTone(int8_t gainLowPass, int8_t gainBandPass, int8_t gainHighPass);
void setI2SCommFMT_LSB(bool commFMT);
int getCodec() {return m_codec;}
......@@ -455,14 +457,19 @@ private:
WiFiClientSecure clientsecure; // @suppress("Abstract class cannot be instantiated")
WiFiClient* _client = nullptr;
SemaphoreHandle_t mutex_audio;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#if ESP_IDF_VERSION_MAJOR == 5
i2s_chan_handle_t m_i2s_tx_handle = {};
i2s_chan_config_t m_i2s_chan_cfg = {}; // stores I2S channel values
i2s_std_config_t m_i2s_std_cfg = {}; // stores I2S driver values
#else
i2s_config_t m_i2s_config = {}; // stores values for I2S driver
i2s_pin_config_t m_pin_config = {0};
i2s_config_t m_i2s_config = {};
i2s_pin_config_t m_pin_config = {};
#endif
#pragma GCC diagnostic pop
std::vector<char*> m_playlistContent; // m3u8 playlist buffer
std::vector<char*> m_playlistURL; // m3u8 streamURLs buffer
std::vector<uint32_t> m_hashQueue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment