# NNS_SndWaveOutStart

## C Specification

      #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` | Location 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 (location). Takes values in the range of 0 (left) to 64 (center) to 127 (right).

## Return Values

Returns if the playback was successful.

## Description

Plays back the waveform data.

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

Specify the waveform data 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

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

Loop flag `loopFlag` is a flag used for determining execution of the loop playback. When `TRUE` is specified, the playback will restart at the location of `loopStartSample` after the last sample was played back. The `loopStartSample` must be a multiple of 4 for the 8-bit PCM, and a multiple of 2 for the 16-bit PCM.

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

The playback `speed` specifies the speed used for playback. Played back at speed divided by 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

07/01/2004 Initial version.