[g-a-devel] Happy patch bonanza



Hello,

finally, I'm attaching patches:

audsp-queue.patch
  Patch for festival's audsp to also report the currently playing file
  on (audio_mode 'query)

  This seems to bring no particular improvement.  I suspect that
  gnopernicus doesn't need the is_speaking function too badly, after
  all?

unclutter.patch
  Patch for gnome-speech festival driver to send a single, more compact
  SayText command, and to avoid sending empty strings or string
  containing only blanks.

  This is mainly a cosmetic patch.

recode.patch
  Patch for gnome-speech festival driver.  When one of the Italian
  voices is requested, switches the g_io output channel to latin1
  instead of utf-8.

  This fixes the Italian voices!  Hooray!!


Ciao,

Enrico

-- 
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico debian org>
--- /home/enrico/src/orig/gnome-speech-0.4.0/drivers/festival/festivalsynthesisdriver.c	2006-05-14 16:49:21.000000000 +0200
+++ festivalsynthesisdriver.c	2006-06-28 17:43:04.252707768 +0200
@@ -35,6 +35,7 @@
 #include <netinet/in.h>
 #include <libbonobo.h>
 #include <netdb.h>
+#include <ctype.h>
 #include "festivalsynthesisdriver.h"
 #include "festivalspeaker.h"
 
@@ -910,21 +911,29 @@
 {
         gchar *escaped_string;
 	gchar *ptr1, *ptr2;
+	int spaces_only = 1;
 
 	g_assert (IS_FESTIVAL_SYNTHESIS_DRIVER (d) && IS_FESTIVALSPEAKER (s) && text);
     
-    
-        escaped_string = g_malloc (strlen (text)*2+1);
+
+        escaped_string = g_malloc (strlen (text)*2+1+20);
+	strcpy(escaped_string, "(SayText \"");
         ptr1 = text;
-        ptr2 = escaped_string;
+        ptr2 = escaped_string + strlen(escaped_string);
         while (ptr1 && *ptr1)
         {
-        	if (*ptr1 == '\"')
+		if (!isspace(*ptr1))
+			spaces_only = 0;
+        	if (*ptr1 == '\"' || *ptr1 == '\\')
 		    *ptr2++ = '\\';
 		*ptr2++ = *ptr1++;
         }
+	*ptr2++ = '"';
+	*ptr2++ = ')';
+	*ptr2++ = '\r';
+	*ptr2++ = '\n';
 	*ptr2 = 0;
-
+    
         /* Refresh if needded */ 
         if (d->last_speaker != s || speaker_needs_parameter_refresh (SPEAKER(s)))
 	{
@@ -937,16 +946,15 @@
 	clb_list_free (d->crt_clbs);
 	d->crt_clbs = speaker_get_clb_list (SPEAKER (s));
 
+	if (!spaces_only)
+	{
 #ifdef FESTIVAL_DEBUG_TEXT
-	fprintf (stderr, "\nSENT:\"%s\" from \"%s\"", escaped_string, text);
+		fprintf (stderr, "\nSENT:\"%s\" from \"%s\"", escaped_string, text);
 #endif
-	d->is_speaking = TRUE;
-	d->queue_length = 1;
-	festival_synthesis_driver_say_raw (d, "(SayText \"");
-	festival_synthesis_driver_say_raw (d, escaped_string);
-	festival_synthesis_driver_say_raw (d, "\")\r\n");
-
-	festival_synthesis_driver_say_raw (d, "(SayText \"\")\r\n");
+		d->is_speaking = TRUE;
+		d->queue_length = 1;
+		festival_synthesis_driver_say_raw (d, escaped_string);
+	}
 
         if (escaped_string)
 		g_free (escaped_string);
--- festivalsynthesisdriver.c	2006-06-28 17:43:04.252707768 +0200
+++ festivalsynthesisdriver.c.final	2006-06-28 17:41:15.475244456 +0200
@@ -941,6 +941,12 @@
 	    festival_synthesis_driver_say_raw (d, s->voice);
 	    speaker_refresh_parameters (SPEAKER(s));
 	    d->last_speaker = s;
+
+	    if (strcmp(d->last_speaker->voice, "(voice_pc_diphone)\n") == 0
+	     || strcmp(d->last_speaker->voice, "(voice_lp_diphone)\n") == 0)
+		    g_io_channel_set_encoding(d->channel_sock, "latin1", NULL);
+	    else
+		    g_io_channel_set_encoding(d->channel_sock, "UTF-8", NULL);
 	}
 
 	clb_list_free (d->crt_clbs);
--- audsp.cc	2006-06-28 17:46:18.384195296 +0200
+++ /home/enrico/src/festival-1.4.3.enrico/src/main/audsp.cc	2006-06-28 15:22:28.162537000 +0200
@@ -104,6 +104,15 @@
 static int sp_terminate(void);
 static void tidy_up(void);
 
+static int no_more_input = FALSE;
+static CQueue command_queue;
+static int child_pid = 0;
+static EST_String current_file;
+static EST_Option play_wave_options;
+static int maxqueue = 5;
+static int pending_close = FALSE;
+static int kids = 0;
+
 void CQueue::push(Command *c)
 {
     // Put this item on tail
@@ -143,10 +152,18 @@
 void CQueue::display(void) const
 {
     CQueue_Item *t;
-    int i;
+    int i = 0;
+    int len = length();
+    if (kids > 0)
+    {
+	++len;
+	++i;
+    }
 
-    cerr << "Command_queue: " << length() << endl;
-    for (i=0,t=head; t != 0; t=t->next,i++)
+    cerr << "Command_queue: " << len << endl;
+    if (kids > 0)
+	cerr << " " << 0 << ": " << current_file << endl;
+    for (t=head; t != 0; t=t->next,i++)
 	cerr << " " << i << ": " << t->c->file() << endl;
 }
 
@@ -176,15 +193,6 @@
     tail = 0;
 }
 
-static int no_more_input = FALSE;
-static CQueue command_queue;
-static int child_pid = 0;
-static EST_String current_file;
-static EST_Option play_wave_options;
-static int maxqueue = 5;
-static int pending_close = FALSE;
-static int kids = 0;
-
 int main(int argc, char **argv)
 {
 

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]