|
arduino-audio-tools
|
#include <AudioOutput.h>
Public Member Functions | |
| OutputMixer (Allocator &allocator=DefaultAllocatorRAM) | |
| Default constructor. You must call setOutput() and setOutputCount() before use. | |
| OutputMixer (Print &finalOutput, int outputStreamCount, Allocator &allocator=DefaultAllocatorRAM) | |
| Constructor with output stream, number of input streams, and allocator. | |
| 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 | availablePercent (int idx) |
| Provides the % fill level of the buffer for the indicated index. | |
| int | availableSamples () |
| Returns the minimum number of samples available across all buffers. | |
| bool | begin (int copy_buffer_size_bytes=DEFAULT_BUFFER_SIZE) |
| Starts the processing. | |
| void | end () |
| Remove all input streams. | |
| virtual void | flush () |
| bool | flushMixer () |
| Force output to final destination. | |
| BaseBuffer< T > * | getBuffer (int idx) |
| Provides the write buffer for the indicated index. | |
| void | next () |
| Moves to the next mixing index. | |
| bool | resize (size_t sizeBytes) |
| Resizes the buffer to the indicated number of bytes. | |
| void | setAutoIndex (bool flag) |
| Automatically increment mixing index after each write. | |
| void | setCreateBufferCallback (BaseBuffer< T > *(*cb)(int size)) |
| Define callback to allocate custum buffer types. | |
| void | setIndex (int idx) |
| Sets the Output Stream index. | |
| void | setOutput (Print &finalOutput) |
| Sets the final output destination for mixed audio. | |
| void | setOutputCount (int count) |
| Sets the number of input streams to mix. | |
| 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 |
| Single byte write - not supported, returns 0. | |
| size_t | writeSilence (int idx, size_t bytes) |
| Writes silence to the specified stream buffer. | |
| size_t | writeSilence (size_t bytes) |
| Writes silence to the current stream buffer. | |
Protected Member Functions | |
| bool | allocate_buffers (int sizeBytes) |
| Allocates ring buffers for all input streams. | |
| void | free_buffers () |
| Releases memory for all ring buffers. | |
| void | mixSamples (size_t samples) |
| Mixes the samples from all input streams into the output buffer. | |
| void | update_total_weights () |
| Recalculates the total weights for normalization. | |
Static Protected Member Functions | |
| static BaseBuffer< T > * | create_buffer (int sizeBytes, Allocator &allocator) |
| Creates a default ring buffer of the specified size. | |
Protected Attributes | |
| int | _timeout = 10 |
| Allocator & | allocator |
| Vector< BaseBuffer< T > * > | buffers {0, DefaultAllocatorRAM} |
| BaseBuffer< T > *(* | create_buffer_cb )(int size, Allocator &allocator) = create_buffer |
| bool | is_active = false |
| bool | is_auto_index = true |
| Vector< T > | output {0, allocator} |
| int | output_count = 0 |
| Print * | p_final_output = nullptr |
| void * | p_memory = nullptr |
| int | size_bytes = 0 |
| int | stream_idx = 0 |
| float | total_weights = 0.0 |
| Vector< float > | weights {0, DefaultAllocatorRAM} |
|
inline |
Default constructor. You must call setOutput() and setOutputCount() before use.
| allocator | Reference to the allocator to use for internal buffers (default: DefaultAllocatorRAM) |
|
inline |
Constructor with output stream, number of input streams, and allocator.
| finalOutput | Reference to the Print object for mixed audio output |
| outputStreamCount | Number of input streams to mix |
| allocator | Reference to the allocator to use for internal buffers (default: DefaultAllocatorRAM) |
|
inlineprotected |
Allocates ring buffers for all input streams.
|
inline |
Provides the available bytes in the buffer.
|
inlineoverridevirtual |
Provides the bytes available to write for the current stream buffer.
Reimplemented from Print.
|
inline |
Provides the bytes available to write for the indicated stream index.
|
inline |
Provides the % fill level of the buffer for the indicated index.
|
inline |
Returns the minimum number of samples available across all buffers.
|
inline |
Starts the processing.
|
inlinestaticprotected |
Creates a default ring buffer of the specified size.
|
inline |
Remove all input streams.
|
inlinevirtualinherited |
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, ReformatBaseStream, MultiOutput, AudioOutput, AudioStreamWrapper, ResampleStream, EncodedAudioStream, HDLCStream, URLStream, BufferedTaskStream, I2SStream, HexDumpOutput, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, BufferedStream, BaseStream, NamePrinter, VFSFile, and ZephyrFile.
|
inline |
Force output to final destination.
|
inlineprotected |
Releases memory for all ring buffers.
|
inline |
Provides the write buffer for the indicated index.
|
inlineprotected |
Mixes the samples from all input streams into the output buffer.
|
inline |
Moves to the next mixing index.
|
inline |
Resizes the buffer to the indicated number of bytes.
|
inline |
Automatically increment mixing index after each write.
|
inline |
Define callback to allocate custum buffer types.
|
inline |
Sets the Output Stream index.
|
inline |
Sets the final output destination for mixed audio.
|
inline |
Sets the number of input streams to mix.
|
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
|
inline |
Number of stremams to which are mixed together.
|
inlineprotected |
Recalculates the total weights for normalization.
|
inlineoverridevirtual |
Write the data from a simgle stream which will be mixed together (the stream idx is increased)
Reimplemented from Print.
|
inline |
Write the data for an individual stream idx which will be mixed together.
|
inlineoverride |
Single byte write - not supported, returns 0.
|
inline |
Writes silence to the specified stream buffer.
|
inline |
Writes silence to the current stream buffer.
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |