Skip to main content
Version: 20 Mar 2024

Callbacks

Module: Audio / Audio Definitions / Acoustics

CALLBACKS.

Types

Name
typedef void()(MLHandle handle, MLAudioSoundEvent event, void context)MLAudioSoundEventCallback
Callback to notify when a sound event has occurred.
typedef void()(MLAudioMediaEvent event, void context)MLAudioMediaEventCallback
Callback to notify when a media event has occurred.
typedef void()(MLHandle handle, void context)MLAudioBufferCallback
Callback to notify when an audio buffer is available for reading or writing.
typedef void()(MLHandle resource, void context)MLAudioResourceDiscardedCallback
Callback to notify when an audio resource's data is being discarded to make room for other resource data. Resource data that is not being referenced by a sound will be discarded before resource data that is being referenced by a sound. Resources that are being played by a sound will not have their data discarded.
typedef void()(float new_volume, void context)MLAudioMasterVolumeChangedCallback
Callback to notify when the master volume has been changed.
typedef void()(bool is_muted, void context)MLAudioOutputMuteChangedCallback
Callback to notify when the global output mute has been changed.
typedef void()(MLAudioOutputDevice current_device, void context)MLAudioOutputDeviceChangedCallback
Callback to notify when the active output device has changed.
typedef void()(bool is_muted, void context)MLAudioMicMuteCallback
Callback to notify when the global mic mute has been changed.
typedef void()(MLHandle handle, MLAudioTraitAnalysisTarget target, float value, void context)MLAudioTraitAnalysisCallback
Callback to provide a changed value for a running trait analysis.
typedef void()(MLHandle handle, MLAudioSpectralAnalysisTarget target, MLAudioSpectralAnalysis values, void context)MLAudioSpectralAnalysisCallback
Callback to provide a changed value set for a running spectral analysis.

Types Documentation

MLAudioSoundEventCallback

typedef void(* MLAudioSoundEventCallback) (MLHandle handle, MLAudioSoundEvent event, void *context);

Callback to notify when a sound event has occurred.

note

The callback will be called on a separate thread which is non-blocking, except for calls to MLAudioDestroySound which will be blocked until the callback returns (unless the 'Destroy' call is called from the same thread as the callback, in which case it won't be blocked).


MLAudioMediaEventCallback

typedef void(* MLAudioMediaEventCallback) (MLAudioMediaEvent event, void *context);

Callback to notify when a media event has occurred.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioBufferCallback

typedef void(* MLAudioBufferCallback) (MLHandle handle, void *context);

Callback to notify when an audio buffer is available for reading or writing.

note

The callback will be called on a separate thread which is non-blocking, except for calls to MLAudioDestroySound and MLAudioDestroyInput (for sounds and inputs respectively) which will be blocked until the callback returns (unless the 'Destroy' call is called from the same thread as the callback, in which case it won't be blocked).


MLAudioResourceDiscardedCallback

typedef void(* MLAudioResourceDiscardedCallback) (MLHandle resource, void *context);

Callback to notify when an audio resource's data is being discarded to make room for other resource data. Resource data that is not being referenced by a sound will be discarded before resource data that is being referenced by a sound. Resources that are being played by a sound will not have their data discarded.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioMasterVolumeChangedCallback

typedef void(* MLAudioMasterVolumeChangedCallback) (float new_volume, void *context);

Callback to notify when the master volume has been changed.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioOutputMuteChangedCallback

typedef void(* MLAudioOutputMuteChangedCallback) (bool is_muted, void *context);

Callback to notify when the global output mute has been changed.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioOutputDeviceChangedCallback

typedef void(* MLAudioOutputDeviceChangedCallback) (MLAudioOutputDevice current_device, void *context);

Callback to notify when the active output device has changed.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioMicMuteCallback

typedef void(* MLAudioMicMuteCallback) (bool is_muted, void *context);

Callback to notify when the global mic mute has been changed.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioTraitAnalysisCallback

typedef void(* MLAudioTraitAnalysisCallback) (MLHandle handle, MLAudioTraitAnalysisTarget target, float value, void *context);

Callback to provide a changed value for a running trait analysis.

note

The callback will be called on a separate thread which is non-blocking.


MLAudioSpectralAnalysisCallback

typedef void(* MLAudioSpectralAnalysisCallback) (MLHandle handle, MLAudioSpectralAnalysisTarget target, MLAudioSpectralAnalysis values, void *context);

Callback to provide a changed value set for a running spectral analysis.

note

The callback will be called on a separate thread which is non-blocking.