# NNS_SndWaveOutStart

## Syntax

      #include <nnsys/snd.h>

      BOOL NNS_SndWaveOutStart(
              NNSSndWaveOutHandle handle,
              NNSSndWaveFormat format,
              const void* dataaddr,
              BOOL loopFlag,
              int loopStartSample,
              int samples,
              int sampleRate,
              int volume,
              int speed,
              int pan );

## Arguments

`handle` | Waveform playback handle.
`format` | Waveform data format.
`dataaddr` | The starting address of the waveform data.
`loopFlag` | The loop flag.
`loopStartSample` | Position of the loop start sample.
`samples` | Number of samples of the waveform data.
`sampleRate` | Sampling rate of the waveform data. It is expressed in MHz.
`volume` | The volume. Takes a value between 0 and 127.
`speed` | Playback speed.
`pan` | Pan position. Takes values in the range of 0 (left) to 64 (center) to 127 (right).

## Return Values

Returns whether the playback was successful.

## Description

Plays back the waveform data.

For the waveform playback handle `handle`, use the return value obtained with the `NNS_SndWaveOutAllocChannel` function.

Specify the waveform data format `format` with the values shown below.

Table: NNSSndWaveFormat

Label | Description
--- | ---
`NNS_SND_WAVE_FORMAT_PCM8` | 8-bit PCM.
`NNS_SND_WAVE_FORMAT_PCM16` | 16-bit PCM
`NNS_SND_WAVE_FORMAT_ADPCM` | IMA-ADPCM

The waveform data starting address `dataaddr` must be 4-byte aligned.

The loop flag `loopFlag` indicates whether to perform loop playback. When `TRUE` is specified, playback restarts from the location of `loopStartSample` after the last sample is played. The `loopStartSample` loop starting sample must be a multiple of 4 for 8-bit PCM, a multiple of 2 for 16-bit PCM, and a multiple of 8 for IMA-ADPCM.

The `samples` number of samples must be a multiple of 4 for 8-bit PCM, a multiple of 2 for 16-bit PCM, and a multiple of 8 for IMA-ADPCM.

The playback speed `speed` specifies the speed used for playback. The waveform is played at a rate of `speed` ÷ 32768. The faster playback speed makes the playback time shorter, and the pitch of the played sound becomes higher.

## See Also

`NNS_SndWaveOutAllocChannel`

## Revision History

2009/02/02 Support for IMA-ADPCM.
2004/07/01 Initial version.

CONFIDENTIAL