2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 #include <flite/flite.h>
22 cst_voice *register_cmu_us_kal();
23 static cst_voice *voice;
25 static FILE *pipe_write;
26 static GThread *aoview_flite_thread;
29 aoview_flite_task(gpointer data)
34 while (fgets(line, sizeof (line) - 1, input) != NULL)
35 flite_text_to_speech(line, voice, "play");
40 aoview_flite_stop(void)
47 if (aoview_flite_thread) {
48 g_thread_join(aoview_flite_thread);
49 aoview_flite_thread = NULL;
54 aoview_flite_start(void)
63 voice = register_cmu_us_kal();
65 perror("register voice");
71 pipe_read = fdopen(p[0], "r");
72 pipe_write = fdopen(p[1], "w");
73 g_thread_create(aoview_flite_task, pipe_read, TRUE, &error);