@@ -365,9 +365,9 @@ class HexDumpOutput : public AudioOutput {
365365template <typename T>
366366class OutputMixer : public Print {
367367public:
368- OutputMixer () = default ;
368+ OutputMixer (Allocator &allocator = DefaultAllocatorRAM) : allocator(allocator) {}
369369
370- OutputMixer (Print &finalOutput, int outputStreamCount) {
370+ OutputMixer (Print &finalOutput, int outputStreamCount, Allocator &allocator = DefaultAllocatorRAM) : OutputMixer(allocator ) {
371371 setOutput (finalOutput);
372372 setOutputCount (outputStreamCount);
373373 }
@@ -574,9 +574,10 @@ class OutputMixer : public Print {
574574 }
575575
576576protected:
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};
580581 Print *p_final_output = nullptr ;
581582 float total_weights = 0.0 ;
582583 bool is_active = false ;
@@ -585,11 +586,11 @@ class OutputMixer : public Print {
585586 int output_count = 0 ;
586587 void *p_memory = nullptr ;
587588 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;
589590
590591 // / 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 );
593594 }
594595
595596 // / Recalculates the total weights for normalization
@@ -607,7 +608,7 @@ class OutputMixer : public Print {
607608 if (buffers[j] != nullptr ) {
608609 delete buffers[j];
609610 }
610- buffers[j] = create_buffer (size);
611+ buffers[j] = create_buffer (size, allocator );
611612 }
612613 }
613614
0 commit comments