Add change detection to Display, WaveformDisplay, FilterDisplay, EnvelopeDisplay, and LFODisplay so repaint() is only called when values actually change. Gate updateVisuals() by currentTab so only the visible tab's displays are updated each timer tick. Similarly gate updateModList/updateMacroList to their respective tabs. Manage dynamically created controls via ownedControls unique_ptr vector instead of raw new leaks. Null-check parameter lookups before creating attachments. Hold engine control lock when reading matrix/macros/LFO shape data. Fix envelope display curve directions (attack rising from bottom, decay falling toward sustain, release falling toward bottom). Add tooltip to FilterDisplay noting the approximation. Replace ToggleButton raw param pointer with ParameterAttachment for proper gesture handling. Sync preset and scale combos to processor state.
33 lines
1009 B
C++
33 lines
1009 B
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "../Resources.h"
|
|
#include "../Params.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// Approximate filter frequency-response view (magnitude vs log frequency).
|
|
// ===========================================================================
|
|
class FilterDisplay : public juce::Component,
|
|
public juce::SettableTooltipClient
|
|
{
|
|
public:
|
|
FilterDisplay() { setTooltip ("Approximate response preview; slope, drive and modulation are not modelled."); }
|
|
void setParams (int type, float cutoff, float res, float drive, int slope);
|
|
void setEnabled (bool e) { if (enabled != e) { enabled = e; repaint(); } }
|
|
|
|
void paint (juce::Graphics& g) override;
|
|
|
|
static float magnitude (float freqHz, float cutoffHz, float res, int type);
|
|
|
|
private:
|
|
int type = 0;
|
|
float cutoff = 0.5f, res = 0.0f, drive = 0.0f;
|
|
int slope = 2;
|
|
bool enabled = true;
|
|
};
|
|
|
|
} // namespace serum
|