Replace method to play string for accessibility 01/315601/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 24 Jul 2024 07:57:02 +0000 (16:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 5 Aug 2024 06:49:55 +0000 (15:49 +0900)
Change-Id: I1628e19bb7b87d8dfa2aa3f01426cab29cabe39f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
CMakeLists.txt
packaging/libscl-ui.spec
scl/sclutils-linux.cpp

index 98b9ca2..0b4c74a 100644 (file)
@@ -89,7 +89,6 @@ SET(PKGS_CHECK_MODULES
         feedback
         dlog
         libxml-2.0
-        tts
         vconf
         eldbus
         libscl-common
index 19ab318..65dc1db 100644 (file)
@@ -22,7 +22,6 @@ BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(feedback)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(libxml-2.0)
-BuildRequires:  pkgconfig(tts)
 BuildRequires:  pkgconfig(libscl-common)
 
 
index e93690c..0b1b61f 100644 (file)
 #include <Ecore_X.h>
 #endif
 #include <feedback.h>
-#include <tts.h>
 #include <vconf.h>
 
 #include <dlog.h>
 
 using namespace scl;
 
-static tts_h tts = NULL;
 #ifndef WAYLAND
 static Eina_Bool _get_default_zone_geometry_info(Ecore_X_Window root, scluint *x, scluint *y, scluint *w, scluint *h)
 {
@@ -80,58 +78,12 @@ static Eina_Bool _get_default_zone_geometry_info(Ecore_X_Window root, scluint *x
 #endif
 static void accessibility_changed_cb(keynode_t *key, void* data)
 {
-    int r;
     int enabled = 0;
     if (vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &enabled) == 0) {
-        LOGD("VCONFKEY_SETAPPL_ACCESSIBILITY_TTS : %d, (%p)", enabled, tts);
+        LOGD("VCONFKEY_SETAPPL_ACCESSIBILITY_TTS : %d", enabled);
         CSCLContext *context = CSCLContext::get_instance();
         if (context)
             context->set_tts_enabled(enabled);
-
-        if (enabled) {
-            if (tts == NULL) {
-                LOGD("Initializing TTS\n");
-
-                r = tts_create(&tts);
-                if (TTS_ERROR_NONE != r) {
-                    LOGD("tts_create FAILED : result(%d)", r);
-                } else {
-                    r = tts_set_mode(tts, TTS_MODE_SCREEN_READER);
-                }
-                if (TTS_ERROR_NONE != r) {
-                    LOGD("tts_set_mode FAILED : result(%d)", r);
-                }
-
-                tts_state_e current_state;
-                r = tts_get_state(tts, &current_state);
-                if (TTS_ERROR_NONE != r) {
-                    LOGD("tts_get_state FAILED : result(%d)", r);
-                }
-
-                if (TTS_STATE_CREATED == current_state)  {
-                    r = tts_prepare(tts);
-                }
-                if (TTS_ERROR_NONE != r) {
-                    LOGD("tts_prepare FAILED : ret(%d)\n", r);
-                }
-            }
-        } else {
-            if (tts != NULL) {
-                LOGD("Deinitializing TTS\n");
-
-                r = tts_unprepare(tts);
-                if (TTS_ERROR_NONE != r) {
-                    LOGD("tts_unprepare FAILED : result(%d)", r);
-                }
-
-                r = tts_destroy(tts);
-                if (TTS_ERROR_NONE != r) {
-                    LOGD("tts_destroy FAILED : result(%d)", r);
-                }
-
-                tts = NULL;
-            }
-        }
     }
 }
 
@@ -219,30 +171,8 @@ CSCLUtilsImplLinux::play_tts(const sclchar* str) {
     SCL_DEBUG();
 
     if (str) {
-        int r;
-        int utt_id = 0;
-        tts_state_e current_state;
-
-        r = tts_get_state(tts, &current_state);
-        if (TTS_ERROR_NONE != r) {
-            LOGD("Fail to get state from TTS : ret(%d)\n", r);
-        }
-
-        if (TTS_STATE_PLAYING == current_state)  {
-            r = tts_stop(tts);
-            if (TTS_ERROR_NONE != r) {
-                LOGD("Fail to stop TTS : ret(%d)\n", r);
-            }
-        }
-        r = tts_add_text(tts, str, NULL, TTS_VOICE_TYPE_AUTO, TTS_SPEED_AUTO, &utt_id);
-        if (TTS_ERROR_NONE == r) {
-            r = tts_play(tts);
-            if (TTS_ERROR_NONE != r) {
-                LOGD("Fail to play TTS : ret(%d)\n", r);
-            }
-        } else {
-            LOGD("Fail to add text : ret(%d)\n", r);
-        }
+        LOGI("Request to play (%s) in screen reader", str);
+        elm_atspi_bridge_utils_say(str, EINA_FALSE, NULL, NULL);
     }
 
     return TRUE;