AXAcquireVoice

Syntax

#include <revolution/ax.h>

#define AX_PRIORITY_NODROP  31
#define AX_PRIORITY_LOWEST  1

typedef void(*AXVoiceCallback)(void *p);

AXVPB* AXAcquireVoice(u32 priority, AXVoiceCallback callback, u32 userContext);

Arguments

priority Application-assigned priority. Set from 1 (minimum) to 31 (maximum). 31 is the highest priority. AX_PRIORITY_NODROP is defined as 31. AX_PRIORITY_LOWEST is defined as 1. Voices acquired with AX_PRIORITY_NODROP will not be eligible for reacquisition. Priority of 0 means that the voice is empty.
callback Application callback. When a voice is reacquired (takeover), AX will call this callback. A pointer to the reacquired AXVPB is passed to the callback argument p. If the callback does not need to be called, specify NULL.
userContext An application-defined utility variable. This replaces the AXVPB member userContext at voice acquisition. The application will be able to obtain this variable during voice reacquisition (takeover) through the callback argument (AXVPB pointer) specified above.

Return Values

Pointer to AXVPB associated with the voice. NULL if acquisition failed.

Description

The AXAcquireVoice function attempts to acquire a voice from AX. Voice acquisition is priority-based. If a free voice is not available, the oldest voice of lowest priority (and lower than the requested priority) will be forcibly reacquired to fulfill the request. (Voices with the AX_PRIORITY_NODROP priority cannot be reacquired by this method.) Voices reacquired with the AX_PRIORITY_NODROP priority may still be dropped by the AX if DSP resources are exceeded for an audio frame. Priority for a voice may be reassigned after acquisition by using AXSetVoicePriority().

See Also

AXFreeVoice, AXSetVoicePriority

Revision History

2006/10/17 Added and corrected argument descriptions.
2006/03/01 Initial version.


CONFIDENTIAL