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
f3c5917b
Commit
f3c5917b
authored
May 25, 2022
by
lingex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specifies the I2S port
parent
a8d3c039
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
src/Audio.cpp
src/Audio.cpp
+6
-2
src/Audio.h
src/Audio.h
+2
-1
No files found.
src/Audio.cpp
View file @
f3c5917b
...
...
@@ -154,7 +154,7 @@ uint32_t AudioBuffer::getReadPos() {
return
m_readPtr
-
m_buffer
;
}
//---------------------------------------------------------------------------------------------------------------------
Audio
::
Audio
(
bool
internalDAC
/* = false */
,
uint8_t
channelEnabled
/* = I2S_DAC_CHANNEL_BOTH_EN */
)
{
Audio
::
Audio
(
bool
internalDAC
/* = false */
,
uint8_t
channelEnabled
/* = I2S_DAC_CHANNEL_BOTH_EN */
,
uint8_t
i2sPort
)
{
// build-in-DAC works only with ESP32 (ESP32-S3 has no build-in-DAC)
// build-in-DAC last working Arduino Version: 2.0.0-RC2
...
...
@@ -169,7 +169,7 @@ Audio::Audio(bool internalDAC /* = false */, uint8_t channelEnabled /* = I2S_DAC
m_f_channelEnabled
=
channelEnabled
;
m_f_internalDAC
=
internalDAC
;
//i2s configuration
m_i2s_num
=
I2S_NUM_0
;
// i2s port number
m_i2s_num
=
i2sPort
;
// i2s port number
m_i2s_config
.
sample_rate
=
16000
;
m_i2s_config
.
bits_per_sample
=
I2S_BITS_PER_SAMPLE_16BIT
;
m_i2s_config
.
channel_format
=
I2S_CHANNEL_FMT_RIGHT_LEFT
;
...
...
@@ -4178,6 +4178,10 @@ uint8_t Audio::getVolume() {
return
m_vol
;
}
//---------------------------------------------------------------------------------------------------------------------
uint8_t
Audio
::
getI2sPort
()
{
return
m_i2s_num
;
}
//---------------------------------------------------------------------------------------------------------------------
int32_t
Audio
::
Gain
(
int16_t
s
[
2
])
{
int32_t
v
[
2
];
float
step
=
(
float
)
m_vol
/
64
;
...
...
src/Audio.h
View file @
f3c5917b
...
...
@@ -155,7 +155,7 @@ class Audio : private AudioBuffer{
AudioBuffer
InBuff
;
// instance of input buffer
public:
Audio
(
bool
internalDAC
=
false
,
uint8_t
channelEnabled
=
3
);
// #99
Audio
(
bool
internalDAC
=
false
,
uint8_t
channelEnabled
=
3
,
uint8_t
i2sPort
=
I2S_NUM_0
);
// #99
~
Audio
();
void
setBufsize
(
int
rambuf_sz
,
int
psrambuf_sz
);
bool
connecttohost
(
const
char
*
host
,
const
char
*
user
=
""
,
const
char
*
pwd
=
""
);
...
...
@@ -177,6 +177,7 @@ public:
void
setBalance
(
int8_t
bal
=
0
);
void
setVolume
(
uint8_t
vol
);
uint8_t
getVolume
();
uint8_t
getI2sPort
();
uint32_t
getAudioDataStartPos
();
uint32_t
getFileSize
();
...
...
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