[tuxdroid-svn] r397 - api/python/trunk
Status: Beta
Brought to you by:
ks156
From: remi <c2m...@c2...> - 2007-06-19 07:56:11
|
Author: remi Date: 2007-06-19 09:55:42 +0200 (Tue, 19 Jun 2007) New Revision: 397 Modified: api/python/trunk/tuxapi_class.py Log: UPD API wait a voice loaded ACK in "tts.speak" methode Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-06-18 16:04:29 UTC (rev 396) +++ api/python/trunk/tuxapi_class.py 2007-06-19 07:55:42 UTC (rev 397) @@ -3892,6 +3892,7 @@ self.ac_port=5500 self.ac_address='localhost' self.authorized_voices_list = [] + self.voice_loaded = False #-------------------------------------------------------------------------- # Allow to connect the api to tuxttsd automatically @@ -4111,6 +4112,9 @@ self.authorized_voices_list.append(ord(voice_id)-1) if self.on_voice_list != None: self.on_voice_list() + # A voice has been loaded + if ord(data[1])==CMD_INFO_VOICE_OK: + self.voice_loaded = True #-------------------------------------------------------------------------- # Send command to tuxttsd @@ -4293,9 +4297,18 @@ self.send_command_to_tts(CMD_TYPE_TTS, CMD_TTS_INSERT_PLAY_SPEECH, \ (text_length & 0x0000FF00) >> 8, (text_length & 0x000000FF), \ self.my_voice, self.my_pitch) - self.parent.cmd.audio_channel_tts() + self.voice_loaded = False self.sock.send(text_to_send) counter = 0 + while ((self.voice_loaded == False) and (counter < 300)): + counter = counter + 1 + self.parent.sys.wait(0.1) + if counter == 300: + self.stop() + print "TTS Speak : Voice not loaded" + return False + self.parent.cmd.audio_channel_tts() + counter = 0 while ((self.sound_on == False) and (counter < 100)): counter = counter + 1 self.parent.sys.wait(0.1) |