File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -420,14 +420,8 @@ class OutputMixer : public Print {
420
420
bool result = false ;
421
421
422
422
// determine ringbuffer with mininum available data
423
- size_t samples = 0 ;
424
- for (int j = 0 ; j < output_count; j++) {
425
- int available_samples = buffers[j]->available ();
426
- if (available_samples > 0 ){
427
- samples = MIN (size_bytes / sizeof (T), (size_t )available_samples);
428
- }
429
- }
430
-
423
+ size_t samples = availableSamples ();
424
+ // sum up samples
431
425
if (samples > 0 ) {
432
426
result = true ;
433
427
// mix data from ringbuffers to output
@@ -449,6 +443,17 @@ class OutputMixer : public Print {
449
443
return ;
450
444
}
451
445
446
+ int availableSamples () {
447
+ size_t samples = 0 ;
448
+ for (int j = 0 ; j < output_count; j++) {
449
+ int available_samples = buffers[j]->available ();
450
+ if (available_samples > 0 ){
451
+ samples = MIN (size_bytes / sizeof (T), (size_t )available_samples);
452
+ }
453
+ }
454
+ return samples;
455
+ }
456
+
452
457
// / Resizes the buffer to the indicated number of bytes
453
458
void resize (int size) {
454
459
if (size != size_bytes) {
@@ -493,8 +498,8 @@ class OutputMixer : public Print {
493
498
float total_weights = 0.0 ;
494
499
bool is_active = false ;
495
500
int stream_idx = 0 ;
496
- int size_bytes;
497
- int output_count;
501
+ int size_bytes = 0 ;
502
+ int output_count = 0 ;
498
503
MemoryType memory_type;
499
504
void *p_memory = nullptr ;
500
505
bool is_auto_index = true ;
You can’t perform that action at this time.
0 commit comments