SSPACEAGEDOCUMENTATION/
Architecture and Portability

VST Hosting Spike

Updated Jun 8, 2026   |   2.1 KB   |   docs/VST_Hosting_Spike.md

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.

  • 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::AudioPluginFormatManager to register hostable formats.
  • juce::KnownPluginList and juce::PluginDirectoryScanner to scan plugin folders.
  • juce::AudioPluginInstance to own and process the loaded plugin.
  • juce::AudioProcessorGraph later 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

  1. Build a plugin browser on the Library page with scan locations and a rescan button.
  2. Save a known-plugin database in Documents / Sample Squad.
  3. Add a single test slot for one external plugin instance.
  4. Route MIDI from the piano roll into that instance.
  5. Blend the plugin output with pad/sample/synth output.
  6. Add project restore with missing-plugin warnings.
  7. 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.