CRI ADX  Last Updated: 2024-07-17 10:47 p
Voice Event Callback

Sample Directory

/CRIWARE/SDK/pc/samples/criatomex/voice_event_callback


Sample Description

A voice event callback is a callback event that is triggered in connection with a voice pool access (i.e. when obtaining or releasing a voice).
By registering a voice event callback, you can check whether data requested for playback with an AtomEx player has been played correctly or not.
(For example, you can check at the application level if a voice was allocated and playback was performed, if playback failed due to insufficient voices, if playback of another sound was stopped due to voice limit processing and other details about how the request was processed.)
You can use voice event callbacks as follows:
  1. Define a CriAtomExVoiceEventCbFunc type function in your application.
  2. Register the function you defined with the criAtomEx_SetVoiceEventCallback function.
The following sample code demonstrates this procedure.
/* Define a function of the CriAtomExVoiceEventCbFunc type */
static void user_voice_event_func(
void *obj, CriAtomExVoiceEvent voice_event,
const CriAtomExVoiceInfoDetail *request,
const CriAtomExVoiceInfoDetail *removed,
const CriAtomExVoiceInfoDetail *removed_in_group)
{
/* This function will be executed each time the voice pool is accessed. */
}
main()
{
:
/* Register a voice event callback */
/* Note: The value specified for the second parameter will be passed as-is as the first parameter to the callback. */
criAtomEx_SetVoiceEventCallback(user_voice_event_func, user_obj);
:
}
enum CriAtomExVoiceEventTag CriAtomExVoiceEvent
Voice event.
void criAtomEx_SetVoiceEventCallback(CriAtomExVoiceEventCbFunc func, void *obj)
Register a voice event callback.
Detailed information about a voice.
Definition: cri_le_atom_ex.h:5190



The procedure above will call the registered function any time the voice pool is accessed by the Atom library.
The event that triggered the callback can be determined by the second parameter of the callback function (CriAtomExVoiceEvent).
Refer to CriAtomExVoiceEventTag in the reference for the exact meaning of each CriAtomExVoiceEvent value.<br