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.
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "../Resources.h"
|
|
#include "../Params.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// LFO shape view. Step-sequencer and freehand shapes are click/drag editable.
|
|
// ===========================================================================
|
|
class LFODisplay : public juce::Component
|
|
{
|
|
public:
|
|
void setShape (int s) { if (shape != s) { shape = s; repaint(); } }
|
|
void setShapeData (const std::vector<float>& data, int steps);
|
|
void setOnShapeEdited (std::function<void (const std::vector<float>&, int)> cb) { onEdited = std::move (cb); }
|
|
|
|
void paint (juce::Graphics& g) override;
|
|
void mouseDown (const juce::MouseEvent& e) override;
|
|
void mouseDrag (const juce::MouseEvent& e) override;
|
|
|
|
private:
|
|
int shape = 0;
|
|
std::vector<float> shapeData;
|
|
int steps = 16;
|
|
std::function<void (const std::vector<float>&, int)> onEdited;
|
|
|
|
float valueAt (float phase) const noexcept;
|
|
void editAt (float x, float y);
|
|
};
|
|
|
|
} // namespace serum
|