Skip to main content
Version: 20 Mar 2024

NativeBindings

Native bindings for the MLWebRTC.AudioSink class.

Inherits from:
MagicLeapNativeBindings

Public Methods

MLResult.Code MLWebRTCAudioSinkCreate

Creates an audio sink.

public MLResult.Code MLWebRTCAudioSinkCreate(
out ulong sinkHandle
)

Parameters

TypeNameDescription
out ulongsinkHandleThe handle to the audio sink to return to the caller.

Returns: MLResult.Result will be MLResult.Code.Ok if the audio sink was successfully created. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCAudioSinkCreateEx

Creates an audio sink with the provided params.

public MLResult.Code MLWebRTCAudioSinkCreateEx(
ref MLWebRTCAudioSinkParams sinkParams,
out ulong sinkHandle
)

Parameters

TypeNameDescription
ref MLWebRTCAudioSinkParamssinkParamsParameters to use to create the audio sink.
out ulongsinkHandleThe handle to the audio sink to return to the caller.

Returns: MLResult.Result will be MLResult.Code.Ok if the audio sink was successfully created. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCAudioSinkDestroy

Destroys an audio sink.

public MLResult.Code MLWebRTCAudioSinkDestroy(
ulong sinkHandle
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCAudioSinkResetPosition

Resets the world position of an audio sink for spatialized audio.

public MLResult.Code MLWebRTCAudioSinkResetPosition(
ulong sinkHandle
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCAudioSinkSetCacheSize

Sets the number of milliseconds of audio that should be cached in the buffers before dropping the packets. Dictates the audio latency when app recovers from lifecycle state transitions like standby & reality. Default is 200ms.

public MLResult.Code MLWebRTCAudioSinkSetCacheSize(
ulong sinkHandle,
uint millisecondsToCache
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
uintmillisecondsToCacheHow many milliseconds worth of audio to cache.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCAudioSinkSetDirectSoundLevels

Sets the direct spatial sound send levels of an audio sink channel.

public MLResult.Code MLWebRTCAudioSinkSetDirectSoundLevels(
ulong sinkHandle,
ref MLWebRTCAudioSinkSoundLevels soundLevels
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ref MLWebRTCAudioSinkSoundLevelssoundLevelsThe sound levels & channel to set the audio sink spatialization for.

Returns: MLResult.Result will be MLResult.Code.Ok if spatialization settings were set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetPosition

Sets the world position of an audio sink for spatialized audio.

public MLResult.Code MLWebRTCAudioSinkSetPosition(
ulong sinkHandle,
in MagicLeapNativeBindings.MLVec3f position
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
in MagicLeapNativeBindings.MLVec3fpositionThe position to set the audio sink to.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.


MLResult.Code MLWebRTCAudioSinkSetPositionEx

Sets the world position of an audio sink channel.

public MLResult.Code MLWebRTCAudioSinkSetPositionEx(
ulong sinkHandle,
ref MLWebRTCAudioSinkPosition position
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ref MLWebRTCAudioSinkPositionpositionThe position & channel to set the audio sink spatialization for.

Returns: MLResult.Result will be MLResult.Code.Ok if spatialization settings were set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetRoomSoundLevels

Sets the room spatial sound send levels of an audio sink channel.

public MLResult.Code MLWebRTCAudioSinkSetRoomSoundLevels(
ulong sinkHandle,
ref MLWebRTCAudioSinkSoundLevels soundLevels
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ref MLWebRTCAudioSinkSoundLevelssoundLevelsThe sound levels & channel to set the audio sink spatialization for.

Returns: MLResult.Result will be MLResult.Code.Ok if spatialization settings were set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetSoundDistanceProperties

Sets the distance properties of an audio sink channel.

public MLResult.Code MLWebRTCAudioSinkSetSoundDistanceProperties(
ulong sinkHandle,
ref MLWebRTCAudioSinkSoundDistance soundDistance
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ref MLWebRTCAudioSinkSoundDistancesoundDistanceThe sound distance & channel to set the audio sink spatialization for.

Returns: MLResult.Result will be MLResult.Code.Ok if spatialization settings were set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetSoundOrientation

Sets the world orientation of an audio sink channel.

public MLResult.Code MLWebRTCAudioSinkSetSoundOrientation(
ulong sinkHandle,
ref MLWebRTCAudioSinkOrientation orientation
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ref MLWebRTCAudioSinkOrientationorientationThe orientation & channel to set the audio sink spatialization for.

Returns: MLResult.Result will be MLResult.Code.Ok if spatialization settings were set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetSoundRadiationProperties

Sets the radiation properties of an audio sink channel.

public MLResult.Code MLWebRTCAudioSinkSetSoundRadiationProperties(
ulong sinkHandle,
ref MLWebRTCAudioSinkSoundRadiation soundRadiation
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ref MLWebRTCAudioSinkSoundRadiationsoundRadiationThe sound radiation & channel to set the audio sink spatialization for.

Returns: MLResult.Result will be MLResult.Code.Ok if spatialization settings were set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetSoundVolume

Sets the volume of an audio sink.

public MLResult.Code MLWebRTCAudioSinkSetSoundVolume(
ulong sinkHandle,
float volume
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
floatvolumeThe sink volume.

Returns: MLResult.Result will be MLResult.Code.Ok if the volume was set successfully. MLResult.Result will be MLResult.Code.WebRTCResultInstanceNotCreated if MLWebRTC instance was not created. MLResult.Result will be MLResult.Code.WebRTCResultMismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.InvalidParam if an incorrect param was sent.


MLResult.Code MLWebRTCAudioSinkSetSource

Sets the source of an audio sink.

public MLResult.Code MLWebRTCAudioSinkSetSource(
ulong sinkHandle,
ulong sourceHandle
)

Parameters

TypeNameDescription
ulongsinkHandleThe handle to the audio sink.
ulongsourceHandleThe handle to the source to set onto the audio sink.

Returns: MLResult.Result will be MLResult.Code.Ok if destroying all handles was successful. MLResult.Result will be MLResult.Code.MismatchingHandle if an incorrect handle was sent. MLResult.Result will be MLResult.Code.PermissionDenied if necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to other internal error.