| @@ -1,6 +1,6 @@ | |||
| /* eSpeak NG API. | |||
| * | |||
| * 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 | |||
| @@ -41,6 +41,7 @@ typedef enum { | |||
| ENE_WRITE_ERROR = -2, | |||
| ENE_OUT_OF_MEMORY = -3, | |||
| ENE_COMPILE_ERRORS = -4, | |||
| ENE_VERSION_MISMATCH = -5, | |||
| } espeak_ng_STATUS; | |||
| #define espeakINITIALIZE_PATH_ONLY 0x4000 | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2014 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * Copyright (C) 2013-2015 Reece H. Dunn | |||
| * Copyright (C) 2013-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 | |||
| @@ -30,7 +30,9 @@ | |||
| #include <wctype.h> | |||
| #include <wchar.h> | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2007 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -27,7 +27,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2008 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * Copyright (C) 2013-2015 Reece H. Dunn | |||
| * Copyright (C) 2013-2016 Reece H. Dunn | |||
| * | |||
| * Based on a re-implementation by: | |||
| * (c) 1993,94 Jon Iles and Nick Ing-Simmons | |||
| @@ -33,7 +33,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "klatt.h" | |||
| #include "phoneme.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2015 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -31,7 +31,9 @@ | |||
| #include <wctype.h> | |||
| #include <wchar.h> | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2014 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -26,7 +26,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2015 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -30,7 +30,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2011 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -26,7 +26,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2013 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * Copyright (C) 2013-2015 Reece H. Dunn | |||
| * Copyright (C) 2013-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 | |||
| @@ -40,8 +40,9 @@ | |||
| #include <unistd.h> | |||
| #endif | |||
| #include "speak_lib.h" | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| #include "voice.h" | |||
| @@ -308,19 +309,19 @@ static void init_path(const char *path) | |||
| static int initialise(int control) | |||
| { | |||
| int param; | |||
| int result; | |||
| int srate = 22050; // default sample rate 22050 Hz | |||
| err = EE_OK; | |||
| LoadConfig(); | |||
| if ((result = LoadPhData(&srate)) != 1) { // reads sample rate from espeak-data/phontab | |||
| 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"); | |||
| if ((control & espeakINITIALIZE_DONT_EXIT) == 0) | |||
| 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); | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2007 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * Copyright (C) 2013-2015 Reece H. Dunn | |||
| * Copyright (C) 2013-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 | |||
| @@ -19,11 +19,14 @@ | |||
| #include "config.h" | |||
| #include <stdio.h> | |||
| #if HAVE_STDINT_H | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2013 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -29,7 +29,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2014 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -29,7 +29,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -105,25 +107,24 @@ static char *ReadPhFile(void *ptr, const char *fname, int *size) | |||
| return p; | |||
| } | |||
| int LoadPhData(int *srate) | |||
| espeak_ng_STATUS LoadPhData(int *srate) | |||
| { | |||
| int ix; | |||
| int n_phonemes; | |||
| int version; | |||
| int result = 1; | |||
| int length; | |||
| int rate; | |||
| unsigned char *p; | |||
| int *pw; | |||
| if ((phoneme_tab_data = (unsigned char *)ReadPhFile((void *)(phoneme_tab_data), "phontab", NULL)) == NULL) | |||
| return -1; | |||
| return ENE_READ_ERROR; | |||
| if ((phoneme_index = (USHORT *)ReadPhFile((void *)(phoneme_index), "phonindex", NULL)) == NULL) | |||
| return -1; | |||
| return ENE_READ_ERROR; | |||
| if ((phondata_ptr = ReadPhFile((void *)(phondata_ptr), "phondata", NULL)) == NULL) | |||
| return -1; | |||
| return ENE_READ_ERROR; | |||
| if ((tunes = (TUNE *)ReadPhFile((void *)(tunes), "intonations", &length)) == NULL) | |||
| return -1; | |||
| return ENE_READ_ERROR; | |||
| wavefile_data = (unsigned char *)phondata_ptr; | |||
| n_tunes = length / sizeof(TUNE); | |||
| @@ -136,7 +137,7 @@ int LoadPhData(int *srate) | |||
| } | |||
| if (version != version_phdata) | |||
| result = version; | |||
| return ENE_VERSION_MISMATCH; | |||
| // set up phoneme tables | |||
| p = phoneme_tab_data; | |||
| @@ -161,7 +162,7 @@ int LoadPhData(int *srate) | |||
| if (srate != NULL) | |||
| *srate = rate; | |||
| return result; | |||
| return ENS_OK; | |||
| } | |||
| void FreePhData(void) | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2014 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -29,7 +29,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2014 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -499,7 +499,7 @@ unsigned int LookupSound(PHONEME_TAB *ph1, PHONEME_TAB *ph2, int which, int *mat | |||
| frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, int *n_frames, PHONEME_LIST *plist); | |||
| unsigned char *LookupEnvelope(int ix); | |||
| int LoadPhData(int *srate); | |||
| espeak_ng_STATUS LoadPhData(int *srate); | |||
| void SynthesizeInit(void); | |||
| int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume); | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2015 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -31,7 +31,9 @@ | |||
| #include <wctype.h> | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2014 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -30,7 +30,9 @@ | |||
| #include <wctype.h> | |||
| #include <wchar.h> | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2015 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -36,7 +36,9 @@ | |||
| #include "dirent.h" | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| #include "voice.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2013 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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 | |||
| @@ -30,7 +30,9 @@ | |||
| #include <stdint.h> | |||
| #endif | |||
| #include "espeak_ng.h" | |||
| #include "speak_lib.h" | |||
| #include "speech.h" | |||
| #include "phoneme.h" | |||
| #include "synthesize.h" | |||
| @@ -1,7 +1,7 @@ | |||
| /* | |||
| * Copyright (C) 2005 to 2013 by Jonathan Duddington | |||
| * email: [email protected] | |||
| * 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(); | |||