Navigation
API > API/Runtime > API/Runtime/SignalProcessing
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.
| Name | FPatchMixer |
| Type | class |
| Header File | /Engine/Source/Runtime/SignalProcessing/Public/DSP/MultithreadedPatching.h |
| Include Path | #include "DSP/MultithreadedPatching.h" |
Syntax
class FPatchMixer
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CurrentInputs | TArray< FPatchOutputStrongPtr > | Only accessed within PopAudio. Indirect array of taps that are mixed in during PopAudio. | DSP/MultithreadedPatching.h | |
| CurrentPatchesCriticalSection | FCriticalSection | DSP/MultithreadedPatching.h | ||
| DisconnectedInputs | TArray< int32 > | Patch IDs of individual audio taps that will be removed on the next call of CleanUpDisconnectedPatches. | DSP/MultithreadedPatching.h | |
| InputDeletionCriticalSection | FCriticalSection | Contended by RemoveTap, AddNewPatch, and ConnectNewPatches. | DSP/MultithreadedPatching.h | |
| PendingNewInputs | TArray< FPatchOutputStrongPtr > | New taps are added here in AddNewPatch, and then are moved to CurrentPatches in ConnectNewPatches. | DSP/MultithreadedPatching.h | |
| PendingNewInputsCriticalSection | FCriticalSection | Contended by AddNewPatch, ConnectNewPatches and CleanUpDisconnectedTaps. | DSP/MultithreadedPatching.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddNewInput
(
const FPatchInput& InPatchInput |
Adds an existing patch input to the patch mixer. | DSP/MultithreadedPatching.h | |
FPatchInput AddNewInput
(
int32 MaxLatencyInSamples, |
Adds a new input to the tap collector. | DSP/MultithreadedPatching.h | |
void DisconnectAllInputs() |
Disconnect everything currently connected to this mixer. | DSP/MultithreadedPatching.h | |
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. | DSP/MultithreadedPatching.h | |
int32 Num () |
This returns the number of inputs currently connected to this patch mixer. | DSP/MultithreadedPatching.h | |
int32 PopAudio
(
float* OutBuffer, |
Mixes all inputs into a single buffer. | DSP/MultithreadedPatching.h | |
void RemovePatch
(
const FPatchInput& InPatchInput |
Removes a tap from the tap collector. | DSP/MultithreadedPatching.h | |
bool WaitUntilNumSamplesAvailable
(
int32 NumSamples, |
Pauses the current thread until there are the given number of samples available to pop. | DSP/MultithreadedPatching.h |