Skip to content

Add VST3 .vstpreset interchange codec and serialization provider#40

Merged
matt-edmondson merged 3 commits into
mainfrom
claude/vst-plugin-upstream-djlud9
Jun 9, 2026
Merged

Add VST3 .vstpreset interchange codec and serialization provider#40
matt-edmondson merged 3 commits into
mainfrom
claude/vst-plugin-upstream-djlud9

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Summary

Implements upstream roadmap item #5 from the .NET VST3 effects host plan: a .vstpreset interchange backend so ktsu persistence can round-trip host preset files.

  • VstPresetFile — a faithful reader/writer for the Steinberg VST3 .vstpreset container format: the VST3 header + version + 32-byte class id + an int64 chunk-list offset, the Comp/Cont/Info state chunks, and a trailing little-endian List. Provides Stream and byte[] overloads. Files it writes are loadable by hosts, and host-written presets read back.
  • VstPreset — the decoded model: class id, component state, optional controller state, optional XML metadata, and version.
  • VstPresetSerializationProvider — an ISerializationProvider that wraps an inner provider (e.g. JSON) and packages its output as the component chunk of a .vstpreset. Because the interface is string-based, the binary preset is returned Base64-encoded; for direct file/byte interop callers use VstPresetFile directly.

All additive and netstandard2.0-compatible (uses BinaryReader/BinaryWriter, which are little-endian on every platform).

Testing

Added VstPresetTests (8 cases, MSTest + FluentAssertions): VST3 header validation, full round-trips (component-only, all three chunks, empty state), malformed-input and non-seekable-stream guards, and a provider round-trip that verifies the output is a Base64-encoded real .vstpreset. 20/20 tests pass locally (net10.0); the library also builds clean on netstandard2.0.

Note on AppData

Roadmap #5 names "SerializationProvider / AppData". The substantive interop primitive — the container codec — lives here in SerializationProvider, its natural home; ktsu.AppData can adopt .vstpreset storage by consuming this codec (or the provider) through its existing serializer seam, with no AppData changes required by this PR.

Note: the sandbox's .NET SDK (10.0.108) predates the Roslyn the pinned ktsu.Sdk analyzers (2.8.0) require, so tests were run via the standard MSTest runner against net10.0. CI runs the full multi-target build with analyzers and style enforcement.

🤖 Part of the ktsu VST plugin upstream-enablement work.

https://claude.ai/code/session_01JQ3bQMuSYuumAnQZaYUKP7


Generated by Claude Code

claude added 3 commits June 9, 2026 03:34
Implements the .vstpreset interchange from the .NET VST3 effects host plan
(upstream roadmap item #5), so ktsu persistence can round-trip host preset
files.

- VstPresetFile: a faithful reader/writer for the Steinberg VST3 .vstpreset
  container format (VST3 header + class id + component/controller/info chunks
  + trailing little-endian chunk list). Stream and byte[] overloads. Files it
  writes are loadable by hosts, and host-written presets read back.
- VstPreset: the decoded model (class id, component state, optional controller
  state, optional XML metadata, version).
- VstPresetSerializationProvider: an ISerializationProvider that wraps an inner
  provider (e.g. JSON) and packages its output as the component chunk of a
  .vstpreset, Base64-encoded to satisfy the string-based interface. For direct
  byte/file interop, VstPresetFile is used directly.

All additive and netstandard2.0-compatible. Includes MSTest/FluentAssertions
coverage: header validation, full round-trips (component only, all chunks,
empty state), malformed-input and non-seekable-stream guards, and provider
round-trip producing a real Base64-encoded .vstpreset.
CI's code-style analyzers (which the local sandbox SDK cannot load) flag the
explicit constructor as IDE0290. Convert to a primary constructor with
validating field initializers; behaviour is unchanged.
The ktsu.Sdk analyzer KTSU0004 (which the local sandbox SDK cannot load)
requires Ensure.NotNull(x) instead of manual `?? throw new
ArgumentNullException`. Replace the null checks in VstPreset, VstPresetFile,
and VstPresetSerializationProvider accordingly; Ensure.NotNull returns the
validated value, so it also works in the primary-constructor field
initializers. Behaviour is unchanged.
@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

@matt-edmondson matt-edmondson merged commit 004d2a6 into main Jun 9, 2026
5 checks passed
@matt-edmondson matt-edmondson deleted the claude/vst-plugin-upstream-djlud9 branch June 9, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants