Bug 181652

Summary: Automatically select "master channel" based on Phonon settings
Product: [Applications] kmix Reporter: Michael Liddle <michael>
Component: generalAssignee: Christian Esken <esken>
Status: RESOLVED WORKSFORME    
Severity: wishlist CC: anish.7, beschindler, bouf10pub, denisfalqueto, fire, jckeerthan, kde, linuxhippy, m.wege, maho+kde, me, mss, nikoamia, oliver.henshaw, tesfabpel
Priority: NOR Keywords: junior-jobs, triaged
Version: 4.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Michael Liddle 2009-01-23 11:35:34 UTC
Version:           3.5 (using 4.1.96 (KDE 4.1.96 (KDE 4.2 RC1)) "release 78.1", KDE:KDE4:Factory:Desktop / openSUSE_11.0)
Compiler:          gcc
OS:                Linux (i686) release 2.6.25.20-0.1-default

Is is possible to have the master channel in the systray respond to changes in sound devices, based on Phonon settings?

For example I plug in some USB speakers to my laptop and all my (KDE/Phonon) sounds are redirected to those speakers by the priorities that I have set. However the master channel in the systray icon still controls the on-board sound, and I have to change this manually.
Comment 1 Christian Esken 2009-01-24 10:37:19 UTC
I am not sure whether this can be done reliably, because you have to map phonon output sink to the mixer device. As the sink could be anything (actual soundcard hardware, dmix, gstreamer, file output, ...), this could get tricky or near impossible. Also even when "just" actual souncard hardware is meant, the mapping might be non-trivial. Lets explain:
- With ALSA it sounds easy: just map pcmCxDy to ControlCx. But what if the output device is called "default" or some "plug:*" entry. hen you will end up with parsing the .asoundrc (ouch).
- With OSS ist is possibly easier: While there has never been a guarantee that PCMx maps to MixerX, it is good practice.
- With Solaris I have no idea.

All in all, this is very much OS and driver dependent, and looks like much work and trouble.

I still agree that it would be nice to have this feature.
Comment 2 Michael Liddle 2009-01-24 11:06:03 UTC
Hmmm... tricky indeed. But if it can't be done or is very difficult to do then there certainly seems to a deficiency somewhere, either in KMix (doubtful from what you've said) or in Phonon. Currently the situation I described above definitely does not Just Work (and as another data-point, it _does_ Just Work in Windows :( ). 

I'm a bit surprised that Phonon doesn't expose some kind if mixer interface itself, either directly from the device or through its own API (probably nicer). From what you've said it sounds as if KMix is still working at a layer or two beneath Phonon?

Perhaps a ticket (bug or wishlist?) ought to be filed against Phonon? Or perhaps the Phonon folks could suggest the "right way" to achieve this? Seems like something that should be possible anyway! (If this is the case, then I'm probably not the right person to file, as I know very little about the internals of either KMix or Phonon.)
Comment 3 Malte S. Stretz 2009-05-03 16:00:42 UTC
If I understand the Phonon docs correctly, Sinks are AudioOutputs and those have the needed volume and muted properties so should be mixable. And I found http://websvn.kde.org/trunk/playground/multimedia/phonon/mixer/ (last activity about 1.5 years ago) and http://vir.homelinux.org/blog/archives/57-Mastering-the-Mixer.html

Couldn't KMix be replaced with something like PhononMix and everything would be cool? Or what feature is Phonon missing? (Individual channels could be one thing but I generally only need a Master volume and a Mute button.)
Comment 4 Bernhard Jungk 2009-07-16 14:17:58 UTC
I have experienced, that not only the master channel is not changed to the plugged in sound card, but it is often changed to "PCM" instead of "Master", which is just more wrong. Perhaps KMix could be extended to remember previous choices of the master channel for some configurations? If no choice was made by the user for the actual configuration, some sensible default should be used as fallback.
Comment 5 Christian Esken 2010-05-19 16:14:35 UTC
This is only about comment #3. Other (general) comment follows.

"Couldn't KMix be replaced with something like PhononMix and everything would be
cool? Or what feature is Phonon missing? (Individual channels could be one
thing  [...]"

Individual channels are the thing.
- Whenever you want to record something you definitely need that. The controls that Recorders like Audacity supply are not enough.
- Or when you want regulate the volume distribution between front, rear, Center and LFE.
- Or when you need to change the direction of a plug (mic input/headphone output), which is common on some cheap hardware.
- Or when you need an extra switch to actually activate the headphones or the PreAmp.
Comment 6 Christian Esken 2010-05-19 16:19:10 UTC
I agree that KMix should save the Master of the other cards. It does so while running, but it doesn't save it. But I will implement it.

But that is not really about the original bug report. there "following" the "active" card is requested. But well - there can me multiple "active" cards in Phonon, like "Card 1" for Music and "Card 2" for "Notifications". Does somebody has an idea how to deal with this?
Comment 7 Christian Esken 2010-05-19 16:26:20 UTC
*** Bug 200716 has been marked as a duplicate of this bug. ***
Comment 8 Michael Liddle 2010-05-20 08:12:59 UTC
It definitely seems that there are two levels that need to be catered for: the hardware, which KMix currently does; and the software or "system" level (e.g. 
http://kde-look.org/content/show.php/Phonon+System+Mixer?content=121483, don't know the status of that in terms of KDE SC integration though). 

I'd argue that once the second of these is included that that should be the default backend for the systray applet and keyboard shortcuts etc... 

> But that is not really about the original bug report. there "following" the
> "active" card is requested. But well - there can me multiple "active" cards in
> Phonon, like "Card 1" for Music and "Card 2" for "Notifications". Does somebody
> has an idea how to deal with this?

That's also a bit tricky. It seems either that a new sibling category to Music, Notifications, Video, Games, etc... for "KMix default preference" would solve it. But this is probably be complete overkill, not to mention a bit confusing (control vs. output). 

Another better possibility might be to simply be able to tell KMix to follow _one_ of those categories by default (say Music, or the top-level category). I personally have the same device ordering for all categories, so for me it wouldn't matter which one, but this could be configurable, either in KMix or in the Multimedia Settings dialog. I don't know how this gels with the other issues with different types of sinks mentioned in comment #1 though...

Finally, is there not an overall (software) "Master volume" concept in Phonon,  such that all output sinks could be equally affected? If there was, a slider connected to this in the systray would solve everything.
Comment 9 Christian Esken 2010-08-01 00:09:37 UTC
*** Bug 245661 has been marked as a duplicate of this bug. ***
Comment 10 Christian Esken 2010-08-01 00:15:13 UTC
Honestly, I don't know how to do this. I got confused by all the redirections and indirections of all the API's (Phonon, Pulseaudio, ALSA, dmix, ...).

Quite likely I "just" have to follow Phonon, but I still don't see any way of reliably mapping the devices. If somebody could give me a hint about a possible Phonon API I might take a look. Honestly, while I fully understand the rationale I am personally not too interested in this feature. So the best bet is if there would be a volunteer who will implement this. Then, please contact me. I will gladly assist the efforts.
Comment 11 Christian Esken 2010-08-01 01:19:37 UTC
*** Bug 184047 has been marked as a duplicate of this bug. ***
Comment 12 Christian Esken 2011-12-30 15:20:19 UTC
*** Bug 269043 has been marked as a duplicate of this bug. ***
Comment 13 Ivaylo Kabakov 2012-10-01 08:19:51 UTC
*** This bug has been confirmed by popular vote. ***
Comment 14 Christian Esken 2012-10-04 00:26:45 UTC
*** Bug 199408 has been marked as a duplicate of this bug. ***
Comment 15 Christian Esken 2012-11-10 15:24:08 UTC
*** Bug 250281 has been marked as a duplicate of this bug. ***
Comment 16 Christian Esken 2012-11-10 15:25:54 UTC
*** Bug 238368 has been marked as a duplicate of this bug. ***
Comment 17 Christian Esken 2012-11-10 15:26:33 UTC
*** Bug 302690 has been marked as a duplicate of this bug. ***
Comment 18 tesfabpel 2013-05-05 10:37:36 UTC
*** Bug 316517 has been marked as a duplicate of this bug. ***
Comment 19 Christian Esken 2013-07-20 08:45:13 UTC
Putting on hold until somebody shows up.
Comment 20 Myriam Schweingruber 2013-07-20 10:28:07 UTC
Christian: please don't use JuniorJobs in Components, there is a keyword for it, else nobody can find them, as nobody searches for JuniorJobs in Components. The components need to be real components of the application, not used for something else. Please do not change established ways to use our bugtracker, that doesn't help, really not :(

And if you want to put a report on hold, please change the status to LATER
Comment 21 Christian Esken 2013-07-22 21:45:27 UTC
Myriam, thanks for updating the ticket.
I was not aware that we have a keyword, nor is it very visible. I searched before on Techbase and also looked at various pages like http://community.kde.org/Getinvolved . Looks like I have missed the link on the https://bugs.kde.org/ start page. Well, now I know, but am still wondering whether it should be also on http://community.kde.org/Getinvolved .
Comment 22 Denis Falqueto 2014-01-14 17:21:29 UTC
Christian, I would like to help with this bug. I have this situation with a bluetooth headphone, so it would be very usefull to have it fixed. As it's marked as a Junior Job, I would like to apply for helping. And I'll certainly need your assistance too.

I'll start to dig into kmix to get acquainted to the source code.
Comment 23 Christian Esken 2014-04-04 14:08:57 UTC
Denis, that is good to know.  Unfortunately you got me off guard, when I ceased working on KMix for two months. Please either mail me personally or use the kde-multimedia mailing list, as this feature is of "public" interest.
Comment 24 Andrew Crouthamel 2018-09-25 03:47:52 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 25 Andrew Crouthamel 2018-10-27 02:28:15 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!