Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/GUI-PERFORMANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ArSonComp GUI Performance — isolated LCD (2026-10-31)

## User observation
Task Manager screenshot: 0.4% CPU, 46.4 MB process memory and 2.7% GPU at one instant. These are not host callback duration, continuous memory growth, nor proof of a memory leak. Audio stutter cannot be diagnosed from one Task Manager sample.

## Change
- Split live graph/IN/GR/OUT into an **opaque child canvas**. Parent GUI paints the cached brushed chassis, toolbar and fixed hardware controls. Only the graph canvas receives continuous timer invalidation, preventing re-execution of the parent's text, material and header drawing every meter tick.
- Full canvas draws pre-rendered black LCD/grid plus actual signals/meters. MINI repaints only the 47px meter well. All image decoding and path generation remain on JUCE message thread.
- Preserve native threshold drag by forwarding graph canvas mouse coordinates to parent editor. APVTS automation and host callbacks remain untouched.
- Coalesce idle repaint requests when no new SPSC telemetry, no stopped-transport history ageing, and no perceptible meter decay. Keep the 30 Hz live visualization while active.
- Restore the intended 740×585 minimum / 780×640 default resize limits. No new audio worker, mutex, audio allocation, latency, DSP modification, or file I/O from processBlock.

## Test gate
- Actual Windows VST3 + Standalone, JUCE GUI render screenshots at minimum/default/SIDECHAIN/MINI; engine-safety test on Linux.
- Editor smoke asserts the opaque child bounds at 740×585, 780×640 and MINI, plus restored FULL layout.
- Physical Windows interface/DAW comparison is still required for GUI on/off, same driver/buffer and 30–60-minute run; measure actual xrun counters and sustained CPU/GPU and memory, not Task Manager snapshot alone.

Technical reference: JUCE developer ADC 2025 session on component hierarchy, opaque components, cached painting and avoiding repeated work in paint: https://conference.audio.dev/session/2025/understanding-juce-drawing/
58 changes: 48 additions & 10 deletions plugin/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ Editor::Editor(Processor& p):AudioProcessorEditor(p),processor(p),alternate(p.sn
k.setComponentID("param."+juce::String(spec.id));
k.onValueChange=[this,i] {
if(hoveredParameter==i)updateHoverReadout(i);
if(i==arson::Threshold || i==arson::Ratio ||
i==arson::Knee || i==arson::Range)
graphCanvas.repaint();
};
juce::String shortLabel=juce::String(spec.name).toUpperCase();
if(i==arson::Highpass) shortLabel="HP";
Expand Down Expand Up @@ -461,6 +464,7 @@ Editor::Editor(Processor& p):AudioProcessorEditor(p),processor(p),alternate(p.sn
}
};
addAndMakeVisible(compact);
addAndMakeVisible(graphCanvas);
hoverReadout.setComponentID("view.value.readout");
hoverReadout.setFont(juce::FontOptions(11.0f));
hoverReadout.setColour(juce::Label::textColourId,accentBright);
Expand All @@ -473,7 +477,7 @@ Editor::Editor(Processor& p):AudioProcessorEditor(p),processor(p),alternate(p.sn
presets.setSelectedId(0,juce::dontSendNotification);
presets.setText("Custom / restored",juce::dontSendNotification);
setResizable(true,true);
setResizeLimits(860,700,1200,965);
setResizeLimits(740,585,1200,965);
setSize(780,640);
syncPanelVisibility();
startTimerHz(30);
Expand All @@ -486,6 +490,33 @@ Editor::~Editor() {
parameter->endChangeGesture();
setLookAndFeel(nullptr);
}
void Editor::GraphCanvas::paint(juce::Graphics& g) {
if(owner.compactMode) {
if(owner.metalSurface.isValid())
g.drawImageAt(owner.metalSurface,-getX(),-getY());
else g.fillAll(juce::Colour{0xff0b1014});
juce::Graphics::ScopedSaveState saved(g);
g.setOrigin(-getX(),-getY());
owner.paintCompactMeters(g);
} else {
if(owner.grid.isValid())g.drawImageAt(owner.grid,0,0);
else g.fillAll(juce::Colour{0xff070b0d});
owner.drawDisplay(g);
}
}
void Editor::GraphCanvas::mouseDown(const juce::MouseEvent& e) {
owner.mouseDown(e.getEventRelativeTo(&owner));
}
void Editor::GraphCanvas::mouseDrag(const juce::MouseEvent& e) {
owner.mouseDrag(e.getEventRelativeTo(&owner));
}
void Editor::GraphCanvas::mouseUp(const juce::MouseEvent& e) {
owner.mouseUp(e.getEventRelativeTo(&owner));
}
void Editor::GraphCanvas::mouseMove(const juce::MouseEvent& e) {
owner.mouseMove(e.getEventRelativeTo(&owner));
setMouseCursor(owner.getMouseCursor());
}
void Editor::setValue(std::size_t i,float value) {
if(auto* parameter=processor.state.getParameter(arson::specs[i].id)) {
parameter->beginChangeGesture();
Expand Down Expand Up @@ -601,6 +632,8 @@ void Editor::resized() {
external.setBounds(detX+detW+8,bottomY+42,extW,30);
listen.setBounds(detX+detW+extW+16,bottomY+42,listenW,30);
const int readoutW=juce::jmin(254,w-40);
graphCanvas.setBounds(compactMode
? juce::Rectangle<int>{13,258,w-26,47} : display);
hoverReadout.setBounds(compactMode?w-readoutW-14:
display.getCentreX()-readoutW/2,
compactMode?h-21:display.getBottom()-27,readoutW,18);
Expand Down Expand Up @@ -703,6 +736,8 @@ void Editor::timerCallback() {
outPeaks[i]=std::max(outPeaks[i],frame.outputChannel[i]);
}
}
const auto previousInput=inputDb,previousOutput=outputDb,previousGr=gr;
const auto previousInChannels=inChannelDb,previousOutChannels=outChannelDb;
// Time-based visual smoothing: attack remains responsive (~18 ms) while
// falloff is calm (~210 ms). No change to real detector or DSP latency.
const double now=juce::Time::getMillisecondCounterHiRes();
Expand Down Expand Up @@ -730,8 +765,14 @@ void Editor::timerCallback() {
std::max(1,static_cast<int>(std::round(elapsed*100.0))));
}
if(!compactMode && (received>0 || aged>0))rebuildHistoryPaths();
if(compactMode)repaint(14,298,getWidth()-28,57);
else repaint(display);
bool meterChanged=std::abs(inputDb-previousInput)>0.03f ||
std::abs(outputDb-previousOutput)>0.03f ||
std::abs(gr-previousGr)>0.015f;
for(std::size_t i=0;i<2;++i)
meterChanged=meterChanged ||
std::abs(inChannelDb[i]-previousInChannels[i])>0.03f ||
std::abs(outChannelDb[i]-previousOutChannels[i])>0.03f;
if(received>0 || aged>0 || meterChanged)graphCanvas.repaint();
}

void Editor::rebuildHistoryPaths() {
Expand Down Expand Up @@ -831,10 +872,7 @@ void Editor::paint(juce::Graphics& g) {
g.setColour(accent.withAlpha(0.68f));
g.fillRoundedRectangle(sidechainPanel?115.0f:17.0f,
static_cast<float>(bottomY+22),sidechainPanel?91.0f:88.0f,1.8f,1.0f);
if(!compactMode) {
if(grid.isValid())g.drawImageAt(grid,display.getX(),display.getY());
drawDisplay(g);
} else paintCompactMeters(g);
// Cached chassis/header are static; the live LCD is an opaque child.
g.setColour(text.withAlpha(0.66f));
g.setFont(juce::FontOptions(9.0f));
g.drawText("0 SAMPLES ADDED / REALTIME DSP",
Expand Down Expand Up @@ -901,8 +939,8 @@ void Editor::drawMeter(juce::Graphics& g,juce::Rectangle<float> bounds,
}
void Editor::drawDisplay(juce::Graphics& g) {
juce::Graphics::ScopedSaveState save(g);
g.reduceClipRegion(display);
g.setOrigin(display.getPosition());
g.reduceClipRegion(juce::Rectangle<int>{0,0,
display.getWidth(),display.getHeight()});
const auto plot=plotBounds().translated(-static_cast<float>(display.getX()),
-static_cast<float>(display.getY()));
if(plot.isEmpty())return;
Expand Down Expand Up @@ -1044,7 +1082,7 @@ void Editor::mouseDrag(const juce::MouseEvent& event) {
parameter->setValueNotifyingHost(parameter->convertTo0to1(threshold));
hoveredParameter=arson::Threshold;
updateHoverReadout(hoveredParameter);
repaint(display);
graphCanvas.repaint();
}
void Editor::mouseUp(const juce::MouseEvent&) {
if(!thresholdDragging)return;
Expand Down
15 changes: 15 additions & 0 deletions plugin/Editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ class Editor final : public juce::AudioProcessorEditor, private juce::Timer {
void mouseMove(const juce::MouseEvent&) override;
void mouseEnter(const juce::MouseEvent&) override;
private:
class GraphCanvas final : public juce::Component {
public:
explicit GraphCanvas(Editor& p) : owner(p) {
setComponentID("view.graph.canvas");
setOpaque(true);
}
void paint(juce::Graphics&) override;
void mouseDown(const juce::MouseEvent&) override;
void mouseDrag(const juce::MouseEvent&) override;
void mouseUp(const juce::MouseEvent&) override;
void mouseMove(const juce::MouseEvent&) override;
private:
Editor& owner;
};
void timerCallback() override;
void applyPreset(int);
void setValue(std::size_t,float);
Expand All @@ -52,6 +66,7 @@ class Editor final : public juce::AudioProcessorEditor, private juce::Timer {
CompLook look;
std::array<juce::Slider,arson::Detector> knobs;
std::array<juce::Label,arson::Detector> labels;
GraphCanvas graphCanvas{*this};
juce::Label hoverReadout;
std::size_t hoveredParameter=arson::Threshold;
using SliderAttachment=juce::AudioProcessorValueTreeState::SliderAttachment;
Expand Down
11 changes: 11 additions & 0 deletions tests/PluginSmoke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ int main(int argc,char** argv) {
// No floating tooltip obscures the hardware control strip.
if(!slider->getTooltip().isEmpty())return 49;
}
// Opaque live meter canvas isolates timer repaints from chassis.
auto* canvas=editor->findChildWithID("view.graph.canvas");
const auto expectedCanvas=juce::Rectangle<int>{
8,70,editor->getWidth()-16,editor->getHeight()-268};
if(!canvas || !canvas->isVisible() || !canvas->isOpaque() ||
canvas->getBounds()!=expectedCanvas)return 70;
auto* readout=dynamic_cast<juce::Label*>(
editor->findChildWithID("view.value.readout"));
if(!readout || !readout->isVisible() ||
Expand Down Expand Up @@ -562,6 +568,8 @@ int main(int argc,char** argv) {
if(!mini || !mini->onClick)return 10;
mini->onClick();
if(editor->getHeight()!=330)return 11;
if(canvas->getBounds()!=juce::Rectangle<int>{
13,258,editor->getWidth()-26,47})return 71;
auto compactImage=editor->createComponentSnapshot(editor->getLocalBounds());
if(compactImage.isNull() || compactImage.getHeight()!=330)return 12;
if(argc>1) {
Expand All @@ -572,6 +580,9 @@ int main(int argc,char** argv) {
}
mini->onClick();
if(editor->getHeight()!=640)return 14;
if(canvas->getBounds()!=juce::Rectangle<int>{
8,70,editor->getWidth()-16,editor->getHeight()-268})
return 72;
}
auto image=editor->createComponentSnapshot(editor->getLocalBounds());
if(image.isNull())return 3;
Expand Down
Loading