mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-20 14:20:06 +02:00
More decltype and auto, mostly for loop index variables
This commit is contained in:
parent
919d77d176
commit
2a2013cb4b
@ -4495,14 +4495,14 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
|
|||||||
// Output volume emulation: possibly copy meter samples, then
|
// Output volume emulation: possibly copy meter samples, then
|
||||||
// apply volume, then copy to the output buffer
|
// apply volume, then copy to the output buffer
|
||||||
if (outputMeterFloats != outputFloats)
|
if (outputMeterFloats != outputFloats)
|
||||||
for (int i = 0; i < len; ++i)
|
for (decltype(len) i = 0; i < len; ++i)
|
||||||
outputMeterFloats[numPlaybackChannels*i] +=
|
outputMeterFloats[numPlaybackChannels*i] +=
|
||||||
gain*tempFloats[i];
|
gain*tempFloats[i];
|
||||||
|
|
||||||
if (gAudioIO->mEmulateMixerOutputVol)
|
if (gAudioIO->mEmulateMixerOutputVol)
|
||||||
gain *= gAudioIO->mMixerOutputVol;
|
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];
|
outputFloats[numPlaybackChannels*i] += gain*tempBufs[c][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4513,14 +4513,14 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
|
|||||||
|
|
||||||
// Output volume emulation (as above)
|
// Output volume emulation (as above)
|
||||||
if (outputMeterFloats != outputFloats)
|
if (outputMeterFloats != outputFloats)
|
||||||
for (int i = 0; i < len; ++i)
|
for (decltype(len) i = 0; i < len; ++i)
|
||||||
outputMeterFloats[numPlaybackChannels*i+1] +=
|
outputMeterFloats[numPlaybackChannels*i+1] +=
|
||||||
gain*tempFloats[i];
|
gain*tempFloats[i];
|
||||||
|
|
||||||
if (gAudioIO->mEmulateMixerOutputVol)
|
if (gAudioIO->mEmulateMixerOutputVol)
|
||||||
gain *= gAudioIO->mMixerOutputVol;
|
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];
|
outputFloats[numPlaybackChannels*i+1] += gain*tempBufs[c][i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ void BlockFile::GetMinMax(sampleCount start, sampleCount len,
|
|||||||
float max = -FLT_MAX;
|
float max = -FLT_MAX;
|
||||||
float sumsq = 0;
|
float sumsq = 0;
|
||||||
|
|
||||||
for( int i = 0; i < len; i++ )
|
for( decltype(len) i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
float sample = ((float*)blockData.ptr())[i];
|
float sample = ((float*)blockData.ptr())[i];
|
||||||
|
|
||||||
@ -447,8 +447,7 @@ bool BlockFile::Read256(float *buffer,
|
|||||||
|
|
||||||
if (mSummaryInfo.fields == 2) {
|
if (mSummaryInfo.fields == 2) {
|
||||||
// No RMS info
|
// No RMS info
|
||||||
int i;
|
for(auto i = len; i--;) {
|
||||||
for(i=len-1; i>=0; i--) {
|
|
||||||
buffer[3*i+2] = (fabs(buffer[2*i]) + fabs(buffer[2*i+1]))/4.0;
|
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+1] = buffer[2*i+1];
|
||||||
buffer[3*i] = buffer[2*i];
|
buffer[3*i] = buffer[2*i];
|
||||||
@ -488,8 +487,7 @@ bool BlockFile::Read64K(float *buffer,
|
|||||||
|
|
||||||
if (mSummaryInfo.fields == 2) {
|
if (mSummaryInfo.fields == 2) {
|
||||||
// No RMS info; make guess
|
// No RMS info; make guess
|
||||||
int i;
|
for(auto i = len; i--;) {
|
||||||
for(i=len-1; i>=0; i--) {
|
|
||||||
buffer[3*i+2] = (fabs(buffer[2*i]) + fabs(buffer[2*i+1]))/4.0;
|
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+1] = buffer[2*i+1];
|
||||||
buffer[3*i] = buffer[2*i];
|
buffer[3*i] = buffer[2*i];
|
||||||
|
@ -573,7 +573,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
|
|||||||
auto results = cache.Get(floatSample, *pos - (slen - 1), slen);
|
auto results = cache.Get(floatSample, *pos - (slen - 1), slen);
|
||||||
memcpy(mFloatBuffer, results, sizeof(float) * slen);
|
memcpy(mFloatBuffer, results, sizeof(float) * slen);
|
||||||
track->GetEnvelopeValues(mEnvValues, slen, t - (slen - 1) / mRate);
|
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?
|
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
|
||||||
ReverseSamples((samplePtr)mFloatBuffer, floatSample, 0, slen);
|
ReverseSamples((samplePtr)mFloatBuffer, floatSample, 0, slen);
|
||||||
|
|
||||||
@ -583,7 +583,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
|
|||||||
auto results = cache.Get(floatSample, *pos, slen);
|
auto results = cache.Get(floatSample, *pos, slen);
|
||||||
memcpy(mFloatBuffer, results, sizeof(float) * slen);
|
memcpy(mFloatBuffer, results, sizeof(float) * slen);
|
||||||
track->GetEnvelopeValues(mEnvValues, slen, t);
|
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?
|
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
|
||||||
|
|
||||||
*pos += slen;
|
*pos += slen;
|
||||||
|
@ -1764,7 +1764,7 @@ bool Sequence::ConsistencyCheck(const wxChar *whereStr) const
|
|||||||
void Sequence::DebugPrintf(wxString *dest) const
|
void Sequence::DebugPrintf(wxString *dest) const
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int pos = 0;
|
decltype(mNumSamples) pos = 0;
|
||||||
|
|
||||||
for (i = 0; i < mBlock.size(); i++) {
|
for (i = 0; i < mBlock.size(); i++) {
|
||||||
const SeqBlock &seqBlock = mBlock[i];
|
const SeqBlock &seqBlock = mBlock[i];
|
||||||
|
@ -624,10 +624,11 @@ void SimpleBlockFile::Recover(){
|
|||||||
header.channels = 1;
|
header.channels = 1;
|
||||||
file.Write(&header, sizeof(header));
|
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);
|
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);
|
file.Write(wxT("\0"),1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user