From aa3bc83139f6fcbd83357f1000138f97da9d45ee Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 13 Dec 2015 11:03:44 +0000 Subject: [PATCH] espeakedit: remove support for importing the old SPC2 files (these are not present when building the project) --- src/spect.cpp | 167 ++------------------------------------------------ src/spect.h | 42 +------------ 2 files changed, 6 insertions(+), 203 deletions(-) diff --git a/src/spect.cpp b/src/spect.cpp index ec10d1ad..4cb29392 100644 --- a/src/spect.cpp +++ b/src/spect.cpp @@ -158,96 +158,6 @@ SpectFrame::~SpectFrame() delete spect; } -int SpectFrame::ImportSPC2(wxInputStream& stream, float &time_acc) -{//=============================================================== - int ix; - int size; - unsigned short *spect_data; - CYCLE cy; - CYCLE *p; - float len; - static char peak_factor[8] = {4,5,11,20,20,25,32,32}; - - stream.Read(&cy,44); - size = SPC2_size_cycle(&cy); - - p = (CYCLE *)malloc(size); - if(p == NULL) - { - return(1); - } - stream.SeekI(-44,wxFromCurrent); - stream.Read(p,size); - - time = time_acc; - len = cy.length / 15625.0; - time_acc += len; - pitch = float(cy.pitch) / 16.0; - nx = cy.n_harm; - dx = pitch; - - for(ix=0; ix<7; ix++) - { - peaks[ix].pkfreq = cy.peak_data[ix].freq * peak_factor[ix]; - if(peaks[ix].pkfreq == 0) - peaks[ix].pkfreq = default_freq[ix]; - - peaks[ix].pkheight = cy.peak_data[ix].height * 40; - peaks[ix].pkwidth = cy.peak_data[ix].width_l * 12; - peaks[ix].pkright = cy.peak_data[ix].width_r * 12; - } - for(ix=7; ix<=8; ix++) - { - peaks[ix].pkfreq = default_freq[ix]; // default - peaks[ix].pkheight = 0; - peaks[ix].pkwidth = peaks[ix].pkright = default_width[ix]; - } - if(((cy.flags & 0x80)==0) && (peaks[1].pkheight > 0)) - keyframe = 1; - - if(cy.flags & 0x08) - markers |= 4; - if(cy.flags & 0x10) - markers |= 2; - if(cy.flags & 0x04) - markers |= 8; - - if(nx>0) - { - spect_data = new USHORT[nx]; - - if(spect_data == NULL) - { - wxLogError(_T("Failed to allocate memory")); - return(1); - } - - max_y = 0; - for(ix=0; ixdata[ix]; - if(spect_data[ix] > max_y) - max_y = spect_data[ix]; - } - } - 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; ixLoad(stream, file_format) != 0) { - if(frame->ImportSPC2(stream,time_acc) != 0) - { - delete frame; - break; - } - } - else - { - if(frame->Load(stream, file_format) != 0) - { - delete frame; - break; - } + delete frame; + break; } frames[numframes++] = frame; @@ -652,56 +551,6 @@ else } // end of SpectSeq::Load2 -int SPC2_size_cycle(CYCLE *cy) -/****************************/ -/* Find number of bytes in cycle record */ -{ - int i; - - i = 44 + cy->n_harm; - - if(cy->flags & 1) - { - i += 4; /* label */ - } - return(i); -} /* end of size_cycle */ - - - - -int SpectSeq::ImportSPC2(wxInputStream & stream) -{//============================================= -// load an spectrum with an old "SPC2" format - int n_cycles = 0; - int x; - CYCLE cy; - - /* count number of cycles */ - while(!stream.Eof()) - { - stream.TellI(); - stream.Read(&cy,44); - stream.TellI(); - if(stream.Eof()) break; - - n_cycles++; - x = SPC2_size_cycle(&cy) - 44; - stream.SeekI(x,wxFromCurrent); - } - - if(n_cycles == 0) return(0); - - name = _T(""); - amplitude = 100; - max_y = 0; - - stream.SeekI(4); // rewind and skip header - Load2(stream,2,n_cycles); - - return(0); -} - int SpectSeq::Load(wxInputStream & stream) {//======================================= @@ -714,12 +563,6 @@ int SpectSeq::Load(wxInputStream & stream) id1 = s.Read32(); id2 = s.Read32(); - if(id1 == FILEID1_SPC2) - { - stream.SeekI(4); - return(ImportSPC2(stream)); - } - else if((id1 == FILEID1_SPECTSEQ) && (id2 == FILEID2_SPECTSEQ)) { file_format = 0; // eSpeak formants @@ -745,7 +588,7 @@ int SpectSeq::Load(wxInputStream & stream) amplitude = s.Read16(); max_y = s.Read16(); s.Read16(); - Load2(stream,0,n); + Load2(stream,n); for(ix=0; ix