Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Mixer. Mixes multiple input streams into one output stream. More...
#include <mixer.h>
Public Member Functions | |
Mixer (FrameFactory &frame_factory, const SampleSpec &sample_spec, bool enable_timestamps) | |
Initialize. buffer_factory is used to allocate a temporary buffer for mixing. enable_timestamps defines whether to enable calculation of capture timestamps. More... | |
bool | is_valid () const |
Check if the mixer was succefully constructed. More... | |
void | add_input (IFrameReader &) |
Add input reader. More... | |
void | remove_input (IFrameReader &) |
Remove input reader. More... | |
virtual bool | read (Frame &frame) |
Read audio frame. More... | |
Public Member Functions inherited from roc::core::ListNode< Tag > | |
ListData * | list_data () const |
Get pointer to internal data. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from roc::core::ListNode< Tag > | |
static ListNode * | list_node (ListData *data) |
Get pointer to parent node from pointer to internal data. More... | |
Mixer. Mixes multiple input streams into one output stream.
For example, these two input streams:
are transformed into this output stream:
If timestamps are enabled, mixer computes capture timestamp of output frame as the average capture timestamps of all mixed input frames. This makes sense only when all inputs are synchronized and their timestamps are close to each other.
roc::audio::Mixer::Mixer | ( | FrameFactory & | frame_factory, |
const SampleSpec & | sample_spec, | ||
bool | enable_timestamps | ||
) |
Initialize. buffer_factory
is used to allocate a temporary buffer for mixing. enable_timestamps
defines whether to enable calculation of capture timestamps.
void roc::audio::Mixer::add_input | ( | IFrameReader & | ) |
Add input reader.
bool roc::audio::Mixer::is_valid | ( | ) | const |
Check if the mixer was succefully constructed.
|
virtual |
Read audio frame.
frame
with the result. Implements roc::audio::IFrameReader.
void roc::audio::Mixer::remove_input | ( | IFrameReader & | ) |
Remove input reader.