Microsoft DirectX 8.1 (C++)

Using Wave Data

DirectSound buffers play only waveform audio data, which consists of digital samples of the sound at a fixed sampling rate. The representation of an analog signal by a sequence of numbers is known as pulse code modulation (PCM).

Wave data is usually stored in files or resources in Resource Interchange File Format (RIFF). The data includes a description of the wave format, including parameters such as the sampling rate and number of output channels.

The particular format of a sound can be described by a WAVEFORMATEX or WAVEFORMATEXTENSIBLE structure.

The wFormatTag member of this structure contains a unique identifier assigned by Microsoft Corporation. The only tags valid with DirectSound are the following:

DirectSound does not support compressed wave formats. Applications should use the audio compression manager (ACM) functions, provided with the Win32 APIs in the Platform SDK, to convert compressed audio to PCM format before writing the data to a sound buffer. Alternatively, use the DirectMusic loader, which automatically enlists the help of ACM when loading compressed waves for playback through the DirectMusic performance.

More information on waves is included in the following topics: