|
AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
|
Provide a convenient way to fire and forget sound FX. More...
#include <AudioSink.h>
Public Member Functions | |
| AudioSink () | |
| virtual | ~AudioSink () |
| void | Clear () |
| void | GenerateAudio (double desiredSecondsAvailable, double minSecondsAddedPerMix) |
| void | AddAudioInput (std::shared_ptr< AudioStream > audioStream) |
| std::shared_ptr< AudioStream > | GetAudioOutput () |
| void | SetAudioOutput (std::shared_ptr< AudioStream > audioStreamOut) |
| uint32_t | GetAudioInputCount () const |
Protected Member Functions | |
| template<typename T > | |
| T | CalcNetSample () |
| template<> | |
| float | CalcNetSample () |
| template<> | |
| double | CalcNetSample () |
Protected Attributes | |
| std::vector< std::shared_ptr< AudioStream > > * | audioStreamInArray |
| std::shared_ptr< AudioStream > * | audioStreamOut |
Provide a convenient way to fire and forget sound FX.
What this class is trying to be is a general purpose way of mixing and/or converting audio. It can be used for synthesis or real-time purposes. Note that to use this class in a thread-safe manner (typically for real-time playback of audio), you should use the ThreadSafeAudioStream class instead of just the regular AudioStream class for the audio output.
The real-time case is all about feeding an audio device. The synthesis case is about converting audio from one format to another, or mixing audio.
| AudioSink::AudioSink | ( | ) |
|
virtual |
| void AudioSink::AddAudioInput | ( | std::shared_ptr< AudioStream > | audioStream | ) |
Start playing/mixing the given audio stream immediately.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
| void AudioSink::Clear | ( | ) |
| void AudioSink::GenerateAudio | ( | double | desiredSecondsAvailable, |
| double | minSecondsAddedPerMix ) |
Make sure that an amount of audio data equivilant to the given amount of time is available for consumption in our audio output stream. This will produce silence in the audio output if necessary. Note that too much buffered time will create latency when new audio clips are fired. But too little buffered can cause audio drop-outs due to a starved device.
|
inline |
Return the current number of simulatneously playing audio stream.
|
inline |
| void AudioSink::SetAudioOutput | ( | std::shared_ptr< AudioStream > | audioStreamOut | ) |
|
protected |
|
protected |