Files
SonicForgeStudio/native_bridge/include/RenderJob.h
T
admin 0cca84c5f9 feat(bridge): add --render offline CLI (Phase 0 of pedalboard replacement)
daw_vst_bridge --render <job.json> --out <clip.wav> renders MIDI notes
through the same instrument engines as realtime (SF2/SFZ/VST3/VST2) to a
16-bit stereo WAV, headless, no SHM. Mirrors plugins.py/vst_engine.py
note semantics (velocity int(vel*127), bank CC0 + program at t=0, beatSec
60/max(30,bpm), totalNeeded max(1024,endSample), no tail). Chunk clamped
to 256 to match VST3 host prepared buffers. Uses vendored sheredom json.h
(gated on HAVE_VST3SDK); rc: 0 ok, 1 arg/job error, 2 load fail, 3 crash.
Partial output removed on failure. Verified: SF2, SFZ, Nexus VST3 render
non-silent at exact duration; 9/9 tests pass.
2026-08-17 08:04:25 +07:00

23 lines
1017 B
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).
// 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