Bewerken

Delen via


Audio Data Formats

To specify the data format for a wave audio stream, the KSDATAFORMAT structure is followed immediately by either a WAVEFORMATEX or KSDSOUND_BUFFERDESC structure, and the Specifier member of KSDATAFORMAT is accordingly set to one of the following two values:

  • KSDATAFORMAT_SPECIFIER_WAVEFORMATEX

    Indicates that the data format belongs to a wave stream that is being used by a waveIn or waveOut application. In this case, if the KSDATAFORMAT structure's FormatSize is large enough, the data-format specifier following the KSDATAFORMAT structure is a WAVEFORMATEX structure.

  • KSDATAFORMAT_SPECIFIER_DSOUND

    Indicates that the data format belongs to a wave stream that is being used by a DirectSound application. In this case, the data-format specifier following the KSDATAFORMAT structure is a KSDSOUND_BUFFERDESC structure, which contains an embedded WAVEFORMATEX structure.

The KSDATAFORMAT_WAVEFORMATEX structure encapsulates both a KSDATAFORMAT structure and the WAVEFORMATEX structure that follows it. Similarly, the KSDATAFORMAT_DSOUND structure encapsulates both a KSDATAFORMAT structure and the DSOUND_BUFFERDESC structure that follows it.

For either KSDATAFORMAT_WAVEFORMATEX or KSDATAFORMAT_DSOUND, the last item in the structure is an embedded WAVEFORMATEX structure; in the case of KSDATAFORMAT_DSOUND, the WAVEFORMATEX structure is contained in the embedded DSOUND_BUFFERDESC structure. In either case, the WAVEFORMATEX structure might be the beginning of a WAVEFORMATEXTENSIBLE structure, in which case the wFormatTag member of WAVEFORMATEX is set to the value WAVE_FORMAT_EXTENSIBLE. For more information, see Extensible Wave-Format Descriptors.

To specify the data format for a MIDI stream or DirectMusic stream, the KSDATAFORMAT structure is sufficient; it is not followed by any additional information.

For examples of wave and DirectSound data formats, see PCM Stream Data Format and DirectSound Stream Data Format. For examples of MIDI and DirectMusic data formats, see MIDI Stream Data Format and DirectMusic Stream Data Format.