Debian Codegraph @

external/espeak/espeak_api.cpp

raw symbols SCIP
1 /* An implementation of the eSpeak API using the espeak-ng API.
2 *
3 * Copyright (C) 2005 to 2013 by Jonathan Duddington
4 * email: [email protected]
5 * Copyright (C) 2016 Reece H. Dunn
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see: <http://www.gnu.org/licenses/>.
19 */
20
21 #include "espeak__config.h"cxx . . $ `<file>/external/espeak/espeak__config.h`/
22
23 #include <stdint.h>
24 #include <stdlib.h>
25
26 #include "espeak_ng.h"cxx . . $ `<file>/external/espeak/espeak_ng.h`/
27 #include "speak_lib.h"cxx . . $ `<file>/external/espeak/speak_lib.h`/
28 #include "encoding.h"cxx . . $ `<file>/external/espeak/encoding.h`/
29
30 #include "compiledict.h"cxx . . $ `<file>/external/espeak/compiledict.h`/
31
32 #include "synthesize.h"cxx . . $ `<file>/external/espeak/synthesize.h`/ // for espeakINITIALIZE_PHONEME_IPA
33 #include "translate.h"cxx . . $ `<file>/external/espeak/translate.h`/ // for dictionary_name, option_phoneme_events
34
35 static espeak_ERRORcxx . . $ espeak_ERROR# status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_STATUS status)
36 {
37 switch (status)
38 {
39 case ENS_OK: return EE_OKcxx . . $ EE_OK.;
40 case ENS_SPEECH_STOPPED: return EE_OKcxx . . $ EE_OK.;
41 case ENS_VOICE_NOT_FOUND: return EE_NOT_FOUNDcxx . . $ EE_NOT_FOUND.;
42 case ENS_MBROLA_NOT_FOUND: return EE_NOT_FOUNDcxx . . $ EE_NOT_FOUND.;
43 case ENS_MBROLA_VOICE_NOT_FOUND: return EE_NOT_FOUNDcxx . . $ EE_NOT_FOUND.;
44 case ENS_FIFO_BUFFER_FULL: return EE_BUFFER_FULLcxx . . $ EE_BUFFER_FULL.;
45 default: return EE_INTERNAL_ERRORcxx . . $ EE_INTERNAL_ERROR.;
46 }
47 }
48
49 #pragma GCC visibility push(default)
50
51 #if 0 /* not called in Praat */
52 ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length, const char *path, int options)
53 {
54 espeak_ng_InitializePath(path);
55 espeak_ng_ERROR_CONTEXT context = NULL;
56 espeak_ng_STATUS result = espeak_ng_Initialize(&context);
57 if (result != ENS_OK) {
58 espeak_ng_PrintStatusCodeMessage(result, stderr, context);
59 espeak_ng_ClearErrorContext(&context);
60 if ((options & espeakINITIALIZE_DONT_EXIT) == 0)
61 exit(1);
62 }
63
64 switch (output_type)
65 {
66 case AUDIO_OUTPUT_PLAYBACK:
67 espeak_ng_InitializeOutput(ENOUTPUT_MODE_SPEAK_AUDIO, buf_length, NULL);
68 break;
69 case AUDIO_OUTPUT_RETRIEVAL:
70 espeak_ng_InitializeOutput((espeak_ng_OUTPUT_MODE) 0, buf_length, NULL);
71 break;
72 case AUDIO_OUTPUT_SYNCHRONOUS:
73 espeak_ng_InitializeOutput(ENOUTPUT_MODE_SYNCHRONOUS, buf_length, NULL);
74 break;
75 case AUDIO_OUTPUT_SYNCH_PLAYBACK:
76 espeak_ng_InitializeOutput((espeak_ng_OUTPUT_MODE) (ENOUTPUT_MODE_SYNCHRONOUS | ENOUTPUT_MODE_SPEAK_AUDIO), buf_length, NULL);
77 break;
78 }
79
80 option_phoneme_events = (options & (espeakINITIALIZE_PHONEME_EVENTS | espeakINITIALIZE_PHONEME_IPA));
81
82 return espeak_ng_GetSampleRate();
83 }
84 #endif
85
86 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Synthcxx . . $ espeak_Synth(45b8c1d042238b3).(const void *text, size_t size,
87 unsigned int position,
88 espeak_POSITION_TYPEcxx . . $ espeak_POSITION_TYPE# position_type,
89 unsigned int end_position, unsigned int flags,
90 unsigned int *unique_identifier, void *user_data)
91 {
92 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_Synthesize(text, size, position, position_type, end_position, flags, unique_identifier, user_data));
93 }
94
95 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Synth_Markcxx . . $ espeak_Synth_Mark(397b050f59f15604).(const void *text, size_t size,
96 const char *index_mark,
97 unsigned int end_position,
98 unsigned int flags,
99 unsigned int *unique_identifier,
100 void *user_data)
101 {
102 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SynthesizeMark(text, size, index_mark, end_position, flags, unique_identifier, user_data));
103 }
104
105 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Keycxx . . $ espeak_Key(b3221b0b4720939a).(const char *key_name)
106 {
107 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SpeakKeyName(key_name));
108 }
109
110 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Charcxx . . $ espeak_Char(1fe97c5579bbcbdf).(wchar_t character)
111 {
112 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SpeakCharacter(character));
113 }
114
115 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_SetParametercxx . . $ espeak_SetParameter(20eba2aca5d7cb37).(espeak_PARAMETERcxx . . $ espeak_PARAMETER# parameter, int value, int relative)
116 {
117 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SetParameter(parameter, value, relative));
118 }
119
120 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_SetPunctuationListcxx . . $ espeak_SetPunctuationList(4610bb13426c4fa6).(const wchar_t *punctlist)
121 {
122 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SetPunctuationList(punctlist));
123 }
124
125 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_SetVoiceByNamecxx . . $ espeak_SetVoiceByName(b3221b0b4720939a).(const char *name)
126 {
127 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SetVoiceByName(name));
128 }
129
130 #if ! DATA_FROM_SOURCECODE_FILEScxx . . $ `external/espeak/espeak__config.h:23:9`!
131 ESPEAK_API espeak_ERROR espeak_SetVoiceByFile(const char *filename)
132 {
133 return status_to_espeak_error(espeak_ng_SetVoiceByFile(filename));
134 }
135 #endif // ! DATA_FROM_SOURCECODE_FILES
136
137 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_SetVoiceByPropertiescxx . . $ espeak_SetVoiceByProperties(52dca4cb9a9944d0).(espeak_VOICEcxx . . $ espeak_VOICE# *voice_selector)
138 {
139 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_SetVoiceByProperties(voice_selector));
140 }
141
142 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Cancelcxx . . $ espeak_Cancel(6a8b4ceb9d532773).(void)
143 {
144 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_Cancel());
145 }
146
147 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Synchronizecxx . . $ espeak_Synchronize(6a8b4ceb9d532773).(void)
148 {
149 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_Synchronize());
150 }
151
152 ESPEAK_APIcxx . . $ `external/espeak/speak_lib.h:38:9`! espeak_ERRORcxx . . $ espeak_ERROR# espeak_Terminatecxx . . $ espeak_Terminate(6a8b4ceb9d532773).(void)
153 {
154 return status_to_espeak_errorcxx . . $ status_to_espeak_error(43a47487f97d96ac).(espeak_ng_Terminate());
155 }
156
157 #if ! DATA_FROM_SOURCECODE_FILEScxx . . $ `external/espeak/espeak__config.h:23:9`!
158 ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags)
159 {
160 espeak_ng_ERROR_CONTEXT context = NULL;
161 espeak_ng_STATUS result = espeak_ng_CompileDictionary(path, dictionary_name, log, flags, &context);
162 if (result != ENS_OK) {
163 espeak_ng_PrintStatusCodeMessage(result, stderr, context);
164 espeak_ng_ClearErrorContext(&context);
165 }
166 }
167 #endif // ! DATA_FROM_SOURCECODE_FILES
168
169 #pragma GCC visibility pop