Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Wed, May 19, 2021 at 10:27:36PM +0200, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
dlls/winepulse.drv/mmdevdrv.c | 14 ++++---------- dlls/winepulse.drv/pulse.c | 17 +++++++++++++++++ dlls/winepulse.drv/unixlib.h | 1 + 3 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index bf9a6672b05..1fe0d0bd50e 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -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, diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 43212822f4e..b9dceb911d0 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -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,
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 956dc36e267..d9c6ef057bb 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -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);