File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -136,10 +136,15 @@ class SPDIFStream : public AudioStreamX {
136
136
// / Start with the provided parameters
137
137
bool begin (SPDIFConfig cfg) {
138
138
LOGD (LOG_METHOD);
139
+ // Some validations to make sure that the config is valid
139
140
if (!(cfg.channels == 1 | cfg.channels == 2 )) {
140
141
LOGE (" Unsupported number of channels: %d" , cfg.channels );
141
142
return false ;
142
143
}
144
+ if (info.bits_per_sample != 16 ) {
145
+ LOGE (" Unsupported bits per sample: %d - must be 16!" ,
146
+ info.bits_per_sample );
147
+ }
143
148
144
149
if (i2sOn) {
145
150
i2s.end ();
@@ -148,6 +153,8 @@ class SPDIFStream : public AudioStreamX {
148
153
// initialize S/PDIF buffer
149
154
spdif_buf_init ();
150
155
spdif_ptr = spdif_buf;
156
+
157
+ // Setup I2S
151
158
int sample_rate = cfg.sample_rate * BMC_BITS_FACTOR;
152
159
int bclk = sample_rate * I2S_BITS_PER_SAMPLE * I2S_CHANNELS;
153
160
int mclk = (I2S_BUG_MAGIC / bclk) * bclk; // use mclk for avoiding I2S bug
@@ -186,9 +193,6 @@ class SPDIFStream : public AudioStreamX {
186
193
LOGE (" Unsupported bits per sample: %d - must be 16!" ,
187
194
info.bits_per_sample );
188
195
}
189
- if (info.channels != 2 ) {
190
- LOGE (" Unsupported number of channels: %d - must be 2!" , info.channels );
191
- }
192
196
begin (cfg);
193
197
}
194
198
You can’t perform that action at this time.
0 commit comments