[Sugar-devel] [PATCH Sugar] Close audio device after text to speech - OLPC #11829
Gonzalo Odiard
gonzalo at laptop.org
Mon May 7 09:30:32 EDT 2012
Ok, if we will use EOS message, we don't need add the end marl anymore.
I think i had used this mark, because iin my previous test,
didn't received the EOS signal at times, But now I tested it again and
received the message, then I am ok with doing the change.
A updated patch should be:
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')
--
1.7.10.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120507/0bdf6034/attachment.html>
More information about the Sugar-devel
mailing list