Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
691a12fa
Unverified
Commit
691a12fa
authored
Oct 27, 2021
by
Wolle
Committed by
GitHub
Oct 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #215 CORRUPT HEAP error when destructor called
parent
b77c5b99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
src/Audio.cpp
src/Audio.cpp
+8
-9
src/Audio.h
src/Audio.h
+2
-1
No files found.
src/Audio.cpp
View file @
691a12fa
...
...
@@ -198,22 +198,21 @@ Audio::Audio(bool internalDAC /* = false */, i2s_dac_mode_t channelEnabled /* =
}
//---------------------------------------------------------------------------------------------------------------------
void
Audio
::
initInBuff
()
{
static
bool
f_already_done
=
false
;
if
(
!
f_already_done
)
{
if
(
!
m_f_initInbuffOnce
)
{
size_t
size
=
InBuff
.
init
();
if
(
size
==
m_buffSizeRAM
-
m_resBuffSizeRAM
)
{
sprintf
(
chbuf
,
"PSRAM not found, inputBufferSize: %u bytes"
,
size
-
1
);
if
(
audio_info
)
audio_info
(
chbuf
);
m_f_psram
=
false
;
f_already_don
e
=
true
;
m_f_initInbuffOnc
e
=
true
;
}
if
(
size
==
m_buffSizePSRAM
-
m_resBuffSizePSRAM
)
{
sprintf
(
chbuf
,
"PSRAM found, inputBufferSize: %u bytes"
,
size
-
1
);
if
(
audio_info
)
audio_info
(
chbuf
);
m_f_psram
=
true
;
f_already_don
e
=
true
;
m_f_initInbuffOnc
e
=
true
;
}
}
changeMaxBlockSize
(
1600
);
// default size mp3 or aac
...
...
@@ -254,8 +253,11 @@ esp_err_t Audio::i2s_mclk_pin_select(const uint8_t pin) {
}
//---------------------------------------------------------------------------------------------------------------------
Audio
::~
Audio
()
{
I2Sstop
(
m_i2s_num
);
InBuff
.
~
AudioBuffer
();
//I2Sstop(m_i2s_num);
//InBuff.~AudioBuffer(); #215 the AudioBuffer is automatically destroyed by the destructor
m_f_initInbuffOnce
=
false
;
setDefaults
();
if
(
m_playlistBuff
)
{
free
(
m_playlistBuff
);
m_playlistBuff
=
NULL
;}
}
//---------------------------------------------------------------------------------------------------------------------
void
Audio
::
setDefaults
()
{
...
...
@@ -629,11 +631,8 @@ bool Audio::connecttoSD(const char* path) {
bool
Audio
::
connecttoFS
(
fs
::
FS
&
fs
,
const
char
*
path
)
{
if
(
strlen
(
path
)
>
255
)
return
false
;
char
audioName
[
256
];
setDefaults
();
// free buffers an set defaults
memcpy
(
audioName
,
path
,
strlen
(
path
)
+
1
);
if
(
audioName
[
0
]
!=
'/'
){
for
(
int
i
=
255
;
i
>
0
;
i
--
){
...
...
src/Audio.h
View file @
691a12fa
...
...
@@ -2,7 +2,7 @@
* Audio.h
*
* Created on: Oct 26,2018
* Updated on: Oct
5
,2021
* Updated on: Oct
27
,2021
* Author: Wolle (schreibfaul1)
*/
...
...
@@ -418,6 +418,7 @@ private:
bool
m_f_m3u8data
=
false
;
// used in processM3U8entries
bool
m_f_Log
=
true
;
// if m3u8: log is cancelled
bool
m_f_continue
=
false
;
// next m3u8 chunk is available
bool
m_f_initInbuffOnce
=
false
;
// init InBuff only once
i2s_dac_mode_t
m_f_channelEnabled
=
I2S_DAC_CHANNEL_LEFT_EN
;
// internal DAC on GPIO26 for M5StickC/Plus
uint32_t
m_audioFileDuration
=
0
;
float
m_audioCurrentTime
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment