Make LoadPhData return an espeak_ng_STATUS code.

This commit is contained in:
Reece H. Dunn
2016-01-01 13:17:11 +00:00
parent 2e88afeaa0
commit c2811d074e
19 changed files with 70 additions and 38 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2005 to 2013 by Jonathan Duddington
* email: jonsd@users.sourceforge.net
* Copyright (C) 2015 Reece H. Dunn
* Copyright (C) 2015-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
@@ -46,8 +46,8 @@
#include <locale.h>
#include <sys/stat.h>
#include "speak_lib.h"
#include "espeak_ng.h"
#include "speak_lib.h"
#include "phoneme.h"
#include "synthesize.h"
@@ -343,7 +343,6 @@ static void init_path(char *argv0, char *path_specified)
static int initialise(void)
{
int param;
int result;
int srate = 22050; // default sample rate
// It seems that the wctype functions don't work until the locale has been set
@@ -354,12 +353,13 @@ static int initialise(void)
setlocale(LC_CTYPE, "");
}
if ((result = LoadPhData(&srate)) != 1) {
if (result == -1) {
espeak_ng_STATUS result = LoadPhData(&srate);
if (result != ENS_OK) {
if (result == ENE_READ_ERROR) {
fprintf(stderr, "Failed to load espeak-data\n");
exit(1);
} else
fprintf(stderr, "Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n", result, version_phdata, path_home);
fprintf(stderr, "Wrong version of espeak-data (expected 0x%x) at %s\n", version_phdata, path_home);
}
WavegenInit(srate, 0);
LoadConfig();