From 9826e9cc306a5b96e4abde75168d9981cf5bd342 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sat, 28 Nov 2015 13:57:56 +0000 Subject: [PATCH] Initial support for SSML phoneme tags. --- src/readclause.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/readclause.cpp b/src/readclause.cpp index 585a3bb2..c6816895 100644 --- a/src/readclause.cpp +++ b/src/readclause.cpp @@ -1,6 +1,7 @@ /*************************************************************************** * Copyright (C) 2005 to 2015 by Jonathan Duddington * * email: jonsd@users.sourceforge.net * + * Copyright (C) 2015 by Reece H. Dunn * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -1789,6 +1790,10 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb PARAM_STACK *sp; SSML_STACK *ssml_sp; + static const MNEM_TAB mnem_phoneme_alphabet[] = { + {"espeak",1}, + {NULL, -1}}; + static const MNEM_TAB mnem_punct[] = { {"none", 1}, {"all", 2}, @@ -1938,6 +1943,20 @@ static int ProcessSsmlTag(wchar_t *xml_buf, char *outbuf, int *outix, int n_outb PopParamStack(tag_type, outbuf, outix); break; + case SSML_PHONEME: + attr1 = GetSsmlAttribute(px,"alphabet"); + attr2 = GetSsmlAttribute(px,"ph"); + value = attrlookup(attr1,mnem_phoneme_alphabet); + if (value == 1) // alphabet="espeak" + { + outbuf[(*outix)++] = '['; + outbuf[(*outix)++] = '['; + *outix += attrcopy_utf8(&outbuf[*outix],attr2,n_outbuf-*outix); + outbuf[(*outix)++] = ']'; + outbuf[(*outix)++] = ']'; + } + break; + case SSML_SAYAS: attr1 = GetSsmlAttribute(px,"interpret-as"); attr2 = GetSsmlAttribute(px,"format");