1#![allow(non_camel_case_types)]
19
20#[repr(C)]
21#[derive(Debug, Copy, Clone)]
22pub struct pico_system {
23 _unused: [u8; 0],
24}
25pub type pico_System = *mut pico_system;
26#[repr(C)]
27#[derive(Debug, Copy, Clone)]
28pub struct pico_resource {
29 _unused: [u8; 0],
30}
31pub type pico_Resource = *mut pico_resource;
32#[repr(C)]
33#[derive(Debug, Copy, Clone)]
34pub struct pico_engine {
35 _unused: [u8; 0],
36}
37pub type pico_Engine = *mut pico_engine;
38pub type pico_Int16 = ::std::os::raw::c_short;
39pub type pico_Uint16 = ::std::os::raw::c_ushort;
40pub type pico_Int32 = ::std::os::raw::c_int;
41pub type pico_Uint32 = ::std::os::raw::c_uint;
42pub type pico_Char = ::std::os::raw::c_uchar;
43pub type pico_Retstring = [::std::os::raw::c_char; 200usize];
44pub type pico_Status = ::std::os::raw::c_int;
45extern "C" {
46 #[doc = "Initializes the Pico system and returns its handle in \'outSystem\'."]
47 #[doc = "\'memory\' and \'size\' define the location and maximum size of memory"]
48 #[doc = "in number of bytes that the Pico system will use. The minimum size"]
49 #[doc = "required depends on the number of engines and configurations of"]
50 #[doc = "lingware to be used. No additional memory will be allocated by the"]
51 #[doc = "Pico system. This function must be called before any other API"]
52 #[doc = "function is called. It may only be called once (e.g. at application"]
53 #[doc = "startup), unless a call to \'pico_terminate\'."]
54 pub fn pico_initialize(
55 memory: *mut ::std::os::raw::c_void,
56 size: pico_Uint32,
57 outSystem: *mut pico_System,
58 ) -> pico_Status;
59}
60extern "C" {
61 #[doc = "Terminates the Pico system. Lingware resources still being loaded"]
62 #[doc = "are unloaded automatically. The memory area provided to Pico in"]
63 #[doc = "\'pico_initialize\' is released. The system handle becomes"]
64 #[doc = "invalid. It is not allowed to call this function as long as Pico"]
65 #[doc = "engine instances are existing. No API function may be called after"]
66 #[doc = "this function, except for \'pico_initialize\', which reinitializes"]
67 #[doc = "the system."]
68 pub fn pico_terminate(system: *mut pico_System) -> pico_Status;
69}
70extern "C" {
71 #[doc = "Returns in \'outMessage\' a description of the system status or of an"]
72 #[doc = "error that occurred with the most recently called system-level API"]
73 #[doc = "function."]
74 pub fn pico_getSystemStatusMessage(
75 system: pico_System,
76 errCode: pico_Status,
77 outMessage: *mut ::std::os::raw::c_char,
78 ) -> pico_Status;
79}
80extern "C" {
81 #[doc = "Returns in \'outNrOfWarnings\' the number of warnings that occurred"]
82 #[doc = "with the most recently called system-level API function."]
83 pub fn pico_getNrSystemWarnings(
84 system: pico_System,
85 outNrOfWarnings: *mut pico_Int32,
86 ) -> pico_Status;
87}
88extern "C" {
89 #[doc = "Returns in \'outMessage\' a description of a warning that occurred"]
90 #[doc = "with the most recently called system-level API function."]
91 #[doc = "\'warningIndex\' must be in the range 0..N-1 where N is the number of"]
92 #[doc = "warnings returned by \'pico_getNrSystemWarnings\'. \'outCode\' returns"]
93 #[doc = "the warning as an integer code (cf. PICO_WARN_*)."]
94 pub fn pico_getSystemWarning(
95 system: pico_System,
96 warningIndex: pico_Int32,
97 outCode: *mut pico_Status,
98 outMessage: *mut ::std::os::raw::c_char,
99 ) -> pico_Status;
100}
101extern "C" {
102 #[doc = "Loads a resource file into the Pico system. The number of resource"]
103 #[doc = "files loaded in parallel is limited by PICO_MAX_NUM_RESOURCES."]
104 #[doc = "Loading of a resource file may be done at any time (even in"]
105 #[doc = "parallel to a running engine doing TTS synthesis), but with the"]
106 #[doc = "general restriction that functions taking a system handle as their"]
107 #[doc = "first argument must be called in a mutually exclusive fashion. The"]
108 #[doc = "loaded resource will be available only to engines started after the"]
109 #[doc = "resource is fully loaded, i.e., not to engines currently"]
110 #[doc = "running."]
111 pub fn pico_loadResource(
112 system: pico_System,
113 resourceFileName: *const pico_Char,
114 outResource: *mut pico_Resource,
115 ) -> pico_Status;
116}
117extern "C" {
118 #[doc = "Unloads a resource file from the Pico system. If no engine uses the"]
119 #[doc = "resource file, the resource is removed immediately and its"]
120 #[doc = "associated internal memory is released, otherwise"]
121 #[doc = "PICO_EXC_RESOURCE_BUSY is returned."]
122 pub fn pico_unloadResource(
123 system: pico_System,
124 inoutResource: *mut pico_Resource,
125 ) -> pico_Status;
126}
127extern "C" {
128 #[doc = "Gets the unique resource name of a loaded resource"]
129 pub fn pico_getResourceName(
130 system: pico_System,
131 resource: pico_Resource,
132 outName: *mut ::std::os::raw::c_char,
133 ) -> pico_Status;
134}
135extern "C" {
136 #[doc = "Creates a voice definition. Resources must be added to the created"]
137 #[doc = "voice with \'pico_addResourceToVoiceDefinition\' before using the"]
138 #[doc = "voice in \'pico_newEngine\'. It is an error to create a voice"]
139 #[doc = "definition with a previously defined voice name. In that case use"]
140 #[doc = "\'pico_releaseVoiceName\' first."]
141 pub fn pico_createVoiceDefinition(
142 system: pico_System,
143 voiceName: *const pico_Char,
144 ) -> pico_Status;
145}
146extern "C" {
147 #[doc = "Adds a mapping pair (\'voiceName\', \'resourceName\') to the voice"]
148 #[doc = "definition. Multiple mapping pairs can added to a voice defintion."]
149 #[doc = "When calling \'pico_newEngine\' with \'voiceName\', the corresponding"]
150 #[doc = "resources from the mappings will be used with that engine."]
151 pub fn pico_addResourceToVoiceDefinition(
152 system: pico_System,
153 voiceName: *const pico_Char,
154 resourceName: *const pico_Char,
155 ) -> pico_Status;
156}
157extern "C" {
158 #[doc = "Releases the voice definition \'voiceName\'."]
159 pub fn pico_releaseVoiceDefinition(
160 system: pico_System,
161 voiceName: *const pico_Char,
162 ) -> pico_Status;
163}
164extern "C" {
165 #[doc = "Creates and initializes a new Pico engine instance and returns its"]
166 #[doc = "handle in \'outEngine\'. Only one instance per system is currently"]
167 #[doc = "possible."]
168 pub fn pico_newEngine(
169 system: pico_System,
170 voiceName: *const pico_Char,
171 outEngine: *mut pico_Engine,
172 ) -> pico_Status;
173}
174extern "C" {
175 #[doc = "Disposes a Pico engine and releases all memory it occupied. The"]
176 #[doc = "engine handle becomes invalid."]
177 pub fn pico_disposeEngine(system: pico_System, inoutEngine: *mut pico_Engine) -> pico_Status;
178}
179extern "C" {
180 #[doc = "Puts text \'text\' encoded in UTF8 into the Pico text input buffer."]
181 #[doc = "\'textSize\' is the maximum size in number of bytes accessible in"]
182 #[doc = "\'text\'. The input text may also contain text-input commands to"]
183 #[doc = "change, for example, speed or pitch of the resulting speech"]
184 #[doc = "output. The number of bytes actually copied to the Pico text input"]
185 #[doc = "buffer is returned in \'outBytesPut\'. Sentence ends are"]
186 #[doc = "automatically detected. \'\\0\' characters may be embedded in \'text\'"]
187 #[doc = "to finish text input or separate independently to be synthesized"]
188 #[doc = "text parts from each other. Repeatedly calling \'pico_getData\' will"]
189 #[doc = "result in the content of the text input buffer to be synthesized"]
190 #[doc = "(up to the last sentence end or \'\\0\' character detected). To empty"]
191 #[doc = "the internal buffers without finishing synthesis, use the function"]
192 #[doc = "\'pico_resetEngine\'."]
193 pub fn pico_putTextUtf8(
194 engine: pico_Engine,
195 text: *const pico_Char,
196 textSize: pico_Int16,
197 outBytesPut: *mut pico_Int16,
198 ) -> pico_Status;
199}
200extern "C" {
201 #[doc = "Gets speech data from the engine. Every time this function is"]
202 #[doc = "called, the engine performs, within a short time slot, a small"]
203 #[doc = "amount of processing its input text, and then gives control back to"]
204 #[doc = "the calling application. Ie. after calling \'pico_putTextUtf8\'"]
205 #[doc = "(incl. a final embedded \'\\0\'), this function needs to be called"]
206 #[doc = "repeatedly till \'outBytesReceived\' bytes are returned in"]
207 #[doc = "\'outBuffer\'. The type of data returned in \'outBuffer\' (e.g. 8 or 16"]
208 #[doc = "bit PCM samples) is returned in \'outDataType\' and depends on the"]
209 #[doc = "lingware resources. Possible \'outDataType\' values are listed in"]
210 #[doc = "picodefs.h (PICO_DATA_*)."]
211 #[doc = "This function returns PICO_STEP_BUSY while processing input and"]
212 #[doc = "producing speech output. Once all data is returned and there is no"]
213 #[doc = "more input text available in the Pico text input buffer,"]
214 #[doc = "PICO_STEP_IDLE is returned. All other function return values"]
215 #[doc = "indicate a system error."]
216 pub fn pico_getData(
217 engine: pico_Engine,
218 outBuffer: *mut ::std::os::raw::c_void,
219 bufferSize: pico_Int16,
220 outBytesReceived: *mut pico_Int16,
221 outDataType: *mut pico_Int16,
222 ) -> pico_Status;
223}
224extern "C" {
225 #[doc = "Resets the engine and clears all engine-internal buffers, in"]
226 #[doc = "particular text input and signal data output buffers."]
227 #[doc = "\'resetMode\' is one of \'PICO_RESET_SOFT\', to be used to flush the engine,"]
228 #[doc = "or \'PICO_RESET_FULL\', to reset the engine after an engine error."]
229 pub fn pico_resetEngine(engine: pico_Engine, resetMode: pico_Int32) -> pico_Status;
230}
231extern "C" {
232 #[doc = "Returns in \'outMessage\' a description of the engine status or of an"]
233 #[doc = "error that occurred with the most recently called engine-level API"]
234 #[doc = "function."]
235 pub fn pico_getEngineStatusMessage(
236 engine: pico_Engine,
237 errCode: pico_Status,
238 outMessage: *mut ::std::os::raw::c_char,
239 ) -> pico_Status;
240}
241extern "C" {
242 #[doc = "Returns in \'outNrOfWarnings\' the number of warnings that occurred"]
243 #[doc = "with the most recently called engine-level API function."]
244 pub fn pico_getNrEngineWarnings(
245 engine: pico_Engine,
246 outNrOfWarnings: *mut pico_Int32,
247 ) -> pico_Status;
248}
249extern "C" {
250 #[doc = "Returns in \'outMessage\' a description of a warning that occurred"]
251 #[doc = "with the most recently called engine-level API function."]
252 #[doc = "\'warningIndex\' must be in the range 0..N-1 where N is the number of"]
253 #[doc = "warnings returned by \'pico_getNrEngineWarnings\'. \'outCode\' returns"]
254 #[doc = "the warning as an integer code (cf. PICO_WARN_*)."]
255 pub fn pico_getEngineWarning(
256 engine: pico_Engine,
257 warningIndex: pico_Int32,
258 outCode: *mut pico_Status,
259 outMessage: *mut ::std::os::raw::c_char,
260 ) -> pico_Status;
261}