Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
roc::audio::Mixer Class Reference

Mixer. Mixes multiple input streams into one output stream. More...

#include <mixer.h>

Inheritance diagram for roc::audio::Mixer:
roc::audio::IFrameReader roc::core::NonCopyable< T > roc::core::ListNode roc::core::NonCopyable< ListNode >

Public Member Functions

 Mixer (core::BufferFactory< sample_t > &buffer_factory, core::nanoseconds_t frame_length, const audio::SampleSpec &sample_spec)
 Initialize.
 
bool valid () const
 Check if the mixer was succefully constructed.
 
void add_input (IFrameReader &)
 Add input reader.
 
void remove_input (IFrameReader &)
 Remove input reader.
 
virtual bool read (Frame &frame)
 Read audio frame.
 
virtual bool read (Frame &frame)=0
 Read audio frame.
 
- Public Member Functions inherited from roc::core::ListNode
ListNodeDatalist_node_data () const
 Get list node data.
 

Detailed Description

Mixer. Mixes multiple input streams into one output stream.

For example, these two input streams:

1, 2, 3, ...
4, 5, 6, ...

are transformed into this output stream:

5, 7, 9, ...

Definition at line 41 of file mixer.h.

Constructor & Destructor Documentation

◆ Mixer()

roc::audio::Mixer::Mixer ( core::BufferFactory< sample_t > &  buffer_factory,
core::nanoseconds_t  frame_length,
const audio::SampleSpec sample_spec 
)

Initialize.

Parameters

  • buffer_factory is used to allocate a temporary buffer of samples
  • frame_length defines the temporary buffer length used to read from, in nanoseconds
  • sample_spec defines the sample spec taken from the audio signal

Member Function Documentation

◆ add_input()

void roc::audio::Mixer::add_input ( IFrameReader )

Add input reader.

◆ read()

virtual bool roc::audio::Mixer::read ( Frame frame)
virtual

Read audio frame.

Remarks
Reads samples from every input reader, mixes them, and fills frame with the result.

Implements roc::audio::IFrameReader.

◆ remove_input()

void roc::audio::Mixer::remove_input ( IFrameReader )

Remove input reader.

◆ valid()

bool roc::audio::Mixer::valid ( ) const

Check if the mixer was succefully constructed.


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