From: dead ash Subject: winmm: Fix no sound or recording when use waveform-audio Message-Id: Date: Thu, 9 Apr 2020 13:49:25 +0000 In-Reply-To: References: from MSDN, the waveInGetDevCaps and waveOutGetDevCaps function of parameter uDeviceID can be either a device identifier or a handle of an open waveform-audio input or output device. now the function not support handle. also same as waveOutOpen and waveInOpen

 from MSDN, the waveInGetDevCaps and waveOutGetDevCaps function of parameter uDeviceID can be either a device identifier or a handle of an open waveform-audio input or output device. now the function not support handle. also same as waveOutOpen and waveInOpen
From 398596663420cd4024d1d695831f88c085f26c93 Mon Sep 17 00:00:00 2001 From: deadash Date: Thu, 9 Apr 2020 18:02:14 +0800 Subject: [PATCH 1/2] winmm-wave: fixed waveOutGetDevCaps and waveInGetDevCaps --- dlls/winmm/waveform.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 730851997e..f05f8f45ce 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -2669,10 +2669,15 @@ UINT WINAPI waveOutGetDevCapsW(UINT_PTR uDeviceID, LPWAVEOUTCAPSW lpCaps, caps = &mapper_caps; }else{ - if(uDeviceID >= g_outmmdevices_count) - return MMSYSERR_BADDEVICEID; - - caps = &read_map(g_out_map, uDeviceID)->out_caps; + if(uDeviceID >= g_outmmdevices_count){ + WINMM_Device *device = WINMM_GetDeviceFromHWAVE((HWAVE)uDeviceID); + + if(device == NULL) return MMSYSERR_BADDEVICEID; + + caps = &device->parent->out_caps; + }else{ + caps = &read_map(g_in_map, uDeviceID)->out_caps; + } } memcpy(lpCaps, caps, min(uSize, sizeof(*lpCaps))); @@ -3324,10 +3329,15 @@ UINT WINAPI waveInGetDevCapsW(UINT_PTR uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSi caps = &mapper_caps; }else{ - if(uDeviceID >= g_inmmdevices_count) - return MMSYSERR_BADDEVICEID; - - caps = &read_map(g_in_map, uDeviceID)->in_caps; + if(uDeviceID >= g_inmmdevices_count){ + WINMM_Device *device = WINMM_GetDeviceFromHWAVE((HWAVE)uDeviceID); + + if(device == NULL) return MMSYSERR_BADDEVICEID; + + caps = &device->parent->in_caps; + }else{ + caps = &read_map(g_in_map, uDeviceID)->in_caps; + } } memcpy(lpCaps, caps, min(uSize, sizeof(*lpCaps))); -- 2.26.0.windows.1 From 4c8c059f6f7b65e6750d11ce0556f11f54836624 Mon Sep 17 00:00:00 2001 From: deadash Date: Thu, 9 Apr 2020 21:23:12 +0800 Subject: [PATCH 2/2] winmm-wave: fixed waveOutOpen and waveInOpen --- dlls/winmm/waveform.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index f05f8f45ce..05e4b7aba6 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -1243,10 +1243,17 @@ static LRESULT WOD_Open(WINMM_OpenInfo *info) lock = &g_devthread_lock; internal_index = MAPPER_INDEX; }else{ - if(info->req_device >= g_outmmdevices_count) - return MMSYSERR_BADDEVICEID; + if (info->req_device >= g_outmmdevices_count) { + WINMM_Device *device = WINMM_GetDeviceFromHWAVE((HWAVE)info->req_device); + + if (device == NULL) return MMSYSERR_BADDEVICEID; + + mmdevice = device->parent; + } + else { + mmdevice = read_map(g_out_map, info->req_device); + } - mmdevice = read_map(g_out_map, info->req_device); if(!mmdevice->out_caps.szPname[0]) return MMSYSERR_NOTENABLED; @@ -1334,10 +1341,16 @@ static LRESULT WID_Open(WINMM_OpenInfo *info) lock = &g_devthread_lock; internal_index = MAPPER_INDEX; }else{ - if(info->req_device >= g_inmmdevices_count) - return MMSYSERR_BADDEVICEID; + if (info->req_device >= g_inmmdevices_count){ + WINMM_Device* device = WINMM_GetDeviceFromHWAVE((HWAVE)info->req_device); + + if (device == NULL) return MMSYSERR_BADDEVICEID; - mmdevice = read_map(g_in_map, info->req_device); + mmdevice = device->parent; + } + else { + mmdevice = read_map(g_in_map, info->req_device); + } if(!mmdevice->in_caps.szPname[0]) return MMSYSERR_NOTENABLED; -- 2.26.0.windows.1