#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 first be locked by the SND_LockChannel function. 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 bits right. |
SND_CHANNEL_DATASHIFT_4BIT | Shift data 4 bits 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, its processing will occur only after the command is issued with the SND_FlushCommand function.
If program execution must be synchronized with process completion, first use the SND_GetCurrentCommandTag function to obtain the command tag immediately after calling this function. Then, after the command is issued, use the command tag and call either the SND_IsFinishedCommandTag or SND_WaitForCommandProc function to confirm that processing has finished or to wait for it to complete.
SND_LockChannel, SND_StartTimer, SND_FlushCommand, SND_GetCurrentCommandTag, SND_IsFinishedCommandTag, SND_WaitForCommandProc
2005/02/17 Added a note about ARM7 command processing.
2004/08/10 Initial version.
CONFIDENTIAL