1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00

FFTSimpleExample: avoid an assertion when the input audio is a block of samples all of which are exactly zero

This commit is contained in:
hogliux 2017-08-24 14:22:45 +01:00
parent ade10c9328
commit 8433b3799d

View file

@ -124,7 +124,7 @@ public:
{
const float skewedProportionY = 1.0f - std::exp (std::log (y / (float) imageHeight) * 0.2f);
const int fftDataIndex = jlimit (0, fftSize / 2, (int) (skewedProportionY * fftSize / 2));
const float level = jmap (fftData[fftDataIndex], 0.0f, maxLevel.getEnd(), 0.0f, 1.0f);
const float level = jmap (fftData[fftDataIndex], 0.0f, jmax (maxLevel.getEnd(), 1e-5f), 0.0f, 1.0f);
spectrogramImage.setPixelAt (rightHandEdge, y, Colour::fromHSV (level, 1.0f, level, 1.0f));
}