Class Vst3Preset
Reads and writes Steinberg .vstpreset files — the standard on-disk container for a
VST 3 plug-in's saved state. A preset bundles the component (DSP) state blob and, optionally,
the controller (UI / parameter) state blob, tagged with the plug-in's class identifier so a
host can refuse to load a preset that belongs to a different plug-in.
public static class Vst3Preset
- Inheritance
-
Vst3Preset
- Inherited Members
Remarks
This type handles only the binary container. To save or load the state of a live plug-in use SavePreset(string) / LoadPreset(string), which capture and apply the component / controller blobs for you.
File layout (all integers little-endian, offsets relative to the start of the preset):
Header (48 bytes): "VST3" | int32 version | char[32] classID | int64 chunkListOffset
Chunk data: <component bytes><controller bytes><meta-info bytes>
Chunk list: "List" | int32 entryCount | { char[4] id, int64 offset, int64 size } * n
The class ID stored in the header is the COM / GUID string form Steinberg uses on Windows
(COM_COMPATIBLE): the 16-byte TUID rendered as a 32-character hex string with the
first three GUID fields byte-swapped. The ClassId returned by
Read(Stream) is converted back to the raw-TUID hex used elsewhere in the library
(e.g. ClassId), so the two are directly comparable.
Fields
ComponentChunkId
Chunk id for the component (processor / DSP) state blob.
public const string ComponentChunkId = "Comp"
Field Value
ControllerChunkId
Chunk id for the controller (edit-controller / parameter) state blob.
public const string ControllerChunkId = "Cont"
Field Value
MetaInfoChunkId
Chunk id for the optional XML meta-info chunk.
public const string MetaInfoChunkId = "Info"
Field Value
Methods
Read(Stream)
Reads and parses a .vstpreset from stream (which must be seekable).
public static Vst3PresetContents Read(Stream stream)
Parameters
streamStream
Returns
Exceptions
- InvalidDataException
The stream is not a well-formed
.vstpreset.
Read(string)
Reads and parses a .vstpreset from the given file.
public static Vst3PresetContents Read(string filePath)
Parameters
filePathstring
Returns
ReadClassId(Stream)
Reads just the class id from a .vstpreset stream, without loading the state blobs.
Returned in raw-TUID hex so it can be compared directly with ClassId.
public static string ReadClassId(Stream stream)
Parameters
streamStream
Returns
ReadClassId(string)
Reads just the class id from a .vstpreset file, without loading the state blobs.
public static string ReadClassId(string filePath)
Parameters
filePathstring
Returns
Write(Stream, string, ReadOnlySpan<byte>, ReadOnlySpan<byte>, string?)
Writes a .vstpreset to stream (which must be seekable). The
component blob is always written; the controller blob is written only when
controllerState is non-empty, and the meta-info chunk only when
metaInfoXml is non-null.
public static void Write(Stream stream, string classId, ReadOnlySpan<byte> componentState, ReadOnlySpan<byte> controllerState, string? metaInfoXml = null)
Parameters
streamStreamDestination stream; written from its current position and must be seekable.
classIdstringThe plug-in's class id as 32 hex characters in raw-TUID order (i.e. the value of ClassId / ClassInfo). It is converted to the GUID string form on the wire.
componentStateReadOnlySpan<byte>The component (DSP) state blob.
controllerStateReadOnlySpan<byte>The controller state blob, or empty to omit the chunk.
metaInfoXmlstringOptional meta-info XML, or null to omit the chunk.