Files
JaySynth/tools/testhost/src/Vst2RawChunk.h
T
jensandClaude Sonnet 5 8194bda9c8 testhost: prove the actual chunk-based state path via raw VST2 dispatcher
Add Vst2RawChunk, a raw effGetChunk/effSetChunk bypass around JUCE's
VSTPluginInstance::usesChunks() gate, plus --loadBankChunk/--saveBankChunk/
--loadPatchChunk/--savePatchChunk CLI flags and a new test_chunk_roundtrip
regression test asserting the saved file is genuinely zlib/XML (0x78 header,
>1000 bytes), not a per-parameter fallback.

Building and using this bypass disproved an earlier documented finding: the
compiled VST2 wrapper does set effFlagsProgramChunks and usesChunks() is
genuinely true, so the previous "chunk-advertisement gap" theory in TODO.md
and tests/README.md was wrong. Corrected in both places. The real cause of
old bundled .fxp sample files having no effect remains open and is now
narrowed to a JaySynth-side XML/schema parsing question, not a host/plugin
capability mismatch.

Also adds a PluginHost-method-to-VST2-wiring-to-test coverage table in
tests/README.md, and documents the remaining "exercised but not asserted"
gaps (channel/param counts, DSP correctness) in TODO.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dhtwRLARk4eiPngcQykLJ
2026-07-27 21:22:24 +02:00

39 lines
1.7 KiB
C++

#ifndef TESTHOST_VST2RAWCHUNK_H_INCLUDED
#define TESTHOST_VST2RAWCHUNK_H_INCLUDED
#include <JuceHeader.h>
/** Deliberately VST2-specific (unlike everything else in this tool): talks
to the raw AEffect dispatcher directly, bypassing JUCE's own
VSTPluginInstance::usesChunks() gate.
Why this exists: JUCE's generic AudioProcessor::getStateInformation()/
setStateInformation() only reach a VST2 plugin's real effGetChunk/
effSetChunk implementation if the plugin's AEffect.flags advertises
effFlagsProgramChunks. JaySynth's compiled JUCE 3.1.1 VST wrapper never
sets that flag (see tools/testhost/TODO.md's Investigate section), so
the generic path silently falls back to JUCE's own per-parameter
"regular" fxb/fxp format instead - which never touches JaySynth's own
bankEncodeXml/bankDecodeXml or patchEncodeXml/patchDecodeXml at all.
Many real-world VST2 hosts don't strictly gate on that flag either -
they just call effGetChunk/effSetChunk and see what comes back. This
does the same thing on purpose, to reach and test that actual code
path.
*/
namespace Vst2RawChunk
{
/** Returns nullptr if instance isn't hosted via VSTPluginFormat (or the
AEffect's magic number doesn't check out). */
void *getRawAEffect (AudioPluginInstance *instance);
/** isPreset: true = patch (single program) chunk, false = bank (whole
plugin) chunk - matches VST2's effGetChunk/effSetChunk "index"
argument (see aeffect.h). Returns false if the plugin isn't VST2,
or the dispatcher call returned no data. */
bool getChunk (AudioPluginInstance *instance, bool isPreset, MemoryBlock &outData);
bool setChunk (AudioPluginInstance *instance, bool isPreset, const void *data, int size);
}
#endif // TESTHOST_VST2RAWCHUNK_H_INCLUDED