From b2a45335634c367ab502f0600f1632893145684b Mon Sep 17 00:00:00 2001 From: daniel-c-harvey Date: Mon, 27 Jul 2026 03:18:10 -0400 Subject: [PATCH] fix(comments): correct stale v3 "CURRENT" payload prose to v5 in sample_map --- src/vst/sample_map.cpp | 12 +++++++----- src/vst/sample_map.h | 15 ++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/vst/sample_map.cpp b/src/vst/sample_map.cpp index 760332e..5f07b99 100644 --- a/src/vst/sample_map.cpp +++ b/src/vst/sample_map.cpp @@ -353,11 +353,13 @@ struct ByteReader { } }; -// Append the zones payload — the shared body of the v2 performance blob and the v3 component -// blob, so both write zones identically. Always emits PAYLOAD v2 (the S11 self-describing -// marker + version + EXTENDED records): the marker precedes the zone count so any reader can -// detect the record shape independently of the envelope version (see sample_map.h). The S11 -// loop/start overrides therefore round-trip through EITHER envelope with no envelope bump. +// Append the zones payload — the shared body of the performance blob and the component blob, +// so both write zones identically. Always emits the CURRENT PAYLOAD version (kZonesPayloadVersion +// == v5: the S11 self-describing marker + version + EXTENDED records carrying the loop/start tail +// AND the full play-params tail with wall-clock times stored as SECONDS): the marker precedes +// the zone count so any reader can detect the record shape independently of the envelope version +// (see sample_map.h). The S11 loop/start overrides and the play params therefore round-trip +// through EITHER envelope with no envelope bump. void putZonesPayload(std::vector& out, const PerformanceMap& map) { putU32le(out, kZonesFormatMarker); putU32le(out, kZonesPayloadVersion); diff --git a/src/vst/sample_map.h b/src/vst/sample_map.h index 2bd5d79..fac8cf4 100644 --- a/src/vst/sample_map.h +++ b/src/vst/sample_map.h @@ -355,13 +355,14 @@ DecodedZonePcm decodeChannels(const std::vector& interleaved, inline constexpr std::uint32_t kPerformanceStateVersion = 2; -// The zones-payload format version and its detection marker (S11/S15/S16). serializePerformance -// and serializeComponentState both emit the CURRENT payload version (v3 — marker + version + -// records with the S11 loop/start tail AND the S15/S16 play-params tail) so the overrides -// round-trip through EITHER envelope. Readers accept a v1 payload (no marker) and a v2 payload -// (marker + version 2, no play tail) for back-compat, lifting the missing fields to defaults. -// The marker is a high sentinel that a legitimate zone count (bounded by 128 MIDI zones in -// practice, always tiny) can never collide with. +// The zones-payload format version and its detection marker (S11/S15/S16/S12). serializePerformance +// and serializeComponentState both emit the CURRENT payload version (v5 — marker + version + +// records with the S11 loop/start tail AND the full play-params tail with wall-clock times in +// SECONDS) so the overrides round-trip through EITHER envelope. Readers accept a v1 payload (no +// marker), a v2 payload (marker + version 2, no play tail), and a v3 payload (legacy S15/S16 +// play tail with wall-clock frame counts) for back-compat, lifting missing fields to defaults. +// v4 was never shipped and is not read. The marker is a high sentinel that a legitimate zone +// count (bounded by 128 MIDI zones in practice, always tiny) can never collide with. inline constexpr std::uint32_t kZonesPayloadVersion = 5; // S12: full per-zone play params, SECONDS inline constexpr std::uint32_t kZonesFormatMarker = 0xFFFFFF00u;