mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-11 09:03:36 +02:00
Bug1320: Correct contrast window miscalculations of RMS
This commit is contained in:
@@ -364,8 +364,8 @@ bool Sequence::GetRMS(sampleCount start, sampleCount len,
|
||||
float blockMin, blockMax, blockRMS;
|
||||
mBlock->Item(b)->f->GetMinMax(&blockMin, &blockMax, &blockRMS);
|
||||
|
||||
sumsq += blockRMS * blockRMS * mBlock->Item(block0)->f->GetLength();
|
||||
length += mBlock->Item(block0)->f->GetLength();
|
||||
sumsq += blockRMS * blockRMS * mBlock->Item(b)->f->GetLength();
|
||||
length += mBlock->Item(b)->f->GetLength();
|
||||
}
|
||||
|
||||
// Now we take the first and last blocks into account, noting that the
|
||||
@@ -394,6 +394,9 @@ bool Sequence::GetRMS(sampleCount start, sampleCount len,
|
||||
length += l0;
|
||||
}
|
||||
|
||||
// PRL: catch bugs like 1320:
|
||||
wxASSERT(length == len);
|
||||
|
||||
*outRMS = sqrt(sumsq/length);
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user