Skip to main content
Version: 2.x

Class MediaDecoder

Odin Playback Media

Declaration
public class MediaDecoder : IMedia, IDisposable

Implements:
OdinNative.Wrapper.Media.IMedia, System.IDisposable

Properties

Id

Media id

Declaration
public ulong Id { get; }

IsPaused

Declaration
public bool IsPaused { get; }

Samplerate

Output samplerate

Declaration
public uint Samplerate { get; }

Stereo

Output channel flag

Declaration
public bool Stereo { get; }

IsAlive

Flag if the native decoder handle is still usable, e.g. false after the peer left and the decoder was disposed

Declaration
public bool IsAlive { get; }

Pipeline

Odin effect pipeline

Declaration
public MediaPipeline Pipeline { get; set; }

ChannelMask

Declaration
public Utility.ChannelMask ChannelMask { get; }

Position

Declaration
public NativeBindings.OdinPosition Position { get; }

ListenChannelMask

Channels this decoder accepts incoming datagrams for when routed by OdinNative.Wrapper.Room.Room.Room_OnDatagram(System.Object,OdinNative.Wrapper.Room.DatagramEventArgs) . Defaults to OdinNative.Core.Utility.ChannelMask.All so a single decoder receives every channel of its peer.

Declaration
public Utility.ChannelMask ListenChannelMask { get; set; }

Parent

Default value null indicates root or not set

Declaration
public IPeer Parent { get; set; }

Methods

Create(uint, bool)

Create a new dangling output media.

Declaration
public static MediaDecoder Create(uint samplerate, bool stereo)
Returns

OdinNative.Wrapper.MediaDecoder: output media

Parameters
TypeNameDescription
System.UInt32sampleratesamplerate
System.Booleanstereostereo flag

GetPipeline()

Get native effect pipeline

Declaration
public MediaPipeline GetPipeline()
Returns

OdinNative.Wrapper.MediaPipeline: managed effect pipeline

GetPositions(ChannelMask)

Get native position in channel

Declaration
public NativeBindings.OdinPosition[] GetPositions(Utility.ChannelMask mask)
Returns

OdinNative.Core.Imports.NativeBindings.OdinPosition[]: 3d position array

Parameters
TypeNameDescription
OdinNative.Core.Utility.ChannelMaskmaskchannel mask to get position from

GetPosition(ChannelMask)

Get first native position of any channel

Declaration
public NativeBindings.OdinPosition GetPosition(Utility.ChannelMask mask)
Returns

OdinNative.Core.Imports.NativeBindings.OdinPosition: 3d position

Parameters
TypeNameDescription
OdinNative.Core.Utility.ChannelMaskmaskchannel mask to get position from

GetChannels()

Get active native channels

Declaration
public Utility.ChannelMask GetChannels()
Returns

OdinNative.Core.Utility.ChannelMask: channel mask

GetIsSilent()

This reflects the internal silence detection state of the decoder, which updates as audio is processed

Declaration
public bool GetIsSilent()
Returns

System.Boolean: Returns whether the decoder is currently processing silence

Pop(ref float[], out bool)

Pop output audio from the media

Declaration
public bool Pop(ref float[] audio, out bool isSilent)
Returns

System.Boolean: true on success or false

Parameters
TypeNameDescription
System.Single[]audiosamples
System.BooleanisSilentflag whether the popped buffer contains silence

Push(float[])

Push output audio into the media for effect processing

Declaration
public bool Push(float[] datagram)
Returns

System.Boolean: true on success or false

Parameters
TypeNameDescription
System.Single[]datagramsamples

Push(nint, int)

Declaration
protected bool Push(nint datagramPtr, int datagramLength)
Returns

System.Boolean

Parameters
TypeName
System.IntPtrdatagramPtr
System.Int32datagramLength

Dispose(bool)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeName
System.Booleandisposing

Dispose()

Free native media decoder

Declaration
public void Dispose()

Implements