UOdinDecoder
Represents a decoder for media streams from remote voice chat clients, which encapsulates all the components required to process incoming audio streams.
- Header:
#include "OdinAudio/OdinDecoder.h" - Module:
Odin - Inherits from:
UObject - Blueprint: Blueprint type, Blueprintable · Blueprint reference
Overview
Functions
| Name | Description |
|---|---|
ConstructDecoder | Create uobject decoder with already created decoder handle |
SetupInternalDecoder | Internally Creates a new instance of an ODIN decoder with default settings used to process the remote media stream. |
FreeDecoder | Frees the resources associated with the specified decoder. |
FreeDecoderInternal | |
GetOrCreateDecoderPipeline | Returns an object to the pointer of the internal ODIN audio pipeline instance used by the given decoder. |
GetOrCreatePipeline | Returns an object to the pointer of the internal ODIN audio pipeline instance used by the given decoder. |
GetIsSilent | Returns whether the decoder is currently processing silence. |
SetAudioEventHandler | Registers a callback to receive decoder audio events. |
GetActiveChannelMask | Returns a bitmask indicating the channels on which the most recently pushed voice packet was transmitted. |
GetPositions | Retrieves the last known 3D position(s) sent by the remote peer. |
Pop | Retrieves a block of processed audio samples from the decoder's buffer. |
Push | Pushes an incoming datagram to the specified decoder for processing. |
GetNativeHandle | Get internal handle |
GetHandle | |
SetHandle | Replace internal handle object |
GetHandleCell |
Properties
| Name | Description |
|---|---|
Pipeline | The audio pipeline of the decoder, once it was created. |
ChannelMask | The channels this decoder plays back. |
SampleRate | Sample rate of the audio the decoder produces. |
bStereo | True if the decoder produces interleaved stereo audio. |
Functions
ConstructDecoder
Overload 1
Static
Create uobject decoder with already created decoder handle
| Parameter | Type | Description |
|---|---|---|
WorldContextObject | UObject* | context lifetime object |
Handle | OdinDecoder* | incomplete internal handle type |
Returns UOdinDecoder* – uobject decoder or null
Overload 2
Static · Blueprint: Construct Decoder
Create uobject decoder with already created decoder handle
| Parameter | Type | Description |
|---|---|---|
WorldContextObject | UObject* | context lifetime object |
SampleRate | int32 | samplerate for f32bit Default: 48000. |
bUseStereo | bool | channels interleaved Default: false. |
Returns UOdinDecoder* – uobject decoder or null
SetupInternalDecoder
Blueprint: Create Decoder
Internally Creates a new instance of an ODIN decoder with default settings used to process the remote media stream. Will re-setup
| Parameter | Type | Description |
|---|---|---|
DecoderSampleRate | int32 | samplerate for f32bit |
bUseStereo | bool | channels interleaved |
Returns UOdinDecoder*
FreeDecoder
Static · Blueprint: Free Decoder
Frees the resources associated with the specified decoder.
| Parameter | Type | Description |
|---|---|---|
Decoder | UOdinDecoder* | The decoder to free. |
Returns bool – True if the decoder was freed.
FreeDecoderInternal
Static
| Parameter | Type | Description |
|---|---|---|
DecoderHandle | OdinDecoder* |
Returns bool
GetOrCreateDecoderPipeline
Static · Blueprint: Get Decoder Pipeline
Returns an object to the pointer of the internal ODIN audio pipeline instance used by the given decoder.
| Parameter | Type | Description |
|---|---|---|
Decoder | UOdinDecoder* | The decoder. |
Returns UOdinPipeline* – The pipeline.
GetOrCreatePipeline
Blueprint: Get Pipeline
Returns an object to the pointer of the internal ODIN audio pipeline instance used by the given decoder.
Returns UOdinPipeline*
GetIsSilent
Const · Blueprint: Get Silent Flag (Decoder)
Returns whether the decoder is currently processing silence. This reflects the internal silence detection state of the decoder, which updates as audio is processed.
Returns bool – True if silent.
Always returns true, if the passed decoder is invalid.
SetAudioEventHandler
Blueprint: Register AudioEvent Handler (Decoder)
Registers a callback to receive decoder audio events. The filter determines which event types will trigger the callback, allowing selective handling.
| Parameter | Type | Description |
|---|---|---|
EFilter | int32 | Bitmask filter for events. |
Returns bool – True if registration was successful.
Any previously registered callback is replaced.
GetActiveChannelMask
Const · Blueprint: Get Active ChannelMask
Returns a bitmask indicating the channels on which the most recently pushed voice packet was transmitted.
Returns int64 – Active channel mask.
If no packet has been processed yet, the value is 0.
GetPositions
Const · Blueprint: Get Positions (Decoder)
Retrieves the last known 3D position(s) sent by the remote peer. This data is available even if the audio stream is currently silent.
| Parameter | Type | Description |
|---|---|---|
ChannelMask | FOdinChannelMask | The channel mask. |
Returns TArray<FOdinPosition> – Array of positions, one for each channel in the mask.
Pop
Overload 1
Const · Blueprint: Pop Samples
Retrieves a block of processed audio samples from the decoder's buffer. The samples are interleaved floating-point values in the range[-1, 1] and are written into the provided output buffer.
| Parameter | Type | Description |
|---|---|---|
Samples | TArray<float>& | interleaved float buffer |
bSilence | bool& | A flag is also set to indicate if the output is silent |
Returns int32 – samples count
Overload 2
Const
| Parameter | Type | Description |
|---|---|---|
Samples | float* | |
Count | int32 | |
bSilence | bool* |
Returns int32
Push
Const · Blueprint: Push Datagram
Pushes an incoming datagram to the specified decoder for processing.
| Parameter | Type | Description |
|---|---|---|
Datagram | const TArray<uint8>& | audio byte array |
Returns int32 – datagram size
GetNativeHandle
Const · Inline
Get internal handle
Returns OdinDecoder* – incomplete handle type or nullptr
OdinDecoder operations are thread-safe and the same encoder handle may be accessed concurrently from multiple threads.
GetHandle
Const · Inline
Returns TWeakObjectPtr<UOdinHandle>
SetHandle
Replace internal handle object
| Parameter | Type | Description |
|---|---|---|
NewHandle | OdinDecoder* | internal handle |
GetHandleCell
Const · Inline
Returns TSharedRef<FOdinDecoderHandleCell, ESPMode::ThreadSafe>
Properties
Pipeline
Blueprint: Get
The audio pipeline of the decoder, once it was created.
ChannelMask
Blueprint: Get/Set
The channels this decoder plays back. Applied when the decoder is registered to a peer; voice packets on other channels are not routed to it.
SampleRate
Blueprint: Get
Sample rate of the audio the decoder produces.
bStereo
Blueprint: Get
True if the decoder produces interleaved stereo audio.
Events
OnAudioEventCallbackBP
Blueprint: On Audio Event (Decoder)
A callback invoked when the decoder reports one or more audio events.
Signature: FOdinDecoderAudioEventCallbackDelegate void(UOdinDecoder* decoder, EOdinAudioEvents filter) (multicast)
Please remember to start listening by calling SetAudioEventHandler!