예제 #1
0
int isTalking() {
  int status = 0;

  if ( 1 == initFlag ) {
    status = espeak_IsPlaying();
  }
  return status;
}
예제 #2
0
파일: speech.c 프로젝트: rhdunn/espeak
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Synchronize(void)
{
	espeak_ng_STATUS berr = err;
#ifdef USE_ASYNC
	while (espeak_IsPlaying())
		usleep(20000);
#endif
	err = ENS_OK;
	return berr;
}
예제 #3
0
ESPEAK_API espeak_ERROR espeak_Synchronize(void)
{//=============================================
#ifdef USE_ASYNC
	SHOW_TIME("espeak_Synchronize > ENTER");
	while (espeak_IsPlaying())
	{
		usleep(20000);
	}
#endif
	SHOW_TIME("espeak_Synchronize > LEAVE");
	return EE_OK;
}   //  end of espeak_Synchronize
예제 #4
0
void
carmen_voice_send_alert(char *message, int min_time_between_messages, char *language)
{
	static int first = 1;
	static double time_when_stop_speaking = 0;
//	static int started_speaking = 0;
	double current_time;
	unsigned int text_size;

	if (first)
	{
		carmen_voice_initialize(language);
		first = 0;
	}

	/**
	 * The following code is a state machine. While the computer is speaking,
	 * the code do nothing, it just returns. If it ended speaking, we wait some time
	 * before start speaking again.
	 */
	text_size = strlen(message) + 1;
	current_time = time(NULL);

	if (espeak_IsPlaying())
		return;

//	if (started_speaking && !espeak_IsPlaying())
//	{
//		started_speaking = 0;
//	}

	if (fabs(current_time - time_when_stop_speaking) < min_time_between_messages)
		return;

	printf("saying '%s'\n", message);
	espeak_Synth(message, text_size, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL);
	time_when_stop_speaking = time(NULL);
//	started_speaking = 1;
}
예제 #5
0
//-----------------------------------------------------------------------------
// Data definitions
//-----------------------------------------------------------------------------
void RobotSpeak::Speak(const char *psz, bool fWait)
{

    // Tell msound to release itself if necessary...
    printf("Speak %s\n", psz);

    // See if we need to initialize.
    if (!_fSpeakInit)
        InitSpeak();
    else
    {
        // if it is still playing cancel any active stuff...
        if (espeak_IsPlaying())
            espeak_Cancel();
    }

    if (psz)
    {
        espeak_Synth( psz, strlen(psz)+1, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, &_uSpeakIdentifier, 0 );
        if (fWait)
            espeak_Synchronize();
    }
}
예제 #6
0
파일: espeak.cpp 프로젝트: rob-h-w/BabySmix
bool ESpeak::isPlaying()
{
    return (bool)espeak_IsPlaying();
}
예제 #7
0
//wait till current text is spoken
void T4K_Tts_wait()
{
	while (espeak_IsPlaying() && tts_thread)
	{};
	SDL_Delay(30); 
}