File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 2020#include " AudioConfig.h"
2121#include " AudioTools/AudioLogger.h"
2222#include " AudioTools/AudioStreams.h"
23+ #include " AudioI2S/I2SConfig.h"
24+ #include " AudioI2S/I2SStream.h"
2325
2426// Set USE_ESP32_I2S to 1 if you want to use the explicit ESP32 implementation.
2527// 0 for generic implementation
5759#define SYNC_OFFSET 2 // byte offset of SYNC
5860#define SYNC_FLIP ((BMC_B ^ BMC_M) >> (SYNC_OFFSET * 8 ))
5961
60- // Include I2S based on configuration
61- #if defined(ESP32) && USE_ESP32_I2S == 1
62- #include " driver/i2s.h"
63- #include " freertos/FreeRTOS.h"
64- #else
65- #include " AudioI2S/I2SConfig.h"
66- #include " AudioI2S/I2SStream.h"
67- #endif
6862
6963namespace audio_tools {
7064
@@ -142,15 +136,15 @@ class SPDIFStream : public AudioStreamX {
142136 // / Start with the provided parameters
143137 bool begin (SPDIFConfig cfg) {
144138 LOGD (LOG_METHOD);
145- if (i2sOn) {
146- i2s.end ();
147- }
148-
149139 if (!(cfg.channels == 1 | cfg.channels == 2 )) {
150140 LOGE (" Unsupported number of channels: %d" , cfg.channels );
151141 return false ;
152142 }
153143
144+ if (i2sOn) {
145+ i2s.end ();
146+ }
147+
154148 // initialize S/PDIF buffer
155149 spdif_buf_init ();
156150 spdif_ptr = spdif_buf;
You can’t perform that action at this time.
0 commit comments