#include <nitro/snd.h>
void SND_SetupChannelNoise( int chNo, int volume, SNDChannelDataShift shift, int timer, int pan );
chNo |
The channel number. Takes a value between 14 and 15. |
volume |
The volume. Takes a value between 0 and 127. |
shift |
Data shift specification. |
timer |
The timer. Takes a value between 0x10 and 0xffff. |
pan |
The pan. Takes values in the range of 0 (left) to 64 (center) to 127 (right). |
This function sets up a channel for playing white noise.
The function sets the parameters for the channel specified by chNo
. The channel must be locked by the SND_LockChannel
function before the parameters can be set. Once the parameters have been set, call the SND_StartTimer
function to begin actual playback.
Choose from among these values for the data shift setting shift
:
Table. SNDChannelDataShift
Label | Description |
---|---|
SND_CHANNEL_DATASHIFT_NONE | Do not perform a data shift. |
SND_CHANNEL_DATASHIFT_1BIT | Shift data 1 bit right. |
SND_CHANNEL_DATASHIFT_2BIT | Shift data 2 bit right. |
SND_CHANNEL_DATASHIFT_4BIT | Shift data 4 bit right. |
timer specifies 8 cycles of white noise by clock count. The number of ticks per second is approximately 16.757 MHz with SND_TIMER_CLOCK
. For example, the following calculation will play a pitch that has a frequency freq Hz.
timer = SND_TIMER_CLOCK
/ ( 8 * freq )
This function is an ARM7 reserved function. After this function is called, processing occurs only after the command is issued with the SND_FlushCommand
function.
When it is necessary to synchronize something with the completion of the process, first use SND_GetCurrentCommandTag
to obtain the command tag immediately after calling this function. After the command is issued, use the command tag and call either the SND_IsFinishedCommandTag
or SND_WaitForCommandProc
function to confirm that the process has finished or to wait for it to complete.
SND_LockChannel, SND_StartTimer, SND_FlushCommand, SND_GetCurrentCommandTag, SND_IsFinishedCommandTag, SND_WaitForCommandProc
02/17/2005 Added a note about ARM7 command processing
08/10/2004 Initial version