From bc9805c71a67b2717c79533731608eff679cded1 Mon Sep 17 00:00:00 2001 From: Alex B Date: Sat, 5 Feb 2022 00:02:15 +0300 Subject: ao_pipewire: fix ao-volume handling Pass channel volumes to `pw_stream_set_control` as array. This is correct calling conventions and prevents right channel muting every time ao-volume property is changed. Terminate `pw_stream_set_control` calls with 0. --- audio/out/ao_pipewire.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index c61c0b4f69..0b2e178bbe 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -512,14 +512,17 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) switch (cmd) { case AOCONTROL_SET_VOLUME: { struct ao_control_vol *vol = arg; - float left = mp_volume_to_spa_volume(vol->left), right = mp_volume_to_spa_volume(vol->right); - ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_channelVolumes, 2, &left, &right)); + float values[2] = { + mp_volume_to_spa_volume(vol->left), + mp_volume_to_spa_volume(vol->right), + }; + ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_channelVolumes, 2, values, 0)); break; } case AOCONTROL_SET_MUTE: { bool *muted = arg; float value = *muted ? 1.f : 0.f; - ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_mute, 1, &value)); + ret = CONTROL_RET(pw_stream_set_control(p->stream, SPA_PROP_mute, 1, &value, 0)); break; } case AOCONTROL_UPDATE_STREAM_TITLE: { -- cgit v1.2.3