From 2a2013cb4b1d6be2f78f70624e88a036cc5c4541 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 6 Sep 2016 19:46:56 -0400 Subject: [PATCH] More decltype and auto, mostly for loop index variables --- src/AudioIO.cpp | 8 ++++---- src/BlockFile.cpp | 8 +++----- src/Mix.cpp | 4 ++-- src/Sequence.cpp | 2 +- src/blockfile/SimpleBlockFile.cpp | 5 +++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index c403bd49d..4c498a474 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -4495,14 +4495,14 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer, // Output volume emulation: possibly copy meter samples, then // apply volume, then copy to the output buffer if (outputMeterFloats != outputFloats) - for (int i = 0; i < len; ++i) + for (decltype(len) i = 0; i < len; ++i) outputMeterFloats[numPlaybackChannels*i] += gain*tempFloats[i]; if (gAudioIO->mEmulateMixerOutputVol) gain *= gAudioIO->mMixerOutputVol; - for(int i=0; imEmulateMixerOutputVol) gain *= gAudioIO->mMixerOutputVol; - for(int i=0; i=0; i--) { + for(auto i = len; i--;) { buffer[3*i+2] = (fabs(buffer[2*i]) + fabs(buffer[2*i+1]))/4.0; buffer[3*i+1] = buffer[2*i+1]; buffer[3*i] = buffer[2*i]; @@ -488,8 +487,7 @@ bool BlockFile::Read64K(float *buffer, if (mSummaryInfo.fields == 2) { // No RMS info; make guess - int i; - for(i=len-1; i>=0; i--) { + for(auto i = len; i--;) { buffer[3*i+2] = (fabs(buffer[2*i]) + fabs(buffer[2*i+1]))/4.0; buffer[3*i+1] = buffer[2*i+1]; buffer[3*i] = buffer[2*i]; diff --git a/src/Mix.cpp b/src/Mix.cpp index c0e171939..6f92d55b2 100644 --- a/src/Mix.cpp +++ b/src/Mix.cpp @@ -573,7 +573,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache, auto results = cache.Get(floatSample, *pos - (slen - 1), slen); memcpy(mFloatBuffer, results, sizeof(float) * slen); track->GetEnvelopeValues(mEnvValues, slen, t - (slen - 1) / mRate); - for(int i=0; iGetEnvelopeValues(mEnvValues, slen, t); - for(int i=0; i