fix(vst): zone-bleed (3a) — reconcile the Sample-face zone on load so the loaded sample zone is the one first-match resolve plays

This commit is contained in:
2026-07-27 19:09:53 -04:00
parent a4e33b1c04
commit 7fd812bd34
6 changed files with 186 additions and 5 deletions
+14 -4
View File
@@ -231,6 +231,18 @@ void ReaSamplerEditor::commitAndReload() {
#endif
}
void ReaSamplerEditor::loadSelection(const std::string& id) {
// Zone-bleed fix (3a): a Sample-face load REPLACES the loaded sound. The previous
// sample's materialized full-range zone must not linger — first-match resolve would
// keep playing it while the editor draws the new pick's zone (matched by sampleId,
// order-blind). Authored Zone-view maps (any narrow key range) are left untouched.
selectedId_ = id;
if (reconcileSingleCaptureZones(map_, selectedId_)) {
selectedZone_ = map_.zones.empty() ? -1 : 0;
}
commitAndReload();
}
ReaSamplerEditor::SetupMarkers ReaSamplerEditor::pickedMarkers(std::int64_t frames) const {
SetupMarkers m;
// Seed from the bank's S2 intrinsic loop (fact about the file), then let a per-zone override
@@ -1739,8 +1751,7 @@ void ReaSamplerEditor::onMouseDown(int x, int y) {
if (contains(bm.confirm, x, y)) {
// Load: commit the pending pick (if any) into the loaded selection + reload, then Sample.
if (!browsePendingId_.empty()) {
selectedId_ = browsePendingId_;
commitAndReload();
loadSelection(browsePendingId_);
}
browsePendingId_.clear();
searchFocused_ = false;
@@ -1778,8 +1789,7 @@ void ReaSamplerEditor::onMouseDown(int x, int y) {
// is the load accelerator (commit + dismiss). Browse never loads on a single click.
const std::string id = visible_[static_cast<std::size_t>(card)].id;
if (lastBrowseClickCard_ == card && browsePendingId_ == id) {
selectedId_ = id;
commitAndReload();
loadSelection(id);
browsePendingId_.clear();
lastBrowseClickCard_ = -1;
searchFocused_ = false;