CRI ADX  Last Updated: 2025-05-07 13:34 p
Voice Event Callback

Sample directory

/cri/pc/samples/criatomex/voice_event_callback

Data used in the sample

/cri/common/smpdata/criatomex/
  • ForVoiceEvent.acf
  • ForVoiceEvent.acb
  • ForVoiceEvent.awb
  • music.hca
  • music_loop.adx

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.
/* 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
By performing the above operations, the registered function will be called every time the voice pool is accessed in the Atom library.
The type of event that occurred can be determined by the second argument (CriAtomExVoiceEvent) of the callback function.
For the meaning of each CriAtomExVoiceEvent value, refer to the explanation of " ::CriAtomExVoiceEventTag " in the reference.


AtomCraft project directory for data used in the sample

/cri/tools/criatomex/examples/for_voice_event_callback