Q-W2v: split VST god-modules — editor 8 face-axis TUs (+pure layout hoist), processor 3 TUs, component_state_io codec split (extension drops the voice engine), zone_params.h, core/wire putLE; formats frozen, 61/61 green
This commit is contained in:
@@ -7,25 +7,19 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include "core/wire/reasampler_uid.h" // REASAMPLER_ACTIVE_UID_* — the FROZEN, channel-selected class UID
|
||||
#include "core/instrument/map/sample_map.h" // ComponentState + serializeComponentState (the SHARED writer)
|
||||
#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)
|
||||
|
||||
namespace reasampler::wire {
|
||||
|
||||
using instrument::map::ComponentState;
|
||||
using instrument::map::serializeComponentState;
|
||||
|
||||
namespace {
|
||||
|
||||
// Little-endian appenders — the .vstpreset container stores its integers little-endian on
|
||||
// disk (public.sdk vstpresetfile.cpp swaps only on big-endian hosts).
|
||||
void appendU32LE(std::vector<std::uint8_t>& out, std::uint32_t v) {
|
||||
out.push_back(static_cast<std::uint8_t>(v & 0xFF));
|
||||
out.push_back(static_cast<std::uint8_t>((v >> 8) & 0xFF));
|
||||
out.push_back(static_cast<std::uint8_t>((v >> 16) & 0xFF));
|
||||
out.push_back(static_cast<std::uint8_t>((v >> 24) & 0xFF));
|
||||
}
|
||||
|
||||
void appendU64LE(std::vector<std::uint8_t>& out, std::uint64_t v) {
|
||||
for (int i = 0; i < 8; ++i)
|
||||
out.push_back(static_cast<std::uint8_t>((v >> (8 * i)) & 0xFF));
|
||||
}
|
||||
// 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).
|
||||
|
||||
void appendFourCC(std::vector<std::uint8_t>& out, const char id[4]) {
|
||||
out.insert(out.end(), id, id + 4);
|
||||
@@ -58,19 +52,19 @@ std::vector<std::uint8_t> buildVstPresetBytes(
|
||||
|
||||
out.reserve(static_cast<std::size_t>(listOffset) + 4 + 4 + (4 + 8 + 8));
|
||||
appendFourCC(out, "VST3");
|
||||
appendU32LE(out, 1); // kFormatVersion
|
||||
putLE<std::uint32_t>(out, 1); // kFormatVersion
|
||||
out.insert(out.end(), classIdHex32.begin(), classIdHex32.end());
|
||||
appendU64LE(out, listOffset);
|
||||
putLE<std::uint64_t>(out, listOffset);
|
||||
|
||||
// Data area: the one 'Comp' chunk's bytes, at offset kHeaderSize.
|
||||
out.insert(out.end(), componentState.begin(), componentState.end());
|
||||
|
||||
// Chunk list: 'List' + entry count + one entry {'Comp', offset, size}.
|
||||
appendFourCC(out, "List");
|
||||
appendU32LE(out, 1);
|
||||
putLE<std::uint32_t>(out, 1);
|
||||
appendFourCC(out, "Comp");
|
||||
appendU64LE(out, kHeaderSize);
|
||||
appendU64LE(out, compSize);
|
||||
putLE<std::uint64_t>(out, kHeaderSize);
|
||||
putLE<std::uint64_t>(out, compSize);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user