Bug 294878 - KMix: add menu to switch soundcard profile when using pulseaudio
Summary: KMix: add menu to switch soundcard profile when using pulseaudio
Status: RESOLVED INTENTIONAL
Alias: None
Product: kmix
Classification: Applications
Component: Backend: Pulseaudio (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Colin Guthrie
URL:
Keywords:
: 220562 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-26 18:17 UTC by Moritz Moroder
Modified: 2012-11-14 23:58 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
based on kdemultimedia 4.8 (16.12 KB, patch)
2012-02-26 18:17 UTC, Moritz Moroder
Details
Patch based on kdemultimedia 4.8 (15.90 KB, patch)
2012-02-26 18:28 UTC, Moritz Moroder
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Moroder 2012-02-26 18:17:40 UTC
Created attachment 69113 [details]
based on kdemultimedia 4.8

Version:           unspecified (using KDE 4.8.0) 
OS:                Linux

I'd like a additional menu in the kmix system tray context menu which enables one to switch soundcard profile when using pulseaudio.
I'm not an experienced kde developer, but I have some Qt skills. So I tried to develop it. I used a class from the phonon kcm and modified it to fit my needs.

Reproducible: Always



Expected Results:  
Be able to switch soundcard profile quickly.
Comment 1 Moritz Moroder 2012-02-26 18:28:52 UTC
Created attachment 69114 [details]
Patch based on kdemultimedia 4.8

Previous one was broken.
Comment 2 Christian Esken 2012-07-09 20:22:56 UTC
In general it is planned to remove the menu, as it basically duplicates the functionality from the volume popup, and some desktops do not support more than one action on the System tray. See http://kmix5.wordpress.com/2012/07/09/my-ubuntu-trip-into-desktop-compatibility/ and http://kmix5.wordpress.com/2012/06/26/kmixs-top-secret-features-part-1-volume-presets/
Comment 3 Christian Esken 2012-07-09 20:27:14 UTC
What I meant by this is: Can you put it in the bolume popup (e.g. using a QSpinBox)?
Comment 4 Christian Esken 2012-07-09 20:28:14 UTC
(again, with fixed typo):
What I meant by this is: Can you put it in the volume popup (e.g. using a QSpinBox)?
Comment 5 Moritz Moroder 2012-09-17 12:23:19 UTC
Sorry for the late reply. I have some problems with git / compiling. As I understand, I need the whole kdemultimedia to compile kmix ( i get an error if i try to compile kmix after checking out from kmix repo like "No cmake_minimum_required command is present." ). How can I fix that / checkout the whole kdemultimedia?
Comment 6 Christian Esken 2012-09-20 08:19:18 UTC
Thanks for asking back. You do not need anything else from kdemultimedia (and there is no kdemultimedia package anymore). It could be that you miss some KDE development packages. It would be easier to tell if I have a complete output - you can also send it via Mail to me.
Comment 7 Christian Esken 2012-09-20 12:51:58 UTC
By the way: Is it a good idea to copy the code from the phonon kcm? Since some time you can already access the phonon kcm directly fom the  KMix main menu (Settings->Menu->Audio-Setup). Recently there was a patch applied to directly have it in the KMix tray menu.
Comment 8 Moritz Moroder 2012-09-21 00:13:13 UTC
It would be nice if could select a default profile ( like HDMI output ), and pulse audio would fall back to an other profile if it can't be used ( HDMI unplugged ). But kmix is the wrong application for that, right?
I actually wrote this patch because I have to switch profile very often ( I have a laptop and a monitor connected over HDMI ), so every click less is better for me ;)
Comment 9 Christian Esken 2012-09-28 11:16:30 UTC
In genral it would be a very good idea to have it in KMix. If it is there, it must use the KMix infrastructure, though. I have now took a closer look at the patch and see a bunch of issues:

- Using -DHAVE_PULSEAUDIO is a bad idea. It means you the menu will always be there even if the user does not use Pulseaudio. It must be a runtime option.
- The CMakeFiles.txt change looks suspicious. You try to find Pulseaudio and cnaberra, though there are already checks in there, e.g.:
macro_optional_find_package(PulseAudio "0.9.12")   # <<< existing
+set(PULSEAUDIO_MINIMUM_VERSION "0.9.16")  # <<< your addition
+macro_optional_find_package(PulseAudio)  # <<< your addition

- You use pa_glib_mainloop_new(). I don't know PA good enough to know whether it is an issue to have two PA mainloops in the same application and also in the same thread. It could mean that you are hijacking PA events. Colin Guthrie should take a look at it. [1]

In general I see that you are completely bypassing KMix. As far as the patch is not using the Pixer_Pulse backend (e.g. for event loop, enumeration mixers/controls) and you are not checking whether PA is in use.

There are two ways to progress:
 1) Modify your patch that it is more tightly coupled with KMix. For that please see [1].
 2) Rollout your own Tray application

Personally I would like to see the first option, as it would make a valuable addition to KMix.

[1 ] Please update your patch to current trunk version and put it up your changes on Reviewboard: https://git.reviewboard.kde.org/  . Colin Guthrie should definitely take a look at the patch.


macro_optional_find_package(PulseAudio "0.9.12")
macro_optional_find_package(Canberra)
Comment 10 Colin Guthrie 2012-09-28 11:36:46 UTC
To be perfectly honest, I really don't like the idea of putting profile switching into kmix.

The reason being that profile switching is, by itself, not necessarily something you want to do directly. I could be automated and even when manual choices are made you might not want to have any UI designed around actually selecting the profile itself directly, but by selecting a port that the profile may enable and then being given a choice of which profiles meet that need.

For example, I might want to enable my "Internal Microphone", but I'm currently on the "5.1 Surround Output" profile (which doesn't enable any inputs). The user will be told, they can enable the Internal Microphone only if they switch away from the "5.1 Surround Output" profile and chose one of "Stereo Duplex" or "Stereo Input" profiles.

Add to this that in the future we may make some profile usage automatic. e.g. depending on your Phonon device priorities it will eventually be possible to automatically activate the passthrough device on your audio receiver by automatic profile switch. In this case it is really the phonon priorities that will govern the profile (and port) that is used - it will be a result of that configuration. At this point the manual profile selection available in phonon UI currently will likely be removed in favour of a more user friendly mechanism.

So from the perspective of UIs, the kmix infrastructure really isn't designed to allow this kind of operation and I also don't believe it's the right place to make these kind of decisions. It's too low level for this kind of thing. This is the primary reason I never added this support in the first place when adding PA support to kmix.
Comment 11 Moritz Moroder 2012-09-28 23:52:36 UTC
OK, so I should try to contact someone of the Phonon team.
Thanks for your answers :)
Comment 12 Christian Esken 2012-11-14 23:54:41 UTC
*** Bug 220562 has been marked as a duplicate of this bug. ***
Comment 13 Christian Esken 2012-11-14 23:58:41 UTC
I read Colin's argument, and can agree with him. It should be done on another level. KMix will for now stick with the menu entry to start the Phonon Systemsettings. Thus closing bug report. I'll also merge with Bug 220562, because of the reasons listed there.