diff --git a/dll/win32/wdmaud.drv/legacy.c b/dll/win32/wdmaud.drv/legacy.c index 00c9507341d..f1ada7cdd3b 100644 --- a/dll/win32/wdmaud.drv/legacy.c +++ b/dll/win32/wdmaud.drv/legacy.c @@ -506,7 +506,7 @@ WdmAudSetWaveDeviceFormatByLegacy( ZeroMemory(&DeviceInfo, sizeof(WDMAUD_DEVICE_INFO)); DeviceInfo.DeviceType = DeviceType; DeviceInfo.DeviceIndex = DeviceId; - DeviceInfo.u.WaveFormatEx.cbSize = sizeof(WAVEFORMATEX); //WaveFormat->cbSize; + DeviceInfo.u.WaveFormatEx.cbSize = WaveFormat->cbSize; DeviceInfo.u.WaveFormatEx.wFormatTag = WaveFormat->wFormatTag; #ifdef USERMODE_MIXER DeviceInfo.u.WaveFormatEx.nChannels = 2; @@ -546,7 +546,7 @@ WdmAudSetWaveDeviceFormatByLegacy( } /* store details */ - Instance->WaveFormatEx.cbSize = sizeof(WAVEFORMATEX); + Instance->WaveFormatEx.cbSize = WaveFormat->cbSize; Instance->WaveFormatEx.wBitsPerSample = (DeviceInfo.u.WaveFormatEx.nAvgBytesPerSec * 8) / (DeviceInfo.u.WaveFormatEx.nSamplesPerSec * DeviceInfo.u.WaveFormatEx.nChannels); /* Store sound device handle instance handle */ diff --git a/drivers/ksfilter/ks/connectivity.c b/drivers/ksfilter/ks/connectivity.c index ba7db56d8b5..395d5b53d63 100644 --- a/drivers/ksfilter/ks/connectivity.c +++ b/drivers/ksfilter/ks/connectivity.c @@ -43,7 +43,7 @@ KsCreatePin( PKSDATAFORMAT_WAVEFORMATEX Format = (PKSDATAFORMAT_WAVEFORMATEX)(Connect + 1); if (Format->DataFormat.FormatSize == sizeof(KSDATAFORMAT) || - Format->DataFormat.FormatSize == sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX)) + Format->DataFormat.FormatSize == sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX) + Format->WaveFormatEx.cbSize) { ConnectSize += Format->DataFormat.FormatSize; } diff --git a/sdk/lib/drivers/sound/mmixer/wave.c b/sdk/lib/drivers/sound/mmixer/wave.c index e049ca485bd..7c48f0bc827 100644 --- a/sdk/lib/drivers/sound/mmixer/wave.c +++ b/sdk/lib/drivers/sound/mmixer/wave.c @@ -116,22 +116,40 @@ MMixerInitializeDataFormat( IN PKSDATAFORMAT_WAVEFORMATEX DataFormat, LPWAVEFORMATEX WaveFormatEx) { - DataFormat->WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag; DataFormat->WaveFormatEx.nChannels = WaveFormatEx->nChannels; DataFormat->WaveFormatEx.nSamplesPerSec = WaveFormatEx->nSamplesPerSec; DataFormat->WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign; DataFormat->WaveFormatEx.nAvgBytesPerSec = WaveFormatEx->nAvgBytesPerSec; DataFormat->WaveFormatEx.wBitsPerSample = WaveFormatEx->wBitsPerSample; - DataFormat->WaveFormatEx.cbSize = 0; - DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX); + DataFormat->WaveFormatEx.cbSize = WaveFormatEx->cbSize; + DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX) + WaveFormatEx->cbSize; DataFormat->DataFormat.Flags = 0; DataFormat->DataFormat.Reserved = 0; DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO; - DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX; DataFormat->DataFormat.SampleSize = 4; + + /* Write additional fields for Extensible audio format */ + if (WaveFormatEx->wFormatTag == WAVE_FORMAT_EXTENSIBLE) + { + PWAVEFORMATEXTENSIBLE WaveFormatExt = (PWAVEFORMATEXTENSIBLE)&DataFormat->WaveFormatEx; + WaveFormatExt->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + WaveFormatExt->Samples.wValidBitsPerSample = WaveFormatEx->wBitsPerSample; + if (WaveFormatEx->nChannels == 0) + WaveFormatExt->dwChannelMask = KSAUDIO_SPEAKER_DIRECTOUT; + else if (WaveFormatEx->nChannels == 1) + WaveFormatExt->dwChannelMask = KSAUDIO_SPEAKER_MONO; + else if (WaveFormatEx->nChannels == 2) + WaveFormatExt->dwChannelMask = KSAUDIO_SPEAKER_STEREO; + else if (WaveFormatEx->nChannels == 4) + WaveFormatExt->dwChannelMask = KSAUDIO_SPEAKER_QUAD; + else if (WaveFormatEx->nChannels == 5) + WaveFormatExt->dwChannelMask = KSAUDIO_SPEAKER_5POINT1; + else if (WaveFormatEx->nChannels == 7) + WaveFormatExt->dwChannelMask = KSAUDIO_SPEAKER_7POINT1; + } } MIXER_STATUS @@ -232,7 +250,7 @@ MMixerOpenWavePin( return MM_STATUS_INVALID_PARAMETER; /* allocate pin connect */ - PinConnect = MMixerAllocatePinConnect(MixerContext, sizeof(KSDATAFORMAT_WAVEFORMATEX)); + PinConnect = MMixerAllocatePinConnect(MixerContext, sizeof(KSDATAFORMAT_WAVEFORMATEX) + WaveFormatEx->cbSize); if (!PinConnect) { /* no memory */ @@ -453,12 +471,6 @@ MMixerOpenWave( /* grab mixer list */ MixerList = (PMIXER_LIST)MixerContext->MixerContext; - if (WaveFormat->wFormatTag != WAVE_FORMAT_PCM) - { - /* not implemented */ - return MM_STATUS_NOT_IMPLEMENTED; - } - /* find destination wave */ Status = MMixerGetWaveInfoByIndexAndType(MixerList, DeviceIndex, bWaveIn, &WaveInfo); if (Status != MM_STATUS_SUCCESS)