The current error handling is poor. E.g. if the device open fail, there is no way how the library could signal this to the caller and there is also no handler in the espeak binary which can results in core.
This problem was originally reported in RHBZ:
https://bugzilla.redhat.com/show_bug.cgi?id=904302
I tried to fix this the least intrusive way and not break the current libespeak API/ABI. It could be probably fixed much better way or possibly the interface redesigned, but the idea should be clear from the patch.
Fix is now included in development version 1.46.35 at:
http;//espeak.sf.net/test/latest.html
I will make a new official release (1.47) soon.
I see in 2 places:
-void wave_init(int srate) {}
+int wave_init(int srate) {}
There's a return statement missing there!
Proposed fix.
Kevin thanks for spotting this, I overlooked them as declarations :) This shouldn't be problem in Fedora as this code path shouldn't be executed there.
I uploaded new version of the patch. I also negated the return code of the wave_init to be more consistent with the other code, now 0 means success.
The newly added return statements that were previously missing now returns 0 (success), maybe the failure return code would be better, but I tried to keep the logic same as with wave_close.