| 1 | /* SSML (Speech Synthesis Markup Language) processing APIs. |
| 2 | * |
| 3 | * Copyright (C) 2005 to 2015 by Jonathan Duddington |
| 4 | * email: [email protected] |
| 5 | * Copyright (C) 2015-2018 Reece H. Dunn |
| 6 | * Copyright (C) 2018 Juho Hiltunen |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 3 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, see: <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | #ifndef ESPEAK_NG_SSML_API |
| 22 | #define ESPEAK_NG_SSML_API |
| 23 | |
| 24 | #include <stdbool.h> |
| 25 | #include <wchar.h> |
| 26 | |
| 27 | #include "speak_lib.h" |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" |
| 31 | { |
| 32 | #endif |
| 33 | |
| 34 | // stack for language and voice properties |
| 35 | // frame 0 is for the defaults, before any ssml tags. |
| 36 | typedef struct { |
| 37 | int tag_type; |
| 38 | int voice_variant_number; |
| 39 | int voice_gender; |
| 40 | int voice_age; |
| 41 | char voice_name[40]; |
| 42 | char language[20]; |
| 43 | } SSML_STACK; |
| 44 | |
| 45 | #define N_PARAM_STACK 20 |
| 46 | |
| 47 | #define SSML_SPEAK 1 |
| 48 | #define SSML_VOICE 2 |
| 49 | #define SSML_PROSODY 3 |
| 50 | #define SSML_SAYAS 4 |
| 51 | #define SSML_MARK 5 |
| 52 | #define SSML_SENTENCE 6 |
| 53 | #define SSML_PARAGRAPH 7 |
| 54 | #define SSML_PHONEME 8 |
| 55 | #define SSML_SUB 9 |
| 56 | #define SSML_STYLE 10 |
| 57 | #define SSML_AUDIO 11 |
| 58 | #define SSML_EMPHASIS 12 |
| 59 | #define SSML_BREAK 13 |
| 60 | #define SSML_IGNORE_TEXT 14 |
| 61 | #define HTML_BREAK 15 |
| 62 | #define HTML_NOSPACE 16 // don't insert a space for this element, so it doesn't break a word |
| 63 | #define SSML_CLOSE 0x20 // for a closing tag, OR this with the tag type |
| 64 | |
| 65 | int ProcessSsmlTag(wchar_t *xml_buf, |
| 66 | char *outbuf, |
| 67 | int *outix, |
| 68 | int n_outbuf, |
| 69 | const char *xmlbase, |
| 70 | bool *audio_text, |
| 71 | char *current_voice_id, |
| 72 | espeak_VOICE *base_voice, |
| 73 | char *base_voice_variant_name, |
| 74 | bool *ignore_text, |
| 75 | bool *clear_skipping_text, |
| 76 | int *sayas_mode, |
| 77 | int *sayas_start, |
| 78 | SSML_STACK *ssml_stack, |
| 79 | int *n_ssml_stack, |
| 80 | int *n_param_stack, |
| 81 | int *speech_parameters); |
| 82 | |
| 83 | int ParseSsmlReference(char *ref, |
| 84 | int *c1, |
| 85 | int *c2); |
| 86 | |
| 87 | #ifdef __cplusplus |
| 88 | } |
| 89 | #endif |
| 90 | |
| 91 | #endif |