Skip to content

Commit e008d56

Browse files
committed
V3.2.0
1 parent d0721d5 commit e008d56

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/Audio.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
audio.cpp
44
55
Created on: Oct 28.2018 */char audioI2SVers[] ="\
6-
Version 3.1.0z ";
7-
/* Updated on: May 07.2025
6+
Version 3.2.0 ";
7+
/* Updated on: May 15.2025
88
99
Author: Wolle (schreibfaul1)
10-
Audio library for ESP32 or ESP32-S3
10+
Audio library for ESP32, ESP32-S3 or ESP32-P4
1111
Arduino Vers. V3 is mandatory
1212
external DAC is mandatory
1313
@@ -186,7 +186,7 @@ Audio::Audio(uint8_t i2sPort) {
186186
// -------- I2S configuration -------------------------------------------------------------------------------------------
187187
m_i2s_chan_cfg.id = (i2s_port_t)m_i2s_num; // I2S_NUM_AUTO, I2S_NUM_0, I2S_NUM_1
188188
m_i2s_chan_cfg.role = I2S_ROLE_MASTER; // I2S controller master role, bclk and lrc signal will be set to output
189-
m_i2s_chan_cfg.dma_desc_num = 4; // number of DMA buffer
189+
m_i2s_chan_cfg.dma_desc_num = 8; // number of DMA buffer
190190
m_i2s_chan_cfg.dma_frame_num = 1024; // I2S frame number in one DMA buffer.
191191
m_i2s_chan_cfg.auto_clear = true; // i2s will always send zero automatically if no data to send
192192
i2s_new_channel(&m_i2s_chan_cfg, &m_i2s_tx_handle, NULL);
@@ -250,13 +250,22 @@ void Audio::initInBuff() {
250250

251251
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
252252
esp_err_t Audio::I2Sstart() {
253+
zeroI2Sbuff();
253254
return i2s_channel_enable(m_i2s_tx_handle);
254255
}
255256

256257
esp_err_t Audio::I2Sstop() {
258+
memset(m_outBuff, 0, m_outbuffSize * sizeof(int16_t)); // Clear OutputBuffer
257259
return i2s_channel_disable(m_i2s_tx_handle);
258260
}
259261
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
262+
void Audio::zeroI2Sbuff(){
263+
uint8_t *buff = (uint8_t*)calloc(128, sizeof(uint8_t)); // From IDF V5 there is no longer the zero_dma_buff() function.
264+
size_t bytes_loaded = 0; // As a replacement, we write a small amount of zeros in the buffer and thus reset the entire buffer.
265+
i2s_channel_preload_data(m_i2s_tx_handle, buff, 128, &bytes_loaded);
266+
}
267+
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
268+
260269
void Audio::setDefaults() {
261270
stopSong();
262271
initInBuff(); // initialize InputBuffer if not already done

src/Audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ class Audio : private AudioBuffer{
243243
bool initializeDecoder(uint8_t codec);
244244
esp_err_t I2Sstart();
245245
esp_err_t I2Sstop();
246+
void zeroI2Sbuff();
246247
void IIR_filterChain0(int16_t iir_in[2], bool clear = false);
247248
void IIR_filterChain1(int16_t iir_in[2], bool clear = false);
248249
void IIR_filterChain2(int16_t iir_in[2], bool clear = false);

src/aac_decoder/libfaad/neaacdec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10822,7 +10822,7 @@ void ps_decorrelate(ps_info* ps, qmf_t X_left[38][64], qmf_t X_right[38][64], qm
1082210822
(void)temp_delay;
1082310823
uint8_t sb, maxsb;
1082410824
const complex_t* Phi_Fract_SubQmf;
10825-
uint8_t temp_delay_ser[NO_ALLPASS_LINKS];
10825+
uint8_t temp_delay_ser[NO_ALLPASS_LINKS] = {0};
1082610826
real_t P_SmoothPeakDecayDiffNrg, nrg;
1082710827
// real_t P[32][34];
1082810828
real_t (*P)[34] = (real_t (*)[34])faad_malloc(32 * sizeof(real_t[34]));

0 commit comments

Comments
 (0)