File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
examples/tests/codecs/test-codec-aac-fdk-dec Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change
1
+ #include " AudioTools.h"
2
+ #include " AudioCodecs/CodecAACFDK.h"
3
+ #include " AudioLibs/AudioBoardStream.h"
4
+
5
+ URLStream url (" ssid" ," password" ); // or replace with ICYStream to get metadata
6
+ AudioBoardStream i2s (AudioKitEs8388V1); // final output of decoded stream
7
+ EncodedAudioStream dec (&i2s, new AACDecoderFDK()); // Decoding stream
8
+ StreamCopy copier (dec, url); // copy url to decoder
9
+
10
+
11
+ void setup (){
12
+ Serial.begin (115200 );
13
+ AudioLogger::instance ().begin (Serial, AudioLogger::Info);
14
+
15
+ // setup i2s
16
+ auto config = i2s.defaultConfig (TX_MODE);
17
+ i2s.begin (config);
18
+
19
+ // setup I2S based on sampling rate provided by decoder
20
+ dec.begin ();
21
+
22
+ // aac radio
23
+ url.begin (" http://peacefulpiano.stream.publicradio.org/peacefulpiano.aac" ," audio/aac" );
24
+
25
+ }
26
+
27
+ void loop (){
28
+ copier.copy ();
29
+ }
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ class I2SConfigESP32V1 : public AudioInfo {
79
79
LOGI (" bits per sample: %d" , bits_per_sample);
80
80
LOGI (" number of channels: %d" , channels);
81
81
LOGI (" signal_type: %s" , i2s_signal_types[signal_type]);
82
+ LOGI (" buffer_count:%d" , buffer_count);
83
+ LOGI (" buffer_size:%d" , buffer_size);
82
84
if (signal_type==Digital){
83
85
LOGI (" i2s_format: %s" , i2s_formats[i2s_format]);
84
86
}
Original file line number Diff line number Diff line change @@ -195,9 +195,14 @@ class I2SDriverESP32V1 {
195
195
196
196
i2s_chan_config_t getChannelConfig (I2SConfigESP32V1 &cfg) {
197
197
TRACED ();
198
- return I2S_CHANNEL_DEFAULT_CONFIG (
198
+ i2s_chan_config_t result = I2S_CHANNEL_DEFAULT_CONFIG (
199
199
(i2s_port_t )cfg.port_no ,
200
200
cfg.is_master ? I2S_ROLE_MASTER : I2S_ROLE_SLAVE);
201
+ // use the legicy size parameters for frame num
202
+ int size = cfg.buffer_size * cfg.buffer_count ;
203
+ int frame_size = cfg.bits_per_sample * cfg.channels / 8 ;
204
+ if (size > 0 ) result.dma_frame_num = size / frame_size;
205
+ return result;
201
206
}
202
207
203
208
i2s_std_clk_config_t getClockConfig (I2SConfigESP32V1 &cfg) {
You can’t perform that action at this time.
0 commit comments