| Miles Sound System SDK 7.2a |
The function RAD_IOPRegisterSoundCallback registers a sound data structure to call your sound interrupt callback.
S32 RAD_IOPRegisterSoundCallback( RAD_IOP_SOUND_DATA *sound_data ); |
Returns non-zero if the sound callback was registered, or zero on failure.
This function registers a sound callback structure to call a sound interrupt callback. The sound callbacks won't actually start until a call to RAD_IOPStartSound.
This structure must remain valid until the sound callback is unregistered with the RAD_IOPUnregisterSoundCallback function.
The sound callback function is called at interrupt time, so make sure your code is interrupt safe.
Each time your sound callback is made, you must overwrite or mix sound data into the buffer that is specified by the address and length fields in the sound_data structure. The overwrite flag in the sound_data structure says whether you should copy your data directly into the buffer (if overwrite is true), or whether you should mix your data into the buffer (if overwrite is false). To mix, just add your S16 values with the S16 values that are already in the buffer (clamping at -32768 and 32767).
Normally, the buffer is a 48,000 Hz, 16-bit, stereo PCM data block which is formatted in the Sony style of 256 left samples followed by 256 right samples. The length will always be a multiple of 512 samples (in the current version of RAD_IOP, it will be 2,048 bytes). When the RAD_IOP_SPDIF + RAD_IOP_NEED_CORE0 flags are used, the data block returned by the EE is treated as raw bitstream data, typically destined for a DTS receiver. (The callback's overwrite flag is not meaningful in RAD_IOP_SPDIF mode.)
Group:
The RAD_IOP API for the Sony PS2
Related Functions:
RAD_IOPStartSound, RAD_IOPUnregisterSoundCallback, RAD_IOPUnregisterTimerCallback
Related Basic Types:
S32
Related Structures:
RAD_IOP_SOUND_DATA
For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.