[1.28.03] Added macro in speech.h for max. length of the espeak-data path.

Added language: "bs" Bosnian.
Fix to speak_lib.h for Windows dll version.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@69 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-07-31 09:17:13 +00:00
parent 1329d6c84b
commit 810fb2404d
39 changed files with 368 additions and 312 deletions
+12 -12
View File
@@ -101,7 +101,7 @@ private:
int CPhoneme();
void StartPhonemeTable(const char *name);
void EndPhonemeTable();
void CPhonemeFiles(char *path_source);
void CPhonemeFiles();
int NextItem(int type);
void UngetItem();
void Error(const char *msg);
@@ -173,7 +173,7 @@ private:
};
char path_source[80];
char path_source[sizeof(path_home)+20];
Compile *compile;
@@ -741,7 +741,7 @@ int Compile::LoadWavefile(FILE *f, const char *fname)
int resample_wav = 0;
char fname_temp[100];
int scale_factor=0;
char command[200];
char command[sizeof(path_source)+200];
fseek(f,24,SEEK_SET);
sr1 = Read4Bytes(f);
@@ -894,7 +894,7 @@ int Compile::LoadDataFile(const char *path, int control)
int hash;
int type_code=' ';
REF_HASH_TAB *p, *p2;
char buf[256];
char buf[sizeof(path_source)+120];
count_references++;
@@ -1630,12 +1630,12 @@ void Compile::StartPhonemeTable(const char *name)
void Compile::CPhonemeFiles(char *path_source)
{//===========================================
void Compile::CPhonemeFiles()
{//==========================
int phcode;
int item;
FILE *f;
char buf[120];
char buf[sizeof(path_source)+120];
linenum = 1;
n_phcodes = 1; // don't use phoneme code=0, it's used as string terminator
@@ -1827,7 +1827,7 @@ void Compile::Report(void)
REF_HASH_TAB *p;
REF_HASH_TAB **list;
FILE *f_report;
char fname[80];
char fname[sizeof(path_source)+20];
// make a list of all the references and sort it
list = (REF_HASH_TAB **)malloc(count_references * sizeof(REF_HASH_TAB *));
@@ -1989,7 +1989,7 @@ wxString CompileAllDictionaries()
FILE *log;
FILE *f_phused;
char dictname[80];
char fname_log[80];
char fname_log[sizeof(path_dsource)+20];
char save_voice_name[80];
if(!wxDirExists(path_dictsource))
@@ -2073,7 +2073,7 @@ wxString CompileAllDictionaries()
void Compile::CPhonemeTab(const char *source)
{//========================================
char fname[130];
char fname[sizeof(path_source)+40];
wxString report;
wxString report_dict;
@@ -2176,7 +2176,7 @@ memset(markers_used,0,sizeof(markers_used));
n_phoneme_tabs = 0;
stack_ix = 0;
StartPhonemeTable("base");
CPhonemeFiles(path_source);
CPhonemeFiles();
EndPhonemeTable();
WritePhonemeTable();
@@ -2233,7 +2233,7 @@ void CompileMbrola()
char name1[40];
char name2[40];
char mbrola_voice[40];
char buf[150];
char buf[sizeof(path_home)+30];
int mbrola_ctrl = 20; // volume in 1/16 ths
MBROLA_TAB data[N_PHONEME_TAB];
+3 -3
View File
@@ -1301,9 +1301,9 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
FILE *f_out;
int offset_rules=0;
int value;
char fname_buf[130];
char fname_temp[130];
char path[80];
char fname_buf[sizeof(path_home)+15];
char fname_temp[sizeof(path_home)+15];
char path[sizeof(path_home)+40]; // path_dsource+20
error_count = 0;
+1 -1
View File
@@ -127,7 +127,7 @@ int Translator::LoadDictionary(const char *name, int no_error)
int length;
FILE *f;
unsigned int size;
char fname[130];
char fname[sizeof(path_home)+20];
strcpy(dictionary_name,name); // currently loaded dictionary name
+1 -1
View File
@@ -22,7 +22,7 @@
#include <string.h>
#include <getopt.h>
#include <time.h>
#include "sys/stat.h"
#include <sys/stat.h>
#include "speak_lib.h"
+2 -2
View File
@@ -427,8 +427,8 @@ void MyFrame::OnTools(wxCommandEvent& event)
{//=========================================
int err;
FILE *log;
char fname_log[80];
char err_fname[130];
char fname_log[sizeof(path_dsource)+12];
char err_fname[sizeof(path_home)+15];
switch(event.GetId())
{
+12 -10
View File
@@ -21,8 +21,9 @@
#include <wx/dirdlg.h>
#include "wx/filename.h"
#include "wx/sound.h"
#include "wx/dir.h"
#include "sys/stat.h"
#include <sys/stat.h>
#include "speak_lib.h"
#include "main.h"
@@ -487,7 +488,8 @@ void Lexicon_Ru()
int counts[20][20][10];
char phonemes[N_WORD_PHONEMES];
char buf[100];
char buf[120];
char fname[sizeof(path_dsource)+20];
// KOI8-R codes for Russian vowels
static char vowels[] = {0xa3,0xc0,0xc1,0xc5,0xc9,0xcf,0xd1,0xd5,0xd9,0xdc,0};
@@ -543,18 +545,18 @@ void Lexicon_Ru()
}
input_length = GetFileLength(buf);
sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_listx_1");
if((f_out = fopen(buf,"w")) == NULL)
sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_listx_1");
if((f_out = fopen(fname,"w")) == NULL)
{
wxLogError(_T("Can't write to: ")+wxString(buf,wxConvLocal));
wxLogError(_T("Can't write to: ")+wxString(fname,wxConvLocal));
fclose(f_in);
return;
}
sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_log");
f_log = fopen(buf,"w");
sprintf(buf,"%s%c%s",path_dsource,PATHSEP,"ru_roots_1");
f_roots = fopen(buf,"w");
sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_log");
f_log = fopen(fname,"w");
sprintf(fname,"%s%c%s",path_dsource,PATHSEP,"ru_roots_1");
f_roots = fopen(fname,"w");
LoadVoice("ru",0);
@@ -1211,6 +1213,7 @@ result = espeak_SetVoiceByProperties(&voice);
return 0;
}
char* text1 = "Hello World2. <audio src=\"here\"> Some text</audio> This is the second sentence";
void TestTest(int control)
@@ -1227,7 +1230,6 @@ void TestTest(int control)
//CharsetToUnicode("ISO-8859-4");
//CharsetToUnicode("ISCII");
test4();
return;
if(control==2)
+6 -8
View File
@@ -20,7 +20,7 @@
#include "wx/wx.h"
#include "wx/fileconf.h"
#include "sys/stat.h"
#include <sys/stat.h>
#include "speech.h"
#ifdef PLATFORM_WINDOWS
@@ -36,10 +36,8 @@ extern void strncpy0(char *to,const char *from, int size);
extern int GetNumeric(wxTextCtrl *t);
extern void SetNumeric(wxTextCtrl *t, int value);
extern int samplerate;
extern char path_home[120]; // .speak directory in user's HOME
extern char voice_name[40];
wxString basedir;
wxString path_spectload;
wxString path_spectload2;
wxString path_pitches;
@@ -53,7 +51,7 @@ wxString path_modifiervoice;
wxString path_dir1;
int option_speed=160;
char path_dsource[120];
char path_dsource[sizeof(path_home)+20];
BEGIN_EVENT_TABLE(Options, wxDialog)
EVT_BUTTON(wxID_SAVE,Options::OnCommand)
@@ -110,7 +108,7 @@ void Options::OnCommand(wxCommandEvent& event)
void ConfigSetPaths()
{//==================
// set paths from wxStrings
// set c_string paths from wxStrings
strncpy0(path_source,path_phsource.mb_str(wxConvLocal),sizeof(path_source)-1);
strcat(path_source,"/");
@@ -123,6 +121,7 @@ void ConfigInit()
{//==============
long value;
wxString string;
wxString basedir;
const char *path_base;
#ifdef PLATFORM_WINDOWS
@@ -133,7 +132,7 @@ void ConfigInit()
{
wxString RegVal;
pRegKey->QueryValue(_T("Path"),RegVal);
strcpy(buf,RegVal.mb_str(wxConvLocal));
strncpy0(buf,RegVal.mb_str(wxConvLocal),sizeof(buf));
path_base = buf;
}
else
@@ -156,7 +155,7 @@ void ConfigInit()
#endif
WavegenInit(value,0);
pConfig->Read(_T("/basedir"),&basedir,wxString(path_base,wxConvLocal));
basedir = wxString(path_base,wxConvLocal); // this is only used to set defaults for other paths if they are not in the config file
pConfig->Read(_T("/spectload"),&path_spectload,basedir+_T("/phsource"));
pConfig->Read(_T("/spectload2"),&path_spectload2,basedir+_T("/phsource"));
pConfig->Read(_T("/pitchpath"),&path_pitches,basedir+_T("/pitch"));
@@ -183,7 +182,6 @@ void ConfigSave(int exit)
#ifndef PLATFORM_WINDOWS
pConfig->Write(_T("/samplerate"),samplerate);
#endif
pConfig->Write(_T("/basedir"),basedir);
pConfig->Write(_T("/spectload"),path_spectload);
pConfig->Write(_T("/spectload2"),path_spectload2);
pConfig->Write(_T("/pitchpath"),path_pitches);
+2 -2
View File
@@ -40,8 +40,8 @@ extern wxString path_dictsource;
extern wxString path_modifiervoice;
extern wxString path_dir1;
extern char path_source[80];
extern char path_dsource[120];
extern char path_source[sizeof(path_home)+20];
extern char path_dsource[sizeof(path_home)+20];
extern int option_speed;
+128 -3
View File
@@ -34,6 +34,7 @@
#include "synthesize.h"
#include "translate.h"
#include <locale.h>
#define N_XML_BUF 256
espeak_VOICE *SelectVoice(espeak_VOICE *voice_select, int *variant);
@@ -151,7 +152,131 @@ const int param_defaults[N_SPEECH_PARAM] = {
};
#ifdef PLATFORM_RISCOS
#ifdef NEED_WCHAR_FUNCTIONS
// additional Latin characters beyond the Latin1 character set
#define MAX_WALPHA 0x233
// indexed by character - 0x100
// 0=not alphabetic, 0xff=lower case, other=value to add to upper case to convert to lower case
static unsigned char walpha_tab[MAX_WALPHA-0xff] = {
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120
0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160
1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170
0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180
203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190
1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0
0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0
0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0
0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210
0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220
1,0xff, 1,0xff }; // 230
// use ctype.h functions for Latin1 (character < 0x100)
int iswalpha(int c)
{
if(c < 0x100)
return(isalpha(c));
if(c > MAX_WALPHA)
return(0);
return(walpha_tab[c-0x100]);
}
int iswdigit(int c)
{
if(c < 0x100)
return(isdigit(c));
return(0);
}
int iswalnum(int c)
{
if(iswdigit(c))
return(1);
return(iswalpha(c));
}
int towlower(int c)
{
int x;
if(c < 0x100)
return(tolower(c));
if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff))
return(c); // already lower case
return(c + x); // convert to lower case
}
int towupper(int c)
{
// check whether the previous character code is the upper-case equivalent of this character
if(tolower(c-1) == c)
return(c-1); // yes, use it
return(c); // no
}
int iswupper(int c)
{
int x;
if(c < 0x100)
return(isupper(c));
if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff))
return(0);
return(1);
}
int iswlower(int c)
{
if(c < 0x100)
return(islower(c));
if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff))
return(0);
return(1);
}
int iswspace(int c)
{
if(c < 0x100)
return(isspace(c));
return(0);
}
int iswpunct(int c)
{
if(c < 0x100)
return(ispunct(c));
return(0);
}
const wchar_t *wcschr(const wchar_t *str, int c)
{
while(*str != 0)
{
if(*str == c)
return(str);
str++;
}
return(NULL);
}
const int wcslen(const wchar_t *str)
{
int ix=0;
while(*str != 0)
{
ix++;
}
return(ix);
}
float wcstod(const wchar_t *str, wchar_t **tailptr)
{
int ix;
@@ -395,8 +520,8 @@ static int LoadSoundFile(const char *fname, int index)
int *ip;
int length;
char fname_temp[100];
char fname2[200];
char command[150];
char fname2[sizeof(path_home)+13+40];
char command[sizeof(fname2)+sizeof(fname2)+30];
if(fname == NULL)
fname = soundicon_tab[index].filename;
+25 -8
View File
@@ -24,19 +24,23 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef PLATFORM_DOS
#ifdef PLATFORM_WINDOWS
#include <windows.h>
#include <winreg.h>
#else
#include <unistd.h>
#endif
#endif
#ifndef NEED_GETOPT
#include <getopt.h>
#endif
#include <time.h>
#include <signal.h>
#include <locale.h>
#include "sys/stat.h"
#include <sys/stat.h>
#include "speak_lib.h"
#include "voice.h"
@@ -46,7 +50,8 @@
char path_home[120];
char path_home[N_PATH_HOME]; // this is the espeak-data directory
char wavefile[120];
int (* uri_callback)(int, const char *, const char *) = NULL;
int (* phoneme_callback)(const char *) = NULL;
@@ -225,11 +230,11 @@ static void init_path(void)
unsigned long size;
unsigned long var_type;
char *env;
unsigned char buf[100];
unsigned char buf[sizeof(path_home)-12];
if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
if(((env = getenv("ESPEAK_DATA_PATH")) != NULL) && ((strlen(env)+12) < sizeof(path_home)))
{
sprintf(path_home,"%s/espeak-data",env);
sprintf(path_home,"%s\\espeak-data",env);
if(GetFileLength(path_home) == -2)
return; // an espeak-data directory exists
}
@@ -242,6 +247,9 @@ static void init_path(void)
sprintf(path_home,"%s\\espeak-data",buf);
#else
#ifdef PLATFORM_DOS
strcpy(path_home,PATH_ESPEAK_DATA);
#else
// char *env;
// if((env = getenv("ESPEAK_DATA_PATH")) != NULL)
// {
@@ -256,6 +264,7 @@ static void init_path(void)
strcpy(path_home,PATH_ESPEAK_DATA);
}
#endif
#endif
}
@@ -553,14 +562,22 @@ int main (int argc, char **argv)
if(flag_compile)
{
#ifdef PLATFORM_WINDOWS
char path_dsource[120];
#ifdef PLATFORM_DOS
char path_dsource[sizeof(path_home)+20];
strcpy(path_dsource,path_home);
path_dsource[strlen(path_home)-11] = 0; // renove "espeak-data" from the end
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end
strcat(path_dsource,"dictsource\\");
CompileDictionary(path_dsource,dictionary_name,NULL,NULL);
#else
#ifdef PLATFORM_WINDOWS
char path_dsource[sizeof(path_home)+20];
strcpy(path_dsource,path_home);
path_dsource[strlen(path_home)-11] = 0; // remove "espeak-data" from the end
strcat(path_dsource,"dictsource\\");
CompileDictionary(path_dsource,dictionary_name,NULL,NULL);
#else
CompileDictionary(NULL,dictionary_name,NULL,NULL);
#endif
#endif
exit(0);
}
+4 -4
View File
@@ -30,7 +30,7 @@
#include "speech.h"
#include "sys/stat.h"
#include <sys/stat.h>
#ifndef PLATFORM_WINDOWS
#include <unistd.h>
#endif
@@ -63,7 +63,7 @@ t_espeak_callback* synth_callback = NULL;
int (* uri_callback)(int, const char *, const char *) = NULL;
int (* phoneme_callback)(const char *) = NULL;
char path_home[120];
char path_home[N_PATH_HOME]; // this is the espeak-data directory
voice_t voicedata;
voice_t *voice = &voicedata;
@@ -285,7 +285,7 @@ static void init_path(const char *path)
unsigned long size;
unsigned long var_type;
char *env;
unsigned char buf[100];
unsigned char buf[sizeof(path_home)-13];
if(path != NULL)
{
@@ -309,7 +309,7 @@ static void init_path(const char *path)
sprintf(path_home,"%s\\espeak-data",buf);
#else
char *env;
// char *env;
if(path != NULL)
{
+2 -118
View File
@@ -129,122 +129,6 @@ static const char *help_text =
"\t If <language> is omitted, then list all voices.\n";
// additional Latin characters beyond the Latin1 character set
#define MAX_WALPHA 0x233
// indexed by character - 0x100
// 0=not alphabetic, 0xff=lower case, other=value to add to upper case to convert to lower case
static unsigned char walpha_tab[MAX_WALPHA-0xff] = {
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 100
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 110
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 120
0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1, // 130
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, // 140
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 150
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 160
1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, // 170
0xff, 210, 1,0xff, 1,0xff, 206, 1,0xff, 205, 205, 1,0xff,0xff, 79, 202, // 180
203, 1,0xff, 205, 207,0xff, 211, 209, 1,0xff,0xff,0xff, 211, 213,0xff, 214, // 190
1,0xff, 1,0xff, 1,0xff, 218, 1,0xff, 218,0xff,0xff, 1,0xff, 218, 1, // 1a0
0xff, 217, 217, 1,0xff, 1,0xff, 219, 1,0xff,0xff,0xff, 1,0xff,0xff,0xff, // 1b0
0xff,0xff,0xff,0xff, 2, 1,0xff, 2, 1,0xff, 2, 1,0xff, 1,0xff, 1, // 1c0
0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff,0xff, 1,0xff, // 1d0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1e0
0xff, 2, 1,0xff, 1,0xff,0xff,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 1f0
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 200
1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 210
0xff, 0, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, 1,0xff, // 220
1,0xff, 1,0xff }; // 230
// use ctype.h functions for Latin1 (character < 0x100)
int iswalpha(int c)
{
if(c < 0x100)
return(isalpha(c));
if(c > MAX_WALPHA)
return(0);
return(walpha_tab[c-0x100]);
}
int iswdigit(int c)
{
if(c < 0x100)
return(isdigit(c));
return(0);
}
int iswalnum(int c)
{
if(iswdigit(c))
return(1);
return(iswalpha(c));
}
int towlower(int c)
{
int x;
if(c < 0x100)
return(tolower(c));
if((c > MAX_WALPHA) || ((x = walpha_tab[c-0x100])==0xff))
return(c); // already lower case
return(c + x); // convert to lower case
}
int iswupper(int c)
{
int x;
if(c < 0x100)
return(isupper(c));
if(((c > MAX_WALPHA) || (x = walpha_tab[c-0x100])==0) || (x == 0xff))
return(0);
return(1);
}
int iswlower(int c)
{
if(c < 0x100)
return(islower(c));
if((c > MAX_WALPHA) || (walpha_tab[c-0x100] != 0xff))
return(0);
return(1);
}
int iswspace(int c)
{
if(c < 0x100)
return(isspace(c));
return(0);
}
int iswpunct(int c)
{
if(c < 0x100)
return(ispunct(c));
return(0);
}
const wchar_t *wcschr(const wchar_t *str, int c)
{
while(*str != 0)
{
if(*str == c)
return(str);
str++;
}
return(NULL);
}
const int wcslen(const wchar_t *str)
{
int ix=0;
while(*str != 0)
{
ix++;
}
return(ix);
}
int GetFileLength(const char *filename)
{//====================================
int length=0;
@@ -284,7 +168,7 @@ void ReadVoiceNames2(char *directory)
_kernel_swi_regs regs;
_kernel_oserror *error;
char buf[80];
char directory2[80];
char directory2[sizeof(path_home)+100];
regs.r[0] = 10;
regs.r[1] = (int)directory;
@@ -324,7 +208,7 @@ void ReadVoiceNames2(char *directory)
void ReadVoiceNames()
{//===================
char directory[80];
char directory[sizeof(path_home)+10];
for(n_voice_files=0; n_voice_files<N_VOICE_NAMES; n_voice_files++)
voice_names[n_voice_files] = NULL;
+3 -2
View File
@@ -87,9 +87,10 @@ int GetFileLength(const char *filename);
char *Alloc(int size);
void Free(void *ptr);
#define N_PATH_HOME 120
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory
extern void strncpy0(char *to,const char *from, int size);
extern char path_home[];
extern const char *version_string;
extern const int version_phdata;
extern void strncpy0(char *to,const char *from, int size);
+1 -1
View File
@@ -116,7 +116,7 @@ espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans)
int size;
FILE *f_in;
char path[150];
char path[sizeof(path_home)+15];
mbrola_name[0] = 0;
if(mbrola_voice == NULL)
+3 -3
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.28.01 17.Jul.07";
const char *version_string = "1.28.03 30.Jul.07";
const int version_phdata = 0x012801;
int option_device_number = -1;
@@ -79,7 +79,7 @@ static int ReadPhFile(char **ptr, const char *fname)
FILE *f_in;
char *p;
unsigned int length;
char buf[200];
char buf[sizeof(path_home)+40];
sprintf(buf,"%s%c%s",path_home,PATHSEP,fname);
length = GetFileLength(buf);
@@ -604,7 +604,7 @@ int SelectPhonemeTableName(const char *name)
void LoadConfig(void)
{//==================
// Load configuration file, if one exists
char buf[130];
char buf[sizeof(path_home)+10];
FILE *f;
int ix;
char c1;
+1
View File
@@ -288,6 +288,7 @@ Translator *SelectTranslator(const char *name)
case L('h','r'): // Croatian
case L('b','s'): // Bosnian
case L('s','r'): // Serbian
{
static int stress_amps_hr[8] = {16,16, 20,20, 20,24, 24,22 };
+2 -3
View File
@@ -1594,7 +1594,7 @@ int Translator::TranslateChar(char *ptr, int prev_in, unsigned int c, unsigned i
new_c = langopts.replacement_chars[ix];
break;
}
if((word >> 16) == tolower(next_in))
if((word >> 16) == (unsigned int)tolower(next_in))
{
new_c = langopts.replacement_chars[ix];
ignore_next = 1;
@@ -1616,10 +1616,9 @@ int Translator::TranslateChar(char *ptr, int prev_in, unsigned int c, unsigned i
*insert = c2;
new_c &= 0xffff;
}
#ifndef PLATFORM_RISCOS
if(upper_case)
new_c = towupper(new_c);
#endif
return(new_c);
}
+1 -1
View File
@@ -247,7 +247,7 @@ void TranslDlg::ReadVoice()
{//========================
wxString path;
wxString filename;
char fname[130];
char fname[sizeof(path_home)+10];
sprintf(fname,"%s/voices",path_home);
path = wxFileSelector(_T("Load voice"),wxString(fname,wxConvLocal),_T(""),_T(""),_T("*"),wxOPEN);
+8 -7
View File
@@ -59,7 +59,7 @@ int formant_rate[9]; // values adjusted for actual sample rate
#define DEFAULT_LANGUAGE_PRIORITY 5
#define N_VOICES_LIST 100
#define N_VOICES_LIST 150
static int n_voices_list = 0;
static espeak_VOICE *voices_list[N_VOICES_LIST];
static int len_path_voices;
@@ -226,11 +226,12 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char*lea
// Read a Voice file, allocate a VOICE_DATA and set data from the
// file's language, gender, name lines
char linebuf[120];
char linebuf[80];
char vname[80];
char vgender[80];
char vlanguage[80];
char languages[300]; // allow space for several alternate language names and priorities
char fname_buf[sizeof(path_home)+15];
unsigned int len;
@@ -249,9 +250,9 @@ static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char*lea
// check whether the mbrola speech data is present for this voice
memcpy(vname,&leafname[3],3);
vname[3] = 0;
sprintf(linebuf,"%s/mbrola/%s",path_home,vname);
sprintf(fname_buf,"%s/mbrola/%s",path_home,vname);
if(GetFileLength(linebuf) <= 0)
if(GetFileLength(fname_buf) <= 0)
return(0);
}
#endif
@@ -534,7 +535,7 @@ voice_t *LoadVoice(const char *vname, int control)
char phonemes_name[40];
char *language_type;
char buf[200];
char path_voices[140];
char path_voices[sizeof(path_home)+12];
char langname[4];
int stress_amps[8];
@@ -1327,7 +1328,7 @@ void GetVoices(const char *path)
FILE *f_voice;
espeak_VOICE *voice_data;
int ftype;
char fname[140];
char fname[sizeof(path_home)+100];
#ifdef PLATFORM_RISCOS
#else
@@ -1500,7 +1501,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
int ix;
static espeak_VOICE *voices[N_VOICES_LIST];
char selected_voice_id[80];
char path_voices[130];
char path_voices[sizeof(path_home)+12];
// free previous voice list data
if((voice_selected != NULL) && (voice_selected->identifier != NULL))
+3 -3
View File
@@ -35,11 +35,11 @@
#include "phoneme.h"
#include "synthesize.h"
#include "translate.h"
#include "options.h"
/* Read a file of vowel symbols and f1,f2 formants, and produce a vowel diagram
*/
extern wxString path_phsource;
extern char path_source[];
extern char voice_name[];
extern char *spects_data;
@@ -458,8 +458,8 @@ void MakeVowelLists(void)
SPECT_SEQ *seq;
frame_t *frame;
int match_level;
char dirname[100];
char fname[120];
char dirname[sizeof(path_source)+20];
char fname[sizeof(dirname)+40];
progress = new wxProgressDialog(_T("Vowel charts"),_T(""),n_phoneme_tables);
+4 -3
View File
@@ -100,11 +100,11 @@ static void init_buffer()
SHOW("init_buffer > myRead=0x%x, myWrite=0x%x, BUFFER_LENGTH=0x%x, myReadPosition = myWritePosition = 0\n", (int)myRead, (int)myWrite, BUFFER_LENGTH);
}
static int get_used_mem()
static unsigned int get_used_mem()
{
char* aRead = myRead;
char* aWrite = myWrite;
int used = 0;
unsigned int used = 0;
assert ((aRead >= myBuffer)
&& (aRead <= myBuffer + BUFFER_LENGTH)
@@ -129,12 +129,13 @@ static int get_used_mem()
static void start_stream()
{
PaError err;
SHOW_TIME("start_stream");
my_stream_could_start=0;
mInCallbackFinishedState = false;
PaError err = Pa_StartStream(pa_stream);
err = Pa_StartStream(pa_stream);
SHOW("start_stream > Pa_StartStream=%d (%s)\n", err, Pa_GetErrorText(err));
#if USE_PORTAUDIO == 19
+2
View File
@@ -1,7 +1,9 @@
#ifndef WAVE_H
#define WAVE_H
#ifndef PLATFORM_DOS
#include "stdint.h"
#endif
extern int option_device_number;