[PATCH v3 0/1] MR4820: dlls/winmm: waveOutGetID: Return correct id for WAVE_MAPPER.
Fixes bug 52592. https://bugs.winehq.org/show_bug.cgi?id=52592 -- v3: dlls/winmm: waveOutGetID: Return correct id for WAVE_MAPPER. https://gitlab.winehq.org/wine/wine/-/merge_requests/4820
From: Carlo Bramini <carlo_bramini(a)users.sourceforge.net> Fixes bug 52592. https://bugs.winehq.org/show_bug.cgi?id=52592 Added tests for checking waveOutGetID() --- dlls/winmm/tests/wave.c | 30 ++++++++++++++++++++++++++++++ dlls/winmm/waveform.c | 3 +++ 2 files changed, 33 insertions(+) diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c index 673c2c010ac..0fd1d4cfa8e 100644 --- a/dlls/winmm/tests/wave.c +++ b/dlls/winmm/tests/wave.c @@ -1409,6 +1409,36 @@ static void wave_out_test_device(UINT_PTR device) trace("waveOutOpen(%s): 32 bit float samples not supported\n", dev_name(device)); + /* Test if waveOutGetID() returns expected device */ + + format.wFormatTag=WAVE_FORMAT_PCM; + format.nChannels=1; + format.wBitsPerSample=8; + format.nSamplesPerSec=22050; + format.nBlockAlign=format.nChannels*format.wBitsPerSample/8; + format.nAvgBytesPerSec=format.nSamplesPerSec*format.nBlockAlign; + format.cbSize=0; + + rc = waveOutOpen(&wout, device, &format, 0, 0, 0); + ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + "waveOutOpen(%s): returned %s\n",dev_name(device),wave_out_error(rc)); + if (rc==MMSYSERR_NOERROR) { + rc = waveOutGetID(wout, &f); + ok(rc==MMSYSERR_NOERROR || + rc==MMSYSERR_INVALHANDLE || rc==MMSYSERR_INVALPARAM, + "waveOutGetID(%s): returned %s\n",dev_name(device),wave_out_error(rc)); + if (rc==MMSYSERR_NOERROR) { + ok(f==(UINT)device, + "waveOutGetID(%s): wrong id device, got %d expected %lld\n", + dev_name(device),f,device); + } else + trace("waveOutGetID(%s): cannot get device id\n", + dev_name(device)); + } else + trace("waveOutOpen(%s): cannot test waveOutGetID()\n", + dev_name(device)); + /* Test invalid parameters */ format.wFormatTag = WAVE_FORMAT_PCM; diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 8c0cc4d879c..f033e0a5fed 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -3159,6 +3159,9 @@ UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT* lpuDeviceID) WINMM_DecomposeHWAVE((HWAVE)hWaveOut, lpuDeviceID, &is_out, &dev, &junk); + if (*lpuDeviceID == MAPPER_INDEX) + *lpuDeviceID = WAVE_MAPPER; + return MMSYSERR_NOERROR; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4820
On Sun Jan 14 11:56:07 2024 +0000, eric pouech wrote:
please also add a test (in wimm/tests/wave.c) to demonstrate that your fix is correct the demo you wrote in the bug report is a good start, but * has to be integrated into test framework * waveOutGetId is not tested yet :-( * there's no need to get waveOutGetDevCaps as it's already tested * adding a test for another dev id different from mapper is also interesting I added the test for checking if `waveOutGetID()` returns the expected value. It is called for each audio device, including `WAVE_MAPPER`, so it should fit the request.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4820#note_57367
participants (2)
-
Carlo Bramini -
Carlo Bramini (@carlo-bramini)