Skip to main content
Version: 14 Oct 2024

MLAudioOutput

NameSpace: MagicLeap

Manages Audio.

Inherits from:
MLAutoAPISingleton< MLAudioOutput >,
MLLazySingleton< T >

Public Fields

AudioOutputDevice

Gets the audio output device.


public static Device AudioOutputDevice { get; set; }

TypeDescription
DeviceThe currently active output device.

MasterVolume

Gets the master volume for the device.


public static float MasterVolume { get; set; }


Public Methods

MLResult GetSoundBypassesMasterVolume

public static MLResult GetSoundBypassesMasterVolume(
out bool isBypassing
)

Parameters

TypeNameDescription
out boolisBypassing

delegate void MLAudioMediaEventDelegate

The delegate for audio output media event.

public delegate void MLAudioMediaEventDelegate(
MediaEvent mediaEvent
)

Parameters

TypeNameDescription
MediaEventdeviceThe new media event.

delegate void OnAudioOutputDeviceChangedDelegate

The delegate for audio output device changed event.

public delegate void OnAudioOutputDeviceChangedDelegate(
Device device
)

Parameters

TypeNameDescription
DevicedeviceThe new audio output device.

delegate void OnMasterVolumeChangedDelegate

The delegate for the master volume changed event.

public delegate void OnMasterVolumeChangedDelegate(
float volume
)

Parameters

TypeNameDescription
floatvolumeThe new master volume value.

MLResult SetSoundBypassesMasterVolume

public static MLResult SetSoundBypassesMasterVolume(
bool isBypassing
)

Parameters

TypeNameDescription
boolisBypassing

Protected Methods

StopAPI

Called by MLAutoAPISingleton on destruction

protected virtual override MLResult.Code StopAPI()

Parameters

TypeNameDescription
isSafeToAccessManagedObjectsNot Implemented

Reimplements: StopAPI


Update

Called every device frame

protected virtual override void Update()

Reimplements: Update


Public Events

OnAudioOutputDeviceChanged

Raised whenever the audio output device gets changed.

public static OnAudioOutputDeviceChangedDelegate OnAudioOutputDeviceChanged()

OnMasterVolumeChanged

Raised whenever the master volume gets changed.

public static OnMasterVolumeChangedDelegate OnMasterVolumeChanged()

OnMediaEvent

Raised whenever the media event happens.

public static MLAudioMediaEventDelegate OnMediaEvent()

Public Enums

ChannelFormatType

Possible channel formats for input and output streams.

EnumeratorValueDescription
Default
AmbisonicAmbix

ChannelLayouts

Definition of some of the known Channel Layouts. These layouts are based on ChannelMask composite of individual channel masks.

EnumeratorValueDescription
NoneChannelMask.None
MonoChannelMask.FrontLeftMask shortcut for Mono audio output.
StereoChannelMask.FrontLeftChannelMask.FrontRight
StereoFrontCenterStereoChannelMask.FrontCenter
QuadChannelMask.FrontLeftChannelMask.FrontRight
ChannelMask.BackLeftChannelMask.BackRightMask shortcut for Quad audio output.
QuadFrontCenterQuadChannelMask.FrontCenter
SurroundChannelMask.FrontLeftChannelMask.FrontRight
ChannelMask.BackCenterMask shortcut for surround audio output.
FivePointOneChannelMask.FrontLeftChannelMask.FrontRight
ChannelMask.BackLeftChannelMask.BackRight
ChannelMask.LowFrequencyEffectsMask shortcut for 5.1 audio output.
FivePointOneBackCenterFivePointOneChannelMask.BackCenter
SevenPointOneFivePointOneChannelMask.FrontLeftOfCenter
SevenPointOneSurroundFivePointOneChannelMask.SideLeft

ChannelMask

Audio output channels mask for track type. Bits order matches the C API. These masks are an ORed composite of individual channel masks. For example MLAudioOutput.ChannelLayout.Stereo is composed of MLAudioOutput.ChannelMask.FrontLeft and MLAudioOutput.ChannelMask.FrontRight. Reference:

EnumeratorValueDescription
None0
FrontLeft0x1
FrontRight0x2
FrontCenter0x4
LowFrequencyEffects0x8
BackLeft0x10
BackRight0x20
FrontLeftOfCenter0x40
FrontRightOfCenter0x80
BackCenter0x100
SideLeft0x200
SideRight0x400
TopCenter0x800
TopFrontLeft0x1000
TopFrontCenter0x2000
TopFrontRight0x4000
TopBackLeft0x8000
TopBackCenter0x10000
TopBackRight0x20000

Details*

* https://android.googlesource.com/platform/frameworks/base/+/b267554/media/java/android/media/AudioFormat.java * https://trac.ffmpeg.org/wiki/AudioChannelManipulation#Listchannelnamesandstandardchannellayouts


Device

The currently active output device.

EnumeratorValueDescription
WearableBuilt-in speakers in the wearable.
AnalogJack3.5mm jack on the belt pack.

MediaEvent

Possible media control events initiated by the user.

EnumeratorValueDescription
PlayIndicates a user command to play
StopIndicates a user command to stop.
PauseIndicates a user command to pause.
NextTrackIndicates a user command to go to next track.
PrevTrackIndicates a user command to go to previous track.

SampleFormatType

Possible sample formats for input and output streams.

EnumeratorValueDescription
Int
Float