Files
admin bbb11f8066 Phase 1: import .vstpreset in offline render (loadSerializedState)
daw_vst_bridge --render now applies a VST3 preset when job has 'preset'
(base64 of a .vstpreset file). Parse the SDK binary chunk format with
PresetFile (vst3sdk), rewrap component/controller state into the bridge
blob [4B BE compLen][comp][4B BE ctrlLen][ctrl] and apply via
loadSerializedState before rendering. SF2/SFZ ignore preset (warning).
Bad base64/magic/chunks fail the job with rc 1 and no partial clip.

Tests: golden Nexus .vstpreset fixture; VST3 with/without preset,
bad preset -> rc 1, non-VST3 preset ignored. 20/20 pass.
2026-08-17 10:44:13 +07:00

26 lines
1.2 KiB
C++

// native_bridge/include/RenderJob.h
#ifndef RENDER_JOB_H
#define RENDER_JOB_H
#include <string>
// Offline render mode: `daw_vst_bridge --render <job.json> --out <clip.wav>`.
// Parses the job, creates the instrument headless, renders the MIDI notes to
// a 16-bit stereo WAV, and exits. Realtime SHM mode is untouched.
//
// job.json: { instrument_type, plugin_path, preset?, sample_rate?, block_size?,
// bpm?, soundfont_bank?, soundfont_program?,
// notes: [{pitch?, velocity?, start_beat?, duration_beats?}] }
// instrument_type: 0=VST3, 1=VST2, 2=SF2/SF3, 3=SFZ (InstrumentType enum).
// preset: base64 of a .vstpreset file (VST3 only; SF2/SFZ ignore it). The
// bridge parses the SDK chunk format and applies component/controller
// state via loadSerializedState before rendering.
// pitch/velocity: velocity 0..1 (float) or 0..127; start/duration in beats.
//
// Returns 0 on success. On failure prints a clear error to stderr and returns
// non-zero (1 = job/argument error, 2 = instrument load failure, 3 = plugin
// crashed mid-render). Any partial output file is removed.
int run_render_job(const std::string& jobPath, const std::string& outPath);
#endif // RENDER_JOB_H