Class OdinDecoder
Wrapper class of OdinNative.Wrapper.MediaDecoder for Unity (requires AudioSource)
This convenient class provides predefined helper functions to cover default use cases where the voice chat needs to work with AudioSource, AudioClip, AudioMixer, ...
Default Unity GameObject altering functions:
- OdinNative.Unity.OdinDecoder.AddApm()Add OdinNative.Unity.Audio.OdinApmComponent to the current GameObject
- OdinNative.Unity.OdinDecoder.AddVad()Add OdinNative.Unity.Audio.OdinVadComponent to the current GameObject
- OdinNative.Unity.OdinDecoder.AddVi()Add OdinNative.Unity.Audio.OdinViComponent to the current GameObject
- OdinNative.Unity.OdinDecoder.AddVolumeBoost()Add OdinNative.Unity.Audio.OdinVolumeBoostComponent to the current GameObject
- OdinNative.Unity.OdinDecoder.AddMute()Add OdinNative.Unity.Audio.OdinMuteAudioComponent to the current GameObject
Inheritance: System.Object -> UnityEngine.Object -> UnityEngine.Component -> UnityEngine.Behaviour -> UnityEngine.MonoBehaviour
Implements:
OdinNative.Wrapper.Media.IMedia
Properties
OutSampleRate
Playback samplerate reported by Unity, or OdinNative.Unity.OdinRoom.DefaultSampleRate when the Unity audio engine is disabled.
OutChannels
Gets the playback channel count derived from AudioSettings.speakerMode, clamped to stereo (1 or 2).
Parent
The peer that owns this decoder. Set by OdinNative.Unity.OdinPeer.AddDecoderComponent(UnityEngine.GameObject,System.UInt64,System.Boolean) and used as the
abstraction boundary — allows swapping the native wrapper for a web bridge without changing SDK components.
Id
Odin media id
MediaDecoder
Media reference
SpatialBlend
Property of AudioSource
RolloffMode
Property of AudioSource
MinDistance
Property of AudioSource
MaxDistance
Property of AudioSource
Activity
Media activity state flag
ChannelMask
Position
Server side position
Fields
Playback
Actual Unity audio output component
Room
The OdinNative.Unity.OdinRoom this decoder belongs to
PeerId
The peer id this decoder plays back audio for
AudioMixerGroup
Unity mixer
OnActiveStateChanged
Trigger on OdinNative.Unity.OdinDecoder.Activity changed
AutoDestroyAudioSource
Flag for destroy OdinNative.Unity.OdinDecoder.Playback linked AudioSource
AutoDestroyMediaStream
Flag for dispose of OdinNative.Unity.OdinDecoder.MediaDecoder
Methods
GetPipeline()
Get native effect pipeline
Returns
OdinNative.Wrapper.MediaPipeline: managed effect pipeline
AddApm()
Returns
OdinNative.Unity.Audio.OdinApmComponent
AddVad()
Returns
OdinNative.Unity.Audio.OdinVadComponent
AddVi()
Returns
OdinNative.Unity.Audio.OdinViComponent
AddVolumeBoost()
Returns
OdinNative.Unity.Audio.OdinVolumeBoostComponent
AddMute()
Returns
OdinNative.Unity.Audio.OdinMuteAudioComponent
AddEffect<T>()
Returns
<T>
Type Parameters
T
AddEffect<T>(T)
Returns
<T>
Parameters
| Type | Name |
|---|---|
<T> | effect |
Type Parameters
T
AddEffect<T>(UnityAction<OdinTArray<float>, bool, T>, T)
Returns
OdinNative.Wrapper.Media.CustomEffect<T>
Parameters
| Type | Name |
|---|---|
UnityEngine.Events.UnityAction<OdinNative.Core.Imports.NativeBindings.OdinTArray<System.Single>,System.Boolean,<T>> | callback |
<T> | userData |
Type Parameters
T
SetDecoder(MediaDecoder)
Parameters
| Type | Name |
|---|---|
| OdinNative.Wrapper.MediaDecoder | decoder |
GetPosition()
Get unity translated 3d vector from OdinNative.Core.Imports.NativeBindings.OdinPosition to use the Quaternion and the Matrix4x4 classes for rotating or transforming vectors and points
Returns
UnityEngine.Vector3: A new vector with given x, y, z components.
ReadOdinAudioData()
GetFrameBufferSize()
Returns
System.Single
CheckResetFrameBuffer(float)
Parameters
| Type | Name |
|---|---|
System.Single | audioBufferSize |
SetAudioSourcePtich(float)
Forward for the previous misspelled name
Parameters
| Type | Name |
|---|---|
System.Single | audioBufferSize |
SetAudioSourcePitch(float)
Parameters
| Type | Name |
|---|---|
System.Single | audioBufferSize |