@@ -82,7 +82,6 @@ libespeak_ng_SOURCE = \ | |||
espeakedit_SOURCE = \ | |||
src/compiledata.cpp \ | |||
src/espeakedit.cpp \ | |||
src/options.cpp \ | |||
src/prosodydisplay.cpp \ | |||
src/spect.cpp \ | |||
src/spectseq.cpp |
@@ -49,10 +49,6 @@ | |||
#define wxOPEN wxFD_OPEN | |||
#endif | |||
extern wxString path_dictsource; | |||
extern wxString path_phsource; | |||
extern wxString path_phfile; | |||
extern char path_dsource[sizeof(path_home)+20]; | |||
extern char path_source[sizeof(path_home)+20]; | |||
extern int progress_max; | |||
@@ -1488,7 +1484,7 @@ int LoadSpect(const char *path, int control) | |||
return(0); | |||
} | |||
wxString filename = path_phsource + path_sep + wxString(path,wxConvLocal); | |||
wxString filename = wxString(path_source,wxConvLocal) + path_sep + wxString(path,wxConvLocal); | |||
wxFileInputStream stream(filename); | |||
if(stream.Ok() == FALSE) | |||
@@ -3391,48 +3387,20 @@ make_envs(); | |||
f_errors = stderr; | |||
if(!wxDirExists(path_phsource)) | |||
if(!wxDirExists(path_source)) | |||
{ | |||
if(gui_flag) | |||
{ | |||
wxString dirname = wxDirSelector(_T("Phoneme source directory"),path_phsource); | |||
if(!dirname.IsEmpty()) | |||
{ | |||
path_phsource = dirname; | |||
strncpy0(path_source,path_phsource.mb_str(wxConvLocal),sizeof(path_source)-1); | |||
strcat(path_source,"/"); | |||
} | |||
} | |||
else | |||
{ | |||
fprintf(stderr,"Can't find phoneme source directory: %s\n",path_source); | |||
} | |||
fprintf(stderr,"Can't find phoneme source directory: %s\n",path_source); | |||
return; | |||
} | |||
strncpy0(current_fname,source,sizeof(current_fname)); | |||
strncpy0(fname,path_phfile.mb_str(wxConvLocal),sizeof(fname)); | |||
sprintf(fname,"%s/%s",path_source,"phonemes"); | |||
f_in = fopen_log(f_errors,fname,"rb"); | |||
if(f_in == NULL) | |||
{ | |||
if(gui_flag) | |||
{ | |||
wxString phfile = wxFileSelector(_T("Master phonemes file"),path_phsource, | |||
_T(""),_T(""),_T("*"),wxOPEN); | |||
if(!phfile.IsEmpty()) | |||
{ | |||
path_phfile = phfile; | |||
} | |||
} | |||
strncpy0(fname,path_phfile.mb_str(wxConvLocal),sizeof(fname)); | |||
f_in = fopen_log(f_errors,fname,"rb"); | |||
if(f_in == NULL) | |||
{ | |||
wxLogError(_T("Can't read master phonemes file:\n") + wxString(fname,wxConvLocal)); | |||
return; | |||
} | |||
wxLogError(_T("Can't read master phonemes file:\n") + wxString(fname,wxConvLocal)); | |||
return; | |||
} | |||
progress_max = 0; | |||
@@ -3473,8 +3441,7 @@ make_envs(); | |||
fprintf(f_errors, "Source data path = '%s'\n", path_source); | |||
strncpy0(fname,path_phfile.mb_str(wxConvLocal),sizeof(fname)); | |||
fprintf(f_errors, "Master phonemes file = '%s'\n", fname); | |||
fprintf(f_errors, "Master phonemes file = '%s/phonemes'\n", path_source); | |||
fprintf(f_errors, "Output to '%s/'\n\n", path_home); | |||
sprintf(fname,"%s/%s",path_home,"phondata"); |
@@ -41,7 +41,6 @@ static const char *about_string = "<font size=0><b>espeakedit </b> %s<br>Author: | |||
"<a href=\"http://espeak.sourceforge.net/\">http://espeak.sourceforge.net</a><br>" | |||
"Licensed under <a href=\"http://espeak.sourceforge.net/license.html\">GNU General Public License version 3</a></font>"; | |||
extern void ConfigInit(bool use_defaults); | |||
extern void CompilePhonemeData(void); | |||
extern void CompileSampleRate(void); | |||
extern espeak_ng_STATUS CompileIntonation(FILE *log); | |||
@@ -49,6 +48,9 @@ extern espeak_ng_STATUS CompileIntonation(FILE *log); | |||
int progress_max; | |||
int gui_flag = 0; | |||
char path_source[sizeof(path_home)+20]; | |||
char voice_name2[40]; | |||
class MyApp: public wxApp | |||
{ | |||
public: | |||
@@ -105,7 +107,11 @@ else | |||
exit(0); | |||
} | |||
ConfigInit(true); | |||
char *env; | |||
if((env = getenv("ESPEAK_DATA_PATH")) == NULL) | |||
env = getenv("HOME"); | |||
snprintf(path_home,sizeof(path_home),"%s/espeak-data",env); | |||
snprintf(path_source,sizeof(path_source),"%s/../phsource/",path_home); | |||
if(strcmp(param,"--compile")==0) | |||
{ |
@@ -1,101 +0,0 @@ | |||
/*************************************************************************** | |||
* Copyright (C) 2005 to 2013 by Jonathan Duddington * | |||
* email: [email protected] * | |||
* Copyright (C) 2013-2015 by 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 "wx/wx.h" | |||
#include "wx/fileconf.h" | |||
#include <sys/stat.h> | |||
#include "speech.h" | |||
#ifdef PLATFORM_WINDOWS | |||
#include "wx/msw/registry.h" | |||
#endif | |||
wxString path_phfile; | |||
wxString path_phsource; | |||
wxString path_dictsource; | |||
char path_source[sizeof(path_home)+20]; | |||
char path_dsource[sizeof(path_home)+20]; | |||
char voice_name2[40]; | |||
void ConfigSetPaths() | |||
{//================== | |||
// set c_string paths from wxStrings | |||
strncpy0(path_source,path_phsource.mb_str(wxConvLocal),sizeof(path_source)-1); | |||
strcat(path_source,"/"); | |||
strncpy0(path_dsource,path_dictsource.mb_str(wxConvLocal),sizeof(path_source)-1); | |||
strcat(path_dsource,"/"); | |||
} | |||
void ConfigInit(bool use_defaults) | |||
{//============== | |||
wxString string; | |||
wxString basedir; | |||
const char *path_base; | |||
#ifdef PLATFORM_WINDOWS | |||
int found = 0; | |||
char buf[200]; | |||
wxRegKey *pRegKey = new wxRegKey(_T("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Speech\\Voices\\Tokens\\eSpeak")); | |||
if((path_base = getenv("ESPEAK_DATA_PATH")) != NULL) | |||
{ | |||
sprintf(path_home,"%s\\espeak-data",path_base); | |||
if(GetFileLength(path_home) == -2) | |||
found = 1; // an espeak-data directory exists | |||
} | |||
if(found == 0) | |||
{ | |||
if(pRegKey->Exists() ) | |||
{ | |||
wxString RegVal; | |||
pRegKey->QueryValue(_T("Path"),RegVal); | |||
strncpy0(buf,RegVal.mb_str(wxConvLocal),sizeof(buf)); | |||
path_base = buf; | |||
} | |||
else | |||
{ | |||
path_base = "C:\\Program Files\\eSpeak"; | |||
} | |||
sprintf(path_home,"%s\\espeak-data",path_base); | |||
} | |||
#else | |||
char *env; | |||
if((env = getenv("ESPEAK_DATA_PATH")) == NULL) | |||
env = getenv("HOME"); | |||
snprintf(path_home,sizeof(path_home),"%s/espeak-data",env); | |||
path_base = path_home; | |||
#endif | |||
mkdir(path_home,S_IRWXU); // create if it doesn't already exist | |||
wxFileConfig *pConfig = new wxFileConfig(_T("espeakedit")); | |||
wxFileConfig::Set(pConfig); | |||
basedir = wxString(path_base,wxConvLocal); // this is only used to set defaults for other paths if they are not in the config file | |||
path_phsource = basedir + _T("/../phsource"); | |||
path_phfile = path_phsource + _T("/phonemes"); | |||
path_dictsource = basedir + _T("/../dictsource"); | |||
ConfigSetPaths(); | |||
} // end of ConfigInit |