1 #include <Elementary.h>
3 # include "elementary_config.h"
6 /* to enable this module
7 export ELM_MODULES="access_output>access/api"
8 export ELM_ACCESS_MODE=1
11 static void (*cb_func) (void *data);
13 static Ecore_Exe *espeak = NULL;
14 static Ecore_Event_Handler *exe_exit_handler = NULL;
15 static char *tmpf = NULL;
16 static int tmpfd = -1;
19 _exe_del(void *data __UNUSED__, int type __UNUSED__, void *event)
21 Ecore_Exe_Event_Del *ev = event;
23 if ((espeak) && (ev->exe == espeak))
33 if (cb_func) cb_func(cb_data);
35 return ECORE_CALLBACK_RENEW;
38 // module api funcs needed
40 elm_modapi_init(void *m __UNUSED__)
43 ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
45 return 1; // succeed always
49 elm_modapi_shutdown(void *m __UNUSED__)
53 ecore_event_handler_del(exe_exit_handler);
54 exe_exit_handler = NULL;
56 return 1; // succeed always
59 // module fucns for the specific module type
61 out_read(const char *txt)
68 snprintf(buf, sizeof(buf), "/tmp/.elm-speak-XXXXXX");
69 cur_umask = umask(S_IRWXO | S_IRWXG);
72 if (tmpfd >= 0) tmpf = strdup(buf);
75 if (write(tmpfd, txt, strlen(txt)) < 0) perror("write to tmpfile (espeak)");
85 ecore_exe_interrupt(espeak);
90 // FIXME: espeak supporets -v XX for voice locale. should provide this
91 // based on actual lang/locale
93 snprintf(buf, sizeof(buf), "espeak -p 2 -s 120 -k 10 -m -f %s", tmpf);
94 espeak = ecore_exe_pipe_run(buf,
105 ecore_exe_interrupt(espeak);
118 out_done_callback_set(void (*func) (void *data), const void *data)
121 cb_data = (void *)data;