Added code for checking the return values of tts functions
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 12 Apr 2013 09:02:07 +0000 (18:02 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 12 Apr 2013 09:44:19 +0000 (18:44 +0900)
scl/utils/linux/sclutils-linux.cpp

index 9bf84c0..678ddd5 100644 (file)
@@ -112,14 +112,22 @@ CSCLUtilsImplLinux::play_tts(const sclchar* str) {
     SCL_DEBUG();
 
     if (str) {
+        int r;
         int utt_id = 0;
         tts_state_e current_state;
-        tts_get_state(tts, &current_state);
+
+        r = tts_get_state(tts, &current_state);
+        if (TTS_ERROR_NONE != r) {
+            printf("Fail to get state from TTS : ret(%d)\n", r);
+        }
 
         if (TTS_STATE_PLAYING == current_state)  {
-            tts_stop(tts);
+            r = tts_stop(tts);
+            if (TTS_ERROR_NONE != r) {
+                printf("Fail to stop TTS : ret(%d)\n", r);
+            }
         }
-        int r = tts_add_text(tts, str, "en_US", TTS_VOICE_TYPE_FEMALE, TTS_SPEED_NORMAL, &utt_id);
+        r = tts_add_text(tts, str, "en_US", TTS_VOICE_TYPE_FEMALE, TTS_SPEED_NORMAL, &utt_id);
         if (TTS_ERROR_NONE == r) {
             r = tts_play(tts);
             if (TTS_ERROR_NONE != r) {
@@ -127,6 +135,7 @@ CSCLUtilsImplLinux::play_tts(const sclchar* str) {
             }
         }
     }
+
     return TRUE;
 }