mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-01 05:46:19 +00:00
[1.46.10]
Add --version command-line option. Allow hexadecimal numbers for UTF-8 bytes in rules in *_rules files. wave_pulse.cpp, ensure wave_close is not called again while waiting. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@278 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+23
-10
@@ -745,19 +745,32 @@ size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSiz
|
||||
int wave_close(void* theHandler)
|
||||
{
|
||||
SHOW_TIME("wave_close > ENTER");
|
||||
static int aStopStreamCount = 0;
|
||||
|
||||
int a_status = pthread_mutex_lock(&pulse_mutex);
|
||||
if (a_status) {
|
||||
SHOW("Error: pulse_mutex lock=%d (%s)\n", a_status, __FUNCTION__);
|
||||
return PULSE_ERROR;
|
||||
}
|
||||
|
||||
drain();
|
||||
// Avoid race condition by making sure this function only
|
||||
// gets called once at a time
|
||||
aStopStreamCount++;
|
||||
if (aStopStreamCount != 1)
|
||||
{
|
||||
SHOW_TIME("wave_close > LEAVE (stopStreamCount)");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&pulse_mutex);
|
||||
SHOW_TIME("wave_close (ret)");
|
||||
int a_status = pthread_mutex_lock(&pulse_mutex);
|
||||
if (a_status)
|
||||
{
|
||||
SHOW("Error: pulse_mutex lock=%d (%s)\n", a_status, __FUNCTION__);
|
||||
aStopStreamCount = 0; // last action
|
||||
return PULSE_ERROR;
|
||||
}
|
||||
|
||||
return PULSE_OK;
|
||||
drain();
|
||||
|
||||
pthread_mutex_unlock(&pulse_mutex);
|
||||
SHOW_TIME("wave_close (ret)");
|
||||
|
||||
aStopStreamCount = 0; // last action
|
||||
return PULSE_OK;
|
||||
}
|
||||
|
||||
//>
|
||||
|
||||
Reference in New Issue
Block a user