Files
reasampler/src/shell/instrument/instrument_bake.h
T

38 lines
1.6 KiB
C++

// instrument_bake — the instrument's half of the resample chain: render the dialed sound
// offline, stage it outside the bank, ask the extension to bank it, then re-point and go
// neutral. UI thread only; nothing here is on any audio path.
//
// The extension is REQUIRED. Without it the bank has no writer, so the affordance reads
// Disabled and this refuses rather than half-baking.
#pragma once
#include <string>
namespace reasampler::vst {
class ReaSamplerProcessor;
class ReaperBridge;
// Whether a bake can run at all right now: a REAPER host, and the extension's bake action
// registered. Runs one NamedCommandLookup and builds one std::string per call — cost
// unmeasured. It is on the editor's sync tick because that is where the button's paint
// state is decided, and the control must never be enabled and then refuse.
bool bakeAvailable(ReaperBridge& bridge);
struct BakeChainResult {
bool ok = false;
std::string message; // always populated — the editor prints it either way
};
// Runs the whole chain against `processor`. On failure NOTHING has changed: no temp file
// survives, no bank entry was added, no assign was written, and the dialed state is
// exactly as it was before the click.
//
// MUST NOT be called from a mouse handler. It invokes a REAPER action synchronously — an
// offline landing nested inside a click, with the mouse captured, re-pointing the very
// instance whose frame is on the stack. The editor defers it to its own timer tick.
BakeChainResult runBake(ReaSamplerProcessor& processor);
} // namespace reasampler::vst