File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -439,10 +439,10 @@ typedef uint32_t eps32_i2s_sample_rate_type;
439
439
440
440
// use 0 for https://github.com/baldram/ESP_VS1053_Library
441
441
// use 1 for https://github.com/pschatzmann/arduino-vs1053
442
- #define VS1053_EXT 0
442
+ #define VS1053_EXT 1
443
443
//----------------
444
444
445
- #ifdef IS_DESKTO
445
+ #ifdef IS_DESKTOP
446
446
#define USE_URL_ARDUINO
447
447
#define FLUSH_OVERRIDE override
448
448
#endif
Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ class VS1053Config : public AudioBaseInfo {
180
180
uint8_t dreq_pin = VS1053_DREQ;
181
181
int16_t reset_pin = VS1053_RESET; // -1 is undefined
182
182
uint8_t cs_sd_pin = VS1053_CS_SD;
183
+ RxTxMode mode;
183
184
};
184
185
185
186
/* *
@@ -193,9 +194,10 @@ class VS1053Stream : public AudioStreamX {
193
194
VS1053Stream (){
194
195
}
195
196
196
- VS1053Config defaultConfig () {
197
+ VS1053Config defaultConfig (RxTxMode mode=TX_MODE ) {
197
198
LOGD (LOG_METHOD);
198
199
VS1053Config c;
200
+ c.mode = mode;
199
201
return c;
200
202
}
201
203
@@ -224,8 +226,21 @@ class VS1053Stream : public AudioStreamX {
224
226
AudioEncoder *p_enc = cfg.is_encoded_data ? p_encoder :©
225
227
p_out = new EncodedAudioStream (p_driver, p_enc);
226
228
}
227
- p_out->begin (cfg);
228
- p_driver->begin ();
229
+
230
+ switch (cfg.mode ){
231
+ case TX_MODE:
232
+ p_out->begin (cfg);
233
+ p_driver->begin ();
234
+ return true ;
235
+ #if VS1053_EXT
236
+ case RX_MODE:
237
+ getVS1053 ().beginInput (cfg.is_encoded_data );
238
+ return true ;
239
+ #endif
240
+ default :
241
+ LOGE (" Mode not supported" );
242
+ return false ;
243
+ }
229
244
}
230
245
231
246
// / Stops the processing and releases the memory
@@ -307,6 +322,12 @@ class VS1053Stream : public AudioStreamX {
307
322
}
308
323
309
324
#if VS1053_EXT
325
+ int available () override {
326
+ return getVS1053 ().available ();
327
+ }
328
+ size_t readBytes (uint8_t * data, size_t len) override {
329
+ return getVS1053 ().readBytes (data, len);
330
+ }
310
331
311
332
// / Provides the treble amplitude value
312
333
float treble () {
You can’t perform that action at this time.
0 commit comments