diff --git a/Makefile.am b/Makefile.am
index 89bc9675..0bea26d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,6 +99,7 @@ src_libespeak_ng_la_SOURCES = \
src/libespeak-ng/compiledict.c \
src/libespeak-ng/compilembrola.c \
src/libespeak-ng/dictionary.c \
+ src/libespeak-ng/error.c \
src/libespeak-ng/espeak_api.c \
src/libespeak-ng/ieee80.c \
src/libespeak-ng/intonation.c \
diff --git a/src/libespeak-ng/error.c b/src/libespeak-ng/error.c
new file mode 100644
index 00000000..37e6950b
--- /dev/null
+++ b/src/libespeak-ng/error.c
@@ -0,0 +1,101 @@
+/* Error handling APIs.
+ *
+ * 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: .
+ */
+
+#include "config.h"
+
+#include
+#include
+#if HAVE_STDINT_H
+#include
+#endif
+#include
+
+#include "espeak_ng.h"
+
+#include "speech.h"
+#include "phoneme.h"
+#include "synthesize.h"
+
+#pragma GCC visibility push(default)
+
+ESPEAK_NG_API void espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status, char *buffer, size_t length)
+{
+ switch (status)
+ {
+ case ENS_COMPILE_ERROR:
+ strncpy0(buffer, "Compile error.", length);
+ break;
+ case ENS_VERSION_MISMATCH:
+#ifdef PLATFORM_WINDOWS
+ sprintf(buffer, "Wrong version of espeak-data (expected 0x%x) at '%s'.", version_phdata, path_home);
+#else
+ snprintf(buffer, length, "Wrong version of espeak-data (expected 0x%x) at '%s'.", version_phdata, path_home);
+#endif
+ break;
+ case ENS_FIFO_BUFFER_FULL:
+ strncpy0(buffer, "The FIFO buffer is full.", length);
+ break;
+ case ENS_NOT_INITIALIZED:
+ strncpy0(buffer, "The espeak-ng library has not been initialized.", length);
+ break;
+ case ENS_AUDIO_ERROR:
+ strncpy0(buffer, "Cannot initialize the audio device.", length);
+ break;
+ case ENS_VOICE_NOT_FOUND:
+ strncpy0(buffer, "The specified espeak-ng voice does not exist.", length);
+ break;
+ case ENS_MBROLA_NOT_FOUND:
+ strncpy0(buffer, "Could not load the mbrola.dll file.", length);
+ break;
+ case ENS_MBROLA_VOICE_NOT_FOUND:
+ strncpy0(buffer, "Could not load the specified mbrola voice file.", length);
+ break;
+ case ENS_EVENT_BUFFER_FULL:
+ strncpy0(buffer, "The event buffer is full.", length);
+ break;
+ case ENS_NOT_SUPPORTED:
+ strncpy0(buffer, "The requested functionality has not been built into espeak-ng.", length);
+ break;
+ case ENS_UNSUPPORTED_PHON_FORMAT:
+ strncpy0(buffer, "The phoneme file is not in a supported format.", length);
+ break;
+ case ENS_NO_SPECT_FRAMES:
+ strncpy0(buffer, "The spectral file does not contain any frame data.", length);
+ break;
+ default:
+ if ((status & ENS_GROUP_MASK) == ENS_GROUP_ERRNO)
+ strerror_r(status, buffer, length);
+ else {
+#ifdef PLATFORM_WINDOWS
+ sprintf(buffer, "Unspecified error 0x%x.", status);
+#else
+ snprintf(buffer, length, "Unspecified error 0x%x.", status);
+#endif
+ }
+ break;
+ }
+}
+
+ESPEAK_NG_API void espeak_ng_PrintStatusCodeMessage(espeak_ng_STATUS status, FILE *out)
+{
+ char error[512];
+ espeak_ng_GetStatusCodeMessage(status, error, sizeof(error));
+ fprintf(out, "%s\n", error);
+}
+
+#pragma GCC visibility pop
diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c
index 8bcc51e6..1d5ddaf9 100644
--- a/src/libespeak-ng/speech.c
+++ b/src/libespeak-ng/speech.c
@@ -366,71 +366,6 @@ ESPEAK_NG_API int espeak_ng_GetSampleRate(void)
return samplerate;
}
-ESPEAK_NG_API void espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status, char *buffer, size_t length)
-{
- switch (status)
- {
- case ENS_COMPILE_ERROR:
- strncpy0(buffer, "Compile error.", length);
- break;
- case ENS_VERSION_MISMATCH:
-#ifdef PLATFORM_WINDOWS
- sprintf(buffer, "Wrong version of espeak-data (expected 0x%x) at '%s'.", version_phdata, path_home);
-#else
- snprintf(buffer, length, "Wrong version of espeak-data (expected 0x%x) at '%s'.", version_phdata, path_home);
-#endif
- break;
- case ENS_FIFO_BUFFER_FULL:
- strncpy0(buffer, "The FIFO buffer is full.", length);
- break;
- case ENS_NOT_INITIALIZED:
- strncpy0(buffer, "The espeak-ng library has not been initialized.", length);
- break;
- case ENS_AUDIO_ERROR:
- strncpy0(buffer, "Cannot initialize the audio device.", length);
- break;
- case ENS_VOICE_NOT_FOUND:
- strncpy0(buffer, "The specified espeak-ng voice does not exist.", length);
- break;
- case ENS_MBROLA_NOT_FOUND:
- strncpy0(buffer, "Could not load the mbrola.dll file.", length);
- break;
- case ENS_MBROLA_VOICE_NOT_FOUND:
- strncpy0(buffer, "Could not load the specified mbrola voice file.", length);
- break;
- case ENS_EVENT_BUFFER_FULL:
- strncpy0(buffer, "The event buffer is full.", length);
- break;
- case ENS_NOT_SUPPORTED:
- strncpy0(buffer, "The requested functionality has not been built into espeak-ng.", length);
- break;
- case ENS_UNSUPPORTED_PHON_FORMAT:
- strncpy0(buffer, "The phoneme file is not in a supported format.", length);
- break;
- case ENS_NO_SPECT_FRAMES:
- strncpy0(buffer, "The spectral file does not contain any frame data.", length);
- break;
- default:
- if ((status & ENS_GROUP_MASK) == ENS_GROUP_ERRNO)
- strerror_r(status, buffer, length);
- else {
-#ifdef PLATFORM_WINDOWS
- sprintf(buffer, "Unspecified error 0x%x.", status);
-#else
- snprintf(buffer, length, "Unspecified error 0x%x.", status);
-#endif
- }
- break;
- }
-}
-
-ESPEAK_NG_API void espeak_ng_PrintStatusCodeMessage(espeak_ng_STATUS status, FILE *out)
-{
- char error[512];
- espeak_ng_GetStatusCodeMessage(status, error, sizeof(error));
- fprintf(out, "%s\n", error);
-}
-
#pragma GCC visibility pop
static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *text, int flags)