#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)
{
#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;
- }
- }
}
}
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;