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:
parent
e4043f6518
commit
5fd751169f
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user