#include "Visualisation.h" Visualisation::Visualisation (const RefineDsp& dsp) : sepDsp (dsp), minMag (-30.f), maxMag (0.f) { setOpaque(true); startTimer(100); } Visualisation::~Visualisation() { } void Visualisation::paint (Graphics& g) { g.fillAll(Colour(0xFF101010)); const int w = jmin(rmsData.size(), colourData.size(), getWidth()); const float yBottom = getHeight() - 1.f; for (int i = 0; i> 16) & 0xFF) / 255.f; const float mulGreen = ((colourData.getReference(i) >> 8) & 0xFF) / 255.f; const float mulRed = ((colourData.getReference(i)) & 0xFF) / 255.f; uint8_t r = uint8_t(blue.getRed()*mulBlue + green.getRed()*mulGreen + red.getRed()*mulRed); uint8_t g = uint8_t(blue.getGreen()*mulBlue + green.getGreen()*mulGreen + red.getGreen()*mulRed); uint8_t b = uint8_t(blue.getBlue()*mulBlue + green.getBlue()*mulGreen + red.getBlue()*mulRed); r = 64 + r / 2; g = 64 + g / 2; b = 64 + b / 2; colourData.getReference(i) = (255 << 24) | (r << 16) | (g << 8) | (b << 0); } } if (newMin < 10 && newMin > 0) { newMean /= meanSize; const float dist = jmax(0.01f, jmin(newMax - newMean, newMean - newMin)); newMin = jmax(1e-8f, jmin(0.9f*newMin, newMean - dist)); newMax = jmax(1.1f*newMax, newMean + dist); const float minDb = 10 * std::log10(newMin); const float maxDb = 10 * std::log10(newMax); minMag = minMag*0.95f + 0.05f*minDb; maxMag = maxMag*0.95f + 0.05f*maxDb; } for (int i = 0; i