[Sugar-devel] [PATCH Sugar] Close audio device after text to speech - OLPC #11829
godiard at sugarlabs.org
godiard at sugarlabs.org
Fri May 4 17:34:51 EDT 2012
From: Gonzalo Odiard <godiard at gmail.com>
In xo with alsa, if we keep opened the audio device after
doing tts, other activities can't use it.
We need close the device after the eof message is received,
because the message came a little before the sound has finished.
Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
---
src/jarabe/model/speech.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/jarabe/model/speech.py b/src/jarabe/model/speech.py
index ffc108c..46ce483 100644
--- a/src/jarabe/model/speech.py
+++ b/src/jarabe/model/speech.py
@@ -155,10 +155,11 @@ class _GstSpeechPlayer(gobject.GObject):
def stop_sound_device(self):
if self._pipeline is None:
- return
+ return False
self._pipeline.set_state(gst.STATE_NULL)
self.emit('stop')
+ return False
def make_pipeline(self, command):
if self._pipeline is not None:
@@ -174,6 +175,7 @@ class _GstSpeechPlayer(gobject.GObject):
def __pipe_message_cb(self, bus, message):
if message.structure.get_name() == 'espeak-mark' and \
message.structure['mark'] == 'end':
+ gobject.timeout_add_seconds(1, self.stop_sound_device)
self.emit('stop')
def speak(self, pitch, rate, voice_name, text):
--
1.7.10
More information about the Sugar-devel
mailing list