Q-W6: registration table (OCP) in main.cpp; bank verbs -> shell/bank_ops(Session&); persist.h + wav_trim + namespaces.h shims deleted; 61/61
capture.h realtime seam split to capture_realtime_shell.h; GetProjExtState grow-loop rehomed to core/wire/ext_state_read; stale persist.cpp/bank_panel.cpp comment refs fixed; CLAUDE.md persist/bank_book/actions bullets updated. Command-id suffixes, display phrases, and undo labels byte-identical.
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
// bank_ops — the promptless bank-verb seam (Q-W6 lift of the Q-W4 single-owner
|
||||
// verbs out of shell/panel/panel_bank_ops into a NON-UI home). Each verb is a model
|
||||
// op on the given session's BankBook + persistBankOp (undo-batched ext-state
|
||||
// persist) — NO prompts, NO message boxes, NO panel-state nudges, NO panel-global
|
||||
// reads. The two UX surfaces consume these as thin skins:
|
||||
//
|
||||
// * shell/panel/panel_bank_ops — the panel's menu handlers (prompts / confirms /
|
||||
// repaints), passing the panel's live session.
|
||||
// * shell/actions/bank_actions — the bindable family (text prompts / console
|
||||
// feedback), passing its registered session.
|
||||
//
|
||||
// The session arrives BY REFERENCE: there is exactly one session pointer question
|
||||
// per call site (the caller's), so a missing session can never be half-reported as
|
||||
// a model rejection from in here (the Q-W4 review's fail-safe-collapse concern).
|
||||
// Every verb returns whether the model accepted the mutation — a rejected op
|
||||
// persists nothing and opens no undo point.
|
||||
//
|
||||
// REAPER-facing (persist + undo blocks + GUID minting) but SDK-free in this header.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace reasampler {
|
||||
|
||||
class ReaSamplerSession;
|
||||
|
||||
// Mints a stable GUID bank id, creates `name` in the book. Returns the new bank id,
|
||||
// or "" when the model rejects the name (duplicate, trimmed + case-insensitive).
|
||||
// Create is purely organizational — no generation bump.
|
||||
std::string bankOpCreate(ReaSamplerSession& session, const std::string& name);
|
||||
|
||||
// Renames `bankId`. False when the model rejects (pool un-renamable / name in use).
|
||||
bool bankOpRename(ReaSamplerSession& session, const std::string& bankId,
|
||||
const std::string& newName);
|
||||
|
||||
// Deletes `bankId`. False when the model rejects (pool un-deletable). The caller
|
||||
// passes `bumpGeneration` from the member count it read BEFORE any evacuate/delete
|
||||
// (an evacuate-then-delete flow must still bump on the ORIGINAL membership).
|
||||
bool bankOpDelete(ReaSamplerSession& session, const std::string& bankId,
|
||||
bool bumpGeneration);
|
||||
|
||||
// Evacuates `bankId`'s members to the pool. False when the model rejects (the pool
|
||||
// itself). Bumps the generation (membership changed).
|
||||
bool bankOpEvacuate(ReaSamplerSession& session, const std::string& bankId);
|
||||
|
||||
// Activates `bankId` as the capture target. False on an unknown id. No bump.
|
||||
bool bankOpActivate(ReaSamplerSession& session, const std::string& bankId);
|
||||
|
||||
// Moves (copy=false) or copies (copy=true) `sampleIds` from `srcBankId` to
|
||||
// `destBankId` (index-only; files never relocate). Returns whether the index
|
||||
// actually mutated — the verb-aware no-op guardrail: a COPY collapse changes
|
||||
// nothing (no undo point); a MOVE collapse did remove the source entry (counts).
|
||||
// Persists ONE undo point ("move/copy sample(s)") only when mutated.
|
||||
bool bankOpTransfer(ReaSamplerSession& session,
|
||||
const std::vector<std::string>& sampleIds,
|
||||
const std::string& srcBankId, const std::string& destBankId,
|
||||
bool copy);
|
||||
|
||||
// Removes `sampleIds` from `srcBankId` (index-only, this-bank scope; never deletes
|
||||
// bytes). Returns whether anything was removed; persists one undo point when so.
|
||||
bool bankOpRemove(ReaSamplerSession& session,
|
||||
const std::vector<std::string>& sampleIds,
|
||||
const std::string& srcBankId);
|
||||
|
||||
// Persists a completed bank-index verb as a single REAPER undo point (R-B).
|
||||
// Wraps the session persist (SetProjExtState) in a Begin/End block with
|
||||
// UNDO_STATE_MISCCFG so the bank op is one Ctrl-Z. On an unsaved / no-active project
|
||||
// the persist no-ops and the block is closed with an empty label + zero flag (REAPER
|
||||
// discards it). Callers must invoke this ONLY after a successful/effective mutation —
|
||||
// rejected ops (duplicate name, un-deletable pool, etc.) must return before reaching
|
||||
// here so no empty undo point is ever opened for a no-op.
|
||||
//
|
||||
// S9 bank-generation bump: pass `bumpGeneration = true` for a verb that changes what a
|
||||
// live instance would PLAY — move / copy / remove / evacuate / delete-with-members. Leave
|
||||
// it false (the default) for a PURELY ORGANIZATIONAL verb — create / rename / activate /
|
||||
// reorder. The bump (when requested) happens INSIDE the block, BEFORE the persist, so
|
||||
// the stamped counter rides the same ext-state write and undo captures the pre/post
|
||||
// generation with the rest of the blob.
|
||||
void persistBankOp(ReaSamplerSession& session, const char* label,
|
||||
bool bumpGeneration = false);
|
||||
|
||||
} // namespace reasampler
|
||||
Reference in New Issue
Block a user