tts: ensure that tts_play will always be called along with tts_speak
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 10 Sep 2015 07:10:28 +0000 (09:10 +0200)
committerTomasz Olszak <t.olszak@samsung.com>
Thu, 10 Sep 2015 16:40:12 +0000 (01:40 +0900)
Change-Id: If8d8ebe125e4247c21434aa5fccc897d3c934b32

src/screen_reader_spi.c
src/screen_reader_tts.c

index 9627fa1..90449f7 100644 (file)
@@ -272,19 +272,7 @@ void spi_event_listener_cb(AtspiEvent * event, void *user_data)
                return;
        }
        DEBUG("SPEAK: %s", text_to_read)
-               tts_speak(text_to_read, EINA_TRUE);
-
-       tts_state_e state;
-       Service_Data *sd = (Service_Data *) user_data;
-       tts_get_state(sd->tts, &state);
-
-       if (state == TTS_STATE_READY || state == TTS_STATE_PAUSED) {
-               int ret = tts_play(sd->tts);
-               if (TTS_ERROR_NONE != ret)
-                       ERROR("Fail to play TTS : ret(%d)", ret);
-       } else {
-               DEBUG("Current tts state: %d", state);
-       }
+       tts_speak(text_to_read, EINA_TRUE);
 
        free(text_to_read);
        DEBUG("END")
index 76dac65..f5ca2e3 100644 (file)
@@ -271,6 +271,7 @@ void tts_speak(char *text_to_speak, Eina_Bool flush_switch)
 
        DEBUG("added id to:%d\n", speak_id);
        last_utt_id = speak_id;
+       tts_play(sd->tts);
 }
 
 Eina_Bool update_supported_voices(void *data)
@@ -322,15 +323,8 @@ void state_changed_cb(tts_h tts, tts_state_e previous, tts_state_e current, void
                txt = eina_strbuf_string_steal(txt_keep_buff);
                eina_strbuf_free(txt_keep_buff);
                txt_keep_buff = NULL;
-
                tts_speak(txt, EINA_FALSE);
-               tts_play(sd->tts);
                free(txt);
-       } else if (current == TTS_STATE_READY || current == TTS_STATE_PAUSED) {
-               DEBUG("TTS state == %s!", get_tts_state(current));
-               tts_play(sd->tts);
-       } else {
-               DEBUG("TTS state != ready or paused!\n");
        }
 }