@@ -120,10 +120,6 @@ class DriverPWMBase {
120
120
LOGE (" Only max %d channels are supported!" ,maxChannels ());
121
121
return false ;
122
122
}
123
- if (audio_config.bits_per_sample !=16 ){
124
- LOGE (" bits_per_sample must be 16!" );
125
- return false ;
126
- }
127
123
// allocate buffer if necessary
128
124
if (user_callback==nullptr ) {
129
125
if (buffer!=nullptr ){
@@ -195,10 +191,6 @@ class DriverPWMBase {
195
191
}
196
192
}
197
193
198
- void setUserCallback (PWMCallbackType cb){
199
- user_callback = cb;
200
- }
201
-
202
194
bool isTimerStarted () {
203
195
return is_timer_started;
204
196
}
@@ -224,22 +216,8 @@ class DriverPWMBase {
224
216
bool is_timer_started = false ;
225
217
bool is_blocking_write = true ;
226
218
227
- void playNextFrameCallback (){
228
- // TRACED();
229
- uint8_t channels = audio_config.channels ;
230
- int16_t data[channels];
231
- if (user_callback (channels, data)){
232
- for (uint8_t j=0 ;j<audio_config.channels ;j++){
233
- int value = map (data[j], -NumberConverter::maxValue (16 ), NumberConverter::maxValue (16 ), 0 , 255 );
234
- pwmWrite (j, value);
235
- }
236
- updateStatistics ();
237
- }
238
- }
239
-
240
-
241
219
// / writes the next frame to the output pins
242
- void playNextFrameStream (){
220
+ void playNextFrame (){
243
221
if (isTimerStarted () && buffer!=nullptr ){
244
222
// TRACED();
245
223
int required = (audio_config.bits_per_sample / 8 ) * audio_config.channels ;
@@ -255,15 +233,6 @@ class DriverPWMBase {
255
233
}
256
234
}
257
235
258
- void playNextFrame (){
259
- // TRACED();
260
- if (user_callback!=nullptr ){
261
- playNextFrameCallback ();
262
- } else {
263
- playNextFrameStream ();
264
- }
265
- }
266
-
267
236
// / determines the next scaled value
268
237
virtual int nextValue () {
269
238
int result = 0 ;
0 commit comments