如何在for(;;)循环中暂停我的程序?

时间:2018-03-19 18:02:34

标签: c++ for-loop espeak

我的程序中有一个for循环,其中有一个 #include <string.h> #include <malloc.h> #include <espeak/speak_lib.h> espeak_POSITION_TYPE position_type; espeak_AUDIO_OUTPUT output; char *path=NULL; int Buflength = 1000, Options=0; void* user_data; t_espeak_callback *SynthCallback; espeak_PARAMETER Parm; char Voice[] = {"English"}; unsigned int Size,position=0, end_position=0, flags=espeakCHARS_AUTO, *unique_identifier; espeak_init() { output = AUDIO_OUTPUT_PLAYBACK; espeak_Initialize(output, Buflength, path, Options ); espeak_SetVoiceByName(Voice); const char *langNativeString = "en"; espeak_VOICE voice = {0}; // memset(&voice, 0, sizeof(espeak_VOICE)); voice.languages = langNativeString; voice.name = "US"; voice.variant = 2; voice.gender = 1; espeak_SetVoiceByProperties(&voice); Size = strlen(text)+1; } int main() { for(;;) { ... espeak_Synth( text, Size, position, position_type, end_position, flags,unique_identifier, user_data ); espeak_Synchronize( ); // REST OF THE CODE...PRINTING THE WORLD THAT ESPEAK SAID FOR EXAMPLE printf("\n %s \n", text); ... } } 内部调用:

文本由其他应用程序给出,并且在循环的每个循环中都不同,我试图获取此文本,将其传递给espeak,它说文本,其余代码将运行(打印给出文本例如)。

但问题是,当espeak正在谈话时,其余的代码不会等到它结束说话,我正在寻找一种暂停程序直到espeak结束的方法,然后其余代码将执行,但不知道怎么做?

{{1}}

0 个答案:

没有答案