From: dead ash Subject: [PATCH 2/2]winmm: Fix no sound or recording when use waveform-audio Message-Id: Date: Thu, 9 Apr 2020 14:17:01 +0000 ​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: deadash Date: Thu, 9 Apr 2020 21:23:12 +0800 Subject: [PATCH 2/2] winmm-wave: fixed waveOutOpen and waveInOpen Signed-off-by: deadash --- 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