DirectSound Stream Data Format
This example uses a KSDATAFORMAT_DSOUND structure to describe the data format of a DirectSound stream.
DataFormat.FormatSize = sizeof(KSDATAFORMAT_DSOUND);
DataFormat.Flags = 0;
DataFormat.SampleSize = 0;
DataFormat.Reserved = 0;
DataFormat.MajorFormat = STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO);
DataFormat.SubFormat = STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM);
DataFormat.Specifier = STATICGUIDOF(KSDATAFORMAT_SPECIFIER_DSOUND);
BufferDesc.Flags = KSDSOUND_BUFFER_LOCHARDWARE;
BufferDesc.Control = KSDSOUND_BUFFER_CTRL_3D;
BufferDesc.WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
BufferDesc.WaveFormatEx.nChannels = 2;
BufferDesc.WaveFormatEx.nSamplesPerSec = 22050;
BufferDesc.WaveFormatEx.nAvgBytesPerSec = 88200;
BufferDesc.WaveFormatEx.nBlockAlign = 4;
BufferDesc.WaveFormatEx.wBitsPerSample = 16;
BufferDesc.WaveFormatEx.cbSize = 0;