Commit 44e41324 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winepulse: Move pulse_get_frequency to unix lib.

parent a6131544
......@@ -1283,19 +1283,13 @@ static ULONG WINAPI AudioClock_Release(IAudioClock *iface)
static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
{
ACImpl *This = impl_from_IAudioClock(iface);
HRESULT hr;
TRACE("(%p)->(%p)\n", This, freq);
pulse->lock();
hr = pulse_stream_valid(This);
if (SUCCEEDED(hr)) {
*freq = This->pulse_stream->ss.rate;
if (This->pulse_stream->share == AUDCLNT_SHAREMODE_SHARED)
*freq *= pa_frame_size(&This->pulse_stream->ss);
}
pulse->unlock();
return hr;
if (!This->pulse_stream)
return AUDCLNT_E_NOT_INITIALIZED;
return pulse->get_frequency(This->pulse_stream, freq);
}
static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
......
......@@ -1694,6 +1694,22 @@ static HRESULT WINAPI pulse_get_next_packet_size(struct pulse_stream *stream, UI
return S_OK;
}
static HRESULT WINAPI pulse_get_frequency(struct pulse_stream *stream, UINT64 *freq)
{
pulse_lock();
if (!pulse_stream_valid(stream))
{
pulse_unlock();
return AUDCLNT_E_DEVICE_INVALIDATED;
}
*freq = stream->ss.rate;
if (stream->share == AUDCLNT_SHAREMODE_SHARED)
*freq *= pa_frame_size(&stream->ss);
pulse_unlock();
return S_OK;
}
static void WINAPI pulse_set_volumes(struct pulse_stream *stream, float master_volume,
const float *volumes, const float *session_volumes)
{
......@@ -1741,6 +1757,7 @@ static const struct unix_funcs unix_funcs =
pulse_get_latency,
pulse_get_current_padding,
pulse_get_next_packet_size,
pulse_get_frequency,
pulse_set_volumes,
pulse_set_event_handle,
pulse_test_connect,
......
......@@ -83,6 +83,7 @@ struct unix_funcs
HRESULT (WINAPI *get_latency)(struct pulse_stream *stream, REFERENCE_TIME *latency);
HRESULT (WINAPI *get_current_padding)(struct pulse_stream *stream, UINT32 *out);
HRESULT (WINAPI *get_next_packet_size)(struct pulse_stream *stream, UINT32 *frames);
HRESULT (WINAPI *get_frequency)(struct pulse_stream *stream, UINT64 *freq);
void (WINAPI *set_volumes)(struct pulse_stream *stream, float master_volume,
const float *volumes, const float *session_volumes);
HRESULT (WINAPI *set_event_handle)(struct pulse_stream *stream, HANDLE event);
......
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