fix: insert onto selected track(s) at edit cursor, not a new track

Wire both insert actions to CurrentTrack (InsertMedia base 0). Per selected
track: SetOnlyTrackSelected, reset cursor to snapshot, InsertMedia; then restore
original selection + cursor. No-op when no track selected. Corrected stale
extraflags / new-track / preservePitch comments.
This commit is contained in:
2026-07-23 05:56:25 -04:00
parent 59e3c5907f
commit 2536b4bedb
5 changed files with 142 additions and 66 deletions
+7 -7
View File
@@ -142,7 +142,8 @@ static void RunCaptureMasterSpike()
static void RunInsertSelected(bool conform)
{
reasampler::InsertRequest req;
req.options.target = reasampler::InsertTarget::NewTrack; // sensible default: own track
// target defaults to CurrentTrack (InsertOptions::target) — inserts onto the
// user's currently-selected track(s) at the edit cursor.
req.options.conform =
conform ? reasampler::TempoConform::Ratio1x : reasampler::TempoConform::None;
// preservePitch stays true: a tempo conform matches tempo without varispeeding
@@ -154,14 +155,13 @@ static void RunInsertSelected(bool conform)
switch (res.status)
{
case reasampler::InsertStatus::Ok:
msg = "ReaSampler: inserted " + std::to_string(res.inserted) +
(res.inserted == 1 ? " sample" : " samples") +
(conform ? " (conformed to tempo)" : " (native length)");
if (res.skipped > 0)
msg += ", skipped " + std::to_string(res.skipped) + " unresolvable";
msg += "\n";
msg = "ReaSampler: inserted onto " + std::to_string(res.inserted) +
(res.inserted == 1 ? " track" : " tracks") +
(conform ? " (conformed to tempo)" : " (native length)") + "\n";
break;
case reasampler::InsertStatus::NoSelection:
// "select a track first" is printed by runInsert when no track is
// selected; this branch covers the no-panel-selection case.
msg = "ReaSampler insert: nothing selected in the bank panel.\n";
break;
case reasampler::InsertStatus::NoProject: