Browse Source

espeak-ng: use the new espeak-ng initialization APIs

master
Reece H. Dunn 9 years ago
parent
commit
b28a0001c0
3 changed files with 22 additions and 2 deletions
  1. 14
    2
      src/espeak-ng.c
  2. 3
    0
      src/include/espeak-ng/espeak_ng.h
  3. 5
    0
      src/libespeak-ng/speak_lib.c

+ 14
- 2
src/espeak-ng.c View File

} }
} }


espeak_ng_InitializePath(data_path);
espeak_ng_STATUS result = espeak_ng_Initialize();
if (result != ENS_OK) {
if (result == ENE_READ_ERROR)
fprintf(stderr, "Failed to load espeak-data\n");
else
fprintf(stderr, "Wrong version of espeak-data\n");
exit(1);
}

if (option_waveout || quiet) { if (option_waveout || quiet) {
// writing to a file (or no output), we can use synchronous mode // writing to a file (or no output), we can use synchronous mode
samplerate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 0, data_path, 0);
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, 0, NULL);
samplerate = espeak_ng_GetSampleRate();
samples_split = samplerate * samples_split_seconds; samples_split = samplerate * samples_split_seconds;


espeak_SetSynthCallback(SynthCallback); espeak_SetSynthCallback(SynthCallback);
} }
} else { } else {
// play the sound output // play the sound output
samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, data_path, 0);
espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, 0, NULL);
samplerate = espeak_ng_GetSampleRate();
} }


if (voicename[0] == 0) if (voicename[0] == 0)

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

int buffer_length, int buffer_length,
const char *device); const char *device);


ESPEAK_NG_API int
espeak_ng_GetSampleRate(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/speak_lib.c View File



return ENS_OK; return ENS_OK;
} }

ESPEAK_NG_API int espeak_ng_GetSampleRate(void)
{
return samplerate;
}
#pragma GCC visibility pop #pragma GCC visibility pop


static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text, int flags) static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text, int flags)

Loading…
Cancel
Save