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

Authored by drosca on Jul 22 2016, 7:59 PM.

Details

Summary

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.

BUG: 365771

Diff Detail

Repository
R115 Plasma Audio Volume Applet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
drosca updated this revision to Diff 5453.Jul 22 2016, 7:59 PM
drosca retitled this revision from to Try to be more clever about what sink to use for volume control.
drosca updated this object.
drosca edited the test plan for this revision. (Show Details)
drosca added a reviewer: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptJul 22 2016, 7:59 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson accepted this revision.Jul 24 2016, 7:19 PM
davidedmundson added a reviewer: davidedmundson.
davidedmundson added a subscriber: davidedmundson.
davidedmundson added inline comments.
src/device.cpp
63

Use the values from pa_sink_state ?

src/device.h
128

it's worth initialising this to Unknown.

This revision is now accepted and ready to land.Jul 24 2016, 7:19 PM
drosca added inline comments.Jul 24 2016, 7:26 PM
src/device.cpp
63

libpulse has pa_sink_state and pa_source_state, but here it is in Device - so for both sink and source. I can change it to use either PA_SOURCE_* or PA_SINK_* values (which are both exactly the same) but it won't be entirely "correct" (same as just using integer values).

src/device.h
128

I used old-style initialization in constructor, will change it.

This revision was automatically updated to reflect the committed changes.