Commit graph

288 commits

Author SHA1 Message Date
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
0bf2cae5a6 moved lock/unlock in queue_process_entry
The only time queue_process_entry should lock the queue gard is when it
is removing the item from the queue.  This happens only when the item
was successfully processed.
2009-06-25 12:06:51 -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
42c3f76a08 moved include for pthread.h to espeakup.h 2009-06-25 01:21:44 -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
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
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
dfc9bbff65 fixed should_run declaration
Removed the local declaration of should_run and set up the extern.
2009-06-24 20:12:15 -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
24e7d667bc queue fixes
This adds retry processing back to the queue functions.  queue_remove
should only be called after the head entry on the queue is processed
successfully.
2009-06-23 20:34:04 -05:00
William Hubbs
26ab109bd8 moved the check for stop out of the loop
In the callback, we should check to see if the stopped flag is true
whether or not we are processing audio.
2009-06-23 16:13:52 -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
ec9d8b1ee2 Add error-checking to the snd_pcm_set_* calls.
These can fail.  They do more than simply manipulate a structure.
2009-06-22 23:05:07 -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
3bb78df86c Do not set the period. 2009-06-22 21:36:31 -05:00
William Hubbs
94e23a3a02 fixed error condition check in alsa.c
The check was looking for a specific error when it should have been just
checking for failure.
2009-06-22 20:44:42 -05:00
William Hubbs
a69342fcad removed some blank lines and put the variables at the top of the file 2009-06-22 19:09:07 -05:00
Christopher Brannon
91b8960b6a Protect the stopped variable with a mutex.
An oversight.  Should have done this in the initial commit.
volatile does not imply atomic.
2009-06-21 14:36:13 -05:00
William Hubbs
0ad70b4eaa Revert "fixed stop_speech issue"
This reverts commit 1c440e5a42.
2009-06-20 19:14:42 -05:00
William Hubbs
1d02169aa5 alsa support is conditional
This commit updates the makefile and the documentation to explain how to
build alsa support.  It has not been fully tested, so it is not built by
default.  Also, I was able to remove the conditional compile directives
from the source.
2009-06-20 16:46:50 -05:00
William Hubbs
1c440e5a42 fixed stop_speech issue
The stop_speech function needs to test the return code from
espeak_Cancel() to be sure the operation was successful before
signaling the callback to stop the audio.
2009-06-20 16:17:42 -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 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
2db53856a9 fixed typo in tarball script 2009-05-30 10:37:39 -05:00
William Hubbs
55f8ebf98a released v0.70 v0.70 2009-05-30 10:32:36 -05:00
William Hubbs
69f1e8554a The tarball script now adds a ChangeLog 2009-05-30 10:30:45 -05:00
William Hubbs
0e47c95015 updated README 2009-05-30 08:36:33 -05:00
William Hubbs
c235a3b063 added .indent.pro to the repository 2009-05-30 00:20:31 -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
3a8323f98c Fixed typo in README 2009-04-15 08:03:40 -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
a1510b5e93 indentation fixes 2009-04-12 16:33:01 -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
9551ba81d9 espeakup 0.60 v0.60 2009-03-09 00:42:29 -05:00
William Hubbs
6366b41bdf espeakup v0.6 v0.6 2009-03-08 23:25:54 -05:00
William Hubbs
40f152e11f allow users to override CFLAGS
This fixes an issue with the Makefile that was not allowing users to
override cflags and keeping -Wall in the flags when compiling.
2009-03-08 21:05:24 -05:00