From d2d763b36ba477c18a04933ee49b68f71dd641a2 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sat, 30 Aug 2008 15:02:26 -0500 Subject: [PATCH] moved flush processing into main loop This patch from Kirk Reiser attempts to increase responsiveness by moving the flush processing into the main loop. --- softsynth.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/softsynth.c b/softsynth.c index 95351f6..aa10480 100644 --- a/softsynth.c +++ b/softsynth.c @@ -139,6 +139,7 @@ void main_loop (struct synth_t *s) fd_set set; struct timeval tv; int i; + int j; ssize_t length; char buf[maxBufferSize]; @@ -167,6 +168,16 @@ void main_loop (struct synth_t *s) perror("Read from softsynth failed"); break; } + for(i = length; i > 0; i--) + if (*(buf+i) == 0x18) { /* synth flush char. */ + queue_clear(); + stop_speech(); + j = length-i; + for(length = 0; length < j; length++) + *(buf+length) = *(buf+i++); + *(buf+length) = 0; + break; + } *(buf+length) = 0; process_buffer (s, buf, length); }