From: Giovanni Mascellani <gmascellani@codeweavers.com> Windows format with 24 valid bits out of 32 stores the valid bits as the most significant ones. In PulseAudio format PA_SAMPLE_S24_32LE stores the valid bits as the least significant ones, so the two formats are not compatible. It doesn't seem PulseAudio is able to express the Windows format (in principle we could just pretend samples are 32 bits and hope the least significant bits are inaudible, but since the code has been broken for years and nobody seems to have ever complained, probably nobody cares about 24-on-32 bit at all). --- dlls/winepulse.drv/pulse.c | 4 +--- dlls/winmm/tests/wave.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index d7a9985bb39..58087e553fa 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -1000,9 +1000,7 @@ static HRESULT pulse_spec_from_waveformat(struct pulse_stream *stream, const WAV stream->ss.format = PA_SAMPLE_S24LE; break; case 32: - if (valid == 24) - stream->ss.format = PA_SAMPLE_S24_32LE; - else if (valid == 32) + if (valid == 32) stream->ss.format = PA_SAMPLE_S32LE; break; default: diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c index acf8599ce72..5e3a5341423 100644 --- a/dlls/winmm/tests/wave.c +++ b/dlls/winmm/tests/wave.c @@ -1872,6 +1872,8 @@ static void test_PlaySound(void) ok(br, "PlaySound failed, got %d\n", br); br = PlaySoundA("test_s24_32le.wav", GetModuleHandleA(NULL), SND_RESOURCE | SND_NODEFAULT); + /* Not supported on some Wine drivers. */ + todo_wine_if(!br) ok(br, "PlaySound failed, got %d\n", br); br = PlaySoundA("test_alaw.wav", GetModuleHandleA(NULL), SND_RESOURCE | SND_NODEFAULT); @@ -2086,7 +2088,9 @@ static void test_format(WAVEFORMATEXTENSIBLE *fmt) || fmt->Format.wFormatTag == WAVE_FORMAT_ALAW || fmt->Format.wFormatTag == WAVE_FORMAT_MULAW || fmt->Format.cbSize > sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) /* Native seems to largely ignore when the channel mask has nonsensical values, while Wine is more picky. */ - || (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && __popcnt(fmt->dwChannelMask) != fmt->Format.nChannels))) + || (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && __popcnt(fmt->dwChannelMask) != fmt->Format.nChannels) + /* Some drivers do not support 24-on-32 bits samples. */ + || (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && fmt->Format.wBitsPerSample == 32 && fmt->Samples.wValidBitsPerSample == 24))) ok(mmr == expected || broken(channel_mismatch), "waveOutOpen(0) got result %#08x, expected %#08x\n", mmr, expected); ok((mmr == MMSYSERR_NOERROR) == !!hwo, "Unexpected waveout %p\n", hwo); @@ -2104,7 +2108,9 @@ static void test_format(WAVEFORMATEXTENSIBLE *fmt) || fmt->Format.cbSize > sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) /* Wine currently doesn't accept 24-bit PCM in direct mode. */ || fmt->Format.wBitsPerSample == 24 - || (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && __popcnt(fmt->dwChannelMask) != fmt->Format.nChannels))) + || (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && __popcnt(fmt->dwChannelMask) != fmt->Format.nChannels) + /* Some drivers do not support 24-on-32 bits samples. */ + || (fmt->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE && fmt->Format.wBitsPerSample == 32 && fmt->Samples.wValidBitsPerSample == 24))) ok(mmr == expected || (mmr == MMSYSERR_INVALPARAM && expected == WAVERR_BADFORMAT) || broken(channel_mismatch), "waveOutOpen(DIRECT) got result %#08x, expected %#08x\n", mmr, expected); ok((mmr == MMSYSERR_NOERROR) == !!hwo, "Unexpected waveout %p\n", hwo); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10243