# NNS_SndStrmAllocChannel

## Syntax

      #include <nnsys/snd.h>

      BOOL NNS_SndStrmAllocChannel(
              NNSSndStrm* stream,
              int numChannels,
              const u8 chNoList[] );

## Arguments

`stream` | Pointer to a stream structure.
`numChannels` | The number of channels to allocate. Takes a value between 1 and 16.
`chNoList[]` | An array of channel numbers.

## Return Values

Returns a value to indicate if it was able to allocate the channels.

## Description

Allocates the channels used when a stream is played. Before playing a stream, you must use this function to allocate channels.

The channel number array `chNoList[]` must contain as many elements as the number of channels, `numChannels`. Each element specifies a channel number. Although you can specify channel numbers from 0 - 15, different channel numbers are used for different features. Therefore you must consider cooperation with other uses when specifying. For example, channels number 14 or 15 should probably not be used here if the sequence playback is going to need them for playing noise.

Table: Use of each channel and its functionality

Channel Number | Features
--- | ---
0, 2 | Can play PCM/ADPCM. Output from these channels can also be used for input to sound capture.
1, 3 | Can play PCM/ADPCM. Because these channels share sound capture and timer, when sound capture is used these channels can only be used as sound capture output channels.
4 ~ 7 | Can play PCM/ADPCM. These channels are used preferentially when playing back waveform data on sequence playback.
8 ~ 13 | Can play PCM/ADPCM and PSG square waves.
14, 15 | Can play PCM/ADPCM and white noise.

To free an allocated channel, call `NNS_SndStrmFreeChannel`.

## See Also

NNS_SndStrmFreeChannel

## Revision History

2004/08/10 Initial version.

CONFIDENTIAL