fix(vst): channel-derive the shared ext-state namespace (V4↔S4 reconcile)

ext_keys.h's kProjExtNamespace now delegates to app_version::extStateNamespace() so the beta instrument reads "reasampler_beta" — the namespace the beta extension writes — instead of stale stable. Link app_version into reasampler_vst.
This commit is contained in:
2026-07-26 18:46:17 -04:00
parent e9498c4290
commit dc5d36ff43
3 changed files with 26 additions and 11 deletions
+4 -1
View File
@@ -829,8 +829,11 @@ if(WIN32)
# give the shell TUs their headers (ext_keys.h, bank_book.h, sampler_core.h, ...).
# embed_strip (S6): the pure inline-strip layout + hit-test the embed shell marshals
# into; it links editor_geometry transitively (shared Rect).
# app_version: ext_keys.h's channel-derived namespace accessor (V4) delegates to it, so
# the instrument reads the SAME namespace the extension writes; its PUBLIC include dir
# (build/generated) carries version_generated.h for the channel bit.
target_link_libraries(reasampler_vst PRIVATE vst3_sdk editor_geometry bridge_marshal
sample_map capture_paths embed_strip)
sample_map capture_paths embed_strip app_version)
# SDK_INC gives reaper_vst3_interfaces.h + reaper_plugin_functions.h for the bridge;
# WDL_INC gives LICE for the editor. The VST3 SDK headers come from vst3_sdk PUBLIC.
target_include_directories(reasampler_vst PRIVATE ${SDK_INC} ${WDL_INC})
+15 -5
View File
@@ -5,18 +5,28 @@
// wire contract cannot drift between the two artifacts (the S4 reviewer flagged the
// spike's duplicated constants as a drift risk).
//
// PURE HEADER: NO REAPER types, NO VST3 types, NO SWELL, NO vendor/ includes. Just
// string constants, so both the REAPER-facing persist shell and the SDK-facing VST
// bridge can include it without pulling either SDK.
// PURE HEADER: NO REAPER types, NO VST3 types, NO SWELL, NO vendor/ includes. The key
// spellings are string constants; the NAMESPACE is channel-derived (Phase V, V4) so it
// delegates to the pure app_version module (also REAPER-free / VST3-free). Both the
// REAPER-facing persist shell and the SDK-facing VST bridge include this without pulling
// either SDK.
//
// FOREVER-STABLE once shipped: these strings key every already-saved project's
// stored state. Changing any of them orphans that state. See persist.h for the
// per-key retirement / migration semantics — this header only owns the spellings.
#include "app_version.h"
namespace reasampler {
// The ext-state namespace all ReaSampler project state is stored under.
inline constexpr const char* kProjExtNamespace = "reasampler";
// The ext-state namespace all ReaSampler project state is stored under. CHANNEL-DERIVED
// (Phase V, V4): delegates to the ONE app_version symbol so the extension (writer) and the
// VST3 instrument (reader) resolve the SAME namespace per channel — "reasampler" on stable,
// "reasampler_beta" on the isolated beta build. An accessor (not a constexpr literal)
// because the value is fixed by the channel bit at build time. This is the wire-contract
// reconciliation between S4 (shared ext_keys) and V4 (channel-isolated namespace): without
// it a beta instrument would read the stable namespace and see empty state.
inline const char* kProjExtNamespace() { return extStateNamespace().c_str(); }
// The multi-bank key: the whole serialized BankBook (pool + named banks). This is
// the key the VST3 instrument reads to see the live bank (read-only, S4). persist.h
+7 -5
View File
@@ -29,10 +29,12 @@ namespace Steinberg {
// interface (FUnknownPtr uses the iid), so the definition lives with its sole use.
DEF_CLASS_IID(Steinberg::IReaperHostApplication)
// The "reasampler" ext-state namespace is the SHARED wire contract between the
// extension (writer) and this instrument (reader); it lives in ext_keys.h (pure,
// REAPER-free) — reasampler::kProjExtNamespace — so the two artifacts read one symbol
// and cannot drift. The S1 spike duplicated it locally; that duplication is retired.
// The ext-state namespace is the SHARED wire contract between the extension (writer)
// and this instrument (reader); it lives in ext_keys.h (pure, REAPER-free) —
// reasampler::kProjExtNamespace() — so the two artifacts read one symbol and cannot
// drift. Channel-derived (Phase V, V4): the accessor returns "reasampler" (stable) or
// "reasampler_beta" (beta), matching whatever the extension wrote. The S1 spike
// duplicated it locally; that duplication is retired.
namespace reasampler::vst {
@@ -83,7 +85,7 @@ std::optional<std::string> ReaperBridge::readReasamplerExtState(const std::strin
// complete, else grow and retry up to a 16 MB ceiling.
for (int cap = 1 << 16; cap <= (1 << 24); cap <<= 2) {
std::vector<char> buf(static_cast<std::size_t>(cap), '\0');
const int rv = getProjExtState_(proj, kProjExtNamespace, key.c_str(),
const int rv = getProjExtState_(proj, kProjExtNamespace(), key.c_str(),
buf.data(), cap);
if (rv <= 0) return std::nullopt; // absent / empty key
std::string s(buf.data());