espeak_ng.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /* eSpeak NG API.
  2. *
  3. * Copyright (C) 2015-2017 Reece H. Dunn
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef ESPEAK_NG_H
  19. #define ESPEAK_NG_H
  20. #include "speak_lib.h"
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. #define ESPEAK_NG_API
  26. #define ESPEAKNG_DEFAULT_VOICE "en"
  27. typedef enum {
  28. ENS_GROUP_MASK = 0x70000000,
  29. ENS_GROUP_ERRNO = 0x00000000, /* Values 0-255 map to errno error codes. */
  30. ENS_GROUP_ESPEAK_NG = 0x10000000, /* eSpeak NG error codes. */
  31. /* eSpeak NG 1.49.0 */
  32. ENS_OK = 0,
  33. ENS_COMPILE_ERROR = 0x100001FF,
  34. ENS_VERSION_MISMATCH = 0x100002FF,
  35. ENS_FIFO_BUFFER_FULL = 0x100003FF,
  36. ENS_NOT_INITIALIZED = 0x100004FF,
  37. ENS_AUDIO_ERROR = 0x100005FF,
  38. ENS_VOICE_NOT_FOUND = 0x100006FF,
  39. ENS_MBROLA_NOT_FOUND = 0x100007FF,
  40. ENS_MBROLA_VOICE_NOT_FOUND = 0x100008FF,
  41. ENS_EVENT_BUFFER_FULL = 0x100009FF,
  42. ENS_NOT_SUPPORTED = 0x10000AFF,
  43. ENS_UNSUPPORTED_PHON_FORMAT = 0x10000BFF,
  44. ENS_NO_SPECT_FRAMES = 0x10000CFF,
  45. ENS_EMPTY_PHONEME_MANIFEST = 0x10000DFF,
  46. ENS_SPEECH_STOPPED = 0x10000EFF,
  47. /* eSpeak NG 1.49.2 */
  48. ENS_UNKNOWN_PHONEME_FEATURE = 0x10000FFF,
  49. ENS_UNKNOWN_TEXT_ENCODING = 0x100010FF,
  50. } espeak_ng_STATUS;
  51. typedef enum {
  52. ENOUTPUT_MODE_SYNCHRONOUS = 0x0001,
  53. ENOUTPUT_MODE_SPEAK_AUDIO = 0x0002,
  54. } espeak_ng_OUTPUT_MODE;
  55. typedef enum {
  56. ENGENDER_UNKNOWN = 0,
  57. ENGENDER_MALE = 1,
  58. ENGENDER_FEMALE = 2,
  59. ENGENDER_NEUTRAL = 3,
  60. } espeak_ng_VOICE_GENDER;
  61. /* eSpeak NG 1.49.0 */
  62. typedef struct espeak_ng_ERROR_CONTEXT_ *espeak_ng_ERROR_CONTEXT;
  63. ESPEAK_NG_API void
  64. espeak_ng_ClearErrorContext(espeak_ng_ERROR_CONTEXT *context);
  65. ESPEAK_NG_API void
  66. espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status,
  67. char *buffer,
  68. size_t length);
  69. ESPEAK_NG_API void
  70. espeak_ng_PrintStatusCodeMessage(espeak_ng_STATUS status,
  71. FILE *out,
  72. espeak_ng_ERROR_CONTEXT context);
  73. ESPEAK_NG_API void
  74. espeak_ng_InitializePath(const char *path);
  75. ESPEAK_NG_API espeak_ng_STATUS
  76. espeak_ng_Initialize(espeak_ng_ERROR_CONTEXT *context);
  77. ESPEAK_NG_API espeak_ng_STATUS
  78. espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE output_mode,
  79. int buffer_length,
  80. const char *device);
  81. ESPEAK_NG_API int
  82. espeak_ng_GetSampleRate(void);
  83. ESPEAK_NG_API espeak_ng_STATUS
  84. espeak_ng_SetParameter(espeak_PARAMETER parameter,
  85. int value,
  86. int relative);
  87. ESPEAK_NG_API espeak_ng_STATUS
  88. espeak_ng_SetPunctuationList(const wchar_t *punctlist);
  89. ESPEAK_NG_API espeak_ng_STATUS
  90. espeak_ng_SetVoiceByName(const char *name);
  91. ESPEAK_NG_API espeak_ng_STATUS
  92. espeak_ng_SetVoiceByProperties(espeak_VOICE *voice_selector);
  93. ESPEAK_NG_API espeak_ng_STATUS
  94. espeak_ng_Synthesize(const void *text,
  95. size_t size,
  96. unsigned int position,
  97. espeak_POSITION_TYPE position_type,
  98. unsigned int end_position,
  99. unsigned int flags,
  100. unsigned int *unique_identifier,
  101. void *user_data);
  102. ESPEAK_NG_API espeak_ng_STATUS
  103. espeak_ng_SynthesizeMark(const void *text,
  104. size_t size,
  105. const char *index_mark,
  106. unsigned int end_position,
  107. unsigned int flags,
  108. unsigned int *unique_identifier,
  109. void *user_data);
  110. ESPEAK_NG_API espeak_ng_STATUS
  111. espeak_ng_SpeakKeyName(const char *key_name);
  112. ESPEAK_NG_API espeak_ng_STATUS
  113. espeak_ng_SpeakCharacter(wchar_t character);
  114. ESPEAK_NG_API espeak_ng_STATUS
  115. espeak_ng_Cancel(void);
  116. ESPEAK_NG_API espeak_ng_STATUS
  117. espeak_ng_Synchronize(void);
  118. ESPEAK_NG_API espeak_ng_STATUS
  119. espeak_ng_Terminate(void);
  120. ESPEAK_NG_API espeak_ng_STATUS
  121. espeak_ng_CompileDictionary(const char *dsource,
  122. const char *dict_name,
  123. FILE *log,
  124. int flags,
  125. espeak_ng_ERROR_CONTEXT *context);
  126. ESPEAK_NG_API espeak_ng_STATUS
  127. espeak_ng_CompileMbrolaVoice(const char *path,
  128. FILE *log,
  129. espeak_ng_ERROR_CONTEXT *context);
  130. ESPEAK_NG_API espeak_ng_STATUS
  131. espeak_ng_CompilePhonemeData(long rate,
  132. FILE *log,
  133. espeak_ng_ERROR_CONTEXT *context);
  134. ESPEAK_NG_API espeak_ng_STATUS
  135. espeak_ng_CompileIntonation(FILE *log,
  136. espeak_ng_ERROR_CONTEXT *context);
  137. /* eSpeak NG 1.49.1 */
  138. ESPEAK_NG_API espeak_ng_STATUS
  139. espeak_ng_CompilePhonemeDataPath(long rate,
  140. const char *source_path,
  141. const char *destination_path,
  142. FILE *log,
  143. espeak_ng_ERROR_CONTEXT *context);
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147. #endif