arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OutputMixer< T > Class Template Reference

Mixing of multiple outputs to one final output. More...

#include <AudioOutput.h>

Inheritance diagram for OutputMixer< T >:
Print

Public Member Functions

 OutputMixer (Print &finalOutput, int outputStreamCount)
 
int availableForWrite () override
 Provides the bytes available to write for the current stream buffer.
 
int availableForWrite (int idx)
 Provides the bytes available to write for the indicated stream index.
 
bool begin (int copy_buffer_size_bytes=DEFAULT_BUFFER_SIZE, MemoryType memoryType=PS_RAM)
 Starts the processing.
 
void end ()
 Remove all input streams.
 
virtual void flush ()
 
void flushMixer ()
 Force output to final destination.
 
void resize (int size)
 Resizes the buffer to the indicated number of bytes.
 
void setOutput (Print &finalOutput)
 
void setOutputCount (int count)
 
void setWeight (int channel, float weight)
 
int size ()
 Number of stremams to which are mixed together.
 
size_t write (const uint8_t *buffer_c, size_t bytes) override
 
size_t write (int idx, const uint8_t *buffer_c, size_t bytes)
 Write the data for an individual stream idx which will be mixed together.
 
size_t write (uint8_t) override
 

Protected Member Functions

void allocate_buffers (int size)
 
void free_buffers ()
 
void update_total_weights ()
 

Protected Attributes

int _timeout = 10
 
Vector< RingBuffer< T > * > buffers {0}
 
bool is_active = false
 
MemoryType memory_type
 
Vector< T > output {0}
 
int output_count
 
Printp_final_output = nullptr
 
void * p_memory = nullptr
 
int size_bytes
 
int stream_idx = 0
 
float total_weights = 0.0
 
Vector< float > weights {0}
 

Detailed Description

template<typename T>
class audio_tools::OutputMixer< T >

Mixing of multiple outputs to one final output.

Author
Phil Schatzmann
Template Parameters
T

Member Function Documentation

◆ setWeight()

void setWeight ( int  channel,
float  weight 
)
inline

Defines a new weight for the indicated channel: If you set it to 0.0 it is muted. The initial value is 1.0

◆ write()

size_t write ( const uint8_t *  buffer_c,
size_t  bytes 
)
inlineoverridevirtual

Write the data from a simgle stream which will be mixed together (the stream idx is increased)

Reimplemented from Print.


The documentation for this class was generated from the following file: