strawberrymusicplayer / strawberry

:strawberry: Strawberry Music Player
https://www.strawberrymusicplayer.org/
GNU General Public License v3.0
2.65k stars 182 forks source link

Synchronize volume with PulseAudio #1037

Closed glaubersm closed 1 year ago

glaubersm commented 2 years ago

Describe the bug The slider of the sound applet that indicates the volume of Strawberry in KDE Plasma does not change when I adjust the volume level via Strawberry GUI,

To Reproduce

  1. play a song with Strawberry installed in a linux distribution that runs KDE Plasma desktop environment
  2. click on sound icon in the system tray and click on 'Applications' tab - there is a slider indicating the current volume of Strawberry
  3. hover over the volume slider of Strawberry and adjust the volume by scrolling up/down

Expected behavior the volume slider in 'Applications' tab of the sound applet should reflect the volume adjustment done in the step 3

System Information:

Additional context I think this is a Strawberry bug because I'm unable to reproduce with VLC player installed on the same systems.

jonaski commented 2 years ago

Strawberry using GStreamer has it's own independent software volume, unlike VLC, it implements synchronization to PA volume control. So I don't think this is possible.

glaubersm commented 2 years ago

Humm, I'm also unable to reproduce with Firefox. Is VLC backend still available for Strawberry?

jonaski commented 2 years ago

VLC is still available but still very incomplete and untested.

glaubersm commented 2 years ago

Thanks Jonas. I'm also unable to reproduce with these players:

Audacious Qmmp Lollypop Exaile Quod Libet Pragha Totem video player (gstreamer, I guess)

jonaski commented 1 year ago

The volume in Strawberry synchronizes fine with kmix and the media player applet in KDE. This is done using MPRIS2. But I assume you mean the Plasma PulseAudio Applet (this one: https://invent.kde.org/plasma/plasma-pa). That's PulseAudio. The volume in Strawberry (or gstreamer) doesn't synchronize with Pulse Audio, it has never done that and it has never been implemented. It's the same result with the PulseAudio volume control (pavucontrol). I'm not familiar with most of the other music players you mention, but at least Pragha is using GStreamer, it uses GTK, so it's probably using some GLib API or the PulseAudio library directly, not through gstreamer. so I'm probably wrong, it is most likely possible to implement in Strawberry.

jonaski commented 1 year ago

The reason this worked in other GStreamer players, and not Strawberry is because Strawberry was creating it's own volume element, instead of using the pipeline/playbin or output/sink volume, mainly because of the fading features. I have now fixed so that Strawberry uses the existing volume instead of creating it's own volume when it's detected that there is a volume for the output/sink, this now works when specifically selecting PulseAudio or any other output/sink that supports it, however it still doesn't work when output/sink is set to auto, because in that case it's not detected which output/sink GStreamer selects, maybe there is a solution to that. The fader now creates it's own dedicated volume that works internally independent of the user volume if one or more of the fading options are enabled.

glaubersm commented 1 year ago

Thank you for explaining and fixing this bug Jonas. I have just installed strawberry_1.0.10-35-g55e04dd5-jammy_amd64.deb on neon unstable and can confirm that the bug is no longer reproducible when 'Plays audio to a PulseAudio server' is selected as output. :)

jonaski commented 1 year ago

With https://github.com/strawberrymusicplayer/strawberry/commit/b2073df3c3391d2db5645f2fc246eb785e76e956 it should now detect if there is a volume control when set to auto too.

glaubersm commented 1 year ago

Thank you again Jonas. I have created another issue possibly related to this one: https://github.com/strawberrymusicplayer/strawberry/issues/1083