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:
+13
-10
@@ -27,7 +27,7 @@ class ReaSamplerSession;
|
||||
// tempo-conform choice) so the two action variants (native-length vs
|
||||
// conform-to-tempo) differ only by this struct — no divergent code paths.
|
||||
struct InsertRequest {
|
||||
InsertOptions options; // defaults: new track, no conform, native length
|
||||
InsertOptions options; // defaults: current track, no conform, native length
|
||||
};
|
||||
|
||||
// The outcome of an insert action, for the caller to log to the console.
|
||||
@@ -44,16 +44,19 @@ struct InsertResult {
|
||||
int skipped = 0; // selected-but-unresolvable/unreadable samples skipped
|
||||
};
|
||||
|
||||
// Runs the insert: reads bank_panel's selection, resolves each sample against the
|
||||
// current project dir, and inserts them AT THE EDIT CURSOR in bank order, advancing
|
||||
// the cursor so multiple samples lay end-to-end. The whole placement is wrapped in
|
||||
// a single Undo_BeginBlock2 / Undo_EndBlock2 so one undo removes the entire insert.
|
||||
// `session` supplies the live bank the selected ids resolve against.
|
||||
// Runs the insert: reads the bank panel's single focused sample and the user's
|
||||
// currently-selected track set, then inserts the sample onto EACH selected track
|
||||
// at the SAME edit-cursor position. Snapshot/restore ensures the user's track
|
||||
// selection and cursor position are unchanged after the action. The whole operation
|
||||
// is wrapped in a single Undo_BeginBlock2 / Undo_EndBlock2.
|
||||
//
|
||||
// Multi-select behavior: each selected sample is inserted sequentially at the
|
||||
// then-current edit cursor; InsertMedia advances the cursor to the end of the
|
||||
// inserted media, so N samples lay contiguously left-to-right. Single-select is the
|
||||
// N==1 case of the same path.
|
||||
// No-op cases (with console messages):
|
||||
// - No track selected: prints "select a track first."
|
||||
// - No sample selected in the panel: NoSelection status.
|
||||
// - Unsaved project (no resolvable bank dir): NoProject status.
|
||||
// - Sample id not in bank / file missing: NothingResolved status.
|
||||
//
|
||||
// `session` supplies the live bank the selected id resolves against.
|
||||
InsertResult runInsert(ReaSamplerSession* session, const InsertRequest& request);
|
||||
|
||||
} // namespace reasampler
|
||||
|
||||
Reference in New Issue
Block a user