static GstBus *bus;
static gboolean speaking=FALSE;
static gboolean speak_ok;
+static gboolean espeak_ok;
static gboolean
bus_call (GstBus *bus, GstMessage *msg, gpointer data)
gboolean
speak_init(gchar *voice, guint speed, guint pitch)
{
+espeak_ok=FALSE;
erate=espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL, 100, NULL, 0);
if (erate==-1)
return FALSE;
bus=gst_pipeline_get_bus(GST_PIPELINE (ge.pipeline));
g_assert(bus);
gst_bus_add_watch(bus, bus_call, NULL);
-
+espeak_ok=TRUE;
return TRUE;
}
void
speak_deinit(void)
{
+if (espeak_ok==FALSE)
+ return;
+
gst_element_set_state(ge.pipeline, GST_STATE_NULL);
gst_object_unref(ge.pipeline);
ge.pipeline=NULL;
gboolean
speak_text(gchar *text)
{
+#if 0
if (speaking==TRUE)
return FALSE;
+#endif
g_printf("Speaking: %s (%d)\n", text, strlen(text));
espeak_Synth(text, strlen(text)+1, 0, POS_CHARACTER, 0, espeakCHARS_UTF8, NULL, NULL);
-if (gst_element_set_state (ge.pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
- g_print("Failed to play\n");
- speaking=FALSE;
- return FALSE;
+if (speaking!=TRUE) {
+ if (gst_element_set_state (ge.pipeline, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
+ g_print("Failed to play\n");
+ speaking=FALSE;
+ return FALSE;
+ }
+ speaking=TRUE;
}
-speaking=TRUE;
g_print("Playing...\n");
return TRUE;
}