VST Hosting Spike
VST Hosting Spike
Goal: let Sample Squad use external instruments such as Dexed as optional sound engines without making the core drum lab heavier for everyone.
Recommended First Version
- Add a new engine type called
External Plugin. - Support VST3 first on Windows.
- Load one plugin instance per selected pad only when explicitly enabled.
- Keep the internal synth/sample engines active as the default path.
- Add a global CPU warning before enabling many external instances.
- Save the plugin identifier, plugin state block, MIDI note mapping, output gain, and wet/dry blend in the project.
JUCE Pieces To Use
juce::AudioPluginFormatManagerto register hostable formats.juce::KnownPluginListandjuce::PluginDirectoryScannerto scan plugin folders.juce::AudioPluginInstanceto own and process the loaded plugin.juce::AudioProcessorGraphlater if routing becomes more DAW-like.
Why Not Rush It Into The Audio Thread
Plugin hosting is feasible, but it can destabilize an otherwise solid instrument if it is bolted on quickly. External plugins can crash, report latency, allocate memory, open editors, use copy protection, and consume large CPU bursts. For a commercial user experience, scanning and loading should happen away from playback, and the project should still open gracefully if a collaborator does not own the same plugin.
Safe Implementation Path
- Build a plugin browser on the Library page with scan locations and a rescan button.
- Save a known-plugin database in Documents / Sample Squad.
- Add a single test slot for one external plugin instance.
- Route MIDI from the piano roll into that instance.
- Blend the plugin output with pad/sample/synth output.
- Add project restore with missing-plugin warnings.
- Add per-pad external plugin support only after the single-slot version is stable.
CPU Guidance
The first release should treat external plugins as an advanced feature. A few hosted synths are fine; dozens of hosted synths inside a drum workstation can become bloated fast. The UI should show a clear "external plugin active" indicator and eventually a simple CPU meter.