winepulse: Store volume levels in pulse_stream.
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
b1ddfca16e
commit
bca0706f3a
|
@ -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];
|
||||
vol[i] = This->pulse_stream->vol[i] * This->session->master_vol * This->session->channel_vols[i];
|
||||
adjust |= vol[i] != 1.0f;
|
||||
}
|
||||
if (!adjust) goto write;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue