summaryrefslogtreecommitdiff
blob: b4975840129887330a78bca500ef5f4addae0ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
--- gtetrinet-0.7.11/configure.in~	2006-11-15 17:02:36.000000000 +0000
+++ gtetrinet-0.7.11/configure.in	2011-03-06 15:39:10.000000000 +0000
@@ -30,7 +30,6 @@
 LIBGTK_REQUIRED=2.6.0
 LIBGNOME_REQUIRED=2.0.0
 LIBGNOMEUI_REQUIRED=2.0.0
-LIBESD_REQUIRED=0.2.36
 
 dnl *****************************************
 dnl libgnome, libgnomeui needed for all utils
@@ -40,21 +39,21 @@
 AC_SUBST(GTET_CFLAGS)
 AC_SUBST(GTET_LIBS)
 
-dnl Check for libesd
-if pkg-config --exists esound ; then
-	have_esound=yes
+dnl Check for libcanberra
+if pkg-config --exists libcanberra ; then
+	have_libcanberra=yes
 else 
-	have_esound=no
+	have_libcanberra=no
 fi
 
-if test "x$have_esound" = "xyes"; then
-AC_DEFINE(HAVE_ESD, 1, [Define this to enable EsounD support.])
-PKG_CHECK_MODULES(ESOUND, esound >= $LIBESD_REQUIRED)
-AC_SUBST(ESOUND_CFLAGS)
-AC_SUBST(ESOUND_LIBS)
+if test "x$have_libcanberra" = "xyes"; then
+AC_DEFINE(HAVE_LIBCANBERRA, 1, [Define this to enable libcanberra support.])
+PKG_CHECK_MODULES(LIBCANBERRA, libcanberra)
+AC_SUBST(LIBCANBERRA_CFLAGS)
+AC_SUBST(LIBCANBERRA_LIBS)
 fi
 
-AM_CONDITIONAL(HAVE_ESOUND, test "x$have_esound" = "xyes")
+AM_CONDITIONAL(HAVE_LIBCANBERRA, test "x$have_libcanberra" = "xyes")
 
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
--- gtetrinet-0.7.11/config.h.in~	2006-11-15 17:03:53.000000000 +0000
+++ gtetrinet-0.7.11/config.h.in	2011-03-06 15:39:31.000000000 +0000
@@ -15,8 +15,8 @@
 /* Define to 1 if you have the `dcgettext' function. */
 #undef HAVE_DCGETTEXT
 
-/* Define this to enable EsounD support. */
-#undef HAVE_ESD
+/* Define this to enable libcanberra support. */
+#undef HAVE_LIBCANBERRA
 
 /* Define if the GNU gettext() function is already present or preinstalled. */
 #undef HAVE_GETTEXT
--- gtetrinet-0.7.11/src/dialogs.c~	2006-11-03 12:49:49.000000000 +0000
+++ gtetrinet-0.7.11/src/dialogs.c	2011-03-06 15:40:45.000000000 +0000
@@ -1054,7 +1054,7 @@
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(soundcheck), soundenable);
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(midicheck), midienable);
 
-#ifdef HAVE_ESD
+#ifdef HAVE_LIBCANBERRA
     if (midienable) prefdialog_midion ();
     else prefdialog_midioff ();
     if (soundenable) prefdialog_soundon ();
--- gtetrinet-0.7.11/src/sound.c~	2005-03-18 21:19:18.000000000 +0000
+++ gtetrinet-0.7.11/src/sound.c	2011-03-06 15:47:24.000000000 +0000
@@ -36,33 +36,36 @@
 char midifile[1024];
 char midicmd[1024];
 
-#ifdef HAVE_ESD
+#ifdef HAVE_LIBCANBERRA
 
-#include <esd.h>
-#include <libgnome/gnome-sound.h>
+#include <canberra.h>
 
-static int soundsamples[S_NUM];
 static int midipid = 0;
+static ca_context *ctx = 0;
 
 void sound_cache (void)
 {
     int i;
     if (!soundenable) return;
+    if (!ctx)
+        ca_context_create(&ctx);
+    if (ctx) {
     for (i = 0; i < S_NUM; i ++) {
-        if (soundsamples[i])
-            esd_sample_free (gnome_sound_connection_get (), soundsamples[i]);
         if (soundfiles[i][0])
-            soundsamples[i] = gnome_sound_sample_load (soundfiles[i], soundfiles[i]);
-        else
-            soundsamples[i] = 0;
+                ca_context_cache(ctx,
+                    CA_PROP_MEDIA_FILENAME, soundfiles[i],
+                    NULL);
+        }
     }
 }
 
 void sound_playsound (int id)
 {
-    if (!soundenable) return;
-    if (soundsamples[id] > 0)
-      esd_sample_play (gnome_sound_connection_get (), soundsamples[id]);
+    if (!soundenable || !ctx) return;
+    if (soundfiles[id][0])
+        ca_context_play(ctx, 0,
+            CA_PROP_MEDIA_FILENAME, soundfiles[id],
+            NULL);
 }
 
 void sound_playmidi (char *file)
--- gtetrinet-0.7.11/src/Makefile.am~	2006-11-03 16:20:08.000000000 +0000
+++ gtetrinet-0.7.11/src/Makefile.am	2011-03-06 15:57:32.000000000 +0000
@@ -7,8 +7,8 @@
 	   -DGTETPIXMAPSDIR=\""$(datadir)/pixmaps/gtetrinet"\" \
 	   $(GTET_CFLAGS)
 
-if HAVE_ESOUND
-LDADD = $(GTET_LIBS) $(ESOUND_LIBS)
+if HAVE_LIBCANBERRA
+LDADD = $(GTET_LIBS) $(LIBCANBERRA_LIBS)
 else
 LDADD = $(GTET_LIBS)
 endif