Create an espeak_ng_EncodingFromName API.

This commit is contained in:
Reece H. Dunn
2017-03-27 20:59:37 +01:00
parent e12abb4244
commit b47363b7d3
5 changed files with 120 additions and 1 deletions
+10
View File
@@ -183,6 +183,16 @@ espeak_ng_CompilePhonemeDataPath(long rate,
FILE *log,
espeak_ng_ERROR_CONTEXT *context);
/* eSpeak NG 1.49.2 */
typedef enum
{
ESPEAKNG_ENCODING_UNKNOWN,
} espeak_ng_ENCODING;
ESPEAK_NG_API espeak_ng_ENCODING
espeak_ng_EncodingFromName(const char *encoding);
#ifdef __cplusplus
}
#endif
+50
View File
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2017 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see: <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <espeak-ng/espeak_ng.h>
#include "speech.h"
static int
LookupMnemValue(MNEM_TAB *table,
const char *string)
{
while (table->mnem != NULL) {
if (strcmp(string, table->mnem) == 0)
return table->value;
table++;
}
return table->value;
}
MNEM_TAB mnem_encoding[] = {
{ NULL, ESPEAKNG_ENCODING_UNKNOWN }
};
#pragma GCC visibility push(default)
espeak_ng_ENCODING
espeak_ng_EncodingFromName(const char *encoding)
{
return LookupMnemValue(mnem_encoding, encoding);
}
#pragma GCC visibility pop