@@ -141,6 +141,7 @@ src_libespeak_ng_la_SOURCES = \ | |||
src/libespeak-ng/intonation.c \ | |||
src/libespeak-ng/numbers.c \ | |||
src/libespeak-ng/readclause.c \ | |||
src/libespeak-ng/phoneme.c \ | |||
src/libespeak-ng/phonemelist.c \ | |||
src/libespeak-ng/setlengths.c \ | |||
src/libespeak-ng/spect.c \ |
@@ -41,6 +41,7 @@ typedef enum { | |||
ENS_GROUP_ERRNO = 0x00000000, /* Values 0-255 map to errno error codes. */ | |||
ENS_GROUP_ESPEAK_NG = 0x10000000, /* eSpeak NG error codes. */ | |||
/* eSpeak NG 1.49.0 */ | |||
ENS_OK = 0, | |||
ENS_COMPILE_ERROR = 0x100001FF, | |||
ENS_VERSION_MISMATCH = 0x100002FF, | |||
@@ -56,6 +57,9 @@ typedef enum { | |||
ENS_NO_SPECT_FRAMES = 0x10000CFF, | |||
ENS_EMPTY_PHONEME_MANIFEST = 0x10000DFF, | |||
ENS_SPEECH_STOPPED = 0x10000EFF, | |||
/* eSpeak NG 1.49.2 */ | |||
ENS_UNKNOWN_PHONEME_FEATURE = 0x10000FFF, | |||
} espeak_ng_STATUS; | |||
typedef enum { |
@@ -2054,6 +2054,9 @@ int CompilePhoneme(int compile_phoneme) | |||
continue; | |||
} | |||
if (phoneme_add_feature(phoneme_out, item_string, NULL) == ENS_OK) | |||
continue; | |||
switch (item_type) | |||
{ | |||
case tPHONEME_TYPE: |
@@ -121,6 +121,9 @@ ESPEAK_NG_API void espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status, char | |||
case ENS_EMPTY_PHONEME_MANIFEST: | |||
strncpy0(buffer, "The phoneme manifest file does not contain any phonemes", length); | |||
break; | |||
case ENS_UNKNOWN_PHONEME_FEATURE: | |||
strncpy0(buffer, "The phoneme feature is not recognised", length); | |||
break; | |||
default: | |||
if ((status & ENS_GROUP_MASK) == ENS_GROUP_ERRNO) | |||
strerror_r(status, buffer, length); |
@@ -0,0 +1,50 @@ | |||
/* | |||
* Copyright (C) 2016 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 <errno.h> | |||
#include <espeak-ng/espeak_ng.h> | |||
#include <espeak-ng/speak_lib.h> | |||
#include "phoneme.h" | |||
#include "speech.h" | |||
#include "error.h" | |||
enum feature_t { | |||
inv, // invalid phoneme feature name | |||
}; | |||
static MNEM_TAB features[] = { | |||
{ NULL, inv }, | |||
}; | |||
espeak_ng_STATUS | |||
phoneme_add_feature(PHONEME_TAB *phoneme, | |||
const char *feature, | |||
espeak_ng_ERROR_CONTEXT *context) | |||
{ | |||
if (!phoneme || !feature) return -EINVAL; | |||
switch (LookupMnem(features, feature)) | |||
{ | |||
default: | |||
return ENS_UNKNOWN_PHONEME_FEATURE; | |||
} | |||
return ENS_OK; | |||
} |
@@ -113,6 +113,11 @@ typedef struct { | |||
unsigned char length_mod; // a length_mod group number, used to access length_mod_tab | |||
} PHONEME_TAB; | |||
espeak_ng_STATUS | |||
phoneme_add_feature(PHONEME_TAB *phoneme, | |||
const char *feature, | |||
espeak_ng_ERROR_CONTEXT *context); | |||
// Several phoneme tables may be loaded into memory. phoneme_tab points to | |||
// one for the current voice | |||
extern int n_phoneme_tab; |