1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-08 14:13:57 +01:00

More uses of min and max

This commit is contained in:
Paul Licameli
2016-09-02 12:50:40 -04:00
parent f372aee9a1
commit 919d77d176
8 changed files with 24 additions and 44 deletions

View File

@@ -370,9 +370,7 @@ bool EffectCompressor::InitPass1()
SelectedTrackListOfKindIterator iter(Track::Wave, mTracks);
WaveTrack *track = (WaveTrack *) iter.First();
while (track) {
auto len = track->GetMaxBlockSize();
if(len > maxlen)
maxlen = len;
maxlen = std::max<size_t>(maxlen, track->GetMaxBlockSize());
//Iterate to the next track
track = (WaveTrack *) iter.Next();
}

View File

@@ -1092,9 +1092,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
for(i=0; i<block; i+=L) //go through block in lumps of length L
{
wcopy = L;
if (i + wcopy > block) //if last lump would exceed block
wcopy = block - i; //shorten it
wcopy = std::min <int> (L, block - i);
for(j=0; j<wcopy; j++)
thisWindow[j] = buffer[i+j]; //copy the L (or remaining) samples
for(j=wcopy; j<windowSize; j++)

View File

@@ -417,7 +417,7 @@ bool EffectEqualization48x::DeltaTrack(WaveTrack * t, WaveTrack * t2, sampleCoun
auto currentSample = start;
while(len) {
auto curretLength = (trackBlockSize > len) ? len : trackBlockSize;
auto curretLength = std::min(len, trackBlockSize);
t->Get((samplePtr)buffer1, floatSample, currentSample, curretLength);
t2->Get((samplePtr)buffer2, floatSample, currentSample, curretLength);
for(decltype(curretLength) i=0;i<curretLength;i++)