Commit graph

53 commits

Author SHA1 Message Date
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
42c3f76a08 moved include for pthread.h to espeakup.h 2009-06-25 01:21:44 -05:00
William Hubbs
c6b57885c9 removed declaration of rate from main 2009-06-24 22:22:34 -05:00
Christopher Brannon
d82bfcd09c Make one thread responsible for handling espeak interaction.
Most of the idea for this change came from William:
Renamed queue_runner to espeak_thread.  Moved espeak initialization
and termination to espeak_thread.  The while loops that process
the queue now use the variable should_run.
2009-06-24 22:11:52 -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
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
b108764b02 removed the audio_callback variable 2009-06-23 11:02:09 -05:00
Christopher Brannon
739d79cff8 Select audio mode before initializing espeak. 2009-06-23 10:48:56 -05:00
Christopher Brannon
a5d1a48f42 Obtain sample rate from the value of espeak_Initialize.
espeak uses a sample rate of 22050 HZ, but let's not rely on that knowledge.
espeak_Initialize returns the sample rate on success,
so rely on that value when selecting a rate.
2009-06-22 22:32:27 -05:00
William Hubbs
08e46c58a8 indentation fixes 2009-06-20 13:09:57 -05:00
Christopher Brannon
d373fb2aa7 An initial stab at ALSA support.
It's very raw right now.
2009-06-19 15:11:51 -05:00
William Hubbs
b31985f97c released v0.71 2009-05-30 12:44:33 -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
55f8ebf98a released v0.70 2009-05-30 10:32:36 -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
e7d300a183 turn off espeak's default processing of uppercase letters
This needs to be turned off since speakup processes upper case by
raising the pitch.
2009-04-14 09:00:32 -05:00
William Hubbs
9551ba81d9 espeakup 0.60 2009-03-09 00:42:29 -05:00
William Hubbs
6366b41bdf espeakup v0.6 2009-03-08 23:25:54 -05:00
William Hubbs
2351b5d489 add support for setting the default voice
This adds support for a --default-voice or -V (upper case) command line
option which will set the default voice espeakup uses.  This takes a
name of an espeak voice -- for example:

espeakup --default-voice=en-us

or

espeakup -V en-us
2009-03-07 14:34:49 -06:00
William Hubbs
da15136aa7 only one espeakup daemon should be running
This fixes a bug which would allow espeakup in debug mode to be run even
if espeakup was already running as a daemon.
2009-03-07 10:39:00 -06:00
William Hubbs
7db5530308 Espeakup version 0.51. 2009-02-10 21:57:10 -06:00
William Hubbs
0f24afef95 espeakup v0.5 2009-02-09 09:05:28 -06:00
William Hubbs
c12ec3e1b0 moved version definition
This commit moves the version definition to espeakup.c instead of cli.c
2009-02-09 08:46:14 -06:00
William Hubbs
f76d00f6af removed the callback function
This commit removes the synthcallback function since it wasn't doing
anything.  Also, it has been reported that this may be causing the
sluggishness when espeakup is asked to shut up.
Thanks to Chris Brannon for finding this.
2008-10-04 11:39:01 -05:00
William Hubbs
527fb136de starting work toward supporting changing voices
This commit adds a set_voice() function which will ultimately allow the
user to switch voices.
2008-09-27 10:52:24 -05:00
William Hubbs
f52c03ec2b Fixed a typo. 2008-09-26 08:17:13 -05:00
William Hubbs
1f784be891 added support for long command line options 2008-09-03 08:16:54 -05:00
William Hubbs
037019de3a Espeakup v0.2 2008-09-01 16:18:46 -05:00
William Hubbs
5ddeb1e978 indentation fixes 2008-09-01 12:50:16 -05:00
William Hubbs
b34e397717 clear the queue when we catch a signal 2008-08-16 20:09:03 -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
William Hubbs
882e9c20a5 clean up the main function
This commit cleans up the main function and moves command line processing
to a separate function.
2008-08-12 08:10:56 -05:00
William Hubbs
9402716c32 cleaned up command line option processing 2008-08-02 16:30:43 -05:00
William Hubbs
6ecc3182da added a version command line option and variable. 2008-08-01 22:12:57 -05:00
William Hubbs
02c88e949a adjusted multipliers
I adjusted the pitch and volume multipliers.
This should allow us to come closer to the maximum espeak settings.
2008-08-01 20:35:55 -05:00
William Hubbs
d7de943a3a added frequency support
This patch, also from Kirk Reiser, adds frequency support.
2008-08-01 19:51:29 -05:00
William Hubbs
cddead8aa9 pid file support
This commit adds support for a pid file so that we can be stopped and
started by init systems.
2008-08-01 09:27:51 -05:00
William Hubbs
b51cf9d774 Added a signal handler
This commit adds a signal handler so that espeakup will terminate cleanly.
2008-07-31 20:32:51 -05:00
William Hubbs
61aac5ecb5 moved some variables
This commit removes the softsynth file descriptor and the debug flag
from the synth structure.  These will need to be accessed from a signal
handler and there is no way to pass the structure to it.
Also, the process_data function now works with local variables and assigns
them to the synth structure, avoiding allocating a buffer with malloc/free.
2008-07-31 08:47:00 -05:00
William Hubbs
eb5cb3d36d fixed volume
I applied another patch from Kirk Reiser which fixes the volume setting.
Thanks to Kirk for the patch.
2008-07-31 08:24:57 -05:00
William Hubbs
7604cac68c fixed the garbage characters bug
This fixes the bug that was causing garbage characters to be spoken.  Also
it sets the initial voice to "default".
2008-07-30 08:51:23 -05:00
William Hubbs
b745e0c48b more error checking
I moved the read call out of process_data and into the main loop.
Also, error checking was added for select() and read().
2008-07-29 22:58:41 -05:00
William Hubbs
c3b0e8d0da code cleanup
This patch adds the length of the buffer to the synth structure and
clears the buffer before we use it.
Thanks to Kirk Reiser for the patch.
2008-07-29 20:00:04 -05:00
William Hubbs
c4839ac78b added maxBufferSize constant 2008-07-28 08:58:32 -05:00