fix(processor): close S-VIEW-4 previewVelocity persistence loop

Add previewVelocity_ member to ReaSamplerProcessor; populate it in
getState and restore it in setState so the field round-trips in the
plugin, not just in the pure unit test. Clamp 1..127 at the
deserialize read boundary in sample_map.cpp.
This commit is contained in:
2026-07-27 13:34:39 -04:00
parent b0b24c3e31
commit 5db620be78
3 changed files with 15 additions and 1 deletions
+5 -1
View File
@@ -628,7 +628,11 @@ ComponentState deserializeComponentState(const std::vector<std::uint8_t>& bytes,
if (!r.ok) return out; // truncated before/inside the marker -> empty (marker 0 holds)
const std::uint8_t previewVel = r.u8();
if (!r.ok) return out; // truncated before the velocity byte -> empty (mid default holds)
out.previewVelocity = previewVel;
// Clamp to the documented MIDI 1..127 range: a 0 byte (or any out-of-spec value from a
// corrupt blob) falls back to the mid default rather than silencing the preview trigger.
out.previewVelocity = (previewVel >= 1 && previewVel <= 127)
? previewVel
: kPreviewVelocityDefault;
const std::uint32_t idLen = r.u32();
out.selectionId = r.str(idLen);
if (!r.ok) { out.selectionId.clear(); return out; } // truncated id -> empty