Commit 984cae31 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Move get_latency to the unixlib.

parent aa9d07e6
......@@ -806,7 +806,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
REFERENCE_TIME *latency)
{
ACImpl *This = impl_from_IAudioClient3(iface);
struct oss_stream *stream = This->stream;
struct get_latency_params params;
TRACE("(%p)->(%p)\n", This, latency);
......@@ -816,15 +816,11 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
if(!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
oss_lock(stream);
/* pretend we process audio in Period chunks, so max latency includes
* the period time. Some native machines add .6666ms in shared mode. */
*latency = (REFERENCE_TIME)stream->period_us * 10 + 6666;
oss_unlock(stream);
params.stream = This->stream;
params.latency = latency;
OSS_CALL(get_latency, &params);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
......
......@@ -762,6 +762,20 @@ static NTSTATUS get_buffer_size(void *args)
return oss_unlock_result(stream, &params->result, S_OK);
}
static NTSTATUS get_latency(void *args)
{
struct get_latency_params *params = args;
struct oss_stream *stream = params->stream;
oss_lock(stream);
/* pretend we process audio in Period chunks, so max latency includes
* the period time. Some native machines add .6666ms in shared mode. */
*params->latency = (REFERENCE_TIME)stream->period_us * 10 + 6666;
return oss_unlock_result(stream, &params->result, S_OK);
}
unixlib_entry_t __wine_unix_call_funcs[] =
{
test_connect,
......@@ -771,4 +785,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
is_format_supported,
get_mix_format,
get_buffer_size,
get_latency,
};
......@@ -113,6 +113,13 @@ struct get_buffer_size_params
UINT32 *size;
};
struct get_latency_params
{
struct oss_stream *stream;
HRESULT result;
REFERENCE_TIME *latency;
};
enum oss_funcs
{
oss_test_connect,
......@@ -122,6 +129,7 @@ enum oss_funcs
oss_is_format_supported,
oss_get_mix_format,
oss_get_buffer_size,
oss_get_latency,
};
extern unixlib_handle_t oss_handle;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment