Cut core/wire and shell/persist comment bloat ~46% (comments only, zero code change)
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
// instrument_drop — pure implementation. See instrument_drop.h.
|
||||
// NO REAPER / SWELL / VST3 SDK / vendor. Reuses sample_map's ComponentState serializer and
|
||||
// the SDK-free UID macros (core/wire/reasampler_uid.h).
|
||||
// No REAPER/SWELL/VST3 SDK/vendor. Reuses sample_map's ComponentState serializer
|
||||
// and the SDK-free UID macros (reasampler_uid.h).
|
||||
|
||||
#include "core/wire/instrument_drop.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "core/wire/reasampler_uid.h" // REASAMPLER_ACTIVE_UID_* — the FROZEN, channel-selected class UID
|
||||
#include "core/instrument/map/component_state_io.h" // ComponentState + serializeComponentState (the SHARED writer, Q-W2v codec split)
|
||||
#include "core/wire/bytes.h" // putLE — the ONE LE byte codec (T4-20)
|
||||
#include "core/instrument/map/component_state_io.h" // ComponentState + serializeComponentState (the SHARED writer)
|
||||
#include "core/wire/bytes.h" // putLE — the ONE LE byte codec
|
||||
|
||||
namespace reasampler::wire {
|
||||
|
||||
@@ -18,8 +18,7 @@ using instrument::map::serializeComponentState;
|
||||
namespace {
|
||||
|
||||
// The .vstpreset container stores its integers little-endian on disk (public.sdk
|
||||
// vstpresetfile.cpp swaps only on big-endian hosts) — putLE (core/wire/bytes.h) is
|
||||
// exactly that byte order; the former appendU32LE/appendU64LE copies are retired (T4-20).
|
||||
// vstpresetfile.cpp swaps only on big-endian hosts) — putLE is exactly that byte order.
|
||||
|
||||
void appendFourCC(std::vector<std::uint8_t>& out, const char id[4]) {
|
||||
out.insert(out.end(), id, id + 4);
|
||||
@@ -28,9 +27,6 @@ void appendFourCC(std::vector<std::uint8_t>& out, const char id[4]) {
|
||||
} // namespace
|
||||
|
||||
std::string vstClassIdHex() {
|
||||
// FUID::toString reduces to the four INLINE_UID words as "%08X" in order on BOTH byte
|
||||
// layouts (see header contract), so rendering the macros directly is the platform-stable
|
||||
// derivation of the string the .vstpreset header must carry.
|
||||
char buf[33];
|
||||
std::snprintf(buf, sizeof(buf), "%08X%08X%08X%08X",
|
||||
static_cast<unsigned>(REASAMPLER_ACTIVE_UID_1),
|
||||
@@ -69,12 +65,8 @@ std::vector<std::uint8_t> buildVstPresetBytes(
|
||||
}
|
||||
|
||||
std::vector<std::uint8_t> instrumentDropStateBytes(const std::string& sampleId) {
|
||||
// The ONE fact the drop carries: this capture is the instance's selection. Everything
|
||||
// else stays at the fresh-instance defaults (no zones, implicit channel mode, generation
|
||||
// 0) — the same ComponentState a browser click would produce. The implicit mode means
|
||||
// the GA auto-default will follow the loaded capture's channel count on first reload.
|
||||
// serializeComponentState is the instrument's own writer (the single source of truth for
|
||||
// the byte layout), so this is NOT a parallel encoder — it IS the instrument's encoder.
|
||||
// Everything but selectionId stays at fresh-instance defaults (no zones,
|
||||
// implicit channel mode, generation 0) — same as a browser click.
|
||||
ComponentState cs;
|
||||
cs.selectionId = sampleId;
|
||||
return serializeComponentState(cs);
|
||||
@@ -85,16 +77,7 @@ std::vector<std::uint8_t> buildInstrumentDropPreset(const std::string& sampleId)
|
||||
}
|
||||
|
||||
bool infoNamesFxHotspot(const std::string& info) {
|
||||
// See the header contract. Prefix rule (S-GA-DropFX): "fx_" names the FX-chain /
|
||||
// floating-FX windows; "tcp.fx" / "mcp.fx" prefixes name the TCP/MCP FX button and its
|
||||
// sibling FX sub-elements (fxbyp/fxparm/fxlist...), tolerant of the SDK-documented "may
|
||||
// append additional information". Bare "tcp"/"mcp" and non-FX sub-elements ("tcp.mute",
|
||||
// "tcp.vol") must NOT trigger an instrument drop.
|
||||
//
|
||||
// EXCLUDE the embed-strip sub-element ("tcp.fxembed" / "mcp.fxembed"): that is the
|
||||
// surface where a ReaSampler 9000 embed strip draws inside the TCP/MCP. Dropping a card
|
||||
// there must NOT add a SECOND instance — the surface is the existing instance's own UI,
|
||||
// not an FX-chain drop target. It starts with "tcp.fx" so it must be explicitly excluded.
|
||||
// See the header contract for the prefix rule and the embed-strip exclusion.
|
||||
auto startsWith = [&info](const char* p) { return info.rfind(p, 0) == 0; };
|
||||
if (startsWith("tcp.fxembed") || startsWith("mcp.fxembed")) return false;
|
||||
return startsWith("fx_") || startsWith("tcp.fx") || startsWith("mcp.fx");
|
||||
|
||||
Reference in New Issue
Block a user