Skip to content

Commit d1d249d

Browse files
committed
client.stop(9 in stopSong()
I2Snum in I2Sstart() and I2Sstop it no longer used reduce I2Sbuff
1 parent 0057bae commit d1d249d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/Audio.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
audio.cpp
44
55
Created on: Oct 28.2018 */char audioI2SVers[] ="\
6-
Version 3.1.0y ";
6+
Version 3.1.0z ";
77
/* Updated on: May 07.2025
88
99
Author: Wolle (schreibfaul1)
@@ -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 = 8; // number of DMA buffer
189+
m_i2s_chan_cfg.dma_desc_num = 4; // 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);
@@ -204,7 +204,7 @@ Audio::Audio(uint8_t i2sPort) {
204204
m_i2s_std_cfg.clk_cfg.clk_src = I2S_CLK_SRC_DEFAULT; // Select PLL_F160M as the default source clock
205205
m_i2s_std_cfg.clk_cfg.mclk_multiple = I2S_MCLK_MULTIPLE_128; // mclk = sample_rate * 256
206206
i2s_channel_init_std_mode(m_i2s_tx_handle, &m_i2s_std_cfg);
207-
I2Sstart(m_i2s_num);
207+
I2Sstart();
208208
m_sampleRate = 44100;
209209

210210
for(int i = 0; i < 3; i++) {
@@ -249,11 +249,11 @@ void Audio::initInBuff() {
249249
}
250250

251251
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
252-
esp_err_t Audio::I2Sstart(uint8_t i2s_num) {
252+
esp_err_t Audio::I2Sstart() {
253253
return i2s_channel_enable(m_i2s_tx_handle);
254254
}
255255

256-
esp_err_t Audio::I2Sstop(uint8_t i2s_num) {
256+
esp_err_t Audio::I2Sstop() {
257257
return i2s_channel_disable(m_i2s_tx_handle);
258258
}
259259
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -4887,9 +4887,9 @@ bool Audio::setPinout(uint8_t BCLK, uint8_t LRC, uint8_t DOUT, int8_t MCLK) {
48874887
gpio_cfg.dout = (gpio_num_t)DOUT;
48884888
gpio_cfg.mclk = (gpio_num_t)MCLK;
48894889
gpio_cfg.ws = (gpio_num_t)LRC;
4890-
I2Sstop(m_i2s_num);
4890+
I2Sstop();
48914891
result = i2s_channel_reconfig_std_gpio(m_i2s_tx_handle, &gpio_cfg);
4892-
I2Sstart(m_i2s_num);
4892+
I2Sstart();
48934893

48944894
return (result == ESP_OK);
48954895
}
@@ -5026,7 +5026,7 @@ uint8_t Audio::getChannels() {
50265026
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
50275027
void Audio::reconfigI2S(){
50285028

5029-
I2Sstop(0);
5029+
I2Sstop();
50305030

50315031
if(getBitsPerSample() == 8 && getChannels() == 2) m_i2s_std_cfg.clk_cfg.sample_rate_hz = getSampleRate() * 2;
50325032
else m_i2s_std_cfg.clk_cfg.sample_rate_hz = getSampleRate();
@@ -5039,7 +5039,7 @@ void Audio::reconfigI2S(){
50395039
i2s_channel_reconfig_std_clock(m_i2s_tx_handle, &m_i2s_std_cfg.clk_cfg);
50405040
i2s_channel_reconfig_std_slot(m_i2s_tx_handle, &m_i2s_std_cfg.slot_cfg);
50415041

5042-
I2Sstart(m_i2s_num);
5042+
I2Sstart();
50435043

50445044
memset(m_filterBuff, 0, sizeof(m_filterBuff)); // Clear FilterBuffer
50455045
IIR_calculateCoefficients(m_gain0, m_gain1, m_gain2); // must be recalculated after each samplerate change

src/Audio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ class Audio : private AudioBuffer{
241241
bool parseContentType(char* ct);
242242
bool parseHttpResponseHeader();
243243
bool initializeDecoder(uint8_t codec);
244-
esp_err_t I2Sstart(uint8_t i2s_num);
245-
esp_err_t I2Sstop(uint8_t i2s_num);
244+
esp_err_t I2Sstart();
245+
esp_err_t I2Sstop();
246246
void IIR_filterChain0(int16_t iir_in[2], bool clear = false);
247247
void IIR_filterChain1(int16_t iir_in[2], bool clear = false);
248248
void IIR_filterChain2(int16_t iir_in[2], bool clear = false);

0 commit comments

Comments
 (0)