Add 250% scale option, default 150%, widen base layout; polish trail scaling

This commit is contained in:
Armin 2026-09-16 21:16:37 +02:00
commit e4af0eb793
7 changed files with 123 additions and 67 deletions

View file

@ -7,7 +7,8 @@ TerionProcessorEditor::TerionProcessorEditor(TerionProcessor& p)
fadeKnob(*p.apvts.getParameter("fadeTime")),
sensitivityKnob(*p.apvts.getParameter("sensitivity")),
dotSizeKnob(*p.apvts.getParameter("dotSize")),
smoothingKnob(*p.apvts.getParameter("smoothing"))
smoothingKnob(*p.apvts.getParameter("smoothing")),
afterglowKnob(*p.apvts.getParameter("afterglow"))
{
setSize(kBaseWidth, kBaseHeight);
setResizable(true, true);
@ -28,7 +29,7 @@ TerionProcessorEditor::TerionProcessorEditor(TerionProcessor& p)
// Dot size knob
addAndMakeVisible(dotSizeKnob);
dotSizeKnob.setRange(0.5, 3.0);
dotSizeKnob.setRange(0.5, 8.0);
dotSizeAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(
processorRef.apvts, "dotSize", dotSizeKnob);
@ -38,6 +39,12 @@ TerionProcessorEditor::TerionProcessorEditor(TerionProcessor& p)
smoothingAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(
processorRef.apvts, "smoothing", smoothingKnob);
// Afterglow knob
addAndMakeVisible(afterglowKnob);
afterglowKnob.setRange(0.0, 5.0);
afterglowAttachment = std::make_unique<juce::AudioProcessorValueTreeState::SliderAttachment>(
processorRef.apvts, "afterglow", afterglowKnob);
// Freeze button
addAndMakeVisible(freezeButton);
freezeButton.setButtonText("FRZ");
@ -60,8 +67,9 @@ TerionProcessorEditor::TerionProcessorEditor(TerionProcessor& p)
scaleBox.addItem("125%", 2);
scaleBox.addItem("150%", 3);
scaleBox.addItem("200%", 4);
scaleBox.addItem("300%", 5);
scaleBox.setSelectedId(2, juce::dontSendNotification);
scaleBox.addItem("250%", 5);
scaleBox.addItem("300%", 6);
scaleBox.setSelectedId(3, juce::dontSendNotification);
scaleBox.onChange = [this] { scaleChanged(); };
scaleChanged();
@ -75,7 +83,6 @@ TerionProcessorEditor::TerionProcessorEditor(TerionProcessor& p)
addAndMakeVisible(label);
label.setText(text, juce::dontSendNotification);
label.setJustificationType(juce::Justification::centredTop);
label.setFont(juce::Font(juce::FontOptions(9.0f)));
label.setColour(juce::Label::textColourId, juce::Colour(0xff888899));
label.setInterceptsMouseClicks(false, false);
};
@ -83,6 +90,7 @@ TerionProcessorEditor::TerionProcessorEditor(TerionProcessor& p)
setupLabel(sensitivityLabel, sensitivityKnob.getParameterName());
setupLabel(dotSizeLabel, dotSizeKnob.getParameterName());
setupLabel(smoothingLabel, smoothingKnob.getParameterName());
setupLabel(afterglowLabel, afterglowKnob.getParameterName());
}
TerionProcessorEditor::~TerionProcessorEditor() {}
@ -96,12 +104,14 @@ void TerionProcessorEditor::scaleChanged()
case 2: currentScale = 1.25f; break;
case 3: currentScale = 1.5f; break;
case 4: currentScale = 2.0f; break;
case 5: currentScale = 3.0f; break;
default: currentScale = 1.25f; break;
case 5: currentScale = 2.5f; break;
case 6: currentScale = 3.0f; break;
default: currentScale = 1.5f; break;
}
const int maxDim = static_cast<int>(kBaseWidth * kMaxScale);
setResizeLimits(kBaseWidth, kBaseHeight, maxDim, maxDim);
scope.setScale(currentScale);
setSize(static_cast<int>(kBaseWidth * currentScale),
static_cast<int>(kBaseHeight * currentScale));
}
@ -151,21 +161,32 @@ void TerionProcessorEditor::resized()
// Scope fills the remaining area
scope.setBounds(bounds);
// Controls layout: top-right corner, horizontal row
const int startX = bounds.getWidth() - (4 * (knobs + margin) + knobs + margin);
const int startY = static_cast<int>(10.0f * s);
// Controls layout: knob row sits 8px above the footer, FRZ stays top-right
const int gap = static_cast<int>(8.0f * s);
const int numKnobs = 5;
const int rowH = knobs + static_cast<int>(12.0f * s) - static_cast<int>(6.0f * s);
const int startX = bounds.getWidth() - (numKnobs * (knobs + margin) + knobs + margin);
const int startY = bounds.getHeight() - rowH - gap;
fadeKnob.setBounds(startX, startY, knobs, knobs);
sensitivityKnob.setBounds(startX + (knobs + margin), startY, knobs, knobs);
dotSizeKnob.setBounds(startX + 2 * (knobs + margin), startY, knobs, knobs);
smoothingKnob.setBounds(startX + 3 * (knobs + margin), startY, knobs, knobs);
freezeButton.setBounds(startX + 4 * (knobs + margin), startY + static_cast<int>(10.0f * s),
afterglowKnob.setBounds(startX + 4 * (knobs + margin), startY, knobs, knobs);
freezeButton.setBounds(bounds.getWidth() - knobs - margin, static_cast<int>(20.0f * s),
knobs, knobs - static_cast<int>(20.0f * s));
const int labelY = startY + knobs - static_cast<int>(6.0f * s);
const int labelH = static_cast<int>(12.0f * s);
const float labelFont = 9.0f * s;
fadeLabel.setBounds(fadeKnob.getX(), labelY, knobs, labelH);
fadeLabel.setFont(juce::Font(juce::FontOptions(labelFont)));
sensitivityLabel.setBounds(sensitivityKnob.getX(), labelY, knobs, labelH);
sensitivityLabel.setFont(juce::Font(juce::FontOptions(labelFont)));
dotSizeLabel.setBounds(dotSizeKnob.getX(), labelY, knobs, labelH);
dotSizeLabel.setFont(juce::Font(juce::FontOptions(labelFont)));
smoothingLabel.setBounds(smoothingKnob.getX(), labelY, knobs, labelH);
smoothingLabel.setFont(juce::Font(juce::FontOptions(labelFont)));
afterglowLabel.setBounds(afterglowKnob.getX(), labelY, knobs, labelH);
afterglowLabel.setFont(juce::Font(juce::FontOptions(labelFont)));
}