return status; | return status; | ||||
} | } | ||||
espeak_ng_STATUS event_clear_all() | |||||
espeak_ng_STATUS event_clear_all(void) | |||||
{ | { | ||||
espeak_ng_STATUS status; | espeak_ng_STATUS status; | ||||
if ((status = pthread_mutex_lock(&my_mutex)) != ENS_OK) | if ((status = pthread_mutex_lock(&my_mutex)) != ENS_OK) | ||||
return ENS_OK; | return ENS_OK; | ||||
} | } | ||||
static void *pop() | |||||
static void *pop(void) | |||||
{ | { | ||||
void *the_data = NULL; | void *the_data = NULL; | ||||
} | } | ||||
static void init() | |||||
static void init(void) | |||||
{ | { | ||||
while (event_delete((espeak_EVENT *)pop())) | while (event_delete((espeak_EVENT *)pop())) | ||||
; | ; | ||||
node_counter = 0; | node_counter = 0; | ||||
} | } | ||||
void event_terminate() | |||||
void event_terminate(void) | |||||
{ | { | ||||
if (thread_inited) { | if (thread_inited) { | ||||
my_terminate_is_required = true; | my_terminate_is_required = true; |
MAX_INACTIVITY_CHECK = 2 | MAX_INACTIVITY_CHECK = 2 | ||||
}; | }; | ||||
void fifo_init() | |||||
void fifo_init(void) | |||||
{ | { | ||||
// security | // security | ||||
pthread_mutex_init(&my_mutex, (const pthread_mutexattr_t *)NULL); | pthread_mutex_init(&my_mutex, (const pthread_mutexattr_t *)NULL); | ||||
return ENS_OK; | return ENS_OK; | ||||
} | } | ||||
espeak_ng_STATUS fifo_stop() | |||||
espeak_ng_STATUS fifo_stop(void) | |||||
{ | { | ||||
if (!thread_inited) return ENS_OK; | if (!thread_inited) return ENS_OK; | ||||
espeak_ng_STATUS status; | espeak_ng_STATUS status; | ||||
return ENS_OK; | return ENS_OK; | ||||
} | } | ||||
int fifo_is_busy() | |||||
int fifo_is_busy(void) | |||||
{ | { | ||||
if (!thread_inited) return false; | if (!thread_inited) return false; | ||||
pthread_mutex_lock(&my_mutex); | pthread_mutex_lock(&my_mutex); | ||||
return running; | return running; | ||||
} | } | ||||
static int sleep_until_start_request_or_inactivity() | |||||
static int sleep_until_start_request_or_inactivity(void) | |||||
{ | { | ||||
int a_start_is_required = false; | int a_start_is_required = false; | ||||
return a_start_is_required; | return a_start_is_required; | ||||
} | } | ||||
static espeak_ng_STATUS close_stream() | |||||
static espeak_ng_STATUS close_stream(void) | |||||
{ | { | ||||
espeak_ng_STATUS status = pthread_mutex_lock(&my_mutex); | espeak_ng_STATUS status = pthread_mutex_lock(&my_mutex); | ||||
if (status != ENS_OK) | if (status != ENS_OK) | ||||
return NULL; | return NULL; | ||||
} | } | ||||
int fifo_is_command_enabled() | |||||
int fifo_is_command_enabled(void) | |||||
{ | { | ||||
return 0 == my_stop_is_required; | return 0 == my_stop_is_required; | ||||
} | } | ||||
return ENS_OK; | return ENS_OK; | ||||
} | } | ||||
static t_espeak_command *pop() | |||||
static t_espeak_command *pop(void) | |||||
{ | { | ||||
t_espeak_command *the_command = NULL; | t_espeak_command *the_command = NULL; | ||||
node_counter = 0; | node_counter = 0; | ||||
} | } | ||||
void fifo_terminate() | |||||
void fifo_terminate(void) | |||||
{ | { | ||||
if (!thread_inited) return; | if (!thread_inited) return; | ||||
to Kopen. | to Kopen. | ||||
*/ | */ | ||||
static double impulsive_source() | |||||
static double impulsive_source(void) | |||||
{ | { | ||||
static const double doublet[] = { 0.0, 13000000.0, -13000000.0 }; | static const double doublet[] = { 0.0, 13000000.0, -13000000.0 }; | ||||
static double vwave; | static double vwave; | ||||
spectral zero around 800 Hz, magic constants a,b reset pitch synchronously. | spectral zero around 800 Hz, magic constants a,b reset pitch synchronously. | ||||
*/ | */ | ||||
static double natural_source() | |||||
static double natural_source(void) | |||||
{ | { | ||||
double lgtemp; | double lgtemp; | ||||
static double vwave; | static double vwave; | ||||
} | } | ||||
} | } | ||||
void KlattInit() | |||||
void KlattInit(void) | |||||
{ | { | ||||
static const short formant_hz[10] = { 280, 688, 1064, 2806, 3260, 3700, 6500, 7000, 8000, 280 }; | static const short formant_hz[10] = { 280, 688, 1064, 2806, 3260, 3700, 6500, 7000, 8000, 280 }; |
} | } | ||||
} | } | ||||
static bool isKlattFrameFollowing() { | |||||
static bool isKlattFrameFollowing(void) { | |||||
// eSpeak implements its command queue with a circular buffer. | // eSpeak implements its command queue with a circular buffer. | ||||
// Thus to walk it, we start from the head, walking to the tail, which may wrap around to the beginning of the buffer as it is circular. | // Thus to walk it, we start from the head, walking to the tail, which may wrap around to the beginning of the buffer as it is circular. | ||||
for(int i=(wcmdq_head+1)%N_WCMDQ;i!=wcmdq_tail;i=(i+1)%N_WCMDQ) { | for(int i=(wcmdq_head+1)%N_WCMDQ;i!=wcmdq_tail;i=(i+1)%N_WCMDQ) { | ||||
spFrame->endVoicePitch=spFrame->voicePitch; | spFrame->endVoicePitch=spFrame->voicePitch; | ||||
} | } | ||||
void KlattInitSP() { | |||||
void KlattInitSP(void) { | |||||
speechPlayerHandle=speechPlayer_initialize(22050); | speechPlayerHandle=speechPlayer_initialize(22050); | ||||
} | } | ||||
void KlattFiniSP() { | |||||
void KlattFiniSP(void) { | |||||
if (speechPlayerHandle) | if (speechPlayerHandle) | ||||
speechPlayer_terminate(speechPlayerHandle); | speechPlayer_terminate(speechPlayerHandle); | ||||
speechPlayerHandle = NULL; | speechPlayerHandle = NULL; | ||||
} | } | ||||
void KlattResetSP() { | |||||
void KlattResetSP(void) { | |||||
KlattFiniSP(); | KlattFiniSP(); | ||||
KlattInitSP(); | KlattInitSP(); | ||||
} | } |
return y; | return y; | ||||
} | } | ||||
static SpectFrame *SpectFrameCreate() | |||||
static SpectFrame *SpectFrameCreate(void) | |||||
{ | { | ||||
int ix; | int ix; | ||||
SpectFrame *frame; | SpectFrame *frame; | ||||
} | } | ||||
#pragma GCC visibility push(default) | #pragma GCC visibility push(default) | ||||
SpectSeq *SpectSeqCreate() | |||||
SpectSeq *SpectSeqCreate(void) | |||||
{ | { | ||||
SpectSeq *spect = malloc(sizeof(SpectSeq)); | SpectSeq *spect = malloc(sizeof(SpectSeq)); | ||||
if (!spect) | if (!spect) |
return buf; | return buf; | ||||
} | } | ||||
void SynthesizeInit() | |||||
void SynthesizeInit(void) | |||||
{ | { | ||||
last_pitch_cmd = 0; | last_pitch_cmd = 0; | ||||
last_amp_cmd = 0; | last_amp_cmd = 0; | ||||
return len; | return len; | ||||
} | } | ||||
static frame_t *AllocFrame() | |||||
static frame_t *AllocFrame(void) | |||||
{ | { | ||||
// Allocate a temporary spectrum frame for the wavegen queue. Use a pool which is big | // Allocate a temporary spectrum frame for the wavegen queue. Use a pool which is big | ||||
// enough to use a round-robin without checks. | // enough to use a round-robin without checks. |
return count; | return count; | ||||
} | } | ||||
static void Word_EmbeddedCmd() | |||||
static void Word_EmbeddedCmd(void) | |||||
{ | { | ||||
// Process embedded commands for emphasis, sayas, and break | // Process embedded commands for emphasis, sayas, and break | ||||
int embedded_cmd; | int embedded_cmd; |
#pragma GCC visibility pop | #pragma GCC visibility pop | ||||
void FreeVoiceList() | |||||
void FreeVoiceList(void) | |||||
{ | { | ||||
int ix; | int ix; | ||||
for (ix = 0; ix < n_voices_list; ix++) { | for (ix = 0; ix < n_voices_list; ix++) { |
242, 246, 249, 252, 254, 255 | 242, 246, 249, 252, 254, 255 | ||||
}; | }; | ||||
void WcmdqStop() | |||||
void WcmdqStop(void) | |||||
{ | { | ||||
wcmdq_head = 0; | wcmdq_head = 0; | ||||
wcmdq_tail = 0; | wcmdq_tail = 0; | ||||
#endif | #endif | ||||
} | } | ||||
int WcmdqFree() | |||||
int WcmdqFree(void) | |||||
{ | { | ||||
int i; | int i; | ||||
i = wcmdq_head - wcmdq_tail; | i = wcmdq_head - wcmdq_tail; | ||||
return i; | return i; | ||||
} | } | ||||
int WcmdqUsed() | |||||
int WcmdqUsed(void) | |||||
{ | { | ||||
return N_WCMDQ - WcmdqFree(); | return N_WCMDQ - WcmdqFree(); | ||||
} | } | ||||
void WcmdqInc() | |||||
void WcmdqInc(void) | |||||
{ | { | ||||
wcmdq_tail++; | wcmdq_tail++; | ||||
if (wcmdq_tail >= N_WCMDQ) wcmdq_tail = 0; | if (wcmdq_tail >= N_WCMDQ) wcmdq_tail = 0; | ||||
} | } | ||||
static void WcmdqIncHead() | |||||
static void WcmdqIncHead(void) | |||||
{ | { | ||||
MAKE_MEM_UNDEFINED(&wcmdq[wcmdq_head], sizeof(wcmdq[wcmdq_head])); | MAKE_MEM_UNDEFINED(&wcmdq[wcmdq_head], sizeof(wcmdq[wcmdq_head])); | ||||
wcmdq_head++; | wcmdq_head++; | ||||
return hmax; // highest harmonic number | return hmax; // highest harmonic number | ||||
} | } | ||||
static void AdvanceParameters() | |||||
static void AdvanceParameters(void) | |||||
{ | { | ||||
// Called every 64 samples to increment the formant freq, height, and widths | // Called every 64 samples to increment the formant freq, height, and widths | ||||
if (wvoice == NULL) | if (wvoice == NULL) | ||||
setresonator(&rbreath[ix], 2000, 200, 1); | setresonator(&rbreath[ix], 2000, 200, 1); | ||||
} | } | ||||
static void SetBreath() | |||||
static void SetBreath(void) | |||||
{ | { | ||||
int pk; | int pk; | ||||
return value; | return value; | ||||
} | } | ||||
static void SetPitchFormants() | |||||
static void SetPitchFormants(void) | |||||
{ | { | ||||
if (wvoice == NULL) | if (wvoice == NULL) | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
static int WavegenFill2() | |||||
static int WavegenFill2(void) | |||||
{ | { | ||||
// Pick up next wavegen commands from the queue | // Pick up next wavegen commands from the queue | ||||
// return: 0 output buffer has been filled | // return: 0 output buffer has been filled |