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.
31 lines
944 B
C++
31 lines
944 B
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "../Resources.h"
|
|
#include "../Wavetable.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// Single-cycle wavetable view (morphs with the WT position knob).
|
|
// ===========================================================================
|
|
class WaveformDisplay : public juce::Component
|
|
{
|
|
public:
|
|
void setWavetables (const WavetableLibrary* lib) { if (wtLib != lib) { wtLib = lib; repaint(); } }
|
|
void setWaveIndex (int index) { if (wave != index) { wave = index; repaint(); } }
|
|
void setFramePosition (float pos) { if (wtPos != pos) { wtPos = pos; repaint(); } }
|
|
void setEnabled (bool e) { if (enabled != e) { enabled = e; repaint(); } }
|
|
|
|
void paint (juce::Graphics& g) override;
|
|
|
|
private:
|
|
const WavetableLibrary* wtLib = nullptr;
|
|
int wave = 0;
|
|
float wtPos = 0.0f;
|
|
bool enabled = true;
|
|
};
|
|
|
|
} // namespace serum
|