# NNS_SndWaveOutAllocChannel

## C Specification

      #include <nnsys/snd.h>

      NNSSndWaveOutHandle NNS_SndWaveOutAllocChannel( int chNo );

## Arguments

`chNo` | Number for the channel to be allocated. Specify a value between 0 to 15.

## Return Values

Returns a waveform playback handle. If the channel allocation fails, it returns `NNS_SND_WAVEOUT_INVALID_HANDLE`.

## Description

Allocates a channel for the waveform playback.

If the specified channel is generating sounds by playing back the sequence, the sound being generated will be forcibly stopped. However, if the specified channel is being used for any other purposes besides playing back the sequence, the function will fail.

The allocated channel will be occupied until it is released with the `NNS_SndWaveOutFreeChannel` function.

The channel number `chNo` can be specified between 0 to 15. As indicated in the table below, these channels are used for different functions, so the channel number should be selected with the use of other channels in mind. 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.

## See Also

NNS_SndWaveOutFreeChannel

## Revision History

07/01/2004 Initial version.