@@ -19,6 +19,8 @@ | |||
#ifndef ESPEAK_NG_H | |||
#define ESPEAK_NG_H | |||
#include <wchar.h> | |||
#ifdef __cplusplus | |||
extern "C" | |||
{ | |||
@@ -60,6 +62,9 @@ espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE output_mode, | |||
ESPEAK_NG_API int | |||
espeak_ng_GetSampleRate(void); | |||
ESPEAK_NG_API espeak_ng_STATUS | |||
espeak_ng_SpeakCharacter(wchar_t character); | |||
ESPEAK_NG_API espeak_ng_STATUS | |||
espeak_ng_CompileDictionary(const char *dsource, | |||
const char *dict_name, |
@@ -21,6 +21,7 @@ | |||
#include "speak_lib.h" | |||
#include "espeak_ng.h" | |||
#include <errno.h> | |||
#include <stdlib.h> | |||
#if HAVE_STDINT_H | |||
#include <stdint.h> | |||
@@ -31,6 +32,17 @@ | |||
#include "synthesize.h" | |||
#include "translate.h" | |||
static espeak_ERROR status_to_espeak_error(espeak_ng_STATUS status) | |||
{ | |||
switch (status) | |||
{ | |||
case ENS_OK: return EE_OK; | |||
case ENOENT: return EE_NOT_FOUND; | |||
case ENS_FIFO_BUFFER_FULL: return EE_BUFFER_FULL; | |||
default: return EE_INTERNAL_ERROR; | |||
} | |||
} | |||
#pragma GCC visibility push(default) | |||
ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length, const char *path, int options) | |||
@@ -68,6 +80,11 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length | |||
return espeak_ng_GetSampleRate(); | |||
} | |||
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character) | |||
{ | |||
return status_to_espeak_error(espeak_ng_SpeakCharacter(character)); | |||
} | |||
ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags) | |||
{ | |||
espeak_ng_CompileDictionary(path, dictionary_name, log, flags); |
@@ -756,29 +756,24 @@ ESPEAK_API espeak_ERROR espeak_Key(const char *key) | |||
return a_error; | |||
} | |||
ESPEAK_API espeak_ERROR espeak_Char(wchar_t character) | |||
ESPEAK_NG_API espeak_ng_STATUS espeak_ng_SpeakCharacter(wchar_t character) | |||
{ | |||
// is there a system resource of character names per language? | |||
if (f_logespeak) | |||
fprintf(f_logespeak, "\nCHAR U+%x\n", character); | |||
#ifdef USE_ASYNC | |||
espeak_ERROR a_error; | |||
if (my_mode & ENOUTPUT_MODE_SYNCHRONOUS) { | |||
sync_espeak_Char(character); | |||
return EE_OK; | |||
return ENS_OK; | |||
} | |||
t_espeak_command *c = create_espeak_char(character, NULL); | |||
a_error = status_to_espeak_error(fifo_add_command(c)); | |||
if (a_error != EE_OK) | |||
espeak_ng_STATUS status = fifo_add_command(c); | |||
if (status != ENS_OK) | |||
delete_espeak_command(c); | |||
return a_error; | |||
return status; | |||
#else | |||
sync_espeak_Char(character); | |||
return EE_OK; | |||
return ENS_OK; | |||
#endif | |||
} | |||