summaryrefslogtreecommitdiff
blob: 4ee47fab39fb0f16db1faf14a675925e7123146a (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
Drop dependency on esound support in libgnome and replace it by libcanberra.

Gentoo bug: #348605

--- a/configure.ac	2008-11-09 20:52:01.000000000 +0000
+++ b/configure.ac	2011-03-06 13:08:42.000000000 +0000
@@ -18,7 +18,8 @@
                         gconfmm-2.6 >= 2.6.0 \
                         gtkmm-2.4 >= 2.6.0 \
                         libgnomecanvasmm-2.6 >= 2.6.0 \
-			libglademm-2.4 >= 2.4.0)
+			libglademm-2.4 >= 2.4.0 \
+			libcanberra)
 AC_SUBST(DEPS_CFLAGS)
 AC_SUBST(DEPS_LIBS)
 
--- a/src/sound.hpp	2007-01-06 16:16:30.000000000 +0000
+++ b/src/sound.hpp	2011-03-06 13:12:47.000000000 +0000
@@ -22,6 +22,7 @@
 #define SOUND_HPP
 
 #include <string>
+#include <canberra.h>
 
 #include "helpers.hpp"
 
@@ -39,8 +40,7 @@
 private:
   Sound();
   
-  typedef std::map<std::string, int> cache_map;
-  cache_map cache;
+  ca_context *ctx;
 };
 
 #endif
--- a/src/sound.cpp	2007-01-06 16:16:30.000000000 +0000
+++ b/src/sound.cpp	2011-03-07 21:55:47.000000000 +0000
@@ -18,9 +18,6 @@
  * USA.
  */
 
-#include <libgnome/gnome-sound.h>
-#include <esd.h>
-
 #include "sound.hpp"
 
 
@@ -30,26 +27,23 @@
   return s;
 }
 
-Sound::Sound()
+Sound::Sound() :
+  ctx(0)
 {
+  ca_context_create(&ctx);
 }
 
 Sound::~Sound()
 {
+  if (ctx)
+    ca_context_destroy(ctx);
 }
 
 void Sound::play(const std::string &name)
 {
-  int id;
-  
-  cache_map::iterator i = cache.find(name);
-  if (i != cache.end())
-    id = i->second;
-  else {
-    id = gnome_sound_sample_load(name.c_str(),
-			    (MONSTER_MASHER_SOUND_DIR + name).c_str());
-    cache.insert(make_pair(name, id));
-  }
-
-  esd_sample_play(gnome_sound_connection_get(), id);
+  if (ctx)
+    ca_context_play(ctx, 0,
+      CA_PROP_MEDIA_FILENAME,         (MONSTER_MASHER_SOUND_DIR + name).c_str(),
+      CA_PROP_CANBERRA_CACHE_CONTROL, "permanent",
+      NULL);
 }