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
2 changes: 1 addition & 1 deletion site/static/manual/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ <h2><span class="num">15</span>Gain and auto gain</h2>

<section id="spectrum">
<h2><span class="num">16</span>Spectrum and analysis views</h2>
<p>The view selector at the left of the control bar switches between <strong>Scope</strong>, <strong>Spectrum (FFT)</strong>, <strong>Spectrum (Band)</strong> and <strong>Stereo</strong>. On desktop it opens a compact list; on touch and in kiosk mode it opens large tiles. Press <strong>V</strong> to open the selector, or <strong>Alt+1 / Alt+2 / Alt+3 / Alt+4</strong> to select a view when the app or plugin editor has focus. The app remembers your choice; plugins save it per instance. The window keys <kbd>1</kbd>–<kbd>5</kbd> and <kbd>W</kbd> work in Scope only.</p>
<p>The view selector at the left of the control bar shows the current view’s icon and a dropdown arrow. Click or tap it to switch between <strong>Scope</strong>, <strong>Spectrum (FFT)</strong>, <strong>Spectrum (Band)</strong> and <strong>Stereo</strong>. On desktop it opens a compact list; on touch and in kiosk mode it opens large tiles. Press <strong>V</strong> to open the selector, or <strong>Alt+1 / Alt+2 / Alt+3 / Alt+4</strong> to select a view when the app or plugin editor has focus. The app remembers your choice; plugins save it per instance. The window keys <kbd>1</kbd>–<kbd>5</kbd> and <kbd>W</kbd> work in Scope only.</p>
<p class="callout">The spectrum and stereo views come after 1.0.0 beta 1. They are on the <code>main</code> branch and will be in the next release; until then they need a build of your own from <code>main</code>, since no published development build has them yet.</p>
<p>Both spectrum views use a black background. Spectrum (FFT) shows incoming audio on a logarithmic frequency axis. Its defaults are a fast peak curve with a solid fill in the selected waveform colour and a slow white peak line, both smoothed over 1/12 octave. It follows audio even when MIDI Clock or host playback is stopped. In the standalone app, Pause holds the spectrum and stops its analysis.</p>
<p><strong>Analysis settings</strong> contains Channels, Range, Slope, one shared Detector (Peak or RMS) and one shared Smoothing setting (Raw or 1/24–1 octave). Both curves use the same detector and smoothing. The filled curve always uses Fast (150 ms) response and Solid drawing in the selected waveform colour. The second curve is a white history line controlled by global Afterglow. There are no per-curve visibility, response, style or colour controls, and no Reset peaks button.</p>
Expand Down
92 changes: 54 additions & 38 deletions ui/AnalysisSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@ namespace
{
const juce::StringArray viewNames{"Scope", "Spectrum (FFT)", "Spectrum (Band)", "Stereo"};

void drawViewIcon(juce::Graphics& g, juce::Rectangle<float> icon, int view)
{
juce::Path p;
for (int i = 0; i <= 64; ++i)
{
const auto x = static_cast<float>(i) / 64.0f;
const auto y = view == 0 ? 0.5f + 0.32f * std::sin(x * 19.0f)
: 0.9f - 0.7f * std::exp(-50.0f * (x - 0.3f) * (x - 0.3f)) -
0.35f * std::exp(-35.0f * (x - 0.7f) * (x - 0.7f));
if (i == 0)
p.startNewSubPath(icon.getX(), icon.getY() + y * icon.getHeight());
else
p.lineTo(icon.getX() + x * icon.getWidth(), icon.getY() + y * icon.getHeight());
}
if (view == 3)
{
juce::Path stereo;
stereo.addEllipse(icon.withSizeKeepingCentre(icon.getWidth() * 0.28f, icon.getHeight()));
g.strokePath(stereo, juce::PathStrokeType(2.0f));
g.drawVerticalLine(juce::roundToInt(icon.getCentreX()), icon.getY(), icon.getBottom());
}
else if (view == 2)
{
for (int i = 0; i < 12; ++i)
{
const auto height = icon.getHeight() *
(0.25f + 0.65f * std::abs(std::sin(static_cast<float>(i) * 0.37f)));
g.fillRect(icon.getX() + static_cast<float>(i) * icon.getWidth() / 12,
icon.getBottom() - height, icon.getWidth() / 12 * 0.7f, height);
}
}
else
g.strokePath(p, juce::PathStrokeType(2.0f));
}

class SelectorButton : public juce::TextButton
{
public:
Expand Down Expand Up @@ -56,42 +91,8 @@ struct AnalysisSelector::Tiles final : juce::Component
g.setFont(18.0f);
g.drawText(getButtonText(), area.removeFromBottom(28), juce::Justification::centred);
auto icon = area.toFloat().reduced(12.0f, 8.0f);
juce::Path p;
for (int i = 0; i <= 64; ++i)
{
const auto x = static_cast<float>(i) / 64.0f;
const auto y = view == 0
? 0.5f + 0.32f * std::sin(x * 19.0f)
: 0.9f - 0.7f * std::exp(-50.0f * (x - 0.3f) * (x - 0.3f)) -
0.35f * std::exp(-35.0f * (x - 0.7f) * (x - 0.7f));
if (i == 0)
p.startNewSubPath(icon.getX(), icon.getY() + y * icon.getHeight());
else
p.lineTo(icon.getX() + x * icon.getWidth(), icon.getY() + y * icon.getHeight());
}
g.setColour(juce::Colour(0xff79ddc6).withAlpha(down ? 0.6f : over ? 1.0f : 0.85f));
if (view == 3)
{
juce::Path stereo;
stereo.addEllipse(
icon.withSizeKeepingCentre(icon.getWidth() * 0.28f, icon.getHeight()));
g.strokePath(stereo, juce::PathStrokeType(2.0f));
g.drawVerticalLine(juce::roundToInt(icon.getCentreX()), icon.getY(),
icon.getBottom());
}
else if (view == 2)
{
for (int i = 0; i < 12; ++i)
{
const auto height =
icon.getHeight() *
(0.25f + 0.65f * std::abs(std::sin(static_cast<float>(i) * 0.37f)));
g.fillRect(icon.getX() + static_cast<float>(i) * icon.getWidth() / 12,
icon.getBottom() - height, icon.getWidth() / 12 - 3, height);
}
}
else
g.strokePath(p, juce::PathStrokeType(2.0f));
drawViewIcon(g, icon, view);
}
};
std::vector<std::unique_ptr<Tile>> buttons;
Expand Down Expand Up @@ -162,15 +163,30 @@ struct AnalysisSelector::Tiles final : juce::Component
AnalysisSelector::AnalysisSelector()
{
setView(0);
setTooltip("Analysis view (V). Alt+1: Scope; Alt+2: Spectrum (FFT); Alt+3: Spectrum (Band); "
"Alt+4: Stereo.");
onClick = [this] { showChoices(); };
}
AnalysisSelector::~AnalysisSelector() = default;
void AnalysisSelector::setView(int view)
{
selected_ = std::clamp(view, 0, viewNames.size() - 1);
setButtonText(viewNames[selected_] + " ▾");
setButtonText(viewNames[selected_]);
setTitle("Analysis view: " + viewNames[selected_]);
setTooltip("Analysis view: " + viewNames[selected_] +
" (V). Alt+1: Scope; Alt+2: Spectrum (FFT); Alt+3: Spectrum (Band); Alt+4: Stereo.");
repaint();
}
void AnalysisSelector::paintButton(juce::Graphics& g, bool over, bool down)
{
getLookAndFeel().drawButtonBackground(g, *this, findColour(buttonColourId), over, down);
auto area = getLocalBounds().toFloat().withSizeKeepingCentre(40.0f, 20.0f);
g.setColour(palette::level.withMultipliedAlpha(isEnabled() ? 1.0f : 0.5f));
drawViewIcon(g, area.removeFromLeft(24.0f), selected_);
g.setColour(palette::text.withMultipliedAlpha(isEnabled() ? 1.0f : 0.5f));
juce::Path arrow;
const auto x = area.getRight() - 8.0f;
const auto y = area.getCentreY();
arrow.addTriangle(x, y - 2.0f, x + 8.0f, y - 2.0f, x + 4.0f, y + 3.0f);
g.fillPath(arrow);
}
void AnalysisSelector::choose(int view)
{
Expand Down
1 change: 1 addition & 0 deletions ui/AnalysisSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class AnalysisSelector final : public juce::TextButton
void parentSizeChanged() override;

private:
void paintButton(juce::Graphics& g, bool over, bool down) override;
struct Tiles;
void choose(int view);
int selected_ = 0;
Expand Down
2 changes: 1 addition & 1 deletion ui/ControlBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ std::array<int, ControlBar::numGroups> ControlBar::groupWidths() const
if (button->isVisible())
buttons +=
(buttons > 0 ? metrics.gap : 0) + button->preferredWidth(metrics.controlHeight);
return {190,
return {60,
pauseVisible_ ? pause_.preferredWidth(metrics.controlHeight) : 0,
spectrum_ ? 0 : window_.preferredWidth(metrics.controlHeight),
tempoVisible_ && !spectrum_ ? tempo_.preferredWidth(metrics.controlHeight) : 0,
Expand Down
Loading