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
4516b13f
Unverified
Commit
4516b13f
authored
May 03, 2022
by
Wolle
Committed by
GitHub
May 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compile error with latest PIO 4.2.0 & Arduino master #301
parent
5d289fd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
src/Audio.cpp
src/Audio.cpp
+11
-7
src/Audio.h
src/Audio.h
+6
-2
No files found.
src/Audio.cpp
View file @
4516b13f
...
...
@@ -2,7 +2,7 @@
* Audio.cpp
*
* Created on: Oct 26,2018
* Updated on:
Apr 12
,2022
* Updated on:
May 03
,2022
* Author: Wolle (schreibfaul1)
*
*/
...
...
@@ -184,7 +184,7 @@ Audio::Audio(bool internalDAC /* = false */, i2s_dac_mode_t channelEnabled /* =
if
(
m_f_channelEnabled
!=
I2S_DAC_CHANNEL_BOTH_EN
)
{
m_f_forceMono
=
true
;
}
}
}
else
{
m_i2s_config
.
mode
=
(
i2s_mode_t
)(
I2S_MODE_MASTER
|
I2S_MODE_TX
);
...
...
@@ -211,7 +211,7 @@ Audio::Audio(bool internalDAC /* = false */, i2s_dac_mode_t channelEnabled /* =
//---------------------------------------------------------------------------------------------------------------------
void
Audio
::
setBufsize
(
int
rambuf_sz
,
int
psrambuf_sz
)
{
if
(
InBuff
.
isInitialized
())
{
ESP_LOGE
(
TAG
,
"Audio::setBufsize must not be called after audio is initialized"
);
log_e
(
"Audio::setBufsize must not be called after audio is initialized"
);
return
;
}
InBuff
.
setBufsize
(
rambuf_sz
,
psrambuf_sz
);
...
...
@@ -240,7 +240,7 @@ esp_err_t Audio::I2Sstop(uint8_t i2s_num) {
//---------------------------------------------------------------------------------------------------------------------
esp_err_t
Audio
::
i2s_mclk_pin_select
(
const
uint8_t
pin
)
{
if
(
pin
!=
0
&&
pin
!=
1
&&
pin
!=
3
)
{
ESP_LOGE
(
TAG
,
"Only support GPIO0/GPIO1/GPIO3, gpio_num:%d"
,
pin
);
log_e
(
"Only support GPIO0/GPIO1/GPIO3, gpio_num:%d"
,
pin
);
return
ESP_ERR_INVALID_ARG
;
}
switch
(
pin
){
...
...
@@ -386,6 +386,12 @@ void Audio::httpPrint(const char* url) {
return
;
}
//---------------------------------------------------------------------------------------------------------------------
void
Audio
::
setConnectionTimeout
(
uint16_t
timeout_ms
,
uint16_t
timeout_ms_ssl
){
if
(
timeout_ms
)
m_timeout_ms
=
timeout_ms
;
if
(
timeout_ms_ssl
)
m_timeout_ms_ssl
=
timeout_ms_ssl
;
}
//---------------------------------------------------------------------------------------------------------------------
bool
Audio
::
connecttohost
(
const
char
*
host
,
const
char
*
user
,
const
char
*
pwd
)
{
// user and pwd for authentification only, can be empty
...
...
@@ -516,10 +522,8 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
// strcat(resp, "Accept-Encoding: gzip;q=0\r\n"); // otherwise the server assumes gzip compression
// strcat(resp, "Transfer-Encoding: \r\n"); // otherwise the server assumes gzip compression
strcat
(
resp
,
"Connection: keep-alive
\r\n\r\n
"
);
const
uint32_t
TIMEOUT_MS
{
250
};
const
uint32_t
TIMEOUT_MS_SSL
{
2700
};
uint32_t
t
=
millis
();
if
(
_client
->
connect
(
hostwoext
,
port
,
m_f_ssl
?
TIMEOUT_MS_SSL
:
TIMEOUT_MS
))
{
if
(
_client
->
connect
(
hostwoext
,
port
,
m_f_ssl
?
m_timeout_ms_ssl
:
m_timeout_ms
))
{
_client
->
setNoDelay
(
true
);
// if(audio_info) audio_info("SSL/TLS Connected to server");
_client
->
print
(
resp
);
...
...
src/Audio.h
View file @
4516b13f
...
...
@@ -2,7 +2,7 @@
* Audio.h
*
* Created on: Oct 26,2018
* Updated on:
Feb 19
,2022
* Updated on:
May 03
,2022
* Author: Wolle (schreibfaul1)
*/
...
...
@@ -32,7 +32,8 @@
#ifdef SDFATFS_USED
typedef
File32
File
;
//typedef File32 File;
typedef
FsFile
File
;
namespace
fs
{
class
FS
:
public
SdFat
{
...
...
@@ -162,6 +163,7 @@ public:
bool
connecttoFS
(
fs
::
FS
&
fs
,
const
char
*
path
,
uint32_t
resumeFilePos
=
0
);
bool
connecttoSD
(
const
char
*
path
,
uint32_t
resumeFilePos
=
0
);
bool
setFileLoop
(
bool
input
);
//TEST loop
void
setConnectionTimeout
(
uint16_t
timeout_ms
,
uint16_t
timeout_ms_ssl
);
bool
setAudioPlayPosition
(
uint16_t
sec
);
bool
setFilePos
(
uint32_t
pos
);
bool
audioFileSeek
(
const
float
speed
);
...
...
@@ -434,6 +436,8 @@ private:
uint16_t
m_datamode
=
0
;
// Statemaschine
uint16_t
m_streamTitleHash
=
0
;
// remember streamtitle, ignore multiple occurence in metadata
uint16_t
m_streamUrlHash
=
0
;
// remember streamURL, ignore multiple occurence in metadata
uint16_t
m_timeout_ms
=
250
;
uint16_t
m_timeout_ms_ssl
=
2700
;
uint8_t
m_flacBitsPerSample
=
0
;
// bps should be 16
uint8_t
m_flacNumChannels
=
0
;
// can be read out in the FLAC file header
uint32_t
m_flacSampleRate
=
0
;
// can be read out in the FLAC file header
...
...
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