Browse Source

Create an espeak-ng version of espeak_Synchronize.

master
Reece H. Dunn 9 years ago
parent
commit
4ba60623e8
3 changed files with 13 additions and 5 deletions
  1. 3
    0
      src/include/espeak-ng/espeak_ng.h
  2. 5
    0
      src/libespeak-ng/espeak_api.c
  3. 5
    5
      src/libespeak-ng/speech.c

+ 3
- 0
src/include/espeak-ng/espeak_ng.h View File

ESPEAK_NG_API espeak_ng_STATUS ESPEAK_NG_API espeak_ng_STATUS
espeak_ng_Cancel(void); espeak_ng_Cancel(void);


ESPEAK_NG_API espeak_ng_STATUS
espeak_ng_Synchronize(void);

ESPEAK_NG_API espeak_ng_STATUS ESPEAK_NG_API espeak_ng_STATUS
espeak_ng_CompileDictionary(const char *dsource, espeak_ng_CompileDictionary(const char *dsource,
const char *dict_name, const char *dict_name,

+ 5
- 0
src/libespeak-ng/espeak_api.c View File

return status_to_espeak_error(espeak_ng_Cancel()); return status_to_espeak_error(espeak_ng_Cancel());
} }


ESPEAK_API espeak_ERROR espeak_Synchronize(void)
{
return status_to_espeak_error(espeak_ng_Synchronize());
}

ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags) ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags)
{ {
espeak_ng_CompileDictionary(path, dictionary_name, log, flags); espeak_ng_CompileDictionary(path, dictionary_name, log, flags);

+ 5
- 5
src/libespeak-ng/speech.c View File

static espeak_ng_OUTPUT_MODE my_mode = ENOUTPUT_MODE_SYNCHRONOUS; static espeak_ng_OUTPUT_MODE my_mode = ENOUTPUT_MODE_SYNCHRONOUS;
static int out_samplerate = 0; static int out_samplerate = 0;
static int voice_samplerate = 22050; static int voice_samplerate = 22050;
static espeak_ERROR err = EE_OK;
static espeak_ng_STATUS err = ENS_OK;


t_espeak_callback *synth_callback = NULL; t_espeak_callback *synth_callback = NULL;
int (*uri_callback)(int, const char *, const char *) = NULL; int (*uri_callback)(int, const char *, const char *) = NULL;
out_samplerate = voice_samplerate; out_samplerate = voice_samplerate;
my_audio = wave_open(voice_samplerate, option_device); my_audio = wave_open(voice_samplerate, option_device);
if (!my_audio) { if (!my_audio) {
err = EE_INTERNAL_ERROR;
err = ENS_AUDIO_ERROR;
return -1; return -1;
} }
wave_set_callback_is_output_enabled(fifo_is_command_enabled); wave_set_callback_is_output_enabled(fifo_is_command_enabled);
#endif #endif
} }


ESPEAK_API espeak_ERROR espeak_Synchronize(void)
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Synchronize(void)
{ {
espeak_ERROR berr = err;
espeak_ng_STATUS berr = err;
#ifdef USE_ASYNC #ifdef USE_ASYNC
while (espeak_IsPlaying()) while (espeak_IsPlaying())
usleep(20000); usleep(20000);
#endif #endif
err = EE_OK;
err = ENS_OK;
return berr; return berr;
} }



Loading…
Cancel
Save