Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-05-04 21:29:36 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-05-30 10:53:09 (GMT)
commit699ad0102d6177de21b4c157af979eabf3221fe1 (patch)
treead234b1b70b7bb3be22f5196a749e397e4f5e343
parent6e52abadbb8c80e8040c29de89fb285a65730071 (diff)
Release audio device after text to speech - OLPC #11829
Since on the XO we do not have a sound serever (e.g. pulse audio) we need to make sure to release the audio device in order to make it usable by other components like activities. Gstreamer does wait for 'gst.MESSAGE_EOS' message in order to release the device. See the documentation at [1][2]. [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html#section-helloworld [2] http://pygstdocs.berlios.de/pygst-tutorial/playbin.html Signed-off-by: Simon Schampijer <simon@laptop.org> Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--src/jarabe/model/speech.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/jarabe/model/speech.py b/src/jarabe/model/speech.py
index ffc108c..1cb0ad4 100644
--- a/src/jarabe/model/speech.py
+++ b/src/jarabe/model/speech.py
@@ -169,18 +169,20 @@ class _GstSpeechPlayer(gobject.GObject):
bus = self._pipeline.get_bus()
bus.add_signal_watch()
- bus.connect('message::element', self.__pipe_message_cb)
+ bus.connect('message', self.__pipe_message_cb)
def __pipe_message_cb(self, bus, message):
- if message.structure.get_name() == 'espeak-mark' and \
- message.structure['mark'] == 'end':
+ if message.type == gst.MESSAGE_EOS:
+ self._pipeline.set_state(gst.STATE_NULL)
+ self.emit('stop')
+ elif message.type == gst.MESSAGE_ERROR:
+ self._pipeline.set_state(gst.STATE_NULL)
self.emit('stop')
def speak(self, pitch, rate, voice_name, text):
# TODO workaround for http://bugs.sugarlabs.org/ticket/1801
if not [i for i in text if i.isalnum()]:
return
- text = text + '<mark name="end>"></mark>'
self.make_pipeline('espeak name=espeak ! autoaudiosink')
src = self._pipeline.get_by_name('espeak')