|
|
|
|
|
|
|
|
long count_samples; |
|
|
long count_samples; |
|
|
void *my_audio = NULL; |
|
|
void *my_audio = NULL; |
|
|
|
|
|
|
|
|
|
|
|
static const char *option_device = NULL; |
|
|
static unsigned int my_unique_identifier = 0; |
|
|
static unsigned int my_unique_identifier = 0; |
|
|
static void *my_user_data = NULL; |
|
|
static void *my_user_data = NULL; |
|
|
static espeak_ng_OUTPUT_MODE my_mode = ENOUTPUT_MODE_SYNCHRONOUS; |
|
|
static espeak_ng_OUTPUT_MODE my_mode = ENOUTPUT_MODE_SYNCHRONOUS; |
|
|
|
|
|
|
|
|
sleep(1); |
|
|
sleep(1); |
|
|
} |
|
|
} |
|
|
out_samplerate = voice_samplerate; |
|
|
out_samplerate = voice_samplerate; |
|
|
my_audio = wave_open(voice_samplerate, NULL); |
|
|
|
|
|
|
|
|
my_audio = wave_open(voice_samplerate, option_device); |
|
|
if (!my_audio) { |
|
|
if (!my_audio) { |
|
|
err = EE_INTERNAL_ERROR; |
|
|
err = EE_INTERNAL_ERROR; |
|
|
return -1; |
|
|
return -1; |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#pragma GCC visibility push(default) |
|
|
#pragma GCC visibility push(default) |
|
|
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE output_mode, int buffer_length) |
|
|
|
|
|
|
|
|
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE output_mode, int buffer_length, const char *device) |
|
|
{ |
|
|
{ |
|
|
|
|
|
option_device = device; |
|
|
my_mode = output_mode; |
|
|
my_mode = output_mode; |
|
|
my_audio = NULL; |
|
|
my_audio = NULL; |
|
|
option_waveout = 1; // inhibit portaudio callback from wavegen.cpp |
|
|
option_waveout = 1; // inhibit portaudio callback from wavegen.cpp |
|
|
|
|
|
|
|
|
switch (output_type) |
|
|
switch (output_type) |
|
|
{ |
|
|
{ |
|
|
case AUDIO_OUTPUT_PLAYBACK: |
|
|
case AUDIO_OUTPUT_PLAYBACK: |
|
|
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, buf_length); |
|
|
|
|
|
|
|
|
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, buf_length, NULL); |
|
|
break; |
|
|
break; |
|
|
case AUDIO_OUTPUT_RETRIEVAL: |
|
|
case AUDIO_OUTPUT_RETRIEVAL: |
|
|
espeak_ng_InitializeOutput(0, buf_length); |
|
|
|
|
|
|
|
|
espeak_ng_InitializeOutput(0, buf_length, NULL); |
|
|
break; |
|
|
break; |
|
|
case AUDIO_OUTPUT_SYNCHRONOUS: |
|
|
case AUDIO_OUTPUT_SYNCHRONOUS: |
|
|
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, buf_length); |
|
|
|
|
|
|
|
|
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, buf_length, NULL); |
|
|
break; |
|
|
break; |
|
|
case AUDIO_OUTPUT_SYNCH_PLAYBACK: |
|
|
case AUDIO_OUTPUT_SYNCH_PLAYBACK: |
|
|
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS | ENOUTPUT_MODE_SPEAK_AUDIO, buf_length); |
|
|
|
|
|
|
|
|
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS | ENOUTPUT_MODE_SPEAK_AUDIO, buf_length, NULL); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|