Browse Source

Merge branch 'master' into android

master
Reece H. Dunn 9 years ago
parent
commit
19039c72ab
12 changed files with 92 additions and 38 deletions
  1. 5
    1
      src/compiledata.cpp
  2. 6
    2
      src/compiledict.cpp
  3. 3
    1
      src/dictionary.cpp
  4. 10
    13
      src/espeakedit.cpp
  5. 5
    2
      src/extras.cpp
  6. 4
    0
      src/prosodydisplay.cpp
  7. 21
    13
      src/spect.cpp
  8. 1
    0
      src/spectdisplay.cpp
  9. 16
    4
      src/spectseq.cpp
  10. 6
    0
      src/synthdata.cpp
  11. 4
    0
      src/voices.cpp
  12. 11
    2
      src/vowelchart.cpp

+ 5
- 1
src/compiledata.cpp View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2013 by Reece H. Dunn *
* 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 *
@@ -1649,6 +1649,7 @@ int LoadSpect(const char *path, int control)
if(stream.Ok() == FALSE)
{
error("Failed to open: '%s'",path);
delete spectseq;
return(0);
}
spectseq->Load(stream);
@@ -1656,6 +1657,7 @@ int LoadSpect(const char *path, int control)
if(spectseq->frames == NULL)
{
error("Bad vowel file, no frames: '%s'",path);
delete spectseq;
return(0);
}

@@ -3997,6 +3999,7 @@ void CompileIntonation()
{
fclose(f_in);
fclose(f_errors);
free(tune_data);
return;
}

@@ -4183,6 +4186,7 @@ void CompileIntonation()
}
}
fwrite(tune_data, n_tune_names, sizeof(TUNE), f_out);
free(tune_data);
fclose(f_in);
fclose(f_out);


+ 6
- 2
src/compiledict.cpp View File

@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 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 *
@@ -870,7 +871,8 @@ static int compile_dictlist_file(const char *path, const char* filename)
return(-1);
}

fprintf(f_log,"Compiling: '%s'\n",fname);
if(f_log != NULL)
fprintf(f_log,"Compiling: '%s'\n",fname);

linenum=0;

@@ -900,7 +902,8 @@ static int compile_dictlist_file(const char *path, const char* filename)
count++;
}

fprintf(f_log,"\t%d entries\n",count);
if(f_log != NULL)
fprintf(f_log,"\t%d entries\n",count);
fclose(f_in);
return(0);
} /* end of compile_dictlist_file */
@@ -1965,6 +1968,7 @@ int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, cha
{
if(fname_err)
strcpy(fname_err,fname_out);
fclose(f_in);
return(-1);
}
sprintf(fname_temp,"%s%ctemp",path_home,PATHSEP);

+ 3
- 1
src/dictionary.cpp View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* Copyright (C) 2013-2015 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 *
@@ -273,6 +273,8 @@ int LoadDictionary(Translator *tr, const char *name, int no_error)
{
fprintf(stderr,"Can't read dictionary file: '%s'\n",fname);
}
if (f != NULL)
fclose(f);
return(1);
}


+ 10
- 13
src/espeakedit.cpp View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2013 by Reece H. Dunn *
* 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 *
@@ -111,21 +111,21 @@ static const char *help_text =
"\tCompile phoneme data in espeak-data/phsource\n"
"\tand dictionary data in espeak-data/dictsource\n";


// Initialise this in OnInit, not statically
bool MyApp::OnInit(void)
{//=====================

int j;
const wxChar *p;
char param[120];


if(argc > 1)
{
p = argv[1];
j = 0;
#if wxUSE_UNICODE == 1
wcstombs(param, argv[1], sizeof(param));
#else
const char *p = argv[1];
while((param[j] = p[j]) != 0) j++;
#endif

if((strcmp(param,"--help")==0) || (strcmp(param,"-h")==0))
{
@@ -559,23 +559,20 @@ void MyFrame::OnAbout(wxCommandEvent& event)
char buf[300];
wxString url_docs;

wxBoxSizer *topsizer;
HtmlWindow *html;
wxDialog dlg(this, wxID_ANY, wxString(_("About")));

topsizer = new wxBoxSizer(wxVERTICAL);

switch(event.GetId())
{
case MENU_ABOUT:
{
wxDialog dlg(this, wxID_ANY, wxString(_("About")));

sprintf(buf,about_string,espeak_Info(NULL));
html = new HtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
HtmlWindow *html = new HtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
html -> SetBorders(0);
html -> SetPage(wxString(buf,wxConvLocal));
html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
html -> GetInternalRepresentation() -> GetHeight());

wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
topsizer -> Add(html, 1, wxALL, 10);

//#if wxUSE_STATLINE

+ 5
- 2
src/extras.cpp View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2006 to 2011 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2013 by Reece H. Dunn *
* 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 *
@@ -369,6 +369,7 @@ void Lexicon_It(int pass)
{
str = wxString(buf, wxConvLocal);
wxLogError(_T("Can't write file: ") + str);
fclose(f_in);
return;
}

@@ -383,7 +384,7 @@ void Lexicon_It(int pass)
f_listx = fopen(buf,"w");
wxLogStatus(_T("Pass 1"));
}
else
else if(pass == 2)
{
CompileDictionary(path_dsource,"it",NULL,NULL,0);
sprintf(buf,"%s/it_listx2",path_dsource);
@@ -711,6 +712,7 @@ void Lexicon_De()
if((f_out = fopen("compare_de","w")) == NULL)
{
wxLogError(_T("Can't write file "));
fclose(f_out);
return;
}
LoadVoice("de",0);
@@ -1646,6 +1648,7 @@ void MakeWordFreqList()
free(p);
}
fclose(f_out);
free(w_list);

} // end of Make WorkFreqList


+ 4
- 0
src/prosodydisplay.cpp View File

@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 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 *
@@ -106,7 +107,10 @@ void ReadPhondataManifest()
}

if((manifest = (NAMETAB *)realloc(manifest, n_lines * sizeof(NAMETAB))) == NULL)
{
fclose(f);
return;
}

n_manifest = 0;
while(fgets(buf, sizeof(buf), f) != NULL)

+ 21
- 13
src/spect.cpp View File

@@ -256,25 +256,33 @@ int SpectFrame::ImportSPC2(wxInputStream& stream, float &time_acc)
if(cy.flags & 0x04)
markers |= 8;

spect_data = new USHORT[nx];

if(spect_data == NULL)
if(nx>0)
{
wxLogError(_T("Failed to allocate memory"));
return(1);
}
spect_data = new USHORT[nx];

max_y = 0;
for(ix=0; ix<nx; ix++)
{
spect_data[ix] = p->data[ix];
if(spect_data[ix] > max_y)
max_y = spect_data[ix];
if(spect_data == NULL)
{
wxLogError(_T("Failed to allocate memory"));
return(1);
}

max_y = 0;
for(ix=0; ix<nx; ix++)
{
spect_data[ix] = p->data[ix];
if(spect_data[ix] > max_y)
max_y = spect_data[ix];
}
}
if(nx==0)
else
{
nx = int(8000/dx);
spect_data = new USHORT[nx];
if(spect_data == NULL)
{
wxLogError(_T("Failed to allocate memory"));
return(1);
}
for(ix=0; ix<nx; ix++)
spect_data[ix] = 1;
max_y = 1;

+ 1
- 0
src/spectdisplay.cpp View File

@@ -993,6 +993,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& event)
if(stream.Ok() == FALSE)
{
wxLogError(_T("Failed to open '%s'"),filename.c_str());
delete spectseq;
return;
}
wxFileName path = wxFileName(filename);

+ 16
- 4
src/spectseq.cpp View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* Copyright (C) 2013-2015 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 *
@@ -386,16 +386,28 @@ void SpectSeq::Load2(wxInputStream& stream, int import, int n)

if(import==1)
{
if(frame->Import(stream) != 0) break;
if(frame->Import(stream) != 0)
{
delete frame;
break;
}
}
else
if(import==2)
{
if(frame->ImportSPC2(stream,time_acc) != 0) break;
if(frame->ImportSPC2(stream,time_acc) != 0)
{
delete frame;
break;
}
}
else
{
if(frame->Load(stream, file_format) != 0) break;
if(frame->Load(stream, file_format) != 0)
{
delete frame;
break;
}
}

frames[numframes++] = frame;

+ 6
- 0
src/synthdata.cpp View File

@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2014 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 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 *
@@ -98,6 +99,7 @@ static char *ReadPhFile(void *ptr, const char *fname, int *size)
if(fread(p,1,length,f_in) != length)
{
fclose(f_in);
Free(p);
return(NULL);
}

@@ -493,7 +495,11 @@ void LoadConfig(void)
if(memcmp(buf,"log",3)==0)
{
if(sscanf(&buf[4],"%d %s",&logging_type,string)==2)
{
if (f_logespeak)
fclose(f_logespeak);
f_logespeak = fopen(string,"w");
}
}
else
if(memcmp(buf,"tone",4)==0)

+ 4
- 0
src/voices.cpp View File

@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2015 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 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 *
@@ -1100,7 +1101,10 @@ voice_t *LoadVoice(const char *vname, int control)
new_translator->dict_min_size = dict_min;
LoadDictionary(new_translator, new_dictionary, control & 4);
if(dictionary_name[0]==0)
{
DeleteTranslator(new_translator);
return(NULL); // no dictionary loaded
}

new_translator->dict_condition = conditional_rules;


+ 11
- 2
src/vowelchart.cpp View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2013 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* Copyright (C) 2013-2015 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 *
@@ -225,6 +225,7 @@ static int VowelChartDir(wxDC *dc, wxBitmap *bitmap)
if(stream.Ok() == FALSE)
{
path = wxFindNextFile();
delete spectseq;
continue;
}
spectseq->Load(stream);
@@ -328,6 +329,7 @@ static int VowelChartList(wxDC *dc, wxBitmap *bitmap, char *fname)

filename.SetExt(_T("png"));
bitmap->SaveFile(filename.GetFullPath(),wxBITMAP_TYPE_PNG);
fclose(f_in);
return(count);
}

@@ -583,7 +585,10 @@ void MakeVowelLists(void)
ix = GetFileLength(fname);
prog_log_table = (PHONEME_PROG_LOG *)malloc(ix);
if(prog_log_table == NULL)
{
fclose(f_prog_log);
return;
}
ix = fread(prog_log_table, 1, ix, f_prog_log);
fclose(f_prog_log);
n_prog_log = ix / sizeof(PHONEME_PROG_LOG);
@@ -604,7 +609,11 @@ void MakeVowelLists(void)

// select the phoneme table by name
// if(SetVoiceByName(phoneme_tab_list[table].name) != 0) continue;
if(SelectPhonemeTableName(phoneme_tab_list[table].name) < 0) continue;
if(SelectPhonemeTableName(phoneme_tab_list[table].name) < 0)
{
fclose(f);
continue;
}

voice_found = 0;
if((LoadVoice(phoneme_tab_list[table].name, 0) != NULL) && (translator->data_dictrules != NULL))

Loading…
Cancel
Save