1 #ifndef SPEAK_LIB_H
2 #define SPEAK_LIB_H
3 /***************************************************************************
4  *   Copyright (C) 2005 to 2012 by Jonathan Duddington                     *
5  *   email: jonsd@users.sourceforge.net                                    *
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:                                 *
19  *               <http://www.gnu.org/licenses/>.                           *
20  ***************************************************************************/
21 
22 
23 /*************************************************************/
24 /* This is the header file for the library version of espeak */
25 /*                                                           */
26 /*************************************************************/
27 
28 #include <stdio.h>
29 #include <stddef.h>
30 
31 #define ESPEAK_API
32 
33 #define ESPEAK_API_REVISION  12
34 /*
35 Revision 2
36    Added parameter "options" to eSpeakInitialize()
37 
38 Revision 3
39    Added espeakWORDGAP to  espeak_PARAMETER
40 
41 Revision 4
42    Added flags parameter to espeak_CompileDictionary()
43 
44 Revision 5
45    Added espeakCHARS_16BIT
46 
47 Revision 6
48   Added macros: espeakRATE_MINIMUM, espeakRATE_MAXIMUM, espeakRATE_NORMAL
49 
50 Revision 7  24.Dec.2011
51   Changed espeak_EVENT structure to add id.string[] for phoneme mnemonics.
52   Added espeakINITIALIZE_PHONEME_IPA option for espeak_Initialize() to report phonemes as IPA names.
53 
54 Revision 8  26.Apr.2013
55   Added function espeak_TextToPhonemes().
56 
57 Revision 9  30.May.2013
58   Changed function espeak_TextToPhonemes().
59 
60 Revision 10 29.Aug.2014
61   Changed phonememode parameter to espeak_TextToPhonemes() and espeak_SetPhonemeTrace
62 
63 Revision 11 (espeak-ng)
64   Made ESPEAK_API import/export symbols correctly on Windows.
65 
66 Revision 12 (espeak-ng)
67   Exposed espeak_SetPhonemeCallback. This is available in eSpeak, but was not exposed in this header.
68 
69 */
70          /********************/
71          /*  Initialization  */
72          /********************/
73 
74 // values for 'value' in espeak_SetParameter(espeakRATE, value, 0), nominally in words-per-minute
75 #define espeakRATE_MINIMUM  80
76 #define espeakRATE_MAXIMUM  450
77 #define espeakRATE_NORMAL   175
78 
79 
80 typedef enum {
81   espeakEVENT_LIST_TERMINATED = 0, // Retrieval mode: terminates the event list.
82   espeakEVENT_WORD = 1,            // Start of word
83   espeakEVENT_SENTENCE = 2,        // Start of sentence
84   espeakEVENT_MARK = 3,            // Mark
85   espeakEVENT_PLAY = 4,            // Audio element
86   espeakEVENT_END = 5,             // End of sentence or clause
87   espeakEVENT_MSG_TERMINATED = 6,  // End of message
88   espeakEVENT_PHONEME = 7,         // Phoneme, if enabled in espeak_Initialize()
89   espeakEVENT_SAMPLERATE = 8       // internal use, set sample rate
90 } espeak_EVENT_TYPE;
91 
92 
93 
94 typedef struct {
95 	espeak_EVENT_TYPE type;
96 	unsigned int unique_identifier; // message identifier (or 0 for key or character)
97 	int text_position;    // the number of characters from the start of the text
98 	int length;           // word length, in characters (for espeakEVENT_WORD)
99 	int audio_position;   // the time in mS within the generated speech output data
100 	int sample;           // sample id (internal use)
101 	void* user_data;      // pointer supplied by the calling program
102 	union {
103 		int number;        // used for WORD and SENTENCE events.
104 		const char *name;  // used for MARK and PLAY events.  UTF8 string
105 		char string[8];    // used for phoneme names (UTF8). Terminated by a zero byte unless the name needs the full 8 bytes.
106 	} id;
107 } espeak_EVENT;
108 /*
109    When a message is supplied to espeak_synth, the request is buffered and espeak_synth returns. When the message is really processed, the callback function will be repetedly called.
110 
111 
112    In RETRIEVAL mode, the callback function supplies to the calling program the audio data and an event list terminated by 0 (LIST_TERMINATED).
113 
114    In PLAYBACK mode, the callback function is called as soon as an event happens.
115 
116    For example suppose that the following message is supplied to espeak_Synth:
117    "hello, hello."
118 
119 
120    * Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function :
121 
122    ** Block 1:
123    <audio data> +
124    List of events: SENTENCE + WORD + LIST_TERMINATED
125 
126    ** Block 2:
127    <audio data> +
128    List of events: WORD + END + LIST_TERMINATED
129 
130    ** Block 3:
131    no audio data
132    List of events: MSG_TERMINATED + LIST_TERMINATED
133 
134 
135    * Once processed in PLAYBACK mode, it could lead to 5 calls of the callback function:
136 
137    ** SENTENCE
138    ** WORD (call when the sounds are actually played)
139    ** WORD
140    ** END (call when the end of sentence is actually played.)
141    ** MSG_TERMINATED
142 
143 
144    The MSG_TERMINATED event is the last event. It can inform the calling program to clear the user data related to the message.
145    So if the synthesis must be stopped, the callback function is called for each pending message with the MSG_TERMINATED event.
146 
147    A MARK event indicates a <mark> element in the text.
148    A PLAY event indicates an <audio> element in the text, for which the calling program should play the named sound file.
149 */
150 
151 
152 
153 typedef enum {
154 	POS_CHARACTER = 1,
155 	POS_WORD,
156 	POS_SENTENCE
157 } espeak_POSITION_TYPE;
158 
159 
160 typedef enum {
161 	/* PLAYBACK mode: plays the audio data, supplies events to the calling program*/
162 	AUDIO_OUTPUT_PLAYBACK,
163 
164 	/* RETRIEVAL mode: supplies audio data and events to the calling program */
165 	AUDIO_OUTPUT_RETRIEVAL,
166 
167 	/* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */
168 	AUDIO_OUTPUT_SYNCHRONOUS,
169 
170 	/* Synchronous playback */
171 	AUDIO_OUTPUT_SYNCH_PLAYBACK
172 
173 } espeak_AUDIO_OUTPUT;
174 
175 
176 typedef enum {
177 	EE_OK=0,
178 	EE_INTERNAL_ERROR=-1,
179 	EE_BUFFER_FULL=1,
180 	EE_NOT_FOUND=2
181 } espeak_ERROR;
182 
183 #define espeakINITIALIZE_PHONEME_EVENTS 0x0001
184 #define espeakINITIALIZE_PHONEME_IPA   0x0002
185 #define espeakINITIALIZE_DONT_EXIT     0x8000
186 
187 #ifdef __cplusplus
188 extern "C"
189 #endif
190 ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options);
191 /* Must be called before any synthesis functions are called.
192    output: the audio data can either be played by eSpeak or passed back by the SynthCallback function.
193 
194    buflength:  The length in mS of sound buffers passed to the SynthCallback function.
195             Value=0 gives a default of 60mS.
196             This paramater is only used for AUDIO_OUTPUT_RETRIEVAL and AUDIO_OUTPUT_SYNCHRONOUS modes.
197 
198    path: The directory which contains the espeak-ng-data directory, or NULL for the default location.
199 
200    options: bit 0:  1=allow espeakEVENT_PHONEME events.
201             bit 1:  1= espeakEVENT_PHONEME events give IPA phoneme names, not eSpeak phoneme names
202             bit 15: 1=don't exit if espeak_data is not found (used for --help)
203 
204    Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR).
205 */
206 
207 typedef int (t_espeak_callback)(short*, int, espeak_EVENT*);
208 
209 #ifdef __cplusplus
210 extern "C"
211 #endif
212 ESPEAK_API void espeak_SetSynthCallback(t_espeak_callback* SynthCallback);
213 /* Must be called before any synthesis functions are called.
214    This specifies a function in the calling program which is called when a buffer of
215    speech sound data has been produced.
216 
217 
218    The callback function is of the form:
219 
220 int SynthCallback(short *wav, int numsamples, espeak_EVENT *events);
221 
222    wav:  is the speech sound data which has been produced.
223       NULL indicates that the synthesis has been completed.
224 
225    numsamples: is the number of entries in wav.  This number may vary, may be less than
226       the value implied by the buflength parameter given in espeak_Initialize, and may
227       sometimes be zero (which does NOT indicate end of synthesis).
228 
229    events: an array of espeak_EVENT items which indicate word and sentence events, and
230       also the occurance if <mark> and <audio> elements within the text.  The list of
231       events is terminated by an event of type = 0.
232 
233 
234    Callback returns: 0=continue synthesis,  1=abort synthesis.
235 */
236 
237 #ifdef __cplusplus
238 extern "C"
239 #endif
240 ESPEAK_API void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*));
241 /* This function may be called before synthesis functions are used, in order to deal with
242    <audio> tags.  It specifies a callback function which is called when an <audio> element is
243    encountered and allows the calling program to indicate whether the sound file which
244    is specified in the <audio> element is available and is to be played.
245 
246    The callback function is of the form:
247 
248 int UriCallback(int type, const char *uri, const char *base);
249 
250    type:  type of callback event.  Currently only 1= <audio> element
251 
252    uri:   the "src" attribute from the <audio> element
253 
254    base:  the "xml:base" attribute (if any) from the <speak> element
255 
256    Return: 1=don't play the sound, but speak the text alternative.
257            0=place a PLAY event in the event list at the point where the <audio> element
258              occurs.  The calling program can then play the sound at that point.
259 */
260 
261 #ifdef __cplusplus
262 extern "C"
263 #endif
264 ESPEAK_API void espeak_SetPhonemeCallback(int (*PhonemeCallback)(const char *));
265 
266 
267          /********************/
268          /*    Synthesis     */
269          /********************/
270 
271 
272 #define espeakCHARS_AUTO   0
273 #define espeakCHARS_UTF8   1
274 #define espeakCHARS_8BIT   2
275 #define espeakCHARS_WCHAR  3
276 #define espeakCHARS_16BIT  4
277 
278 #define espeakSSML        0x10
279 #define espeakPHONEMES    0x100
280 #define espeakENDPAUSE    0x1000
281 #define espeakKEEP_NAMEDATA 0x2000
282 
283 #ifdef __cplusplus
284 extern "C"
285 #endif
286 ESPEAK_API espeak_ERROR espeak_Synth(const void *text,
287 	size_t size,
288 	unsigned int position,
289 	espeak_POSITION_TYPE position_type,
290 	unsigned int end_position,
291 	unsigned int flags,
292 	unsigned int* unique_identifier,
293 	void* user_data);
294 /* Synthesize speech for the specified text.  The speech sound data is passed to the calling
295    program in buffers by means of the callback function specified by espeak_SetSynthCallback(). The command is asynchronous: it is internally buffered and returns as soon as possible. If espeak_Initialize was previously called with AUDIO_OUTPUT_PLAYBACK as argument, the sound data are played by eSpeak.
296 
297    text: The text to be spoken, terminated by a zero character. It may be either 8-bit characters,
298       wide characters (wchar_t), or UTF8 encoding.  Which of these is determined by the "flags"
299       parameter.
300 
301    size: Equal to (or greatrer than) the size of the text data, in bytes.  This is used in order
302       to allocate internal storage space for the text.  This value is not used for
303       AUDIO_OUTPUT_SYNCHRONOUS mode.
304 
305    position:  The position in the text where speaking starts. Zero indicates speak from the
306       start of the text.
307 
308    position_type:  Determines whether "position" is a number of characters, words, or sentences.
309       Values:
310 
311    end_position:  If set, this gives a character position at which speaking will stop.  A value
312       of zero indicates no end position.
313 
314    flags:  These may be OR'd together:
315       Type of character codes, one of:
316          espeakCHARS_UTF8     UTF8 encoding
317          espeakCHARS_8BIT     The 8 bit ISO-8859 character set for the particular language.
318          espeakCHARS_AUTO     8 bit or UTF8  (this is the default)
319          espeakCHARS_WCHAR    Wide characters (wchar_t)
320          espeakCHARS_16BIT    16 bit characters.
321 
322       espeakSSML   Elements within < > are treated as SSML elements, or if not recognised are ignored.
323 
324       espeakPHONEMES  Text within [[ ]] is treated as phonemes codes (in espeak's Hirshenbaum encoding).
325 
326       espeakENDPAUSE  If set then a sentence pause is added at the end of the text.  If not set then
327          this pause is suppressed.
328 
329    unique_identifier: This must be either NULL, or point to an integer variable to
330        which eSpeak writes a message identifier number.
331        eSpeak includes this number in espeak_EVENT messages which are the result of
332        this call of espeak_Synth().
333 
334    user_data: a pointer (or NULL) which will be passed to the callback function in
335        espeak_EVENT messages.
336 
337    Return: EE_OK: operation achieved
338            EE_BUFFER_FULL: the command can not be buffered;
339              you may try after a while to call the function again.
340 	   EE_INTERNAL_ERROR.
341 */
342 
343 #ifdef __cplusplus
344 extern "C"
345 #endif
346 ESPEAK_API espeak_ERROR espeak_Synth_Mark(const void *text,
347 	size_t size,
348 	const char *index_mark,
349 	unsigned int end_position,
350 	unsigned int flags,
351 	unsigned int* unique_identifier,
352 	void* user_data);
353 /* Synthesize speech for the specified text.  Similar to espeak_Synth() but the start position is
354    specified by the name of a <mark> element in the text.
355 
356    index_mark:  The "name" attribute of a <mark> element within the text which specified the
357       point at which synthesis starts.  UTF8 string.
358 
359    For the other parameters, see espeak_Synth()
360 
361    Return: EE_OK: operation achieved
362            EE_BUFFER_FULL: the command can not be buffered;
363              you may try after a while to call the function again.
364 	   EE_INTERNAL_ERROR.
365 */
366 
367 #ifdef __cplusplus
368 extern "C"
369 #endif
370 ESPEAK_API espeak_ERROR espeak_Key(const char *key_name);
371 /* Speak the name of a keyboard key.
372    If key_name is a single character, it speaks the name of the character.
373    Otherwise, it speaks key_name as a text string.
374 
375    Return: EE_OK: operation achieved
376            EE_BUFFER_FULL: the command can not be buffered;
377              you may try after a while to call the function again.
378 	   EE_INTERNAL_ERROR.
379 */
380 
381 #ifdef __cplusplus
382 extern "C"
383 #endif
384 ESPEAK_API espeak_ERROR espeak_Char(wchar_t character);
385 /* Speak the name of the given character
386 
387    Return: EE_OK: operation achieved
388            EE_BUFFER_FULL: the command can not be buffered;
389              you may try after a while to call the function again.
390 	   EE_INTERNAL_ERROR.
391 */
392 
393 
394 
395 
396          /***********************/
397          /*  Speech Parameters  */
398          /***********************/
399 
400 typedef enum {
401   espeakSILENCE=0, /* internal use */
402   espeakRATE=1,
403   espeakVOLUME=2,
404   espeakPITCH=3,
405   espeakRANGE=4,
406   espeakPUNCTUATION=5,
407   espeakCAPITALS=6,
408   espeakWORDGAP=7,
409   espeakOPTIONS=8,   // reserved for misc. options.  not yet used
410   espeakINTONATION=9,
411 
412   espeakRESERVED1=10,
413   espeakRESERVED2=11,
414   espeakEMPHASIS,   /* internal use */
415   espeakLINELENGTH, /* internal use */
416   espeakVOICETYPE,  // internal, 1=mbrola
417   N_SPEECH_PARAM    /* last enum */
418 } espeak_PARAMETER;
419 
420 typedef enum {
421   espeakPUNCT_NONE=0,
422   espeakPUNCT_ALL=1,
423   espeakPUNCT_SOME=2
424 } espeak_PUNCT_TYPE;
425 
426 #ifdef __cplusplus
427 extern "C"
428 #endif
429 ESPEAK_API espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
430 /* Sets the value of the specified parameter.
431    relative=0   Sets the absolute value of the parameter.
432    relative=1   Sets a relative value of the parameter.
433 
434    parameter:
435       espeakRATE:    speaking speed in word per minute.  Values 80 to 450.
436 
437       espeakVOLUME:  volume in range 0-200 or more.
438                      0=silence, 100=normal full volume, greater values may produce amplitude compression or distortion
439 
440       espeakPITCH:   base pitch, range 0-100.  50=normal
441 
442       espeakRANGE:   pitch range, range 0-100. 0-monotone, 50=normal
443 
444       espeakPUNCTUATION:  which punctuation characters to announce:
445          value in espeak_PUNCT_TYPE (none, all, some),
446          see espeak_GetParameter() to specify which characters are announced.
447 
448       espeakCAPITALS: announce capital letters by:
449          0=none,
450          1=sound icon,
451          2=spelling,
452          3 or higher, by raising pitch.  This values gives the amount in Hz by which the pitch
453             of a word raised to indicate it has a capital letter.
454 
455       espeakWORDGAP:  pause between words, units of 10mS (at the default speed)
456 
457    Return: EE_OK: operation achieved
458            EE_BUFFER_FULL: the command can not be buffered;
459              you may try after a while to call the function again.
460 	   EE_INTERNAL_ERROR.
461 */
462 
463 #ifdef __cplusplus
464 extern "C"
465 #endif
466 ESPEAK_API int espeak_GetParameter(espeak_PARAMETER parameter, int current);
467 /* current=0  Returns the default value of the specified parameter.
468    current=1  Returns the current value of the specified parameter, as set by SetParameter()
469 */
470 
471 #ifdef __cplusplus
472 extern "C"
473 #endif
474 ESPEAK_API espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist);
475 /* Specified a list of punctuation characters whose names are to be spoken when the
476    value of the Punctuation parameter is set to "some".
477 
478    punctlist:  A list of character codes, terminated by a zero character.
479 
480    Return: EE_OK: operation achieved
481            EE_BUFFER_FULL: the command can not be buffered;
482              you may try after a while to call the function again.
483 	   EE_INTERNAL_ERROR.
484 */
485 
486 #define espeakPHONEMES_SHOW    0x01
487 #define espeakPHONEMES_IPA     0x02
488 #define espeakPHONEMES_TRACE   0x08
489 #define espeakPHONEMES_MBROLA  0x10
490 #define espeakPHONEMES_TIE     0x80
491 
492 #ifdef __cplusplus
493 extern "C"
494 #endif
495 ESPEAK_API void espeak_SetPhonemeTrace(int phonememode, FILE *stream);
496 /* phonememode:  Controls the output of phoneme symbols for the text
497       bits 0-2:
498          value=0  No phoneme output (default)
499          value=1  Output the translated phoneme symbols for the text
500          value=2  as (1), but produces IPA phoneme names rather than ascii
501       bit 3:   output a trace of how the translation was done (showing the matching rules and list entries)
502       bit 4:   produce pho data for mbrola
503       bit 7:   use (bits 8-23) as a tie within multi-letter phonemes names
504       bits 8-23:  separator character, between phoneme names
505 
506    stream   output stream for the phoneme symbols (and trace).  If stream=NULL then it uses stdout.
507 */
508 
509 #ifdef __cplusplus
510 extern "C"
511 #endif
512 ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode);
513 /* Translates text into phonemes.  Call espeak_SetVoiceByName() first, to select a language.
514 
515    It returns a pointer to a character string which contains the phonemes for the text up to
516    end of a sentence, or comma, semicolon, colon, or similar punctuation.
517 
518    textptr: The address of a pointer to the input text which is terminated by a zero character.
519       On return, the pointer has been advanced past the text which has been translated, or else set
520       to NULL to indicate that the end of the text has been reached.
521 
522    textmode: Type of character codes, one of:
523          espeakCHARS_UTF8     UTF8 encoding
524          espeakCHARS_8BIT     The 8 bit ISO-8859 character set for the particular language.
525          espeakCHARS_AUTO     8 bit or UTF8  (this is the default)
526          espeakCHARS_WCHAR    Wide characters (wchar_t)
527          espeakCHARS_16BIT    16 bit characters.
528 
529    phoneme_mode
530 	    bit 1:   0=eSpeak's ascii phoneme names, 1= International Phonetic Alphabet (as UTF-8 characters).
531         bit 7:   use (bits 8-23) as a tie within multi-letter phonemes names
532         bits 8-23:  separator character, between phoneme names
533 
534 */
535 
536 #ifdef __cplusplus
537 extern "C"
538 #endif
539 ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
540 /* Compile pronunciation dictionary for a language which corresponds to the currently
541    selected voice.  The required voice should be selected before calling this function.
542 
543    path:  The directory which contains the language's '_rules' and '_list' files.
544           'path' should end with a path separator character ('/').
545    log:   Stream for error reports and statistics information. If log=NULL then stderr will be used.
546 
547    flags:  Bit 0: include source line information for debug purposes (This is displayed with the
548           -X command line option).
549 */
550          /***********************/
551          /*   Voice Selection   */
552          /***********************/
553 
554 
555 // voice table
556 typedef struct {
557 	const char *name;      // a given name for this voice. UTF8 string.
558 	const char *languages;       // list of pairs of (byte) priority + (string) language (and dialect qualifier)
559 	const char *identifier;      // the filename for this voice within espeak-ng-data/voices
560 	unsigned char gender;  // 0=none 1=male, 2=female,
561 	unsigned char age;     // 0=not specified, or age in years
562 	unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties
563 	unsigned char xx1;     // for internal use
564 	int score;       // for internal use
565 	void *spare;     // for internal use
566 } espeak_VOICE;
567 
568 /* Note: The espeak_VOICE structure is used for two purposes:
569   1.  To return the details of the available voices.
570   2.  As a parameter to  espeak_SetVoiceByProperties() in order to specify selection criteria.
571 
572    In (1), the "languages" field consists of a list of (UTF8) language names for which this voice
573    may be used, each language name in the list is terminated by a zero byte and is also preceded by
574    a single byte which gives a "priority" number.  The list of languages is terminated by an
575    additional zero byte.
576 
577    A language name consists of a language code, optionally followed by one or more qualifier (dialect)
578    names separated by hyphens (eg. "en-uk").  A voice might, for example, have languages "en-uk" and
579    "en".  Even without "en" listed, voice would still be selected for the "en" language (because
580    "en-uk" is related) but at a lower priority.
581 
582    The priority byte indicates how the voice is preferred for the language. A low number indicates a
583    more preferred voice, a higher number indicates a less preferred voice.
584 
585    In (2), the "languages" field consists simply of a single (UTF8) language name, with no preceding
586    priority byte.
587 */
588 
589 #ifdef __cplusplus
590 extern "C"
591 #endif
592 ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec);
593 /* Reads the voice files from espeak-ng-data/voices and creates an array of espeak_VOICE pointers.
594    The list is terminated by a NULL pointer
595 
596    If voice_spec is NULL then all voices are listed.
597    If voice spec is given, then only the voices which are compatible with the voice_spec
598    are listed, and they are listed in preference order.
599 */
600 
601 #ifdef __cplusplus
602 extern "C"
603 #endif
604 ESPEAK_API espeak_ERROR espeak_SetVoiceByName(const char *name);
605 /* Searches for a voice with a matching "name" field.  Language is not considered.
606    "name" is a UTF8 string.
607 
608    Return: EE_OK: operation achieved
609            EE_BUFFER_FULL: the command can not be buffered;
610              you may try after a while to call the function again.
611 	   EE_INTERNAL_ERROR.
612 */
613 
614 #ifdef __cplusplus
615 extern "C"
616 #endif
617 ESPEAK_API espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec);
618 /* An espeak_VOICE structure is used to pass criteria to select a voice.  Any of the following
619    fields may be set:
620 
621    name     NULL, or a voice name
622 
623    languages  NULL, or a single language string (with optional dialect), eg. "en-uk", or "en"
624 
625    gender   0=not specified, 1=male, 2=female
626 
627    age      0=not specified, or an age in years
628 
629    variant  After a list of candidates is produced, scored and sorted, "variant" is used to index
630             that list and choose a voice.
631             variant=0 takes the top voice (i.e. best match). variant=1 takes the next voice, etc
632 */
633 
634 #ifdef __cplusplus
635 extern "C"
636 #endif
637 ESPEAK_API espeak_VOICE *espeak_GetCurrentVoice(void);
638 /* Returns the espeak_VOICE data for the currently selected voice.
639    This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s>
640 */
641 
642 #ifdef __cplusplus
643 extern "C"
644 #endif
645 ESPEAK_API espeak_ERROR espeak_Cancel(void);
646 /* Stop immediately synthesis and audio output of the current text. When this
647    function returns, the audio output is fully stopped and the synthesizer is ready to
648    synthesize a new message.
649 
650    Return: EE_OK: operation achieved
651 	   EE_INTERNAL_ERROR.
652 */
653 
654 
655 #ifdef __cplusplus
656 extern "C"
657 #endif
658 ESPEAK_API int espeak_IsPlaying(void);
659 /* Returns 1 if audio is played, 0 otherwise.
660 */
661 
662 #ifdef __cplusplus
663 extern "C"
664 #endif
665 ESPEAK_API espeak_ERROR espeak_Synchronize(void);
666 /* This function returns when all data have been spoken.
667    Return: EE_OK: operation achieved
668 	   EE_INTERNAL_ERROR.
669 */
670 
671 #ifdef __cplusplus
672 extern "C"
673 #endif
674 ESPEAK_API espeak_ERROR espeak_Terminate(void);
675 /* last function to be called.
676    Return: EE_OK: operation achieved
677 	   EE_INTERNAL_ERROR.
678 */
679 
680 
681 #ifdef __cplusplus
682 extern "C"
683 #endif
684 ESPEAK_API const char *espeak_Info(const char **path_data);
685 /* Returns the version number string.
686    path_data  returns the path to espeak_data
687 */
688 #endif
689