1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-19 17:40:15 +02:00

More decltype and auto, mostly for loop index variables

This commit is contained in:
Paul Licameli 2016-09-06 19:46:56 -04:00
parent 919d77d176
commit 2a2013cb4b
5 changed files with 13 additions and 14 deletions

View File

@ -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; i<len; i++)
for(decltype(len) i = 0; i < len; i++)
outputFloats[numPlaybackChannels*i] += gain*tempBufs[c][i];
}
@ -4513,14 +4513,14 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
// Output volume emulation (as above)
if (outputMeterFloats != outputFloats)
for (int i = 0; i < len; ++i)
for (decltype(len) i = 0; i < len; ++i)
outputMeterFloats[numPlaybackChannels*i+1] +=
gain*tempFloats[i];
if (gAudioIO->mEmulateMixerOutputVol)
gain *= gAudioIO->mMixerOutputVol;
for(int i=0; i<len; i++)
for(decltype(len) i = 0; i < len; i++)
outputFloats[numPlaybackChannels*i+1] += gain*tempBufs[c][i];
}
}

View File

@ -387,7 +387,7 @@ void BlockFile::GetMinMax(sampleCount start, sampleCount len,
float max = -FLT_MAX;
float sumsq = 0;
for( int i = 0; i < len; i++ )
for( decltype(len) i = 0; i < len; i++ )
{
float sample = ((float*)blockData.ptr())[i];
@ -447,8 +447,7 @@ bool BlockFile::Read256(float *buffer,
if (mSummaryInfo.fields == 2) {
// No RMS info
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];
@ -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];

View File

@ -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; i<slen; i++)
for(decltype(slen) i = 0; i < slen; i++)
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
ReverseSamples((samplePtr)mFloatBuffer, floatSample, 0, slen);
@ -583,7 +583,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
auto results = cache.Get(floatSample, *pos, slen);
memcpy(mFloatBuffer, results, sizeof(float) * slen);
track->GetEnvelopeValues(mEnvValues, slen, t);
for(int i=0; i<slen; i++)
for(decltype(slen) i = 0; i < slen; i++)
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
*pos += slen;

View File

@ -1764,7 +1764,7 @@ bool Sequence::ConsistencyCheck(const wxChar *whereStr) const
void Sequence::DebugPrintf(wxString *dest) const
{
unsigned int i;
int pos = 0;
decltype(mNumSamples) pos = 0;
for (i = 0; i < mBlock.size(); i++) {
const SeqBlock &seqBlock = mBlock[i];

View File

@ -624,10 +624,11 @@ void SimpleBlockFile::Recover(){
header.channels = 1;
file.Write(&header, sizeof(header));
for(i=0;i<mSummaryInfo.totalSummaryBytes;i++)
for(decltype(mSummaryInfo.totalSummaryBytes) i = 0;
i < mSummaryInfo.totalSummaryBytes; i++)
file.Write(wxT("\0"),1);
for(i=0;i<mLen*2;i++)
for(decltype(mLen) i = 0; i < mLen * 2; i++)
file.Write(wxT("\0"),1);
}