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 20
20
#include " AudioConfig.h"
21
21
#include " AudioTools/AudioLogger.h"
22
22
#include " AudioTools/AudioStreams.h"
23
+ #include " AudioI2S/I2SConfig.h"
24
+ #include " AudioI2S/I2SStream.h"
23
25
24
26
// Set USE_ESP32_I2S to 1 if you want to use the explicit ESP32 implementation.
25
27
// 0 for generic implementation
57
59
#define SYNC_OFFSET 2 // byte offset of SYNC
58
60
#define SYNC_FLIP ((BMC_B ^ BMC_M) >> (SYNC_OFFSET * 8 ))
59
61
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
68
62
69
63
namespace audio_tools {
70
64
@@ -142,15 +136,15 @@ class SPDIFStream : public AudioStreamX {
142
136
// / Start with the provided parameters
143
137
bool begin (SPDIFConfig cfg) {
144
138
LOGD (LOG_METHOD);
145
- if (i2sOn) {
146
- i2s.end ();
147
- }
148
-
149
139
if (!(cfg.channels == 1 | cfg.channels == 2 )) {
150
140
LOGE (" Unsupported number of channels: %d" , cfg.channels );
151
141
return false ;
152
142
}
153
143
144
+ if (i2sOn) {
145
+ i2s.end ();
146
+ }
147
+
154
148
// initialize S/PDIF buffer
155
149
spdif_buf_init ();
156
150
spdif_ptr = spdif_buf;
You can’t perform that action at this time.
0 commit comments