After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 305907 - [PATCH] gnome-sound-properties: Please add a default sound card selector
[PATCH] gnome-sound-properties: Please add a default sound card selector
Status: RESOLVED DUPLICATE of bug 329112
Product: gnome-control-center
Classification: Core
Component: Sound
2.11.x
Other Linux
: High enhancement
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
: 141600 319511 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-05-30 10:23 UTC by Martin Pitt
Modified: 2006-01-30 12:14 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
gnome-sound-properties patch (glade and code) (7.42 KB, patch)
2005-05-30 10:24 UTC, Martin Pitt
none Details | Review
set-default-soundcard (3.41 KB, text/plain)
2005-05-30 10:29 UTC, Martin Pitt
  Details
manpage for set-default-soundcard (1.11 KB, text/plain)
2005-05-30 10:29 UTC, Martin Pitt
  Details

Description Martin Pitt 2005-05-30 10:23:34 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?
Comment 1 Martin Pitt 2005-05-30 10:24:54 UTC
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.
Comment 2 Martin Pitt 2005-05-30 10:29:03 UTC
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.
Comment 3 Martin Pitt 2005-05-30 10:29:52 UTC
Created attachment 47025 [details]
manpage for set-default-soundcard
Comment 4 Bastien Nocera 2005-07-07 12:27:47 UTC
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?
Comment 5 Martin Pitt 2005-07-07 12:40:58 UTC
> 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.
Comment 6 Bastien Nocera 2005-07-07 12:51:59 UTC
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?
Comment 7 Bastien Nocera 2005-07-07 12:53:10 UTC
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)
Comment 8 Teppo Turtiainen 2005-07-16 19:13:02 UTC
*** Bug 141600 has been marked as a duplicate of this bug. ***
Comment 9 Sebastien Bacher 2005-12-30 16:17:59 UTC
*** Bug 319511 has been marked as a duplicate of this bug. ***
Comment 10 Jürg Billeter 2006-01-30 10:11:12 UTC
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
Comment 11 Martin Pitt 2006-01-30 10:56:04 UTC
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.
Comment 12 Bastien Nocera 2006-01-30 12:14:49 UTC
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 ***