# NNS_SndWaveOutAllocChannel

## Syntax

      #include <nnsys/snd.h>

      NNSSndWaveOutHandle NNS_SndWaveOutAllocChannel( int chNo );

## Arguments

`chNo` | Number of 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 currently generating audio via sequence playback, the audio being generated will be forcibly stopped. However, if the specified channel is being used for reverb or any other purpose besides sequence playback, this function will fail.

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

Although you can specify the channel number `chNo` 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.

## See Also

NNS_SndWaveOutFreeChannel

## Revision History

2004/07/01 Initial version.

CONFIDENTIAL