nn::snd::CTR::AllocVoice Function

Syntax

Voice * AllocVoice(
     s32 priority,
     VoiceDropCallbackFunc callback,
     uptr userArg
);

Arguments

Name Description
in priority Priority.
in callback Address of the callback function.
in userArg User argument.

Return Values

Returns the address of a Voice object on success. Returns NULL on failure.

Description

Gets a voice.

Call this function to get a valid Voice object. This function returns the address of one usable object of the 24 voice objects managed by the library. If the maximum number of voice objects (24) have already been obtained, behavior depends on the priority specified as an argument.

Normal priority If the priority specified as an argument is greater than or equal to the lowest priority in the obtained objects, the lowest-priority voice is stopped and the object's address is returned. The callback function specified by callback is invoked for the voice that is stopped.
VOICE_PRIORITY_NODROP If the lowest priority object among the obtained objects is VOICE_PRIORITY_NODROP, NULL is returned. If the lowest priority is lower than VOICE_PRIORITY_NODROP, this function behaves as if you specified a normal priority.

Revision History

2010/07/23
Fixed a typo related to the maximum number of voices.
2010/01/29
Initial version.

CONFIDENTIAL