From ea97ec644f371fafa52c3a4618a183e7acd3896b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 24 Jul 2024 16:57:02 +0900 Subject: [PATCH] Replace method to play string for accessibility Change-Id: I1628e19bb7b87d8dfa2aa3f01426cab29cabe39f Signed-off-by: Jihoon Kim --- CMakeLists.txt | 1 - packaging/libscl-ui.spec | 1 - scl/sclutils-linux.cpp | 76 ++---------------------------------------------- 3 files changed, 3 insertions(+), 75 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98b9ca2..0b4c74a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,6 @@ SET(PKGS_CHECK_MODULES feedback dlog libxml-2.0 - tts vconf eldbus libscl-common diff --git a/packaging/libscl-ui.spec b/packaging/libscl-ui.spec index dc18489..9bc019a 100644 --- a/packaging/libscl-ui.spec +++ b/packaging/libscl-ui.spec @@ -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) diff --git a/scl/sclutils-linux.cpp b/scl/sclutils-linux.cpp index e93690c..0b1b61f 100644 --- a/scl/sclutils-linux.cpp +++ b/scl/sclutils-linux.cpp @@ -29,14 +29,12 @@ #include #endif #include -#include #include #include 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, ¤t_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, ¤t_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; -- 2.7.4