Debian Codegraph @

external/espeak/espeak_ng.h

raw
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
19 #ifndef ESPEAK_NG_H
20 #define ESPEAK_NG_H
21
22 #include "speak_lib.h"
23
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28
29 //ppgb #if defined(_WIN32) || defined(_WIN64)
30 //ppgb #ifdef LIBESPEAK_NG_EXPORT
31 //ppgb #define ESPEAK_NG_API __declspec(dllexport)
32 //ppgb #else
33 //ppgb #define ESPEAK_NG_API __declspec(dllimport)
34 //ppgb #endif
35 //ppgb #else
36 #define ESPEAK_NG_API
37 //ppgb #endif
38
39 #define ESPEAKNG_DEFAULT_VOICE "en"
40
41 typedef enum {
42 ENS_GROUP_MASK = 0x70000000,
43 ENS_GROUP_ERRNO = 0x00000000, /* Values 0-255 map to errno error codes. */
44 ENS_GROUP_ESPEAK_NG = 0x10000000, /* eSpeak NG error codes. */
45
46 /* eSpeak NG 1.49.0 */
47 ENS_OK = 0,
48 ENS_COMPILE_ERROR = 0x100001FF,
49 ENS_VERSION_MISMATCH = 0x100002FF,
50 ENS_FIFO_BUFFER_FULL = 0x100003FF,
51 ENS_NOT_INITIALIZED = 0x100004FF,
52 ENS_AUDIO_ERROR = 0x100005FF,
53 ENS_VOICE_NOT_FOUND = 0x100006FF,
54 ENS_MBROLA_NOT_FOUND = 0x100007FF,
55 ENS_MBROLA_VOICE_NOT_FOUND = 0x100008FF,
56 ENS_EVENT_BUFFER_FULL = 0x100009FF,
57 ENS_NOT_SUPPORTED = 0x10000AFF,
58 ENS_UNSUPPORTED_PHON_FORMAT = 0x10000BFF,
59 ENS_NO_SPECT_FRAMES = 0x10000CFF,
60 ENS_EMPTY_PHONEME_MANIFEST = 0x10000DFF,
61 ENS_SPEECH_STOPPED = 0x10000EFF,
62
63 /* eSpeak NG 1.49.2 */
64 ENS_UNKNOWN_PHONEME_FEATURE = 0x10000FFF,
65 ENS_UNKNOWN_TEXT_ENCODING = 0x100010FF,
66 } espeak_ng_STATUS;
67
68 typedef enum {
69 ENOUTPUT_MODE_SYNCHRONOUS = 0x0001,
70 ENOUTPUT_MODE_SPEAK_AUDIO = 0x0002,
71 } espeak_ng_OUTPUT_MODE;
72
73 typedef enum {
74 ENGENDER_UNKNOWN = 0,
75 ENGENDER_MALE = 1,
76 ENGENDER_FEMALE = 2,
77 ENGENDER_NEUTRAL = 3,
78 } espeak_ng_VOICE_GENDER;
79
80 typedef struct
81 {
82 void (*outputPhoSymbol)(char* pho_code,int pho_type);
83 void (*outputSilence)(short echo_tail);
84 void (*outputVoiced)(short sample);
85 void (*outputUnvoiced)(short sample);
86 } espeak_ng_OUTPUT_HOOKS;
87
88 /* eSpeak NG 1.49.0 */
89
90 typedef struct espeak_ng_ERROR_CONTEXT_ *espeak_ng_ERROR_CONTEXT;
91
92 ESPEAK_NG_API void
93 espeak_ng_ClearErrorContext(espeak_ng_ERROR_CONTEXT *context);
94
95 ESPEAK_NG_API void
96 espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status,
97 char *buffer,
98 size_t length);
99
100 ESPEAK_NG_API void
101 espeak_ng_PrintStatusCodeMessage(espeak_ng_STATUS status,
102 FILE *out,
103 espeak_ng_ERROR_CONTEXT context);
104
105 ESPEAK_NG_API void
106 espeak_ng_InitializePath(const char *path);
107
108 ESPEAK_NG_API espeak_ng_STATUS
109 espeak_ng_Initialize(espeak_ng_ERROR_CONTEXT *context);
110
111 ESPEAK_NG_API espeak_ng_STATUS
112 espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE output_mode,
113 int buffer_length,
114 const char *device);
115
116 ESPEAK_NG_API int
117 espeak_ng_GetSampleRate(void);
118
119 ESPEAK_NG_API espeak_ng_STATUS
120 espeak_ng_SetParameter(espeak_PARAMETER parameter,
121 int value,
122 int relative);
123
124 ESPEAK_NG_API espeak_ng_STATUS
125 espeak_ng_SetPhonemeEvents(int enable, int ipa);
126
127 ESPEAK_NG_API espeak_ng_STATUS
128 espeak_ng_SetPunctuationList(const wchar_t *punctlist);
129
130 ESPEAK_NG_API espeak_ng_STATUS
131 espeak_ng_SetVoiceByName(const char *name);
132
133 ESPEAK_NG_API espeak_ng_STATUS
134 espeak_ng_SetVoiceByFile(const char *filename);
135
136 ESPEAK_NG_API espeak_ng_STATUS
137 espeak_ng_SetVoiceByProperties(espeak_VOICE *voice_selector);
138
139 ESPEAK_NG_API espeak_ng_STATUS
140 espeak_ng_Synthesize(const void *text,
141 size_t size,
142 unsigned int position,
143 espeak_POSITION_TYPE position_type,
144 unsigned int end_position,
145 unsigned int flags,
146 unsigned int *unique_identifier,
147 void *user_data);
148
149 ESPEAK_NG_API espeak_ng_STATUS
150 espeak_ng_SynthesizeMark(const void *text,
151 size_t size,
152 const char *index_mark,
153 unsigned int end_position,
154 unsigned int flags,
155 unsigned int *unique_identifier,
156 void *user_data);
157
158 ESPEAK_NG_API espeak_ng_STATUS
159 espeak_ng_SpeakKeyName(const char *key_name);
160
161 ESPEAK_NG_API espeak_ng_STATUS
162 espeak_ng_SpeakCharacter(wchar_t character);
163
164 ESPEAK_NG_API espeak_ng_STATUS
165 espeak_ng_Cancel(void);
166
167 ESPEAK_NG_API espeak_ng_STATUS
168 espeak_ng_Synchronize(void);
169
170 ESPEAK_NG_API espeak_ng_STATUS
171 espeak_ng_Terminate(void);
172
173 ESPEAK_NG_API espeak_ng_STATUS
174 espeak_ng_CompileDictionary(const char *dsource,
175 const char *dict_name,
176 FILE *log,
177 int flags,
178 espeak_ng_ERROR_CONTEXT *context);
179
180 ESPEAK_NG_API espeak_ng_STATUS
181 espeak_ng_CompileMbrolaVoice(const char *path,
182 FILE *log,
183 espeak_ng_ERROR_CONTEXT *context);
184
185 #if ! DATA_FROM_SOURCECODE_FILES
186 ESPEAK_NG_API espeak_ng_STATUS
187 espeak_ng_CompilePhonemeData(long rate,
188 FILE *log,
189 espeak_ng_ERROR_CONTEXT *context);
190 #endif
191
192 ESPEAK_NG_API espeak_ng_STATUS
193 espeak_ng_CompileIntonation(FILE *log,
194 espeak_ng_ERROR_CONTEXT *context);
195
196
197 ESPEAK_NG_API espeak_ng_STATUS
198 espeak_ng_CompileIntonationPath(const char *source_path,
199 const char *destination_path,
200 FILE *log,
201 espeak_ng_ERROR_CONTEXT *context);
202
203 /* eSpeak NG 1.49.1 */
204
205 #if ! DATA_FROM_SOURCECODE_FILES
206 ESPEAK_NG_API espeak_ng_STATUS
207 espeak_ng_CompilePhonemeDataPath(long rate,
208 const char *source_path,
209 const char *destination_path,
210 FILE *log,
211 espeak_ng_ERROR_CONTEXT *context);
212 #endif
213
214 ESPEAK_NG_API espeak_ng_STATUS
215 espeak_ng_SetOutputHooks(espeak_ng_OUTPUT_HOOKS* hooks);
216 ESPEAK_NG_API espeak_ng_STATUS
217 espeak_ng_SetConstF0(int f0);
218
219 ESPEAK_NG_API espeak_ng_STATUS
220 espeak_ng_SetRandSeed(long seed);
221
222
223 #ifdef __cplusplus
224 }
225 #endif
226
227 #endif