Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winepulse.drv/mmdevdrv.c | 14 +++++++++----- dlls/winepulse.drv/pulse.c | 4 ++-- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-)
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Thu, May 13, 2021 at 04:04:14PM +0200, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
dlls/winepulse.drv/mmdevdrv.c | 14 +++++++++----- dlls/winepulse.drv/pulse.c | 4 ++-- dlls/winepulse.drv/unixlib.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 8933a95d834..fc9077b41ce 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -248,7 +248,7 @@ static void silence_buffer(pa_sample_format_t format, BYTE *buffer, UINT32 bytes
static int write_buffer(const ACImpl *This, BYTE *buffer, UINT32 bytes) {
- float vol[PA_CHANNELS_MAX];
- const float *vol = This->pulse_stream->vol; BOOL adjust = FALSE; UINT32 i, channels; BYTE *end;
@@ -263,10 +263,7 @@ static int write_buffer(const ACImpl *This, BYTE *buffer, UINT32 bytes) /* Adjust the buffer based on the volume for each channel */ channels = This->pulse_stream->ss.channels; for (i = 0; i < channels; i++)
{
vol[i] = This->pulse_stream->vol[i] * This->session->channel_vols[i]; adjust |= vol[i] != 1.0f;
} if (!adjust) goto write;
end = buffer + bytes;
@@ -528,7 +525,8 @@ static DWORD WINAPI pulse_timer_cb(void *user)
static void set_stream_volumes(ACImpl *This) {
- pulse->set_volumes(This->pulse_stream, This->session->master_vol, This->vol);
- pulse->set_volumes(This->pulse_stream, This->session->master_vol, This->vol,
This->session->channel_vols);
}
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **keys, @@ -2728,6 +2726,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( { AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); AudioSession *session = This->session;
ACImpl *client;
TRACE("(%p)->(%d, %f, %s)\n", session, index, level, wine_dbgstr_guid(context));
@@ -2745,6 +2744,8 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume(
pulse->lock(); session->channel_vols[index] = level;
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry)
set_stream_volumes(client);
pulse->unlock();
return S_OK;
@@ -2775,6 +2776,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( { AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); AudioSession *session = This->session;
ACImpl *client; int i;
TRACE("(%p)->(%d, %p, %s)\n", session, count, levels,
@@ -2794,6 +2796,8 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( pulse->lock(); for(i = 0; i < count; ++i) session->channel_vols[i] = levels[i];
- LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry)
pulse->unlock(); return S_OK;set_stream_volumes(client);
} diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 02f4d11a7f1..e2af68ea922 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -1005,12 +1005,12 @@ static HRESULT WINAPI pulse_stop(struct pulse_stream *stream) }
static void WINAPI pulse_set_volumes(struct pulse_stream *stream, float master_volume,
const float *volumes)
const float *volumes, const float *session_volumes)
{ unsigned int i;
for (i = 0; i < stream->ss.channels; i++)
stream->vol[i] = volumes[i] * master_volume;
stream->vol[i] = volumes[i] * master_volume * session_volumes[i];
}
static const struct unix_funcs unix_funcs = diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 8636f11d6f5..54c6ab66303 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -81,6 +81,6 @@ struct unix_funcs void (WINAPI *read)(struct pulse_stream *stream); HRESULT (WINAPI *stop)(struct pulse_stream *stream); void (WINAPI *set_volumes)(struct pulse_stream *stream, float master_volume,
const float *volumes);
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);const float *volumes, const float *session_volumes);
};