UOdinPipeline
A highly dynamic audio processing chain that manages a thread-safe collection of filters like voice activity detection, echo cancellation, noise suppression and even custom effects. This allows sequential processing and real-time modification of audio streams through operations like insertion, removal, reordering and configuration updates.
- Header:
#include "OdinAudio/OdinPipeline.h" - Module:
Odin - Inherits from:
UObject - Blueprint: Blueprint type · Blueprint reference
Overview
Functions
| Name | Description |
|---|---|
ConstructPipeline | |
GetEffectCount | Retrieves the total number of effects currently in the audio pipeline. |
GetEffectId | Returns the unique effect identifier from an audio pipeline corresponding to the effect located at the specified index. |
GetEffectIndex | Searches the specified audio pipeline for the effect with the specified effect_id and returns its current index. |
GetEffectType | Obtains the effect type (VAD, APM, or Custom) for the effect identified by effect_id. |
MoveEffect | Reorders the audio pipeline by moving the effect with the specified EffectId to a new index. |
RemoveEffect | Deletes the effect identified by effect_id from the specified audio pipeline. |
RemoveEffectWithCleanup | Removes the effect via the native API and performs the same cache and listener cleanup as RemoveEffect, but returns the raw error code. |
InsertCustomEffect | Inserts a user-defined custom effect at the specified index in the audio pipeline. |
InsertCustomEffectNative | Same as InsertCustomEffect (registers the effect's FFI trampoline and parent wiring), but returns the raw error code. |
InsertVadEffect | Inserts a Voice Activity Detection (VAD) effect into the audio pipeline at the specified index and returns a unique effect identifier. |
GetVadConfig | Retrieves the configuration for a VAD effect identified by effect_id from the specified audio pipeline. |
SetVadConfig | Updates the configuration settings of the VAD effect identified by effect_id in the specified audio pipeline. |
InsertViEffect | Inserts a Voice Isolation (VI) effect into the audio pipeline at the specified index and returns a unique effect identifier. |
GetViConfig | Retrieves the configuration for a VI effect identified by effect_id from the specified audio pipeline. |
SetViConfig | Updates the configuration settings of the VI effect identified by effect_id in the specified audio pipeline. |
InsertApmEffect | Inserts an APM effect into the pipeline at the specified index. |
GetApmPlaybackFormat | Retrieves the playback format that was declared when the APM effect was inserted via InsertApmEffect. |
RegisterApmPlaybackFormat | Records the playback format an APM effect was inserted with, so the submix listener can convert the reverse stream accordingly. |
SetApmConfig | Updates the configuration settings of the APM effect identified by effect_id in the specified audio pipeline. |
SetApmConfigNative | Same as SetApmConfig (including the OnApmConfigChanged broadcast that arms the submix listener), but returns the raw error code. |
GetApmConfig | Retrieves the configuration for an APM effect identified by effect_id from the specified audio pipeline. |
UpdateApmPlayback | Updates the specified APM effect's sample buffer for processing the reverse (playback) audio stream. |
CreateActivityEffect | PRESET: Codec-Effect for the odin audio pipeline. |
AppendActivityEffect | Creates a Activity Effect and adds it at the end of the pipeline. |
CreateCloneEffect | PRESET: Codec-Effect for the odin audio pipeline. |
AppendCloneEffect | Creates a Clone Effect and adds it at the end of the pipeline. |
CreateMuteEffect | PRESET: Codec-Effect for the odin audio pipeline. |
AppendMuteEffect | Creates a Mute Effect and adds it at the end of the pipeline. |
CreateVolumeEffect | PRESET: creates a UOdinVolumeEffect, which scales the samples by SampleScale (linear, raised to ScaleExponent, or in decibels if VolumeLog10 is set), and inserts it at the given index. |
AppendVolumeEffect | Creates a Volume Effect and adds it at the end of the pipeline. |
CreateRmsEffect | PRESET: Codec-Effect for the odin audio pipeline. |
AppendRmsEffect | Creates a RMS Effect and adds it at the end of the pipeline. |
GetHandle | |
SetHandle | |
InvalidateHandle | Called by the owning encoder or decoder before it frees the native pipeline along with its handle. |
Functions
ConstructPipeline
Static
| Parameter | Type | Description |
|---|---|---|
WorldContextObject | UObject* | |
Handle | const OdinPipeline* |
Returns UOdinPipeline*
GetEffectCount
Const · Blueprint: Get Effect Count
Retrieves the total number of effects currently in the audio pipeline.
Returns int32 – effect count
GetEffectId
Const · Blueprint: Get Effect Id
Returns the unique effect identifier from an audio pipeline corresponding to the effect located at the specified index.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | index of effect |
Returns int32 – effect id
GetEffectIndex
Const · Blueprint: Get Effect Index
Searches the specified audio pipeline for the effect with the specified effect_id and returns its current index.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | id of effect |
Returns int32 – effect index
GetEffectType
Const · Blueprint: Get Effect Type
Obtains the effect type (VAD, APM, or Custom) for the effect identified by effect_id.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | id of effect |
Returns EOdinEffectType – effect type
MoveEffect
Blueprint: Move Effect
Reorders the audio pipeline by moving the effect with the specified EffectId to a new index.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | Effect for which the index should be changed |
Index | int32 | new index |
Returns bool – true on success
RemoveEffect
Blueprint: Remove Effect
Deletes the effect identified by effect_id from the specified audio pipeline.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | id of effect |
Returns bool – true on success
RemoveEffectWithCleanup
Removes the effect via the native API and performs the same cache and listener cleanup as RemoveEffect, but returns the raw error code. Every path that removes effects from this pipeline must go through one of the two, otherwise the submix listener keeps feeding the removed effect.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | id of effect |
Returns OdinError – the native result code
InsertCustomEffect
Blueprint: Insert Custom Effect
Inserts a user-defined custom effect at the specified index in the audio pipeline. The effect is implemented via a callback function and associated user data. A unique effect identifier is returned.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Effect | UOdinCustomEffect* | effect object |
Returns int32 – the new effect id or 0
Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.
InsertCustomEffectNative
Same as InsertCustomEffect (registers the effect's FFI trampoline and parent wiring), but returns the raw error code. Used by the native async Blueprint path.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | |
Effect | UOdinCustomEffect* | |
OutEffectId | uint32& |
Returns OdinError
InsertVadEffect
Blueprint: Insert VAD Effect
Inserts a Voice Activity Detection (VAD) effect into the audio pipeline at the specified index and returns a unique effect identifier.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns int32 – the new effect id or 0
Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.
GetVadConfig
Const · Blueprint: Get VAD Config
Retrieves the configuration for a VAD effect identified by effect_id from the specified audio pipeline.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Returns FOdinVadConfig – VAD config
Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.
If the effect was disabled the resulting config object is filled with default values/empty
SetVadConfig
Blueprint: Set VAD Config
Updates the configuration settings of the VAD effect identified by effect_id in the specified audio pipeline.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Config | FOdinVadConfig | the config to set |
Returns bool – true on success
InsertViEffect
Blueprint: Insert VI Effect
Inserts a Voice Isolation (VI) effect into the audio pipeline at the specified index and returns a unique effect identifier. The effect starts out disabled and needs an explicit configuration to start filtering.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns int32 – the new effect id or 0
Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.
The first instance loads the underlying inference model, which can take several hundred milliseconds; additional instances share the already loaded model.
GetViConfig
Const · Blueprint: Get VI Config
Retrieves the configuration for a VI effect identified by effect_id from the specified audio pipeline.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Returns FOdinViConfig – VI config
If the effect was disabled the resulting config object is filled with default values/empty
SetViConfig
Blueprint: Set VI Config
Updates the configuration settings of the VI effect identified by effect_id in the specified audio pipeline. Re-enabling a disabled effect also resets its internal state.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Config | FOdinViConfig | the config to set |
Returns bool – true on success
InsertApmEffect
Blueprint: Insert APM Effect
Inserts an APM effect into the pipeline at the specified index.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | The position at which the APM effect should be inserted in the pipeline. |
SampleRate | int32 | The playback sample rate for the APM effect. 0 uses the current audio mixer sample rate. Default: 0. |
bStereo | bool | A boolean indicating whether the APM effect should use stereo (true) or mono (false) mode. Default: true. |
Returns int32 – The unique identifier of the inserted APM effect if the operation is successful, or -1 if an error occurs.
Index is shifting subsequent effects. An index of 0 inserts at the beginning of the pipeline.
The playback format describes the samples fed into the echo-cancellation reverse stream. In this plugin that source is the UE main submix, so the defaults (0 = current audio mixer sample rate, stereo) are the right choice unless the reverse stream is fed manually with a different format.
GetApmPlaybackFormat
Const
Retrieves the playback format that was declared when the APM effect was inserted via InsertApmEffect.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
OutSampleRate | int32& | the playback sample rate the effect was inserted with |
bOutStereo | bool& | whether the effect was inserted with a stereo playback stream |
Returns bool – true if the effect id is known to this pipeline
RegisterApmPlaybackFormat
Records the playback format an APM effect was inserted with, so the submix listener can convert the reverse stream accordingly. Called by InsertApmEffect; must also be called by any path that inserts an APM effect into this pipeline directly via the native API.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id returned by the native insert call |
SampleRate | int32 | the declared playback sample rate |
bStereo | bool | whether the declared playback stream is stereo |
SetApmConfig
Blueprint: Set APM Config
Updates the configuration settings of the APM effect identified by effect_id in the specified audio pipeline.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Config | FOdinApmConfig | the config to set |
Returns bool – true on success
SetApmConfigNative
Same as SetApmConfig (including the OnApmConfigChanged broadcast that arms the submix listener), but returns the raw error code. Used by the native async Blueprint path.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | |
Config | FOdinApmConfig |
Returns OdinError
GetApmConfig
Const · Blueprint: Get APM Config
Retrieves the configuration for an APM effect identified by effect_id from the specified audio pipeline.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Returns FOdinApmConfig – APM config
if the effect was disabled the resulting config object is filled with default values/empty
UpdateApmPlayback
Overload 1
Blueprint: Update APM Playback
Updates the specified APM effect's sample buffer for processing the reverse (playback) audio stream. The provided samples must be interleaved float values in the range [-1, 1]. The delay parameter is used to align the reverse stream processing with the forward (capture) stream.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | effect id |
Samples | TArray<float>& | audio buffer |
Delay | int32 | delay in milliseconds (ms) Default: 10. |
Returns bool – true on success
The delay can be expressed as:
delay = (t_render - t_analyze) + (t_process - t_capture)
where:
-
t_renderis the time the first sample of the same frame is rendered by the audio hardware. -
t_analyzeis the time the frame is processed in the reverse stream. -
t_captureis the time the first sample of a frame is captured by the audio hardware. -
t_processis the time the frame is processed in the forward stream.
Overload 2
Updates the specified APM effect's sample buffer for processing the reverse (playback) audio stream. The provided samples must be interleaved float values in the range [-1, 1]. The delay parameter is used to align the reverse stream processing with the forward (capture) stream. The delay can be expressed as:
delay = (t_render - t_analyze) + (t_process - t_capture)
where: - t_render is the time the first sample of the same frame is rendered by the audio hardware. - t_analyze is the time the frame is processed in the reverse stream. - t_capture is the time the first sample of a frame is captured by the audio hardware. - t_process is the time the frame is processed in the forward stream.
| Parameter | Type | Description |
|---|---|---|
EffectId | int32 | |
Samples | const float* | |
Count | int32 | |
Delay | int32 | Default: 10. |
Returns bool
CreateActivityEffect
Blueprint: Create Activity Effect
PRESET: Codec-Effect for the odin audio pipeline. The effect will invoke activity event and field based on the silent flag. Event is dispatched to the GameThread.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns UOdinActivityEffect* – the custom effect object
AppendActivityEffect
Blueprint: Append Activity Effect
Creates a Activity Effect and adds it at the end of the pipeline. The effect raises Activity Callback whenever the audio switches between silent and active, e.g. to drive a "speaking" indicator.
Returns UOdinActivityEffect* – The created Activity Effect. Keep it to change its properties at runtime.
CreateCloneEffect
Blueprint: Create Clone Effect
PRESET: Codec-Effect for the odin audio pipeline. The effect will invoke Callback function with a copy of samples buffer and if bound to the delegate, a clone of that buffer. Callback will be called on the GameThread by default.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns UOdinCloneEffect* – the custom effect object
AppendCloneEffect
Blueprint: Append Clone Effect
Creates a Clone Effect and adds it at the end of the pipeline. The effect copies the audio that passes through the pipeline and hands it to On Dispatch Clone Callback on the game thread, e.g. for recording or analysis.
Returns UOdinCloneEffect* – The created Clone Effect. Keep it to change its properties at runtime.
CreateMuteEffect
Blueprint: Create Mute Effect
PRESET: Codec-Effect for the odin audio pipeline. The effect will mutate the silent flag based on the mute uproperty. Sets the flag for following chaining effects in the pipeline as well. Symbolizing silenced audio data without changing the buffer. This results in not necessarily sending the audio packet over the network at all.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns UOdinMuteEffect* – the custom effect object
AppendMuteEffect
Blueprint: Append Mute Effect
Creates a Mute Effect and adds it at the end of the pipeline. Set its Mute Flag to Set to mark the audio as silent, so nothing is transmitted, and to Unset or None to let it pass. Effects after it in the pipeline see the silent flag as well. See the Push To Talk guide.
Returns UOdinMuteEffect* – The created Mute Effect. Keep it to change its properties at runtime.
CreateVolumeEffect
Blueprint: Create Volume Effect
PRESET: creates a UOdinVolumeEffect, which scales the samples by SampleScale (linear, raised to ScaleExponent, or in decibels if VolumeLog10 is set), and inserts it at the given index.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns UOdinVolumeEffect* – the custom effect object
AppendVolumeEffect
Blueprint: Append Volume Effect
Creates a Volume Effect and adds it at the end of the pipeline. The effect multiplies the samples by Sample Scale (raised to Scale Exponent), or treats Sample Scale as a gain in decibels when Volume Log10 is set.
Returns UOdinVolumeEffect* – The created Volume Effect. Keep it to change its properties at runtime.
CreateRmsEffect
Blueprint: Create Rms Effect
PRESET: Codec-Effect for the odin audio pipeline. The effect will set RMS-dBFS based on samples.
| Parameter | Type | Description |
|---|---|---|
Index | int32 | desired index |
Returns UOdinRmsEffect* – the custom effect object
AppendRmsEffect
Blueprint: Append Rms Effect
Creates a RMS Effect and adds it at the end of the pipeline. The effect measures the loudness of the audio as RMS in dBFS and stores it in Rms Dbfs.
Returns UOdinRmsEffect* – The created RMS Effect. Keep it to change its properties at runtime.
GetHandle
Const · Inline
Returns const OdinPipeline*
SetHandle
| Parameter | Type | Description |
|---|---|---|
NewHandle | const OdinPipeline* |
InvalidateHandle
Called by the owning encoder or decoder before it frees the native pipeline along with its handle.
Events
OnApmConfigChanged
Blueprint: On Apm Config Changed
Raised when the configuration of an APM effect in this pipeline changes through Set APM Config.
Signature: FApmConfigChangedDelegate void(UOdinPipeline* Pipeline, int32 EffectId, FOdinApmConfig NewApmConfig) (multicast)