William Hubbs
5ec3809c59
wake up espeak_thread when softsynth_thread terminates
...
espeak_thread needs a signal since it might be sleeping and
should_run has changed. This makes sure it terminates.
2009-06-25 21:17:34 -05:00
William Hubbs
5ebe506026
more mutex fixes
...
Make sure that should_run is protected by the mutex in the softsynth
thread.
2009-06-25 21:07:24 -05:00
Chris Brannon
d5fd5d69b8
don't wait on a condition variable if should_run is false
2009-06-25 20:39:35 -05:00
William Hubbs
dd00775695
initialization update
...
The main function now initializes espeak and opens the softsynth before
starting the threads. This insures that the resources we need are
active.
2009-06-25 18:30:36 -05:00
William Hubbs
3687f16b09
wait for acknowledgements correctly
...
pthread_cond_wait() can have spurious wakeups, so we need to be sure
that the condition is actually true when we return from this function.
Thanks to Chris Brannon for the patch.
2009-06-25 17:05:51 -05:00
William Hubbs
975765289b
made sure all cond_wait and cond_signal calls are inside lock/unlock
...
calls
2009-06-25 14:17:21 -05:00
William Hubbs
b8c7247feb
removed acknowledge_guard and substituted queue_guard
2009-06-25 14:05:36 -05:00
William Hubbs
1091182f88
removed a debug print call
2009-06-25 12:57:29 -05:00
William Hubbs
554a03d26c
white space fix
2009-06-25 12:06:33 -05:00
Christopher Brannon
b7f324072f
Fix concurrency bugs.
...
1. Don't lock or unlock queue_guard during queue_clear.
It is locked when queue_clear is called, and it should remain so.
2. Protect runner_must_stop with queue_guard in
the request_espeak_stop function.
The following condition should always hold: queue_guard is locked while
testing or modifying runner_must_stop.
3. Rename stop_guard to acknowledge_guard. This is a more
descriptive name. This mutex simply protects the acknowledgement of
the stop request from being lost.
4. Remove the pthread_mutex_lock from the top of queue_process_entry,
because queue_guard is already locked when the function is called.
2009-06-25 11:56:20 -05:00
William Hubbs
a8cad20de8
more multithreading work
...
Rearranged the queue handling code so that queue.c is generic. Also
rearranged several functions in the threads.
2009-06-25 09:05:21 -05:00
William Hubbs
3e8e7d12ae
added back the declaration for softFD
2009-06-24 22:44:18 -05:00
William Hubbs
af5717b8cb
moved queue_add_xxx functions to softsynth thread
2009-06-24 22:23:10 -05:00
William Hubbs
0fdca827b8
check for terminalFD after select()
...
If terminalFD has something to read, we break out of the loop in the
softsynth thread.
2009-06-24 21:29:46 -05:00
William Hubbs
474580b08b
add pipe to wake up the softsynth thread
...
This adds a pipe to wake up the softsynth thread, in case we receive a
signal while it is in a select. Thanks to Chris Brannon.
2009-06-24 21:16:30 -05:00
William Hubbs
c5fce64f25
removed open_softsynth and close_softsynth
...
The thread can now handle the softsynth device, so main doesn't need to
call these functions.
2009-06-24 20:44:42 -05:00
William Hubbs
a58f93cd74
renamed reader_thread to softsynth_thread
2009-06-24 20:19:24 -05:00
William Hubbs
9d1cabdd0d
started work on multi-threading more of the program
...
The goal is to create threads for the reader, que runner/espeak
processing and signal handling.
As of this commit, this code is still being worked on, so it is broken.
2009-06-24 20:03:31 -05:00
William Hubbs
f58d9984ce
Now the queue runner/softsynth handler clears the queue
...
Thanks to Chris Brannon for the patch.
2009-06-24 16:59:23 -05:00
William Hubbs
08e46c58a8
indentation fixes
2009-06-20 13:09:57 -05:00
William Hubbs
d7dd0f919d
fixed initialization issues
...
We were not returning exit codes properly if we were unable to open the
softsynth or if the daemon was already running.
2009-05-30 12:37:58 -05:00
William Hubbs
d7c81f5117
indentation fixes
2009-05-29 23:17:28 -05:00
Christopher Brannon
3ddbb94e37
multithreading
...
Make espeakup a multi-threaded program. One thread reads from the softsynth
device, queuing text and synthesis commands. The other thread processes
items from the queue.
2009-05-29 20:00:06 -05:00
William Hubbs
3dbdcb21cb
Aespeakup should not drop all non-ascii characters.
...
This fixes an issue with non-english languages.
Thanks to Samuel Thibault for the patch.
2009-04-05 19:24:36 -05:00
William Hubbs
bbf77d918d
Cleaned up warnings and adjusted CFLAGS
...
This commit cleans up warnings and adjusts CFLAGS. Thanks to
samuel.thibault@ens-lyon.org .
2009-03-03 18:02:19 -06:00
William Hubbs
a3901a7e4c
fixed a bug in process_command
...
One of the switch statements in process_command did not have a default
label, which lead to undefined behavior.
Thanks to Chris Brannon for the patch.
2008-10-22 19:17:03 -05:00
William Hubbs
36b05aec41
Added support for the punctuation command from speakup
2008-10-18 16:56:47 -05:00
William Hubbs
d7e8dc2b34
Revert "fixed the length calculation when a flush is processed."
...
This reverts commit 66cb5a7b5c .
2008-10-09 09:05:56 -05:00
William Hubbs
66cb5a7b5c
fixed the length calculation when a flush is processed.
2008-10-09 08:17:07 -05:00
William Hubbs
62deb008bc
fixed the number of bytes to move in the memmove() call
2008-10-09 07:58:58 -05:00
William Hubbs
14858818d3
changed strcpy to memmove
...
The areas pointed to by strcpy() cannot overlap, so we need to use
memmove() in case that happens.
Thanks to Chris Brannon for pointing this out.
2008-10-08 21:59:36 -05:00
William Hubbs
6bec55ca57
changed process_buffer to use the isprint() call.
2008-10-08 18:14:17 -05:00
William Hubbs
1b608481a4
the main loop now uses strrchr and strcpy
...
The idea for this change came from another patch submitted by Chris
Brannon. We now use strrchr to look for the flush character and strcpy
to move the remainder of the buffer to the beginning.
2008-10-05 16:22:16 -05:00
William Hubbs
faab189389
Fixed the select call
...
The select call was moved to be in the if statement below it since the
return code is not needed after that statement is processed.
2008-10-05 16:12:37 -05:00
William Hubbs
24607b1cc8
made the synth flush character a constant for readability
2008-10-05 14:47:52 -05:00
William Hubbs
c8e2a35763
fixed an off-by-one error
...
The loop can start at length-1 since we know that the last character in
the buffer is a null.
Thanks again to Chris Brannon for finding this.
2008-10-04 12:43:40 -05:00
William Hubbs
5ddeb1e978
indentation fixes
2008-09-01 12:50:16 -05:00
William Hubbs
96a3b19850
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.
2008-08-31 10:29:00 -05:00
William Hubbs
ebcbcac9d2
removed an extra assignment statement
2008-08-30 16:34:59 -05:00
William Hubbs
d2d763b36b
moved flush processing into main loop
...
This patch from Kirk Reiser attempts to increase
responsiveness by moving the flush processing into the main loop.
2008-08-30 15:02:26 -05:00
William Hubbs
564db7981e
put back the select code
...
This needed to be put back to keep espeakup from using 100% of the cpu.
2008-08-29 19:16:10 -05:00
William Hubbs
5005b9ddde
removed code that uses select
...
I was using the wrong type for the return value for read().
2008-08-17 18:32:05 -05:00
William Hubbs
498ce65db7
cleaned up process_command
2008-08-17 00:44:06 -05:00
William Hubbs
655894ee2a
added queueing support
...
I have added queueing support so that when we read from the softsynth we
can put the text and commands we have read into a queue. This will
allow us to retry calling espeak_synth() if we fill espeak's internal
buffer.
2008-08-16 19:48:40 -05:00
William Hubbs
86e93edeb0
removed softsynth code from main module
2008-08-15 22:34:49 -05:00
William Hubbs
029dd03251
modularize the code
...
This commit just re-arranges the source so that it is easier to work with.
2008-08-15 00:11:48 -05:00