Files
reasampler/src/core/instrument/ui/sample_chrome.h
T
daniel 9d38f87a2d instrument: one VELOCITY deck for all three velocity curves, bipolar and off by default for pitch and filter
Payload v12 appends the new velocity->pitch curve and folds the retired filter velAmount into its now-bipolar curve, so pre-v12 projects reopen sounding identical. Preview button takes a drawn play triangle.
2026-07-31 19:15:17 -04:00

51 lines
2.3 KiB
C++

#pragma once
// sample_chrome.h — interior geometry of the Sample face's CHROME band: the toolbar row
// (title + the whole right-anchored control run + Browse) over the strip row, which the
// piano strip has to itself. Reads the band rect the allocator hands it (sample_bands) and
// never allocates vertical space of its own.
#include "core/instrument/ui/editor_geometry.h" // Rect
namespace reasampler::instrument::ui {
inline constexpr int kNavButtonWidth = 62; // the Browse toolbar button
// Every interactive rect inside the chrome band, in one pass so draw and hit-test cannot
// derive them differently. The toolbar's fixed run is right-anchored and the title takes
// what is left of that row; the strip row carries nothing but the strip, so the strip grows
// with the window in both directions.
struct ChromeRects {
Rect toolbar; // full-width top row
Rect title; // the title text slot: the toolbar left of the control run
Rect preview; // ---- the right-anchored run, left to right ----
Rect velCell; // preview-velocity knob cell (knob + label band)
Rect velKnob;
Rect velLabel;
Rect chanMono;
Rect chanStereo;
Rect navBrowse;
Rect controls; // full-width second row
Rect rootStrip; // the piano strip: the whole row, inset only by the shared band pad
};
// `knobSize` is the deck knob square, passed in so this module does not depend on knob_deck.
ChromeRects chromeRects(const Rect& chrome, int knobSize);
// A right-pointing play triangle centered in the preview button: the button's whole label.
// Three vertices, handed straight to one filled-triangle draw. Drawn rather than embedded as a
// bitmap so it inherits the palette role of whatever interaction state the button is in.
struct PreviewGlyph {
int leftX = 0; // the vertical edge
int topY = 0;
int bottomY = 0;
int apexX = 0; // the point, on the button's vertical centre line
int apexY = 0;
bool empty() const { return apexX <= leftX || bottomY <= topY; }
};
// Sized off the button's shorter dimension and clamped, so the glyph stays legible in a squat
// button and never outgrows a generous one. An unusably small button yields an empty glyph.
PreviewGlyph previewGlyph(const Rect& button);
} // namespace reasampler::instrument::ui