mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-06 15:12:24 +00:00
Remove calls to wave_is_busy.
Removing these calls do not impact on the behaviour of the program and simplify the wave.h API.
This commit is contained in:
@@ -197,10 +197,7 @@ static int sleep_until_start_request_or_inactivity()
|
||||
//
|
||||
int i = 0;
|
||||
while ((i <= MAX_INACTIVITY_CHECK) && !a_start_is_required) {
|
||||
if (wave_is_busy(NULL))
|
||||
i = 0;
|
||||
else
|
||||
i++;
|
||||
i++;
|
||||
|
||||
int err = 0;
|
||||
struct timespec ts;
|
||||
|
||||
@@ -802,9 +802,6 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Cancel(void)
|
||||
|
||||
ESPEAK_API int espeak_IsPlaying(void)
|
||||
{
|
||||
if (((my_mode & ENOUTPUT_MODE_SPEAK_AUDIO) == ENOUTPUT_MODE_SPEAK_AUDIO) && wave_is_busy(my_audio))
|
||||
return 1;
|
||||
|
||||
#ifdef USE_ASYNC
|
||||
return fifo_is_busy();
|
||||
#else
|
||||
|
||||
+1
-39
@@ -60,7 +60,6 @@ static int pulse_running;
|
||||
void *wave_port_open(int, const char *);
|
||||
size_t wave_port_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize);
|
||||
int wave_port_close(void *theHandler);
|
||||
int wave_port_is_busy(void *theHandler);
|
||||
void wave_port_terminate();
|
||||
void wave_port_flush(void *theHandler);
|
||||
void *wave_port_test_get_write_buffer();
|
||||
@@ -70,7 +69,6 @@ int is_pulse_running();
|
||||
void *wave_pulse_open(int, const char *);
|
||||
size_t wave_pulse_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize);
|
||||
int wave_pulse_close(void *theHandler);
|
||||
int wave_pulse_is_busy(void *theHandler);
|
||||
void wave_pulse_terminate();
|
||||
void wave_pulse_flush(void *theHandler);
|
||||
void *wave_pulse_test_get_write_buffer();
|
||||
@@ -101,14 +99,6 @@ int wave_close(void *theHandler)
|
||||
return wave_port_close(theHandler);
|
||||
}
|
||||
|
||||
int wave_is_busy(void *theHandler)
|
||||
{
|
||||
if (pulse_running)
|
||||
return wave_pulse_is_busy(theHandler);
|
||||
else
|
||||
return wave_port_is_busy(theHandler);
|
||||
}
|
||||
|
||||
void wave_terminate()
|
||||
{
|
||||
if (pulse_running)
|
||||
@@ -129,7 +119,6 @@ void wave_flush(void *theHandler)
|
||||
#define wave_open wave_port_open
|
||||
#define wave_write wave_port_write
|
||||
#define wave_close wave_port_close
|
||||
#define wave_is_busy wave_port_is_busy
|
||||
#define wave_terminate wave_port_terminate
|
||||
#define wave_flush wave_port_flush
|
||||
|
||||
@@ -547,8 +536,7 @@ size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSiz
|
||||
if (0 != wave_open_sound())
|
||||
return 0;
|
||||
my_stream_could_start = 1;
|
||||
} else if (!wave_is_busy(NULL))
|
||||
my_stream_could_start = 1;
|
||||
}
|
||||
assert(BUFFER_LENGTH >= bytes_to_write);
|
||||
|
||||
if (myWrite >= myBuffer + BUFFER_LENGTH)
|
||||
@@ -694,25 +682,6 @@ int wave_close(void *theHandler)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wave_is_busy(void *theHandler)
|
||||
{
|
||||
(void)theHandler; // unused
|
||||
|
||||
PaError active = 0;
|
||||
|
||||
if (pa_stream) {
|
||||
#if USE_PORTAUDIO == 18
|
||||
active = Pa_StreamActive(pa_stream)
|
||||
&& (mInCallbackFinishedState == false);
|
||||
#else
|
||||
active = Pa_IsStreamActive(pa_stream)
|
||||
&& (mInCallbackFinishedState == false);
|
||||
#endif
|
||||
}
|
||||
|
||||
return active == 1;
|
||||
}
|
||||
|
||||
void wave_terminate()
|
||||
{
|
||||
Pa_Terminate();
|
||||
@@ -743,13 +712,6 @@ int wave_close(void *theHandler)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wave_is_busy(void *theHandler)
|
||||
{
|
||||
(void)theHandler; // unused
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wave_terminate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ extern void *wave_open(int samplerate, const char *device);
|
||||
extern size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize);
|
||||
extern int wave_close(void *theHandler);
|
||||
extern void wave_flush(void *theHandler);
|
||||
extern int wave_is_busy(void *theHandler);
|
||||
extern void wave_terminate();
|
||||
|
||||
// general functions
|
||||
|
||||
@@ -66,7 +66,6 @@ enum {
|
||||
#define wave_open wave_pulse_open
|
||||
#define wave_write wave_pulse_write
|
||||
#define wave_close wave_pulse_close
|
||||
#define wave_is_busy wave_pulse_is_busy
|
||||
#define wave_terminate wave_pulse_terminate
|
||||
#define wave_flush wave_pulse_flush
|
||||
|
||||
@@ -573,15 +572,6 @@ int wave_close(void *theHandler)
|
||||
return PULSE_OK;
|
||||
}
|
||||
|
||||
int wave_is_busy(void *theHandler)
|
||||
{
|
||||
(void)theHandler; // unused
|
||||
|
||||
pa_timing_info a_timing_info = {0};
|
||||
int active = pulse_playing(&a_timing_info);
|
||||
return active;
|
||||
}
|
||||
|
||||
void wave_terminate()
|
||||
{
|
||||
pthread_mutex_t *a_mutex = NULL;
|
||||
|
||||
Reference in New Issue
Block a user