]> err.no Git - mapper/commitdiff
Call espeak terminate on deinit. Add helper to set pitch and speed.
authorKaj-Michael Lang <milang@onion.tal.org>
Mon, 15 Oct 2007 14:02:57 +0000 (17:02 +0300)
committerKaj-Michael Lang <milang@onion.tal.org>
Mon, 15 Oct 2007 14:02:57 +0000 (17:02 +0300)
src/speak.c
src/speak.h

index 0cc553db3f150abd1ec690a552f07c7dff38318e..19f7fae31d8b987d5d307aa3cc2ea1f9e01a9159 100644 (file)
@@ -142,6 +142,13 @@ if (wav==NULL) {
 return 0;
 }
 
+void
+speak_set_parameters(guint speed, guint pitch)
+{
+espeak_SetParameter(espeakRATE, speed, 0);
+espeak_SetParameter(espeakPITCH, pitch, 0);
+}
+
 gboolean
 speak_init(gchar *voice, guint speed, guint pitch)
 {
@@ -151,15 +158,14 @@ if (erate==-1)
 
 espeak_SetSynthCallback(espeak_cb);
 espeak_SetVoiceByName(voice);
-espeak_SetParameter(espeakRATE, speed, 0);
-espeak_SetParameter(espeakPITCH, pitch, 0);
+speak_set_parameters(speed, pitch);
 espeak_SetParameter(espeakVOLUME, 100, 0);
 if (speak_create_pipeline()==FALSE)
        return FALSE;
 
-bus=gst_pipeline_get_bus (GST_PIPELINE (ge.pipeline));
+bus=gst_pipeline_get_bus(GST_PIPELINE (ge.pipeline));
 g_assert(bus);
-gst_bus_add_watch (bus, bus_call, NULL);
+gst_bus_add_watch(bus, bus_call, NULL);
 
 return TRUE;
 }
@@ -167,10 +173,11 @@ return TRUE;
 void
 speak_deinit(void)
 {
-gst_element_set_state (ge.pipeline, GST_STATE_NULL);
-gst_object_unref (ge.pipeline);
+gst_element_set_state(ge.pipeline, GST_STATE_NULL);
+gst_object_unref(ge.pipeline);
 ge.pipeline=NULL;
 speaking=FALSE;
+espeak_Terminate();
 }
 
 gboolean
@@ -212,6 +219,7 @@ gboolean speak_init(gchar voice, guint speed, guint pitch) {return TRUE;}
 void speak_deinit(void) {}
 gboolean speak_stop(void) {return TRUE;}
 gboolean speak_speaking(void) {return FALSE;}
+void speak_set_parameters(guint speed, guint pitch) {}
 
 gboolean 
 speak_text(gchar *text)
index ae8eb254e45811d6c0fbda706b22676ae58fd926..218ef9ac666c79298474d57fafb68d916404813b 100644 (file)
@@ -8,5 +8,6 @@ void speak_deinit(void);
 gboolean speak_stop(void);
 gboolean speak_speaking(void);
 gboolean speak_text(gchar *text);
+void speak_set_parameters(guint speed, guint pitch);
 
 #endif