diff --git a/site/static/manual/index.html b/site/static/manual/index.html index 6be3251..988ceac 100644 --- a/site/static/manual/index.html +++ b/site/static/manual/index.html @@ -275,7 +275,7 @@

15Gain and auto gain

16Spectrum and analysis views

-

The view selector at the left of the control bar switches between Scope, Spectrum (FFT), Spectrum (Band) and Stereo. On desktop it opens a compact list; on touch and in kiosk mode it opens large tiles. Press V to open the selector, or Alt+1 / Alt+2 / Alt+3 / Alt+4 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 1–5 and W work in Scope only.

+

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 Scope, Spectrum (FFT), Spectrum (Band) and Stereo. On desktop it opens a compact list; on touch and in kiosk mode it opens large tiles. Press V to open the selector, or Alt+1 / Alt+2 / Alt+3 / Alt+4 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 1–5 and W work in Scope only.

The spectrum and stereo views come after 1.0.0 beta 1. They are on the main branch and will be in the next release; until then they need a build of your own from main, since no published development build has them yet.

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.

Analysis settings 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.

diff --git a/ui/AnalysisSelector.cpp b/ui/AnalysisSelector.cpp index faaec24..7870399 100644 --- a/ui/AnalysisSelector.cpp +++ b/ui/AnalysisSelector.cpp @@ -8,6 +8,41 @@ namespace { const juce::StringArray viewNames{"Scope", "Spectrum (FFT)", "Spectrum (Band)", "Stereo"}; +void drawViewIcon(juce::Graphics& g, juce::Rectangle icon, int view) +{ + juce::Path p; + for (int i = 0; i <= 64; ++i) + { + const auto x = static_cast(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(i) * 0.37f))); + g.fillRect(icon.getX() + static_cast(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: @@ -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(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(i) * 0.37f))); - g.fillRect(icon.getX() + static_cast(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> buttons; @@ -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) { diff --git a/ui/AnalysisSelector.h b/ui/AnalysisSelector.h index 74ec142..0b8cda3 100644 --- a/ui/AnalysisSelector.h +++ b/ui/AnalysisSelector.h @@ -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; diff --git a/ui/ControlBar.cpp b/ui/ControlBar.cpp index 3f9bcfe..6cc06e5 100644 --- a/ui/ControlBar.cpp +++ b/ui/ControlBar.cpp @@ -215,7 +215,7 @@ std::array 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,