Bug 365771 - Multimedia keys should change volume of active sink or global
Summary: Multimedia keys should change volume of active sink or global
Status: RESOLVED FIXED
Alias: None
Product: plasma-pa
Classification: Plasma
Component: general (show other bugs)
Version: 5.7.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-17 12:15 UTC by Olivier Churlaud
Modified: 2016-07-25 20:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Churlaud 2016-07-17 12:15:14 UTC
Currently scrolling on the plasma-pa icon or using the multimedia keys change the volume of the default device (the speakers of the laptop).

Before it was changing the master. So now I need to go in the parameters to change the volume instead of directly use the keys

Reproducible: Always
Comment 1 David Rosca 2016-07-19 09:41:40 UTC
Before it was changing volume of all audio cards. What is "master" in your case?
Comment 2 tamius.han 2016-07-19 21:29:07 UTC
I have this issue as well since a week or two ago. Scrolling and volume keys change the volume of the de-facto default device (Built-in audio), even if there's a different audio device with higher priority. (Fun fact: kmix used to do (and still does) that).

For example, my USB sound card has the highest priority. If it's plugged in, all audio goes to the USB sound card. If it's not, then built-in audio takes all the sound. Scrolling over the icon/volume keys always change volume of built-in audio, even if all my sound plays on USB sound card.

It would be preferable if volume keys (and scrolling over the speaker icon in the taskbar) would change sound level of either:

 A) all hardware devices (possibly ignoring virtual sinks) or 
 B) a currently active device with highest priority (ignoring unplugged, broken or unused audio devices that may have higher priority)
Comment 3 David Rosca 2016-07-22 20:09:04 UTC
I don't really like the idea of changing volume of all devices, that's why it was changed in 5.7. Controlling volume of currently "active" device seems much better to me, I implemented it in https://phabricator.kde.org/D2270 , would be great if you can test it.
Comment 4 Olivier Churlaud 2016-07-22 20:32:05 UTC
Your patch works for me.
Comment 5 David Rosca 2016-07-25 20:03:02 UTC
Git commit 6c2f9f27543bdfef448c87601a9aa52d271f7927 by David Rosca.
Committed on 25/07/2016 at 20:01.
Pushed by drosca into branch 'master'.

Try to be more clever about what sink to use for volume control

This changes the applet to display volume icon and control volume
through scroll / global shortcuts of "preferred" sink.

Preferred sink is currently chosen according to these rules:
  * if there is only one sink, that sink is preferred
  * if there is some sink that is currently playing some sound, that
    sink is preferred (if default sink is playing sound, default sink
    is used instead)
  * if there is some sink that is currently idle (there are streams on
    the device, but not currently playing), that one sink is preferred
    (same exception for default sink is used here as in case above)

This should help with changing the volume of correct audio device in
most cases.

Differential Revision: https://phabricator.kde.org/D2270

M  +14   -14   applet/contents/ui/main.qml
M  +21   -0    src/device.cpp
M  +21   -0    src/device.h
M  +89   -1    src/pulseaudio.cpp
M  +11   -0    src/pulseaudio.h

http://commits.kde.org/plasma-pa/6c2f9f27543bdfef448c87601a9aa52d271f7927