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
c09c3e74
Unverified
Commit
c09c3e74
authored
Nov 02, 2022
by
Wolle
Committed by
GitHub
Nov 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce the block size when writing to the audio buffer
parent
3f27592f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
src/Audio.cpp
src/Audio.cpp
+16
-10
src/Audio.h
src/Audio.h
+1
-1
No files found.
src/Audio.cpp
View file @
c09c3e74
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
*
*
* Created on: Oct 26.2018
* Created on: Oct 26.2018
*
*
* Version 2.0.6
k
* Version 2.0.6
l
* Updated on:
Oct 2
2.2022
* Updated on:
Nov 0
2.2022
* Author: Wolle (schreibfaul1)
* Author: Wolle (schreibfaul1)
*
*
*/
*/
...
@@ -2849,6 +2849,7 @@ void Audio::processLocalFile() {
...
@@ -2849,6 +2849,7 @@ void Audio::processLocalFile() {
static
bool
f_stream
;
static
bool
f_stream
;
static
bool
f_fileDataComplete
;
static
bool
f_fileDataComplete
;
static
uint32_t
byteCounter
;
// count received data
static
uint32_t
byteCounter
;
// count received data
uint32_t
availableBytes
=
0
;
if
(
m_f_firstCall
)
{
// runs only one time per connection, prepare for start
if
(
m_f_firstCall
)
{
// runs only one time per connection, prepare for start
m_f_firstCall
=
false
;
m_f_firstCall
=
false
;
...
@@ -2858,7 +2859,12 @@ void Audio::processLocalFile() {
...
@@ -2858,7 +2859,12 @@ void Audio::processLocalFile() {
return
;
return
;
}
}
uint32_t
availableBytes
=
maxFrameSize
*
4
;
#ifdef CONFIG_IDF_TARGET_ESP32S3
availableBytes
=
maxFrameSize
*
4
;
#else // Audiobuffer throttle - - -
availableBytes
=
maxFrameSize
;
// reduce blocksize because PSRAM is too slow
#endif
availableBytes
=
min
(
availableBytes
,
InBuff
.
writeSpace
());
availableBytes
=
min
(
availableBytes
,
InBuff
.
writeSpace
());
availableBytes
=
min
(
availableBytes
,
audiofile
.
size
()
-
byteCounter
);
availableBytes
=
min
(
availableBytes
,
audiofile
.
size
()
-
byteCounter
);
if
(
m_contentlength
){
if
(
m_contentlength
){
...
@@ -2950,13 +2956,13 @@ void Audio::processLocalFile() {
...
@@ -2950,13 +2956,13 @@ void Audio::processLocalFile() {
// play audio data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// play audio data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
(
f_stream
){
if
(
f_stream
){
//
static uint8_t cnt = 0;
static
uint8_t
cnt
=
0
;
//
uint8_t compression;
uint8_t
compression
;
//
if(m_codec == CODEC_WAV) compression = 1;
if
(
m_codec
==
CODEC_WAV
)
compression
=
1
;
//
if(m_codec == CODEC_FLAC) compression = 2;
if
(
m_codec
==
CODEC_FLAC
)
compression
=
2
;
//
compression = 6;
compression
=
6
;
//
cnt++;
cnt
++
;
//
if(cnt == compression){playAudioData(); cnt = 0;}
if
(
cnt
==
compression
){
playAudioData
();
cnt
=
0
;}
playAudioData
();
playAudioData
();
}
}
return
;
return
;
...
...
src/Audio.h
View file @
c09c3e74
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* Audio.h
* Audio.h
*
*
* Created on: Oct 28,2018
* Created on: Oct 28,2018
* Updated on:
Oct 2
2,2022
* Updated on:
Nov 0
2,2022
* Author: Wolle (schreibfaul1)
* Author: Wolle (schreibfaul1)
*/
*/
...
...
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