#include <ctype.h> | #include <ctype.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <locale.h> | #include <locale.h> | ||||
#include <stdbool.h> | |||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
SpeakNextClause(NULL, text, 0); | SpeakNextClause(NULL, text, 0); | ||||
if (my_mode == (ENOUTPUT_MODE_SYNCHRONOUS | ENOUTPUT_MODE_SPEAK_AUDIO)) { | if (my_mode == (ENOUTPUT_MODE_SYNCHRONOUS | ENOUTPUT_MODE_SPEAK_AUDIO)) { | ||||
for (;;) { | |||||
bool continue_speaking = true; | |||||
while (continue_speaking) { | |||||
#ifdef PLATFORM_WINDOWS | #ifdef PLATFORM_WINDOWS | ||||
Sleep(300); // 0.3s | Sleep(300); // 0.3s | ||||
#else | #else | ||||
sleep(1); | sleep(1); | ||||
#endif | #endif | ||||
#endif | #endif | ||||
if (SynthOnTimer() != 0) | |||||
break; | |||||
do { | |||||
if (WcmdqUsed() > 0) | |||||
WavegenOpenSound(); | |||||
if (Generate(phoneme_list, &n_phoneme_list, 1) == 0) { | |||||
if (SpeakNextClause(NULL, NULL, 1) == 0) | |||||
continue_speaking = WavegenCloseSound() == 0; | |||||
} | |||||
} while (skipping_text); | |||||
} | } | ||||
return ENS_OK; | return ENS_OK; | ||||
} | } |
return 0; // finished the phoneme list | return 0; // finished the phoneme list | ||||
} | } | ||||
int SynthOnTimer() | |||||
{ | |||||
do { | |||||
if (WcmdqUsed() > 0) | |||||
WavegenOpenSound(); | |||||
if (Generate(phoneme_list, &n_phoneme_list, 1) == 0) { | |||||
if (SpeakNextClause(NULL, NULL, 1) == 0) | |||||
return WavegenCloseSound(); | |||||
} | |||||
} while (skipping_text); | |||||
return 0; | |||||
} | |||||
int SpeakNextClause(FILE *f_in, const void *text_in, int control) | int SpeakNextClause(FILE *f_in, const void *text_in, int control) | ||||
{ | { | ||||
// Speak text from file (f_in) or memory (text_in) | // Speak text from file (f_in) or memory (text_in) |
void SynthesizeInit(void); | void SynthesizeInit(void); | ||||
int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume); | int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume); | ||||
void MakeWave2(PHONEME_LIST *p, int n_ph); | void MakeWave2(PHONEME_LIST *p, int n_ph); | ||||
int SynthOnTimer(void); | |||||
int SpeakNextClause(FILE *f_text, const void *text_in, int control); | int SpeakNextClause(FILE *f_text, const void *text_in, int control); | ||||
void SetSpeed(int control); | void SetSpeed(int control); | ||||
void SetEmbedded(int control, int value); | void SetEmbedded(int control, int value); |