diff --git a/src/compiledata.cpp b/src/compiledata.cpp index cb0d2ae3..3fa643ea 100644 --- a/src/compiledata.cpp +++ b/src/compiledata.cpp @@ -1623,7 +1623,7 @@ int LoadSpect(const char *path, int control) fr_out->frflags = fr->markers | klatt_flag; - rms = int(fr->GetRms(spectseq->amplitude)); + rms = int(GetFrameRms(fr, spectseq->amplitude)); if(rms > 255) rms = 255; fr_out->rms = rms; diff --git a/src/spect.cpp b/src/spect.cpp index 6402aab3..43fa3cdb 100644 --- a/src/spect.cpp +++ b/src/spect.cpp @@ -222,7 +222,7 @@ int LoadFrame(SpectFrame &frame, wxInputStream& stream, int file_format_type) -double SpectFrame::GetRms(int seq_amplitude) +double GetFrameRms(SpectFrame *frame, int seq_amplitude) {//========================================= int h; float total=0; @@ -233,12 +233,12 @@ double SpectFrame::GetRms(int seq_amplitude) 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].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); @@ -246,8 +246,8 @@ double SpectFrame::GetRms(int seq_amplitude) { total += ((htab[h] * htab[h]) >> 10); } - rms = sqrt(total) / 7.25; - return(rms); + frame->rms = sqrt(total) / 7.25; + return(frame->rms); } diff --git a/src/spect.h b/src/spect.h index 64e9aabd..bc690c0e 100644 --- a/src/spect.h +++ b/src/spect.h @@ -91,8 +91,6 @@ public: SpectFrame(SpectFrame *copy=NULL); ~SpectFrame(); - double GetRms(int amp); - int keyframe; int amp_adjust; float length_adjust; @@ -113,6 +111,8 @@ public: peak_t peaks[N_PEAKS]; }; +double GetFrameRms(SpectFrame *frame, int amp); + class SpectSeq {//=========== public: