Module: wine Branch: master Commit: d6728615c93f7cbdae710f49d7bc2d9d95efe820 URL: https://gitlab.winehq.org/wine/wine/-/commit/d6728615c93f7cbdae710f49d7bc2d9...
Author: Davide Beatrici git@davidebeatrici.dev Date: Tue May 23 10:16:19 2023 +0200
winecoreaudio: Implement get_device_period in unixlib.
---
dlls/winecoreaudio.drv/coreaudio.c | 43 ++++++++++++++++++++++++++++++++++++-- dlls/winecoreaudio.drv/mmdevdrv.c | 15 +++++++------ 2 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index ecd137ce609..89265558a1d 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -100,6 +100,9 @@ struct coreaudio_stream BYTE *local_buffer, *cap_buffer, *wrap_buffer, *resamp_buffer, *tmp_buffer; };
+static const REFERENCE_TIME def_period = 100000; +static const REFERENCE_TIME min_period = 50000; + static NTSTATUS unix_not_implemented(void *args) { return STATUS_SUCCESS; @@ -1087,6 +1090,20 @@ unsupported: return STATUS_SUCCESS; }
+static NTSTATUS unix_get_device_period(void *args) +{ + struct get_device_period_params *params = args; + + if (params->def_period) + *params->def_period = def_period; + if (params->min_period) + *params->min_period = min_period; + + params->result = S_OK; + + return STATUS_SUCCESS; +} + static UINT buf_ptr_diff(UINT left, UINT right, UINT bufsize) { if(left <= right) @@ -1739,7 +1756,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = unix_release_capture_buffer, unix_is_format_supported, unix_get_mix_format, - unix_not_implemented, + unix_get_device_period, unix_get_buffer_size, unix_get_latency, unix_get_current_padding, @@ -1934,6 +1951,28 @@ static NTSTATUS unix_wow64_get_mix_format(void *args) return STATUS_SUCCESS; }
+static NTSTATUS unix_wow64_get_device_period(void *args) +{ + struct + { + PTR32 device; + EDataFlow flow; + HRESULT result; + PTR32 def_period; + PTR32 min_period; + } *params32 = args; + struct get_device_period_params params = + { + .device = ULongToPtr(params32->device), + .flow = params32->flow, + .def_period = ULongToPtr(params32->def_period), + .min_period = ULongToPtr(params32->min_period), + }; + unix_get_device_period(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + static NTSTATUS unix_wow64_get_buffer_size(void *args) { struct @@ -2099,7 +2138,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = unix_release_capture_buffer, unix_wow64_is_format_supported, unix_wow64_get_mix_format, - unix_not_implemented, + unix_wow64_get_device_period, unix_wow64_get_buffer_size, unix_wow64_get_latency, unix_wow64_get_current_padding, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 756aab93f71..d8a2e9e5d21 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -790,18 +790,21 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) { ACImpl *This = impl_from_IAudioClient3(iface); + struct get_device_period_params params;
TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod);
- if(!defperiod && !minperiod) + if (!defperiod && !minperiod) return E_POINTER;
- if(defperiod) - *defperiod = DefaultPeriod; - if(minperiod) - *minperiod = MinimumPeriod; + params.device = This->device_name; + params.flow = This->dataflow; + params.def_period = defperiod; + params.min_period = minperiod;
- return S_OK; + UNIX_CALL(get_device_period, ¶ms); + + return params.result; }
static DWORD WINAPI ca_timer_thread(void *user)