Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-02-01 20:32:06 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-02-01 20:32:06 (GMT)
commit54307b100fe9ce4f313f7cac7e1ad4298ba9e41b (patch)
tree31d20a484be072ab8d4b9823bc56727d4771b521 /game.py
parent48a3c653d91aad048f7b0ba34ec5767d9ae35e1d (diff)
Use gstreamer instead of csound to play sound cards
Diffstat (limited to 'game.py')
-rw-r--r--game.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/game.py b/game.py
index 4626a32..b92e895 100644
--- a/game.py
+++ b/game.py
@@ -27,6 +27,7 @@ from gobject import SIGNAL_RUN_FIRST, TYPE_PYOBJECT, GObject, timeout_add
from gobject import source_remove
from model import Model
+from audio import Audio
import theme
_logger = logging.getLogger('memorize-activity')
@@ -85,11 +86,7 @@ class MemorizeGame(GObject):
_logger.error(' [Check for module csnd] not found. There will be no sound.')
if self.sound == 1:
- from csound.csoundserver import CsoundServer
- self.cs = CsoundServer()
- if self.cs.start() != 0:
- _logger.error(' Error starting csound performance.')
- self.sound = 0
+ self.audio = Audio()
def load_game(self, game_name, size, mode):
self.set_load_mode('Loading game')
@@ -176,13 +173,6 @@ class MemorizeGame(GObject):
self.current_player = next
self.update_turn()
- def play_sound(self, snd, sound_file):
- if len(snd.split('.')) > 1:
- if snd.split('.')[1] in ['wav', 'aif', 'aiff']:
- self.cs.perform('i 102 0.0 3.0 "%s" 1 0.9 0'%(sound_file))
- else:
- self.cs.perform('i 100 0.0 3.0 "%s" 1 0.9 0'%(sound_file))
-
def card_overflipped(self, widget, id):
if self._flop_cards and id in self._flop_cards:
self.card_flipped(widget, id)
@@ -216,7 +206,7 @@ class MemorizeGame(GObject):
snd = self.model.grid[id].get('snd', None)
if snd != None:
sound_file = join(self.model.data.get('pathsnd'), snd)
- self.play_sound(snd, sound_file)
+ self.audio.play(sound_file)
self.emit('flip-card', id)
if not signal: