From 96a3b198508172e30bb0614563db94f83e45ce03 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sun, 31 Aug 2008 10:29:00 -0500 Subject: [PATCH] fix flush processing This removes flush processing from process_command() and fixes the code in the main loop so that it does not ignore the 0 position in the buffer. --- softsynth.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/softsynth.c b/softsynth.c index a5a324e..b366dc8 100644 --- a/softsynth.c +++ b/softsynth.c @@ -77,12 +77,6 @@ static int process_command(struct synth_t *s, char *buf, int start) } cp++; break; - case 24: - cmd = CMD_FLUSH; - stop_speech(); - queue_clear(); - cp++; - break; default: cmd = CMD_UNKNOWN; cp++; @@ -168,16 +162,16 @@ void main_loop (struct synth_t *s) perror("Read from softsynth failed"); break; } - for(i = length; i > 0; i--) + *(buf+length) = 0; + 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++) + for(length = 0; length <= j; length++) *(buf+length) = *(buf+i++); break; } - *(buf+length) = 0; process_buffer (s, buf, length); } }