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 available (int idx)
 Provides the available bytes in the buffer.
 
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.
 
int availableSamples ()
 
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 next ()
 Moves to the next mixing index.
 
void resize (int size)
 Resizes the buffer to the indicated number of bytes.
 
void setAutoIndex (bool flag)
 Automatically increment mixing index after each write.
 
void setIndex (int idx)
 Sets the Output Stream index.
 
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 *data, size_t len) 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
 
size_t writeSilence (int idx, size_t bytes)
 
size_t writeSilence (size_t bytes)
 

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
 
bool is_auto_index = true
 
MemoryType memory_type
 
Vector< T > output {0}
 
int output_count = 0
 
Printp_final_output = nullptr
 
void * p_memory = nullptr
 
int size_bytes = 0
 
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 *  data,
size_t  len 
)
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: