Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Thu, May 13, 2021 at 04:03:38PM +0200, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
dlls/winepulse.drv/mmdevdrv.c | 9 ++++++++- dlls/winepulse.drv/pulse.c | 13 ++++++++++++- dlls/winepulse.drv/unixlib.h | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 589a87076ff..2a9ebd86c3a 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -264,7 +264,7 @@ static int write_buffer(const ACImpl *This, BYTE *buffer, UINT32 bytes) channels = This->pulse_stream->ss.channels; for (i = 0; i < channels; i++) {
vol[i] = This->vol[i] * This->session->master_vol * This->session->channel_vols[i];
} if (!adjust) goto write;vol[i] = This->pulse_stream->vol[i] * This->session->master_vol * This->session->channel_vols[i]; adjust |= vol[i] != 1.0f;
@@ -526,6 +526,11 @@ static DWORD WINAPI pulse_timer_cb(void *user) return 0; }
+static void set_stream_volumes(ACImpl *This) +{
- pulse->set_volumes(This->pulse_stream, This->vol);
+}
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **keys, UINT *num, UINT *def_index) { @@ -870,6 +875,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, if (SUCCEEDED(hr)) { hr = get_audio_session(sessionguid, This->parent, This->channel_count, &This->session); if (SUCCEEDED(hr)) {
set_stream_volumes(This); list_add_tail(&This->session->clients, &This->entry); } else { pulse->release_stream(This->pulse_stream, NULL);
@@ -2038,6 +2044,7 @@ static HRESULT WINAPI AudioStreamVolume_SetAllVolumes( for (i = 0; i < count; ++i) This->vol[i] = levels[i];
- set_stream_volumes(This);
out: pulse->unlock(); return hr; diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index fed34167018..f0bfcd98b7d 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -755,7 +755,7 @@ static HRESULT WINAPI pulse_create_stream(const char *name, EDataFlow dataflow, struct pulse_stream **ret) { struct pulse_stream *stream;
- unsigned int bufsize_bytes;
unsigned int i, bufsize_bytes; HRESULT hr;
if (FAILED(hr = pulse_connect(name)))
@@ -765,6 +765,8 @@ static HRESULT WINAPI pulse_create_stream(const char *name, EDataFlow dataflow, return E_OUTOFMEMORY;
stream->dataflow = dataflow;
for (i = 0; i < ARRAY_SIZE(stream->vol); ++i)
stream->vol[i] = 1.f;
hr = pulse_spec_from_waveformat(stream, fmt); TRACE("Obtaining format returns %08x\n", hr);
@@ -1002,6 +1004,14 @@ static HRESULT WINAPI pulse_stop(struct pulse_stream *stream) return hr; }
+static void WINAPI pulse_set_volumes(struct pulse_stream *stream, const float *volumes) +{
- unsigned int i;
- for (i = 0; i < stream->ss.channels; i++)
stream->vol[i] = volumes[i];
+}
static const struct unix_funcs unix_funcs = { pulse_lock, @@ -1013,6 +1023,7 @@ static const struct unix_funcs unix_funcs = pulse_release_stream, pulse_read, pulse_stop,
- pulse_set_volumes, pulse_test_connect,
};
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index ca764afa19d..7b5c5400a1f 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -49,6 +49,7 @@ struct pulse_stream DWORD flags; AUDCLNT_SHAREMODE share; HANDLE event;
float vol[PA_CHANNELS_MAX];
INT32 locked; UINT32 bufsize_frames, real_bufsize_bytes, period_bytes;
@@ -79,5 +80,6 @@ struct unix_funcs void (WINAPI *release_stream)(struct pulse_stream *stream, HANDLE timer); void (WINAPI *read)(struct pulse_stream *stream); HRESULT (WINAPI *stop)(struct pulse_stream *stream);
- void (WINAPI *set_volumes)(struct pulse_stream *stream, const float *volumes); HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
};