Browse Source

espeakedit: inline SpectSeq::Load2 into SpectSeq::Load

master
Reece H. Dunn 9 years ago
parent
commit
d35da4b8b8
2 changed files with 39 additions and 53 deletions
  1. 39
    49
      src/spect.cpp
  2. 0
    4
      src/spect.h

+ 39
- 49
src/spect.cpp View File

} }




void SpectSeq::Load2(wxInputStream& stream, int n)
{//===========================================================
// continuation of load/import
int ix;
wxString string;

int SpectSeq::Load(wxInputStream & stream)
{//=======================================
int n;
int ix;
unsigned int id1, id2;
int set_max_y=0;
float time_offset; float time_offset;
float time_acc=0;
int set_max_y=0;


if(n==0) return;
wxDataInputStream s(stream);

id1 = s.Read32();
id2 = s.Read32();

if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEQ))
{
file_format = 0; // eSpeak formants
}
else
if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEK))
{
file_format = 1; // formants for Klatt synthesizer
}
else
if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSQ2))
{
file_format = 2; // formants for Klatt synthesizer
}
else
{
fprintf(stderr, "Unsupported spectral file format.\n");
return(1);
}

name = s.ReadString();
n = s.Read16();
amplitude = s.Read16();
max_y = s.Read16();
s.Read16();

if(n==0) return(0);


if(frames != NULL) delete frames; if(frames != NULL) delete frames;
frames = new SpectFrame* [n]; frames = new SpectFrame* [n];
max_y = 200; max_y = 200;
else else
max_y = 29000; // disable auto height scaling max_y = 29000; // disable auto height scaling
} // end of SpectSeq::Load2



int SpectSeq::Load(wxInputStream & stream)
{//=======================================
int n;
int ix;
unsigned int id1, id2;

wxDataInputStream s(stream);

id1 = s.Read32();
id2 = s.Read32();

if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEQ))
{
file_format = 0; // eSpeak formants
}
else
if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEK))
{
file_format = 1; // formants for Klatt synthesizer
}
else
if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSQ2))
{
file_format = 2; // formants for Klatt synthesizer
}
else
{
fprintf(stderr, "Unsupported spectral file format.\n");
return(1);
}

name = s.ReadString();
n = s.Read16();
amplitude = s.Read16();
max_y = s.Read16();
s.Read16();
Load2(stream,n);


for(ix=0; ix<numframes; ix++) for(ix=0; ix<numframes; ix++)
{ {

+ 0
- 4
src/spect.h View File

int max_x; int max_x;
int max_y; int max_y;
int file_format; int file_format;


private:
void Load2(wxInputStream& stream, int n);
}; };

Loading…
Cancel
Save