This class is used for retrieving and mixing down audio from multiple threads. 更多...
#include <MultithreadedPatching.h>
Public 成员函数 | |
| FPatchInput | AddNewInput (int32 MaxLatencyInSamples, float InGain) |
| Adds a new input to the tap collector. 更多... | |
| void | DisconnectAllInputs () |
| Disconnect everything currently connected to this mixer. | |
| FPatchMixer () | |
| Constructor. | |
| int32 | MaxNumberOfSamplesThatCanBePopped () |
| This function call gets the maximum number of samples that's safe to pop, based on the thread with the least amount of samples buffered. 更多... | |
| int32 | Num () |
| This returns the number of inputs currently connected to this patch mixer. 更多... | |
| int32 | PopAudio (float *OutBuffer, int32 OutNumSamples, bool bUseLatestAudio) |
| Mixes all inputs into a single buffer. 更多... | |
| void | RemovePatch (const FPatchInput &TapInput) |
| Removes a tap from the tap collector. 更多... | |
This class is used for retrieving and mixing down audio from multiple threads.
Important to note that this is MPSC: while multiple threads can enqueue audio on an instance of FPatchMixer using instances of FPatchInput, only one thread can call PopAudio safely.
| FPatchInput Audio::FPatchMixer::AddNewInput | ( | int32 | MaxLatencyInSamples, |
| float | InGain | ||
| ) |
Adds a new input to the tap collector.
Calling this is thread safe, but individual instances of FPatchInput are only safe to be used from one thread.
| int32 Audio::FPatchMixer::MaxNumberOfSamplesThatCanBePopped | ( | ) |
This function call gets the maximum number of samples that's safe to pop, based on the thread with the least amount of samples buffered.
Thread safe, but blocks for PopAudio.
| int32 Audio::FPatchMixer::Num | ( | ) |
This returns the number of inputs currently connected to this patch mixer.
Thread safe, but blocks for PopAudio.
| int32 Audio::FPatchMixer::PopAudio | ( | float * | OutBuffer, |
| int32 | OutNumSamples, | ||
| bool | bUseLatestAudio | ||
| ) |
Mixes all inputs into a single buffer.
This should only be called from a single thread. Returns the number of non-silent samples popped to OutBuffer.
| void Audio::FPatchMixer::RemovePatch | ( | const FPatchInput & | TapInput | ) |
Removes a tap from the tap collector.
Calling this is thread safe, though FPatchOutput will likely not be deleted until the next call of PopAudio.