Skip to content

Commit

Permalink
Fixing float-equal in GainReductionMeter
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Aug 4, 2023
1 parent e829ab6 commit 2bc0cc7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void GainReductionMeter::BackgroundTask::runTask (const juce::AudioBuffer<float>
compressedLevelPeak = ballisticsFilter.processSample (1, std::abs (compressedData[n]));
}

gainReductionDB = (inputLevelPeak == 0.0f) ? 0.0f : juce::Decibels::gainToDecibels (compressedLevelPeak / inputLevelPeak);
gainReductionDB = juce::approximatelyEqual (inputLevelPeak, 0.0f) ? 0.0f : juce::Decibels::gainToDecibels (compressedLevelPeak / inputLevelPeak);
}

void GainReductionMeter::BackgroundTask::pushBufferData (const chowdsp::BufferView<const float>& buffer, bool isInput)
Expand Down Expand Up @@ -117,7 +117,7 @@ void GainReductionMeter::paint (juce::Graphics& g)
.withLeft (meterWidth * 7 / 4);

auto dbString = juce::String (dbLevel, 0);
if (dbLevel == 0.0f)
if (juce::approximatelyEqual (dbLevel, 0.0f))
dbString += " dB";

g.drawFittedText (dbString, dbRect, juce::Justification::centredLeft, 1);
Expand Down

0 comments on commit 2bc0cc7

Please sign in to comment.