BackgroundAudio 1.3.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BackgroundAudioMixer< _outWords > Class Template Reference

Real-time, IRQ driven mixer with configurable number of inputs. More...

#include <BackgroundAudioMixer.h>

Public Member Functions

 BackgroundAudioMixer (AudioOutputBase &d, int outputRate)
 Construct a mixer with output device and constant sample rate.
 
BackgroundAudioMixerInputadd ()
 Create a new input leg on the mixer, usable as an AudioOutputBase. Only legal before begin
 
bool begin ()
 Start the mixer and attached physical interface.
 

Detailed Description

template<size_t _outWords = 512>
class BackgroundAudioMixer< _outWords >

Real-time, IRQ driven mixer with configurable number of inputs.

Mixing is handled by creating multiple emulated input legs of BackgroundAudioMixerInput.

Each input leg behaves as its own independent AudioOutputBase as far as an output generator is concerned (i.e. a returned BackgroundAudioMixerInput can be passed in to the MP3 or WAV decoder with no special handling needed.

All BackgroundAudioMixerInput objects transparently resample their reports back to the parent BackgroundAudioMixer so all the mixer here has to do is sum up all its legs and send the result out to the real hardware (I2S or PWM).

Template Parameters
_outWordsNumber of 32-bit (one stereo 16-bit sample) words to use for the summing buffer

Constructor & Destructor Documentation

◆ BackgroundAudioMixer()

template<size_t _outWords = 512>
BackgroundAudioMixer< _outWords >::BackgroundAudioMixer ( AudioOutputBase &  d,
int  outputRate 
)
inline

Construct a mixer with output device and constant sample rate.

Parameters
[in]dAudioOutputBase to actually output sound to
[in]outputRateFixed output sample rate. All input legs will be resampled to this rate.

Member Function Documentation

◆ add()

template<size_t _outWords = 512>
BackgroundAudioMixerInput * BackgroundAudioMixer< _outWords >::add ( )
inline

Create a new input leg on the mixer, usable as an AudioOutputBase. Only legal before begin

Returns
Newly created BackgroundAudioMixerInput(of class AudioOutputBase) to be used by an audio generator, or nullptr in case of error

◆ begin()

template<size_t _outWords = 512>
bool BackgroundAudioMixer< _outWords >::begin ( )
inline

Start the mixer and attached physical interface.

Starts all the emulated input legs of the mixer as well as the physical interface summed data will be sent to. The physical output sample rate is fixed at this time and all audio data is resampled to this speed transparently.

Returns
True on success

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