GNOME Bugzilla – Bug 305907
[PATCH] gnome-sound-properties: Please add a default sound card selector
Last modified: 2006-01-30 12:14:49 UTC
Distribution/Version: Ubuntu/Breezy Currently there is no way to select the default sound card in Gnome. This is rather painful for unexperienced users who have multiple sound cards (or modems which provide a PCM interface) and no clue about ALSA configuration. So I added such a thing to gnome-sound-properties, I will attach the patch. It consists of the following parts: - a small python script 'set-default-soundcard' which does the actual change; it can create an ~/.asoundrc, or modify an existing one if the magic comments are intact (to allow custom configurations which are not touched automatically) - a combobox in sound-properties.glade - sound-properties-capplet.c: functions get a list of available ALSA soundcards, and the default soundcard; the combobox is disabled if set-default-soundcard is not available, or the sound cards cannot be queried So far this works well for Ubuntu since we have a rather fixed enironment (ALSA driver with dmix, and python available). IMHO ALSA should not be a big problem for the official gnome since OSS has no concept of a default device anyway. However, you might not like the python implementation of set-default-soundcard; if you rather want to write it in C, that's of course fine for me. So these patches are intended to be a starting point for discussing how to bring this upstream rather than being a final upstream solution. What do you think about this? Do you consider adding such a feature upstream?
Created attachment 47023 [details] [review] gnome-sound-properties patch (glade and code) This contains the glade changes, and the code for detecting ALSA devices, the current default device, and the calling of set-default-soundcard.
Created attachment 47024 [details] set-default-soundcard The current python implementation of set-default-card. In Ubuntu this is part of the alsa-base package since it fits better there. However, if you want to integrate such a thing into a control-center library and implement it in C, that's certainly fine as well.
Created attachment 47025 [details] manpage for set-default-soundcard
What happens when the sound system used isn't ALSA, or the system isn't Linux? Do you warn users that a restart of the applications is required, or could you signal applications (at least GNOME applications) that they need to re-open the default sound device?
> What happens when the sound system used isn't ALSA, or the system isn't Linux? Then the selector will be disabled and is not available. As normal user you cannot change the default OSS device anyway (i. e. alter the /dev/dsp symlink), and I don't really care about OSS. > Do you warn users that a restart of the applications is required, or could you > signal applications (at least GNOME applications) that they need to re-open the > default sound device? We patched esound to reconnect to the device, and polypaudio already sort of does it automatically (in Ubuntu we configure it to automatically unload the alsa module after three seconds of inactivity, and if it is reloaded, the new default device will be used). BTW, I have a slightly updated patch which sends SIGUSR1 to esd which triggers the reconnection. If you intend to adopt that selector in gnome, I will attach the updated patch here and file a bug against esound.
Could we get a signal, via d-bus for example, that the default device has changed so that application that don't use esd can be notified? Also, wouldn't it be a good idea to enable (or at least have a setting) to enable dsym and/or dmix?
Also, it would be a better idea to use HAL to enumerate the soundcards, as it would allow for cards to show up straight away when plugged in. (HAL already knows how to do that)
*** Bug 141600 has been marked as a duplicate of this bug. ***
*** Bug 319511 has been marked as a duplicate of this bug. ***
I forgot about this bug. I've written a gnome-sound-properties patch that uses HAL to enumerate the soundcards and in contrast to set-default-soundcard it doesn't hardcode the alsa sound card number because that number may change across reboots or hotplug hardware changes. Additionally it supports specifying separate devices for music/movies and audio/video conferencing. It can also easily be extended to support non-ALSA systems when the corresponding sound system support is available in HAL. The patch is in bug 329112
Wrt. re-enumeration of sound cards, I fixed this recently in Ubuntu. We now use a more general command 'asoundconf' and we store the ALSA ID instead of the card number, so the order of sound cards does not matter any more. If you are still interested in the current patches/programs, I can attach them here.
Dup'ing this bug against bug 329112 which has a nicer patch. Please carry on the discussion in the other bug. *** This bug has been marked as a duplicate of 329112 ***