Browse Source

espeakedit: move the definition of SpectFrame::GetRms out of the class

master
Reece H. Dunn 9 years ago
parent
commit
e5610301b0
3 changed files with 10 additions and 10 deletions
  1. 1
    1
      src/compiledata.cpp
  2. 7
    7
      src/spect.cpp
  3. 2
    2
      src/spect.h

+ 1
- 1
src/compiledata.cpp View File



fr_out->frflags = fr->markers | klatt_flag; fr_out->frflags = fr->markers | klatt_flag;


rms = int(fr->GetRms(spectseq->amplitude));
rms = int(GetFrameRms(fr, spectseq->amplitude));
if(rms > 255) rms = 255; if(rms > 255) rms = 255;
fr_out->rms = rms; fr_out->rms = rms;



+ 7
- 7
src/spect.cpp View File







double SpectFrame::GetRms(int seq_amplitude)
double GetFrameRms(SpectFrame *frame, int seq_amplitude)
{//========================================= {//=========================================
int h; int h;
float total=0; float total=0;


for(h=0; h<9; h++) for(h=0; h<9; h++)
{ {
height = (peaks[h].pkheight * seq_amplitude * amp_adjust)/10000;
height = (frame->peaks[h].pkheight * seq_amplitude * frame->amp_adjust)/10000;
wpeaks[h].height = height << 8; wpeaks[h].height = height << 8;


wpeaks[h].freq = peaks[h].pkfreq << 16;
wpeaks[h].left = peaks[h].pkwidth << 16;
wpeaks[h].right = peaks[h].pkright << 16;
wpeaks[h].freq = frame->peaks[h].pkfreq << 16;
wpeaks[h].left = frame->peaks[h].pkwidth << 16;
wpeaks[h].right = frame->peaks[h].pkright << 16;
} }


maxh = PeaksToHarmspect(wpeaks,90<<16,htab,0); maxh = PeaksToHarmspect(wpeaks,90<<16,htab,0);
{ {
total += ((htab[h] * htab[h]) >> 10); total += ((htab[h] * htab[h]) >> 10);
} }
rms = sqrt(total) / 7.25;
return(rms);
frame->rms = sqrt(total) / 7.25;
return(frame->rms);
} }





+ 2
- 2
src/spect.h View File

SpectFrame(SpectFrame *copy=NULL); SpectFrame(SpectFrame *copy=NULL);
~SpectFrame(); ~SpectFrame();


double GetRms(int amp);

int keyframe; int keyframe;
int amp_adjust; int amp_adjust;
float length_adjust; float length_adjust;
peak_t peaks[N_PEAKS]; peak_t peaks[N_PEAKS];
}; };


double GetFrameRms(SpectFrame *frame, int amp);

class SpectSeq class SpectSeq
{//=========== {//===========
public: public:

Loading…
Cancel
Save