From 92d522132e76fe71541cae5acbd2f5059f5d2310 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Thu, 23 Apr 2015 18:30:38 +0200 Subject: [PATCH] Variable cleanup --- src/AudioIO.cpp | 4 +--- src/Envelope.cpp | 4 ++-- src/FreqWindow.cpp | 2 -- src/TrackArtist.cpp | 1 - src/TrackPanel.cpp | 3 +-- src/TrackPanel.h | 2 +- src/effects/Equalization.cpp | 1 - src/effects/Leveller.cpp | 1 - src/effects/Phaser.cpp | 2 +- src/effects/TimeWarper.cpp | 2 +- src/import/ImportFFmpeg.cpp | 5 +++++ src/ondemand/ODDecodeFFmpegTask.cpp | 3 --- src/toolbars/MeterToolBar.cpp | 2 -- src/widgets/Ruler.cpp | 1 - 14 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index a9faa3557..c3d472603 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -2283,7 +2283,7 @@ void AudioIO::StopStream() } if( appendRecord ) { // append-recording - bool bResult = true; + bool bResult; if (recordingOffset < 0) bResult = track->Clear(mT0, mT0 - recordingOffset); // cut the latency out else @@ -4115,7 +4115,6 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, bool selected = false; int group = 0; int chanCnt = 0; - float rate = 0.0; int maxLen = 0; for (t = 0; t < numPlaybackTracks; t++) { @@ -4136,7 +4135,6 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, if (vt->GetMute() && !vt->GetSolo()) cut = true; - rate = vt->GetRate(); linkFlag = vt->GetLinked(); selected = vt->GetSelected(); diff --git a/src/Envelope.cpp b/src/Envelope.cpp index b4892292e..b70f3b15a 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -1292,14 +1292,14 @@ static double SolveIntegrateInverseInterpolated(double y1, double y2, double tim else if(1.0 + a * y1 * l <= 0.0) res = 1.0; else - res = log(1.0 + a * y1 * l) / l; + res = log1p(a * y1 * l) / l; } else { if(fabs(y2 - y1) < 1.0e-5) // fall back to average res = a * (y1 + y2) * 0.5; else - res = y1 * (exp(a * (y2 - y1)) - 1.0) / (y2 - y1); + res = y1 * expm1(a * (y2 - y1)) / (y2 - y1); } return std::max(0.0, std::min(1.0, res)) * time; } diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index a54580eab..82c6346fa 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -1064,7 +1064,6 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc, mProcessed[i] = float(0.0); float *in = new float[mWindowSize]; - float *in2 = new float[mWindowSize]; float *out = new float[mWindowSize]; float *out2 = new float[mWindowSize]; float *win = new float[mWindowSize]; @@ -1277,7 +1276,6 @@ bool SpectrumAnalyst::Calculate(Algorithm alg, int windowFunc, } delete[]in; - delete[]in2; delete[]out; delete[]out2; delete[]win; diff --git a/src/TrackArtist.cpp b/src/TrackArtist.cpp index 7e115d2cb..218c2b73a 100644 --- a/src/TrackArtist.cpp +++ b/src/TrackArtist.cpp @@ -2199,7 +2199,6 @@ void TrackArtist::DrawClipSpectrum(WaveTrack *track, } } int it=0; - int oldBin0=-1; bool inMaximum = false; #endif //EXPERIMENTAL_FIND_NOTES diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 6e650097e..d36631b06 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -7187,7 +7187,7 @@ void TrackPanel::DrawTracks(wxDC * dc) *dc, region, tracksRect, clip, mViewInfo, envelopeFlag, samplesFlag, sliderFlag); - DrawEverythingElse(dc, region, panelRect, clip); + DrawEverythingElse(dc, region, clip); } /// Draws 'Everything else'. In particular it draws: @@ -7196,7 +7196,6 @@ void TrackPanel::DrawTracks(wxDC * dc) /// - Fills in space below the tracks. void TrackPanel::DrawEverythingElse(wxDC * dc, const wxRegion ®ion, - const wxRect & WXUNUSED(panelRect), const wxRect & clip) { // We draw everything else diff --git a/src/TrackPanel.h b/src/TrackPanel.h index e97ca7900..80cb6fce7 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -522,7 +522,7 @@ protected: virtual void DrawTracks(wxDC * dc); virtual void DrawEverythingElse(wxDC *dc, const wxRegion & region, - const wxRect & panelRect, const wxRect & clip); + const wxRect & clip); virtual void DrawOutside(Track *t, wxDC *dc, const wxRect & rec, const wxRect &trackRect); void DrawScrubSpeed(wxDC &dc); diff --git a/src/effects/Equalization.cpp b/src/effects/Equalization.cpp index ea4c073d8..141cdb9e3 100644 --- a/src/effects/Equalization.cpp +++ b/src/effects/Equalization.cpp @@ -955,7 +955,6 @@ bool EffectEqualization::TransferDataFromWindow() int m = 2 * mMSlider->GetValue() + 1; // odd numbers only if (m != mM) { - rr = true; mM = m; mPanel->ForceRecalc(); diff --git a/src/effects/Leveller.cpp b/src/effects/Leveller.cpp index 92805a5ec..721e49ca7 100644 --- a/src/effects/Leveller.cpp +++ b/src/effects/Leveller.cpp @@ -283,7 +283,6 @@ void EffectLeveller::CalcLevellerFactors() limit = gLimit[f]; prevAdjLimit = gAdjLimit[prev]; addOnValue = prevAdjLimit - (adjFactor * prevLimit); - upperAdjLimit = (adjFactor * limit) + addOnValue; gAddOnValue[f] = addOnValue; gAdjLimit[f] = (adjFactor * limit) + addOnValue; diff --git a/src/effects/Phaser.cpp b/src/effects/Phaser.cpp index c4b1be586..54cfabc17 100644 --- a/src/effects/Phaser.cpp +++ b/src/effects/Phaser.cpp @@ -157,7 +157,7 @@ sampleCount EffectPhaser::ProcessBlock(float **inBlock, float **outBlock, sample gain = (1.0 + cos(skipcount * lfoskip + phase)) / 2.0; // change lfo shape - gain = (exp(gain * phaserlfoshape) - 1.0) / (exp(phaserlfoshape) - 1.0); + gain = expm1(gain * phaserlfoshape) / expm1(phaserlfoshape); // attenuate the lfo gain = 1.0 - gain / 255.0 * mDepth; diff --git a/src/effects/TimeWarper.cpp b/src/effects/TimeWarper.cpp index 095b9e8fc..5200161a0 100644 --- a/src/effects/TimeWarper.cpp +++ b/src/effects/TimeWarper.cpp @@ -121,7 +121,7 @@ GeometricInputTimeWarper::GeometricInputTimeWarper(double tStart, double tEnd, double GeometricOutputTimeWarper::Warp(double originalTime) const { double scaledTime = mTimeWarper.Warp(originalTime); - return mTStart + mScale*log(mC0 * scaledTime + 1.0); + return mTStart + mScale*log1p(mC0 * scaledTime); } GeometricOutputTimeWarper::GeometricOutputTimeWarper(double tStart, double tEnd, diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index 5a7a26afd..f349b0f91 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -778,6 +778,11 @@ int FFmpegImportFileHandle::WriteData(streamContext *sc) default: wxLogError(wxT("Stream %d has unrecognized sample format %d."), streamid, sc->m_samplefmt); + for (int chn=0; chn < nChannels; chn++) + { + free(tmp[chn]); + } + free(tmp); return 1; break; } diff --git a/src/ondemand/ODDecodeFFmpegTask.cpp b/src/ondemand/ODDecodeFFmpegTask.cpp index 5b97b352c..431ca1f24 100644 --- a/src/ondemand/ODDecodeFFmpegTask.cpp +++ b/src/ondemand/ODDecodeFFmpegTask.cpp @@ -304,8 +304,6 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount samplePtr bufStart = data; streamContext* sc = NULL; - int nChannels; - // printf("start %llu len %llu\n", start, len); //TODO update this to work with seek - this only works linearly now. if(mCurrentPos > start && mCurrentPos <= start+len + kDecodeSampleAllowance) @@ -370,7 +368,6 @@ int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount // ReadNextFrame returns 1 if stream is not to be imported if (sc != (streamContext*)1) { - nChannels = sc->m_stream->codec->channels < sc->m_initialchannels ? sc->m_stream->codec->channels : sc->m_initialchannels; //find out the dts we've seekd to. can't use the stream->cur_dts because it is faulty. also note that until we do the first seek, pkt.dts can be false and will change for the same samples after the initial seek. sampleCount actualDecodeStart = mCurrentPos; diff --git a/src/toolbars/MeterToolBar.cpp b/src/toolbars/MeterToolBar.cpp index 35829803c..ca0a0c06d 100644 --- a/src/toolbars/MeterToolBar.cpp +++ b/src/toolbars/MeterToolBar.cpp @@ -237,9 +237,7 @@ void MeterToolBar::OnSize( wxSizeEvent & event) //WXUNUSED(event) ) bool MeterToolBar::Expose( bool show ) { - bool updated = false; if( show ) { - Meter *meter; if( mPlayMeter ) { mProject->SetPlaybackMeter( mPlayMeter ); } diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index f8ab7f224..cf9ebb5ec 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -867,7 +867,6 @@ void Ruler::TickCustom(int labelIdx, bool major, bool minor) } else { - //strTop =-strH-mLead; strTop = mTop- mLead+4;// More space was needed... mMaxHeight = max(mMaxHeight, strH + 6); }