winepulse: Adjust pulse stream volumes for session volumes.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8060e56b26
commit
131b7fd5e1
|
@ -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)
|
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;
|
BOOL adjust = FALSE;
|
||||||
UINT32 i, channels;
|
UINT32 i, channels;
|
||||||
BYTE *end;
|
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 */
|
/* Adjust the buffer based on the volume for each channel */
|
||||||
channels = This->pulse_stream->ss.channels;
|
channels = This->pulse_stream->ss.channels;
|
||||||
for (i = 0; i < channels; i++)
|
for (i = 0; i < channels; i++)
|
||||||
{
|
|
||||||
vol[i] = This->pulse_stream->vol[i] * This->session->channel_vols[i];
|
|
||||||
adjust |= vol[i] != 1.0f;
|
adjust |= vol[i] != 1.0f;
|
||||||
}
|
|
||||||
if (!adjust) goto write;
|
if (!adjust) goto write;
|
||||||
|
|
||||||
end = buffer + bytes;
|
end = buffer + bytes;
|
||||||
|
@ -528,7 +525,8 @@ static DWORD WINAPI pulse_timer_cb(void *user)
|
||||||
|
|
||||||
static void set_stream_volumes(ACImpl *This)
|
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,
|
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);
|
AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface);
|
||||||
AudioSession *session = This->session;
|
AudioSession *session = This->session;
|
||||||
|
ACImpl *client;
|
||||||
|
|
||||||
TRACE("(%p)->(%d, %f, %s)\n", session, index, level,
|
TRACE("(%p)->(%d, %f, %s)\n", session, index, level,
|
||||||
wine_dbgstr_guid(context));
|
wine_dbgstr_guid(context));
|
||||||
|
@ -2745,6 +2744,8 @@ static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume(
|
||||||
|
|
||||||
pulse->lock();
|
pulse->lock();
|
||||||
session->channel_vols[index] = level;
|
session->channel_vols[index] = level;
|
||||||
|
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry)
|
||||||
|
set_stream_volumes(client);
|
||||||
pulse->unlock();
|
pulse->unlock();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -2775,6 +2776,7 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes(
|
||||||
{
|
{
|
||||||
AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface);
|
AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface);
|
||||||
AudioSession *session = This->session;
|
AudioSession *session = This->session;
|
||||||
|
ACImpl *client;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TRACE("(%p)->(%d, %p, %s)\n", session, count, levels,
|
TRACE("(%p)->(%d, %p, %s)\n", session, count, levels,
|
||||||
|
@ -2794,6 +2796,8 @@ static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes(
|
||||||
pulse->lock();
|
pulse->lock();
|
||||||
for(i = 0; i < count; ++i)
|
for(i = 0; i < count; ++i)
|
||||||
session->channel_vols[i] = levels[i];
|
session->channel_vols[i] = levels[i];
|
||||||
|
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry)
|
||||||
|
set_stream_volumes(client);
|
||||||
pulse->unlock();
|
pulse->unlock();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
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;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < stream->ss.channels; 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 =
|
static const struct unix_funcs unix_funcs =
|
||||||
|
|
|
@ -81,6 +81,6 @@ struct unix_funcs
|
||||||
void (WINAPI *read)(struct pulse_stream *stream);
|
void (WINAPI *read)(struct pulse_stream *stream);
|
||||||
HRESULT (WINAPI *stop)(struct pulse_stream *stream);
|
HRESULT (WINAPI *stop)(struct pulse_stream *stream);
|
||||||
void (WINAPI *set_volumes)(struct pulse_stream *stream, float master_volume,
|
void (WINAPI *set_volumes)(struct pulse_stream *stream, float master_volume,
|
||||||
const float *volumes);
|
const float *volumes, const float *session_volumes);
|
||||||
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
|
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue