Browse Source

espeakedit: move the definition of SpectFrame::Load into spect.cpp

master
Reece H. Dunn 9 years ago
parent
commit
cfb0a8a111
2 changed files with 25 additions and 26 deletions
  1. 25
    25
      src/spect.cpp
  2. 0
    1
      src/spect.h

+ 25
- 25
src/spect.cpp View File







int SpectFrame::Load(wxInputStream& stream, int file_format_type)
int LoadFrame(SpectFrame &frame, wxInputStream& stream, int file_format_type)
{//============================================================== {//==============================================================
int ix; int ix;
int x; int x;


wxDataInputStream s(stream); wxDataInputStream s(stream);


time = s.ReadDouble();
pitch = s.ReadDouble();
length = s.ReadDouble();
dx = s.ReadDouble();
nx = s.Read16();
markers = s.Read16();
amp_adjust = s.Read16();
frame.time = s.ReadDouble();
frame.pitch = s.ReadDouble();
frame.length = s.ReadDouble();
frame.dx = s.ReadDouble();
frame.nx = s.Read16();
frame.markers = s.Read16();
frame.amp_adjust = s.Read16();


if(file_format_type == 2) if(file_format_type == 2)
{ {


for(ix=0; ix<N_PEAKS; ix++) for(ix=0; ix<N_PEAKS; ix++)
{ {
formants[ix].freq = s.Read16();
formants[ix].bandw = s.Read16();
peaks[ix].pkfreq = s.Read16();
if((peaks[ix].pkheight = s.Read16()) > 0)
keyframe = 1;
peaks[ix].pkwidth = s.Read16();
peaks[ix].pkright = s.Read16();
frame.formants[ix].freq = s.Read16();
frame.formants[ix].bandw = s.Read16();
frame.peaks[ix].pkfreq = s.Read16();
if((frame.peaks[ix].pkheight = s.Read16()) > 0)
frame.keyframe = 1;
frame.peaks[ix].pkwidth = s.Read16();
frame.peaks[ix].pkright = s.Read16();


if(file_format_type == 2) if(file_format_type == 2)
{ {
peaks[ix].klt_bw = s.Read16();
peaks[ix].klt_ap = s.Read16();
peaks[ix].klt_bp = s.Read16();
frame.peaks[ix].klt_bw = s.Read16();
frame.peaks[ix].klt_ap = s.Read16();
frame.peaks[ix].klt_bp = s.Read16();
} }
} }


{ {
for(ix=0; ix<N_KLATTP2; ix++) for(ix=0; ix<N_KLATTP2; ix++)
{ {
klatt_param[ix] = s.Read16();
frame.klatt_param[ix] = s.Read16();
} }
} }


spect_data = new USHORT[nx];
spect_data = new USHORT[frame.nx];


if(spect_data == NULL) if(spect_data == NULL)
{ {
return(1); return(1);
} }


max_y = 0;
for(ix=0; ix<nx; ix++)
frame.max_y = 0;
for(ix=0; ix<frame.nx; ix++)
{ {
x = spect_data[ix] = s.Read16(); x = spect_data[ix] = s.Read16();
if(x > max_y) max_y = x;
if(x > frame.max_y) frame.max_y = x;
} }
spect = spect_data;
frame.spect = spect_data;


return(0); return(0);
} // End of SpectFrame::Load } // End of SpectFrame::Load
{ {
SpectFrame *frame = new SpectFrame; SpectFrame *frame = new SpectFrame;


if(frame->Load(stream, file_format) != 0)
if(LoadFrame(*frame, stream, file_format) != 0)
{ {
delete frame; delete frame;
break; break;

+ 0
- 1
src/spect.h View File

public: public:
SpectFrame(SpectFrame *copy=NULL); SpectFrame(SpectFrame *copy=NULL);
~SpectFrame(); ~SpectFrame();
int Load(wxInputStream &stream, int file_format_type);


double GetRms(int amp); double GetRms(int amp);



Loading…
Cancel
Save