@@ -120,10 +120,6 @@ class DriverPWMBase {
120120 LOGE (" Only max %d channels are supported!" ,maxChannels ());
121121 return false ;
122122 }
123- if (audio_config.bits_per_sample !=16 ){
124- LOGE (" bits_per_sample must be 16!" );
125- return false ;
126- }
127123 // allocate buffer if necessary
128124 if (user_callback==nullptr ) {
129125 if (buffer!=nullptr ){
@@ -195,10 +191,6 @@ class DriverPWMBase {
195191 }
196192 }
197193
198- void setUserCallback (PWMCallbackType cb){
199- user_callback = cb;
200- }
201-
202194 bool isTimerStarted () {
203195 return is_timer_started;
204196 }
@@ -224,22 +216,8 @@ class DriverPWMBase {
224216 bool is_timer_started = false ;
225217 bool is_blocking_write = true ;
226218
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-
241219 // / writes the next frame to the output pins
242- void playNextFrameStream (){
220+ void playNextFrame (){
243221 if (isTimerStarted () && buffer!=nullptr ){
244222 // TRACED();
245223 int required = (audio_config.bits_per_sample / 8 ) * audio_config.channels ;
@@ -255,15 +233,6 @@ class DriverPWMBase {
255233 }
256234 }
257235
258- void playNextFrame (){
259- // TRACED();
260- if (user_callback!=nullptr ){
261- playNextFrameCallback ();
262- } else {
263- playNextFrameStream ();
264- }
265- }
266-
267236 // / determines the next scaled value
268237 virtual int nextValue () {
269238 int result = 0 ;
0 commit comments