@@ -365,9 +365,9 @@ class HexDumpOutput : public AudioOutput {
365
365
template <typename T>
366
366
class OutputMixer : public Print {
367
367
public:
368
- OutputMixer () = default ;
368
+ OutputMixer (Allocator &allocator = DefaultAllocatorRAM) : allocator(allocator) {}
369
369
370
- OutputMixer (Print &finalOutput, int outputStreamCount) {
370
+ OutputMixer (Print &finalOutput, int outputStreamCount, Allocator &allocator = DefaultAllocatorRAM) : OutputMixer(allocator ) {
371
371
setOutput (finalOutput);
372
372
setOutputCount (outputStreamCount);
373
373
}
@@ -574,9 +574,10 @@ class OutputMixer : public Print {
574
574
}
575
575
576
576
protected:
577
- Vector<BaseBuffer<T> *> buffers{0 };
578
- Vector<T> output{0 };
579
- Vector<float > weights{0 };
577
+ Vector<float > weights{0 , DefaultAllocatorRAM};
578
+ Vector<BaseBuffer<T> *> buffers{0 , DefaultAllocatorRAM};
579
+ Allocator &allocator;
580
+ Vector<T> output{0 , allocator};
580
581
Print *p_final_output = nullptr ;
581
582
float total_weights = 0.0 ;
582
583
bool is_active = false ;
@@ -585,11 +586,11 @@ class OutputMixer : public Print {
585
586
int output_count = 0 ;
586
587
void *p_memory = nullptr ;
587
588
bool is_auto_index = true ;
588
- BaseBuffer<T>* (*create_buffer_cb)(int size) = create_buffer;
589
+ BaseBuffer<T>* (*create_buffer_cb)(int size, Allocator &allocator ) = create_buffer;
589
590
590
591
// / Creates a default ring buffer of the specified size
591
- static BaseBuffer<T>* create_buffer (int size) {
592
- return new RingBuffer<T>(size / sizeof (T));
592
+ static BaseBuffer<T>* create_buffer (int size, Allocator &allocator ) {
593
+ return new RingBuffer<T>(size / sizeof (T), allocator );
593
594
}
594
595
595
596
// / Recalculates the total weights for normalization
@@ -607,7 +608,7 @@ class OutputMixer : public Print {
607
608
if (buffers[j] != nullptr ) {
608
609
delete buffers[j];
609
610
}
610
- buffers[j] = create_buffer (size);
611
+ buffers[j] = create_buffer (size, allocator );
611
612
}
612
613
}
613
614
0 commit comments