1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 16:39:30 +02:00

Update Amplify.cpp

Fix for a rounding bug that causes the OK button to be sometimes greyed out. The bug may be Linux only (not tested on other platforms) but should not adversely affect other OS's.
This commit is contained in:
Steve Daulton 2015-05-13 13:26:15 +01:00
parent e4043f6518
commit 5fd751169f

View File

@ -279,7 +279,12 @@ bool EffectAmplify::TransferDataFromWindow()
void EffectAmplify::CheckClip()
{
EnableApply(mClip->GetValue() || (mPeak > 0.0f && mRatio <= 1.0f/mPeak));
// On Linux (not tested other platforms), 1.0f/mPeak is calculated at higher precision
// than the (float) value of mRatio, that is, the value is rounded in mRatio = 1/mPeak,
// so there is no guarantee that mRatio == 1/mPeak. To test for equality, assign the value
// of 1/mPeak to a float rather than directly comparing mRatio <= 1.0f/mPeak
float peakInv = 1.0f/mPeak;
EnableApply(mClip->GetValue() || (mPeak > 0.0f && mRatio <= peakInv));
}
void EffectAmplify::OnAmpText(wxCommandEvent & WXUNUSED(evt))