feat: add M6 insert — place selected bank sample at edit cursor

InsertMedia-driven placement reading the bank panel selection, undo-wrapped.
Native length by default; conform-to-tempo is an explicit second action, never
a silent stretch. Pure mode-bit logic (insert_plan) unit-tested.
This commit is contained in:
2026-07-23 05:23:37 -04:00
parent 60add4afc7
commit 172d5902c8
9 changed files with 557 additions and 5 deletions
+16
View File
@@ -778,6 +778,22 @@ bool bankPanelIsOpen() {
return g_panel.open;
}
std::vector<std::string> bankPanelSelectedSampleIds() {
std::vector<std::string> ids;
const BankIndex* bank = g_panel.session ? &g_panel.session->bank() : nullptr;
if (!bank) return ids;
const std::vector<Sample>& samples = bank->all();
const int count = static_cast<int>(samples.size());
// selection.indices is sorted-ascending unique (bank_grid invariant), so the
// returned ids come out in bank order. Guard each index against the live count
// in case the selection outran a shrink the fingerprint pass hasn't cleared yet.
for (int idx : g_panel.selection.indices) {
if (idx >= 0 && idx < count)
ids.push_back(samples[static_cast<std::size_t>(idx)].id);
}
return ids;
}
void bankPanelRefresh() {
if (!g_panel.open || !g_panel.hwnd) return;
// Repaint only when the bank actually changed (generation bump). Cheap tick