#include <opalmixer.h>
Inheritance diagram for OpalAudioMixer:
Public Member Functions | |
OpalAudioMixer (bool stereo=false, unsigned sampleRate=OpalMediaFormat::AudioClockRate, bool pushThread=true, unsigned period=10) | |
~OpalAudioMixer () | |
virtual void | RemoveStream (const Key_T &key) |
virtual void | RemoveAllStreams () |
bool | IsStereo () const |
unsigned | GetSampleRate () const |
bool | SetSampleRate (unsigned rate) |
bool | SetJitterBufferSize (const Key_T &key, unsigned minJitterDelay, unsigned maxJitterDelay) |
Protected Member Functions | |
virtual Stream * | CreateStream () |
virtual bool | MixStreams (RTP_DataFrame &frame) |
virtual size_t | GetOutputSize () const |
void | PreMixStreams () |
void | MixStereo (RTP_DataFrame &frame) |
void | MixAdditive (RTP_DataFrame &frame, const short *audioToSubtract) |
Protected Attributes | |
bool | m_stereo |
unsigned | m_sampleRate |
AudioStream * | m_left |
AudioStream * | m_right |
std::vector< int > | m_mixedAudio |
Data Structures | |
struct | AudioStream |
For 2 or less channels, they may be mixed as stereo where 16 bit PCM samples are placed in adjacent pairs in the output, rather than summing them.
OpalAudioMixer::OpalAudioMixer | ( | bool | stereo = false , |
|
unsigned | sampleRate = OpalMediaFormat::AudioClockRate , |
|||
bool | pushThread = true , |
|||
unsigned | period = 10 | |||
) |
stereo | Indicate stero or mixed mono mode |
sampleRate | Sample rate for audio, default 8kHz |
pushThread | Indicate push thread is to be used |
period | Period for push/pull of audio from mixer in milliseconds |
OpalAudioMixer::~OpalAudioMixer | ( | ) | [inline] |
virtual Stream* OpalAudioMixer::CreateStream | ( | ) | [protected, virtual] |
Implements OpalBaseMixer.
virtual size_t OpalAudioMixer::GetOutputSize | ( | ) | const [protected, virtual] |
Implements OpalBaseMixer.
unsigned OpalAudioMixer::GetSampleRate | ( | ) | const [inline] |
Get sample rate for audio.
bool OpalAudioMixer::IsStereo | ( | ) | const [inline] |
Return flag for mixing stereo audio data.
void OpalAudioMixer::MixAdditive | ( | RTP_DataFrame & | frame, | |
const short * | audioToSubtract | |||
) | [protected] |
void OpalAudioMixer::MixStereo | ( | RTP_DataFrame & | frame | ) | [protected] |
virtual bool OpalAudioMixer::MixStreams | ( | RTP_DataFrame & | frame | ) | [protected, virtual] |
Implements OpalBaseMixer.
void OpalAudioMixer::PreMixStreams | ( | ) | [protected] |
virtual void OpalAudioMixer::RemoveAllStreams | ( | ) | [virtual] |
Remove all input streams from mixer.
Reimplemented from OpalBaseMixer.
virtual void OpalAudioMixer::RemoveStream | ( | const Key_T & | key | ) | [virtual] |
Remove an input stream from mixer.
key | key for mixer stream |
bool OpalAudioMixer::SetJitterBufferSize | ( | const Key_T & | key, | |
unsigned | minJitterDelay, | |||
unsigned | maxJitterDelay | |||
) |
Sets the size of the jitter buffer to be used by the specified stream in this mixer. A mixer defaults to not having any jitter buffer enabled.
If either jitter delay parameter is zero, it destroys the jitter buffer attached to this mixer.
key | key for mixer stream |
minJitterDelay | Minimum jitter buffer delay in RTP timestamp units |
maxJitterDelay | Maximum jitter buffer delay in RTP timestamp units |
bool OpalAudioMixer::SetSampleRate | ( | unsigned | rate | ) |
Set sample rate for audio data. Note that all streams must have the same sample rate.
Returns false if attempts to set sample rate to something different to existing streams.
rate | New rate |
AudioStream* OpalAudioMixer::m_left [protected] |
std::vector<int> OpalAudioMixer::m_mixedAudio [protected] |
AudioStream* OpalAudioMixer::m_right [protected] |
unsigned OpalAudioMixer::m_sampleRate [protected] |
bool OpalAudioMixer::m_stereo [protected] |