Retire the zone system: one capture = one parameter set, and re-seam the engine and Sample face into bands
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
// editor_input_chrome.cpp — the CHROME band's input: the Browse nav, the preview trigger,
|
||||
// the preview-velocity knob grab, the curve-button summon, the channel toggle, and the
|
||||
// root-marker grab plus its live drag. Windows-only.
|
||||
|
||||
#include "shell/instrument/reasampler_editor.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "core/instrument/ui/keyboard_strip.h" // keyAtPoint / resolveDragNote (root marker)
|
||||
#include "shell/instrument/editor_internal.h"
|
||||
#include "shell/instrument/reasampler_processor.h"
|
||||
|
||||
namespace reasampler::vst {
|
||||
|
||||
using namespace reasampler::ui;
|
||||
using namespace reasampler::instrument::ui;
|
||||
|
||||
bool ReaSamplerEditor::mouseDownChrome(const FaceLayout& fl, int x, int y) {
|
||||
const ChromeRects& cr = fl.chrome;
|
||||
|
||||
if (contains(cr.navBrowse, x, y)) {
|
||||
// Open the Browse modal; seed its pending pick from the loaded id so the current
|
||||
// capture reads as pre-selected.
|
||||
browsePendingId_ = selectedId_;
|
||||
lastBrowseClickCard_ = -1;
|
||||
view_ = View::kBrowse;
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
if (selectedId_.empty()) return false; // empty state — nav only
|
||||
|
||||
// Preview-trigger button: fire the loaded capture at its root through the voice engine
|
||||
// (momentary — note-on on press, note-off on release).
|
||||
if (contains(cr.preview, x, y)) {
|
||||
const int note = effectiveRoot();
|
||||
if (previewingNote_ >= 0) processor_->previewNoteOff(previewingNote_);
|
||||
previewingNote_ = note;
|
||||
processor_->previewNoteOn(note);
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
// Radial preview-velocity knob: grab-anchored vertical drag — the grab itself never
|
||||
// jumps the value; the delta from the grab point maps via knobDragValue.
|
||||
if (contains(cr.velCell, x, y)) {
|
||||
drag_ = DragKind::kDeckKnob;
|
||||
dragParamId_ = -2; // sentinel: the preview velocity knob (a processor param)
|
||||
dragKnobStartValue_ = previewVelocity01();
|
||||
dragStartX_ = x;
|
||||
dragStartY_ = y;
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
// The mini curve-preview button: summon the popup editor.
|
||||
if (contains(cr.curveBtn, x, y)) {
|
||||
curvePopupOpen_ = true;
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
if (contains(cr.chanMono, x, y)) {
|
||||
channelMode_ = ChannelMode::Mono;
|
||||
processor_->setChannelMode(ChannelMode::Mono);
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
if (contains(cr.chanStereo, x, y)) {
|
||||
channelMode_ = ChannelMode::Stereo;
|
||||
processor_->setChannelMode(ChannelMode::Stereo);
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
// The root strip: grab the root marker. A plain click sets the root to the clicked key
|
||||
// (applied below as the first delta==0 move).
|
||||
if (cr.rootStrip.width > 0) {
|
||||
const StripLayout sl = layoutStrip(cr.rootStrip.width, cr.rootStrip.height);
|
||||
const int note = keyAtPoint(sl, x - cr.rootStrip.x, y - cr.rootStrip.y);
|
||||
if (note >= 0) {
|
||||
drag_ = DragKind::kRootMarker;
|
||||
dragStartX_ = x;
|
||||
dragStartRoot_ = note;
|
||||
dragStartParams_ = params_;
|
||||
onMouseMove(x, y); // apply the click as the first delta==0 set
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// A click on the control row's background is consumed so it can't fall through to a
|
||||
// band the user cannot see under the chrome.
|
||||
return contains(cr.controls, x, y);
|
||||
}
|
||||
|
||||
void ReaSamplerEditor::dragChrome(const FaceLayout& fl, int x, int y) {
|
||||
(void)y;
|
||||
const Rect& stripArea = fl.chrome.rootStrip;
|
||||
if (stripArea.width <= 0) return;
|
||||
const StripLayout sl = layoutStrip(stripArea.width, stripArea.height);
|
||||
params_.rootOverride = resolveDragNote(sl, dragStartRoot_, x - dragStartX_);
|
||||
invalidate(); // live feedback; the commit lands on WM_LBUTTONUP
|
||||
}
|
||||
|
||||
ReaSamplerEditor::HoverTarget ReaSamplerEditor::hoverChrome(const FaceLayout& fl, int x,
|
||||
int y) const {
|
||||
const ChromeRects& cr = fl.chrome;
|
||||
if (contains(cr.navBrowse, x, y)) return {HoverKind::kNavBrowse, -1};
|
||||
if (selectedId_.empty()) return {}; // empty state — no interactive surfaces beyond nav
|
||||
if (contains(cr.preview, x, y)) return {HoverKind::kPreview, -1};
|
||||
if (contains(cr.velCell, x, y)) return {HoverKind::kVelKnob, -1};
|
||||
if (contains(cr.curveBtn, x, y)) return {HoverKind::kCurveButton, -1};
|
||||
if (contains(cr.chanMono, x, y)) return {HoverKind::kChanMono, -1};
|
||||
if (contains(cr.chanStereo, x, y)) return {HoverKind::kChanStereo, -1};
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace reasampler::vst
|
||||
|
||||
#endif // _WIN32
|
||||
Reference in New Issue
Block a user