# NNS_SndStrmAllocChannel

## C Specification

      #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

This function allocates the channels that are 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, the channel number 14 or 15 may not be the best choice if noise is going to be used for the sequence playback.

Table: Use of each channel and its functionality

Channel Number | Function
--- | ---
0, 2 | Can playback PCM/ADPCM. Output from these channels can also be used for sound capture input.
1, 3 | Can playback PCM/ADPCM. Because sound capture and the timer are shared, these channels can be used only for sound capture output when sound capture is used.
4 〜 7 | Can playback PCM/ADPCM. These channels are used preferentially when playing back waveform data on sequence playback.
8 〜 13 | Can playback PCM/ADPCM and PSG rectangular waveforms.
14, 15 | Can playback PCM/ADPCM and white noise.

To free an allocated channel, call `NNS_SndStrmFreeChannel`.

## See Also

NNS_SndStrmFreeChannel

## Revision History

08/10/2004 Initial version.