Skip to content

Commit

Permalink
ao_pipewire: fix ao-volume handling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pkunk committed Feb 5, 2022
1 parent 7849a36 commit d67a6e4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions audio/out/ao_pipewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,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: {
Expand Down

0 comments on commit d67a6e4

Please sign in to comment.