# SNDWaveData

## Definitions

      #include <nitro/snd.h>

      typedef struct SNDWaveParam
      {
      u8  format;
      u8  loopflag;
      u16 rate;
      u16 timer;
      u16 loopstart;
      u32 looplen;
      } SNDWaveParam;

      typedef struct SNDWaveData
      {
      struct SNDWaveParam param;
      u8 samples[0];
      } SNDWaveData;

## Elements

`format` | This is the sample format.
`loopflag` | The loop flag. There is no loop if zero, and a loop exists if non-zero.
`rate` | This is the sampling rate. It is expressed in MHz.
`timer` | Description It corresponds to SND_TIMER_CLOCK / rate.
`loopstart` | This is the starting point of the loop. It is expressed in words (32-bit).
`looplen` | This is the length of the loop. If there is no loop, this corresponds to the length of the waveform. It is expressed in words (32-bit).
`samples` | This is an array of the sample data. The size of the array is `loopstart`+`looplen` [in words].

## Description

Waveform data structure. It holds the header information and the sample data for the waveform data.

The sample format `format` takes one of the following values.

Table. SNDWaveFormat

Label | Description
--- | ---
SND_WAVE_FORMAT_PCM8 | 8bit PCM
SND_WAVE_FORMAT_PCM16 | 16bit PCM
SND_WAVE_FORMAT_ADPCM | IMA-ADPCM

If the sample format is `SND_WAVE_FORMAT_ADPCM`, ADPCM header information similar to the following is stored in the first word of the sample data `samples`.

    struct {
    s16 prevsample; // Previous sample value
    u8  previndex;  // Previous index value
    u8  padding;    // Padding (always 0)
    };

## See Also

None.

## Revision History

01/19/2005 Initial version