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.
This commit is contained in:
@@ -20,10 +20,10 @@ bool ReaSamplerEditor::handlePopupMouseDown(int w, int h, int x, int y) {
|
||||
// While open the sheet is modal over the face — it owns every left-click. Close click /
|
||||
// outside-wash click dismiss (outside only when no drag is in flight); in-box clicks
|
||||
// route to the curve machinery; anything else on the sheet is swallowed.
|
||||
if (!curvePopupOpen_) return false;
|
||||
if (curvePopup_ == CurveTarget::kNone) return false;
|
||||
const CurvePopupLayout pl = computeCurvePopup(w, h);
|
||||
if (contains(pl.close, x, y)) {
|
||||
curvePopupOpen_ = false;
|
||||
curvePopup_ = CurveTarget::kNone;
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ bool ReaSamplerEditor::handlePopupMouseDown(int w, int h, int x, int y) {
|
||||
return true;
|
||||
}
|
||||
if (popupOutsideSheet(pl, x, y) && drag_ == DragKind::kNone) {
|
||||
curvePopupOpen_ = false;
|
||||
curvePopup_ = CurveTarget::kNone;
|
||||
invalidate();
|
||||
}
|
||||
return true;
|
||||
@@ -42,12 +42,12 @@ void ReaSamplerEditor::handleCurveMouseDown(const Rect& r, int x, int y) {
|
||||
const VelocityCurve::Box box = curveBoxFromRect(r);
|
||||
if (box.width <= 0 || box.height <= 1) return;
|
||||
|
||||
int idx = params_.velocityCurve.pointAtPixel(box, x, y);
|
||||
int idx = editedCurve().pointAtPixel(box, x, y);
|
||||
|
||||
// Modifier-click (Alt) deletes an interior node — a discrete, final edit committed at once
|
||||
// (deletePoint refuses the two endpoints, so an Alt-click on them is a safe no-op).
|
||||
if (idx >= 0 && (GetKeyState(VK_MENU) & 0x8000) != 0) {
|
||||
if (params_.velocityCurve.deletePoint(static_cast<std::size_t>(idx))) {
|
||||
if (editedCurve().deletePoint(static_cast<std::size_t>(idx))) {
|
||||
hover_ = HoverTarget{}; // a stale kCurveNode index would light a shifted node
|
||||
commitAndReload();
|
||||
}
|
||||
@@ -66,8 +66,8 @@ void ReaSamplerEditor::handleCurveMouseDown(const Rect& r, int x, int y) {
|
||||
const bool inBox = (x >= box.left && x < box.left + box.width &&
|
||||
y >= box.top && y < box.top + box.height);
|
||||
if (inBox) {
|
||||
const VelocityPoint p = VelocityCurve::pointFromPixel(box, x, y);
|
||||
idx = static_cast<int>(params_.velocityCurve.addPoint(p.velocity, p.amp));
|
||||
const VelocityPoint p = editedCurve().pointFromPixel(box, x, y);
|
||||
idx = static_cast<int>(editedCurve().addPoint(p.velocity, p.value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void ReaSamplerEditor::handleCurveMouseDown(const Rect& r, int x, int y) {
|
||||
|
||||
drag_ = DragKind::kCurveNode;
|
||||
curvePointIndex_ = idx;
|
||||
dragStartCurve_ = params_.velocityCurve; // AFTER the add — resolvePointDrag's delta base
|
||||
dragStartCurve_ = editedCurve(); // AFTER the add — resolvePointDrag's delta base
|
||||
dragCurveRect_ = r;
|
||||
dragStartX_ = x;
|
||||
dragStartY_ = y;
|
||||
@@ -87,7 +87,7 @@ void ReaSamplerEditor::dragCurve(int x, int y) {
|
||||
// (box + neighbour-X + endpoint-pin clamps), against the grab-time curve + box (absolute
|
||||
// delta — the mirror of the envelope-node drag). Live feedback only; commit on release.
|
||||
if (curvePointIndex_ < 0) return;
|
||||
params_.velocityCurve = VelocityCurve::resolvePointDrag(
|
||||
editedCurve() = VelocityCurve::resolvePointDrag(
|
||||
dragStartCurve_, static_cast<std::size_t>(curvePointIndex_),
|
||||
curveBoxFromRect(dragCurveRect_), x - dragStartX_, y - dragStartY_);
|
||||
invalidate();
|
||||
@@ -98,16 +98,16 @@ void ReaSamplerEditor::onMouseRDown(int x, int y) {
|
||||
// and drag-off remain as landed alternates. Commits immediately through the same path as
|
||||
// Alt-click; deletePoint's endpoint guard makes an endpoint right-click a safe no-op.
|
||||
// Right-clicks act only while the popup is open, and never during an in-flight left drag.
|
||||
if (!processor_ || view_ == View::kBrowse || !curvePopupOpen_) return;
|
||||
if (!processor_ || view_ == View::kBrowse || curvePopup_ == CurveTarget::kNone) return;
|
||||
if (drag_ != DragKind::kNone) return;
|
||||
RECT rc{};
|
||||
GetClientRect(childHwnd_, &rc);
|
||||
const CurvePopupLayout pl = computeCurvePopup(rc.right - rc.left, rc.bottom - rc.top);
|
||||
if (!contains(pl.curveBox, x, y)) return;
|
||||
const VelocityCurve::Box box = curveBoxFromRect(pl.curveBox);
|
||||
const int idx = params_.velocityCurve.pointAtPixel(box, x, y);
|
||||
const int idx = editedCurve().pointAtPixel(box, x, y);
|
||||
if (idx < 0) return;
|
||||
if (params_.velocityCurve.deletePoint(static_cast<std::size_t>(idx))) {
|
||||
if (editedCurve().deletePoint(static_cast<std::size_t>(idx))) {
|
||||
hover_ = HoverTarget{}; // a stale kCurveNode index would light a shifted node
|
||||
commitAndReload();
|
||||
}
|
||||
@@ -120,7 +120,7 @@ ReaSamplerEditor::HoverTarget ReaSamplerEditor::hoverCurvePopup(int w, int h, in
|
||||
if (!contains(pl.curveBox, x, y)) return {};
|
||||
// A curve node under the pointer lights accent-hot.
|
||||
const int idx =
|
||||
params_.velocityCurve.pointAtPixel(curveBoxFromRect(pl.curveBox), x, y);
|
||||
editedCurve().pointAtPixel(curveBoxFromRect(pl.curveBox), x, y);
|
||||
if (idx < 0) return {};
|
||||
return {HoverKind::kCurveNode, idx};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user