NativeBindings
See ml_audio.h for additional comments.
Inherits from:
MagicLeapNativeBindings
Public Methods
MLResult.Code MLAudioGetMasterVolume
Gets the value of the master volume.
public MLResult.Code MLAudioGetMasterVolume(
out float volume
)
Parameters
Type | Name | Description |
---|---|---|
out float | volume | The value of the master volume. |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.InvalidParam if input parameter is invalid. MLResult.Result will be MLResult.Code.NotImplemented .
MLResult.Code MLAudioGetOutputDevice
Gets the current audio output device.
public MLResult.Code MLAudioGetOutputDevice(
out MLAudioOutput.Device device
)
Parameters
Type | Name | Description |
---|---|---|
out MLAudioOutput.Device | device | The audio output device. |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.InvalidParam if input parameter is invalid. MLResult.Result will be MLResult.Code.NotImplemented .
IntPtr MLAudioGetResultString
Gets the result string for a MLResult.Code.
public IntPtr MLAudioGetResultString(
MLResult.Code result
)
Parameters
Type | Name | Description |
---|---|---|
MLResult.Code | result | The MLResult.Code to be requested. |
Returns: A pointer to the result string.
MLResult.Code MLAudioGetSoundBypassesMasterVolume
Queries whether a sound output is exempt from attenuation due to master volume. This call reports whether the output from a sound output is bypassing master volume, making it effectively "always audible" (assuming it is neither muted nor set to zero volume on a per-sound basis). This option can only be set on medical-enabled devices(60601 compliant), and will only work for non-spatial sounds.Non-spatial sound parameters such as volume, mute, pitch and looping are still in effect for sounds that are bypassing master volume.
public MLResult.Code MLAudioGetSoundBypassesMasterVolume(
ulong audioHandle,
out bool isBypassing
)
Parameters
Type | Name | Description |
---|---|---|
ulong | audioHandle | |
out bool | isBypassing |
MLResult.Code MLAudioGetSpatialSoundEnable
Enables/disables 3D audio processing for a sound output.
public MLResult.Code MLAudioGetSpatialSoundEnable(
ulong handle,
out bool enabled
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | MLHandle used to identify the sound output. |
out bool | enabled | Indicates whether 3D processing is on or off. |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.AudioHandleNotFound if handle was not found. MLResult.Result will be MLResult.Code.AudioInternalConfigError if internal config error. MLResult.Result will be MLResult.Code.NotImplemented .
MLResult.Code MLAudioGetSpatialSoundPosition
Returns the 3D position for one channel of a sound output.
public MLResult.Code MLAudioGetSpatialSoundPosition(
ulong handle,
uint channel,
out MagicLeapNativeBindings.MLVec3f position
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | MLHandle used to identify the sound output. |
uint | channel | Selects the channel whose position is being set. |
out MagicLeapNativeBindings.MLVec3f | position | Struct to set the position |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.AudioHandleNotFound if handle was not found. MLResult.Result will be MLResult.Code.AudioInternalConfigError if internal config error. MLResult.Result will be MLResult.Code.NotImplemented .
delegate void MLAudioMasterVolumeChangedCallback
The callback that occurs when the master volume changes.
public delegate void MLAudioMasterVolumeChangedCallback(
float volume,
IntPtr callback
)
Parameters
Type | Name | Description |
---|---|---|
float | volume | The value of the master volume. |
IntPtr | callback | A pointer to the callback. |
delegate void MLAudioMediaEventCallback
Callback to notify when a media event has occurred.
public delegate void MLAudioMediaEventCallback(
MediaEvent mediaEvent,
IntPtr callback
)
Parameters
Type | Name | Description |
---|---|---|
MediaEvent | volume | The new media event. |
IntPtr | callback | A pointer to the callback. |
MLResult.Code MLAudioSetMasterVolumeCallback
Registers a callback for when the master volume changes.
public MLResult.Code MLAudioSetMasterVolumeCallback(
MLAudioMasterVolumeChangedCallback callback,
IntPtr data
)
Parameters
Type | Name | Description |
---|---|---|
MLAudioMasterVolumeChangedCallback | callback | A pointer to the callback. |
IntPtr | data | A generic data pointer passed back to the callback. |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.AllocFailed if failed due to internal error. MLResult.Result will be MLResult.Code.NotImplemented .
MLResult.Code MLAudioSetMediaEventCallback
Registers a callback for user-issued media control events. Events that can result in a callback being called include: pressing a play button; pressing a stop button; pressing a pause button; pressing a next track button, pressing a previous track button; The particular event type (MLAudioMediaEvent) that caused the callback is passed to the callback as its first argument. The 'context' argument is passed back to the callback as its second argument.
public MLResult.Code MLAudioSetMediaEventCallback(
MLAudioMediaEventCallback callback,
IntPtr context
)
Parameters
Type | Name | Description |
---|---|---|
MLAudioMediaEventCallback | callback | |
IntPtr | context |
MLResult.Code MLAudioSetSoundBypassesMasterVolume
Setting this option on a sound output causes its output to bypass master volume, making it effectively "always audible" (assuming it is neither muted nor set to zero volume on a per-sound basis). This option can only be set on medical-enabled devices (60601 compliant), and will only work for non-spatial sounds.Non-spatial sound parameters such as volume, mute, pitch and looping are still in effect for sounds that are bypassing master volume.
public MLResult.Code MLAudioSetSoundBypassesMasterVolume(
ulong audioHandle,
bool isBypassing
)
Parameters
Type | Name | Description |
---|---|---|
ulong | audioHandle | |
bool | isBypassing |
MLResult.Code MLAudioSetSpatialSoundEnable
Enables/disables 3D audio processing for a sound output.
public MLResult.Code MLAudioSetSpatialSoundEnable(
ulong handle,
bool enable
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | MLHandle used to identify the sound output. |
bool | enable | Determines whether 3D processing is on or off. |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.AudioHandleNotFound if handle was not found. MLResult.Result will be MLResult.Code.AudioInternalConfigError if internal config error. MLResult.Result will be MLResult.Code.NotImplemented .
MLResult.Code MLAudioSetSpatialSoundPosition
Sets the 3D position for one channel of a sound output.
public MLResult.Code MLAudioSetSpatialSoundPosition(
ulong handle,
uint channel,
ref MagicLeapNativeBindings.MLVec3f position
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | MLHandle used to identify the sound output. |
uint | channel | Selects the channel whose position is being set. |
ref MagicLeapNativeBindings.MLVec3f | position | Struct to set the position |
Returns: MLResult.Result will be MLResult.Code.Ok if successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.AudioHandleNotFound if handle was not found. MLResult.Result will be MLResult.Code.AudioInternalConfigError if internal config error. MLResult.Result will be MLResult.Code.NotImplemented .