1 --- libcanberra-0.25/src/Makefile.am-orig 2010-09-13 23:46:23.884713926 -0500
2 +++ libcanberra-0.25/src/Makefile.am 2010-09-13 23:46:45.949907623 -0500
3 @@ -60,8 +60,10 @@ libcanberra_la_SOURCES = \
4 fork-detect.c fork-detect.h
5 libcanberra_la_CFLAGS = \
9 libcanberra_la_LIBADD = \
12 libcanberra_la_LDFLAGS = \
14 --- libcanberra-0.25/src/common.c-orig 2010-09-13 19:17:02.032029728 -0500
15 +++ libcanberra-0.25/src/common.c 2010-09-14 00:06:00.628638823 -0500
20 +#include <gconf/gconf-client.h>
27 #include "fork-detect.h"
29 +#define GNOME_VOLUME_CONTROL_KEY_ACTIVE_ELEMENT "/apps/gnome-volume-control/active-element"
33 * @short_description: General libcanberra API
34 @@ -129,6 +133,7 @@ int ca_context_create(ca_context **_c) {
38 + const char *device = NULL;
40 ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
41 ca_return_val_if_fail(_c, CA_ERROR_INVALID);
42 @@ -153,13 +158,79 @@ int ca_context_create(ca_context **_c) {
46 - if ((d = getenv("CANBERRA_DEVICE"))) {
47 - if ((ret = ca_context_change_device(c, d)) < 0) {
49 + * If the user sets CANBERRA_DEVICE, use that. Then fallback to the
50 + * gnome-volume-control setting. If neither is set, then do not set
51 + * the device and just let OSS use its default.
53 + if ((device = getenv("CANBERRA_DEVICE"))) {
54 + if ((ret = ca_context_change_device(c, device)) < 0) {
55 ca_context_destroy(c);
61 + * Note that the following code only works with OSSv4. Also note that
62 + * gnome-volume-control saves the device via GConf in this format:
64 + * foo#0 (OSS v4 Audio Mixer)
66 + * Where the actual device is "/dev/sound/"; followed by the first word
67 + * in the GConf value with the "#" changed to a ":"; and "dsp" appended
68 + * to the end. So "foo#0" becomes /dev/sound/foo:0dsp. The "dsp" is
69 + * needed since canberra uses OSS ioctls.
71 + if (device == NULL) {
72 + GConfClient *gconf_client;
75 + gconf_client = gconf_client_get_default ();
77 + gvc_active = gconf_client_get_string (gconf_client,
78 + GNOME_VOLUME_CONTROL_KEY_ACTIVE_ELEMENT, NULL);
81 + * Only use the gnome-volume-control setting if the value
82 + * is associated with an OSS device. Check for "OSS" string
83 + * in the value since it will be "foo#0 (OSS v4 Audio Mixer)"
86 + if (gvc_active != NULL && strstr (gvc_active, "OSS") != NULL) {
87 + char ** element_arr;
88 + element_arr = g_strsplit (gvc_active, " ", 2);
90 + if (element_arr != NULL &&
91 + element_arr[0] != NULL) {
92 + char **device_arr = g_strsplit (element_arr[0],
94 + if (device_arr != NULL &&
95 + device_arr[0] != NULL &&
96 + device_arr[1] != NULL) {
98 + * Need to prepend "/dev/sound/" and
99 + * append "dsp" to the device name
100 + * returned by gnome-volume-control.
101 + * The "dsp" is needed since canberra
104 + char * device_name = g_strdup_printf
105 + ("/dev/sound/%s:%sdsp",
106 + device_arr[0], device_arr[1]);
107 + if ((ret = ca_context_change_device(c,
108 + device_name)) < 0) {
109 + ca_context_destroy(c);
112 + g_free (device_name);
114 + g_strfreev (device_arr);
116 + g_strfreev (element_arr);
118 + g_free (gvc_active);
124 --- libcanberra-0.30/configure.ac.orig 2012-09-25 02:21:07.000000000 +0200
125 +++ libcanberra-0.30/configure.ac 2023-12-17 10:33:04.145775951 +0100
128 AC_SUBST([WARNINGFLAGS], $with_cflags)
130 -CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
132 - -Wl,--gc-sections])
133 AC_SUBST([GCLDFLAGS], $with_ldflags)
135 #### libtool stuff ####
138 PKG_CHECK_MODULES(VORBIS, [ vorbisfile ])
140 +### GConf (mandatory) ###
142 +PKG_CHECK_MODULES(GCONF, [ gconf-2.0 ])
144 ### Chose builtin driver ###
146 AC_ARG_WITH([builtin],