carb::audio::VoiceCallback

Defined in carb/audio/IAudioPlayback.h

typedef AudioResult (*carb::audio::VoiceCallback)(Voice *voice, VoiceCallbackType callbackType, SoundData *sound, void *data, void *context)

prototype for a voice event callback function.

Remark

This callback allows a system to receive notifications of events occurring on a sound object that is playing on a voice. This callback is performed when either the sound finishes playing or when one of its event points is hit. Since this callback may be performed in the context of the mixer thread, it should take as little time as possible to return. Instead of performing heavy calculations, it should simply set a flag that those calculations need to be handled on another worker thread at a later time.

Parameters
  • voice[in] the voice object that produced the event callback.

  • callbackType[in] the type of callback being performed. This can either be that the sound ended or that one of its event points was hit.

  • sound[in] the sound data object that the voice is playing or just finished playing.

  • data[in] some extra data specific to the callback type that occurred. This will be nullptr for VoiceCallbackType::eSoundEnded callbacks. This will be the EventPoint information for the event point that was hit for VoiceCallbackType::eEventPoint callbacks.

  • context[in] the context value that was specified at the time the callback function was registered with the voice.

Returns

AudioResult::eOk. Returning any other value may result in the mixer being halted or the playback of the current sound stopping.