William Hubbs
e66311bb99
added automatic dependency tracking to the Makefile
2009-09-23 15:44:51 -05:00
William Hubbs
11cc053d82
reworked the makefile
...
This version of the makefile should be more compatible with allowing
users to pass in cflags.
2009-09-07 16:57:00 -05:00
William Hubbs
48fa03faf5
renamed espeak_sound.c to portaudio.c
...
This better describes the sound system that espeak uses natively.
2009-09-05 11:32:22 -05:00
William Hubbs
654fc810fe
default prefix to /usr/local
...
Without packaging, we should be installing espeakup in /usr/local.
2009-08-25 18:22:40 -05:00
William Hubbs
e4e3f0979e
the status handle should be static
2009-08-21 13:03:02 -05:00
William Hubbs
57547e8efa
renamed synth.c to espeak.c
...
The name was changed because it describes the function of this code more
accurately.
2009-08-19 15:14:20 -05:00
William Hubbs
ac9e12414b
made stop_requested a global variable
...
The two variables, stop_requested and runner_must_stop were performing
the same function, so I am using one variable, stop_requested for this
function.
2009-07-01 20:16:29 -05:00
William Hubbs
18ebab3247
indentation fixes
2009-07-01 19:04:01 -05:00
William Hubbs
cc7e77eb9d
move stop_audio call to synth thread
...
Since there is no reason currently for the softsynth thread to do this,
it makes better sense to have the synth thread control all interaction
with espeak.
2009-07-01 13:01:41 -05:00
William Hubbs
32d848cb76
make callback honor should_run
...
The callback should return and abort synthesis if should_run is 0. This
fixes slow shutdown times in alsa mode.
2009-07-01 12:22:14 -05:00
William Hubbs
4de82bf24c
added a couple of #defines to the alsa code
2009-06-30 21:32:52 -05:00
William Hubbs
739e074072
reworked the queue_remove function
...
Now, when queue_remove is called, it returns the pointer to the data of
the first entry in the queue and removes the entry.
2009-06-30 20:15:20 -05:00
William Hubbs
014d27b7aa
removed some unlock_audio_mutex() calls
2009-06-30 19:15:44 -05:00
William Hubbs
82490a98d2
call snd_pcm_prepare after snd_pcm_drop in stop_audio
2009-06-30 15:54:52 -05:00
William Hubbs
101e14901e
removed white space in the makefile
2009-06-30 13:21:52 -05:00
William Hubbs
dc056e6c77
broke the queue definitions out into their own header file
2009-06-30 13:08:07 -05:00
William Hubbs
0a9a8cce9b
small style changes
2009-06-30 08:15:27 -05:00
Christopher Brannon
40479540b4
Fix a memory leak.
...
If we fail to add entries to the queue in queue_add_cmd or
queue_add_text, properly free the entry.
2009-06-29 18:42:25 -05:00
William Hubbs
ccb8cea91e
stop speech before clearing the queue
...
Thanks to Kirk Reiser for pointing out that this makes the cancel
response faster.
2009-06-29 18:12:04 -05:00
Christopher Brannon
31ad5f04ca
Completely data-agnostic queue functions.
...
The functions in queue.c no longer use static variables. We can now use
them for multiple queues, if necessary.
2009-06-29 18:07:18 -05:00
Christopher Brannon
011ec27162
Create pipe before starting the signal handler thread.
...
The thread can write to the pipe, so the pipe must be initialized
before the thread starts.
2009-06-29 17:49:49 -05:00
William Hubbs
04d10d88ec
more sound updates
...
removed the user_data processing code and put the call to snd_pcm_drop
in stop_audio.
2009-06-29 17:48:16 -05:00
William Hubbs
ceaae3640a
audio should be stopped in softsynth_thread not espeak_thread
2009-06-29 15:59:55 -05:00
William Hubbs
c9f871f687
see if we need to silence speech before we process the queue
2009-06-29 15:26:48 -05:00
William Hubbs
a82bbd8140
fixed a memory leak
...
If we processed an entry from the queue successfully, we were removing
the entry itself from the queue but not freeing the memory allocated to
the entry.
2009-06-28 17:56:21 -05:00
William Hubbs
58f09983f8
fixed callback return code
...
The callback should use the value of stop_requested as its return code.
2009-06-28 15:52:59 -05:00
William Hubbs
0238baa5c2
more alsa updates
...
Made an 'if' statement in the callback more clear and added some locking
for the audio mutex.
2009-06-28 13:52:31 -05:00
William Hubbs
bcd64cb263
created a start_audio function
...
This moves audio control to the specific files, espeak_sound.c and
alsa.c, which are tied to the sound systems.
2009-06-27 17:49:57 -05:00
William Hubbs
9b7dcebb6d
alsa updates
...
The first while loop in the callback doesn't need to be a loop. If the
audio fails, we can just print an error and return.
2009-06-27 17:10:10 -05:00
William Hubbs
46bf3d99d5
all access of the audio mutex should go through our functions
2009-06-27 16:05:27 -05:00
William Hubbs
87ab6c6ea8
make sure that snd_pcm_drop is successful.
...
This was suggested by Kirk Reiser and Chris Brannon.
2009-06-27 13:32:43 -05:00
William Hubbs
4889572ad1
use user_data to detect old events
...
When espeak_Cancel is called, change the value of user_data that is
passed to the events, and, in the callback, use this to test to see if
cancel was received. If the value of user_data has changed, discarde
events that have the old value. This patch is from Chris Brannon.
2009-06-27 13:20:43 -05:00
William Hubbs
a9398bdeb4
Added another error check for alsa
2009-06-26 23:11:15 -05:00
William Hubbs
be879d206b
alsa update
...
I changed the name of the callback to alsa_callback and removed a line
that was making the amount of data written to the sound card very small.
2009-06-26 16:12:31 -05:00
William Hubbs
c1d33d6738
Set the espeak audio buffer size to 50 ms
...
This should help make the cancel command more responsive.
2009-06-26 16:00:08 -05:00
William Hubbs
0471ff47f4
add support for the user_data parameter to espeak_synth
...
The user_data parameter is just a pointer that is passed into the
espeak_synth call that is passed back to the callback. In native mode,
we are not using it since there is not a callback. However, in alsa
mode, it will be used to indicate when a cancel was processed.
2009-06-26 11:34:28 -05:00
William Hubbs
520bbae365
renamed stopped to stop_requested
...
This is more descriptive of what the variable actually does. It signals
the callback to stop the audio.
2009-06-26 10:03:11 -05:00
William Hubbs
8f3e8f1967
moved the audio_mutex code to alsa
...
This is not needed for native sound support, so it has been moved into
the alsa specific code.
2009-06-26 09:50:11 -05:00
William Hubbs
e49acbb59a
removed a debug print
2009-06-25 22:03:57 -05:00
William Hubbs
24bcdf5666
another termination fix
...
espeak_thread needs to signal softsynth_thread once more as it is going
town so that softsynth_thread will see that should_run is now 0 and
terminate.
2009-06-25 22:00:25 -05:00
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
633743117c
mutex fixes
...
We need to make sure that should_run is protected by the mutex.
2009-06-25 20:24:34 -05:00
William Hubbs
1750b92cfb
fixed signal handling issue
...
The signal handler stopped working after I moved the initialization
calls to the main function. Creating the signal handler thread first
fixed this issue.
2009-06-25 20:04:42 -05:00
William Hubbs
eb74a3ce17
removed an unnecessary call to espeak_Terminate()
2009-06-25 18:45:37 -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
6a15f2cccf
fixed first wait in softsynth thread
...
The thread should wait if there is nothing in the queue and if there is
not a request to stop.
Thanks to Chris Brannon for the patch.
2009-06-25 18:17:14 -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
938e10b66a
removed a nested lock/unlock
2009-06-25 14:36:25 -05:00