IanB
January 19, 2018, 3:54am
1
Build an Audio App with a VST(say a channel strip) embedded - not inserted like a DAW! Nothing else, just a Window with the VST. No midi, no synth, just Audio into the strip and out. The vst lives in resources/dir. Possible?
If there’s a tutorial please point me in the right direction.
t0m
January 19, 2018, 4:05pm
2
Do you have the source code for the VST (and is it built with JUCE)? If so, the standalone plug-in target is what you want.
Otherwise, the rough procedure is:
OwnedArray<PluginDescription> pluginDescriptions;
KnownPluginList pluginList;
AudioPluginFormatManager pluginFormatManager;
pluginFormatManager.addDefaultFormats();
for (int i = 0; i < pluginFormatManager.getNumFormats(); ++i)
{
pluginList.scanAndAddFile("PATH_TO_PLUGIN_IN_RESOURCES", true, pluginDescriptions,
*pluginFormatManager.getFormat(i));
}
String msg;
instance = pluginFormatManager.createPluginInstance (*pluginDescriptions[0],
sampleRate,
blockSize,
msg);
graph.setPlayConfigDetails (nChannels, nChannels, 44100, 1024);
auto sourceNode = graph.addNode (new AudioProcessorSource());
sourceNode->getProcessor()->enableAllBuses();
pluginNode = graph.addNode (instance.release());
pluginNode->getProcessor()->enableAllBuses();
auto outputNode = graph.addNode (new AudioProcessorGraph::AudioGraphIOProcessor (AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode));
outputNode->getProcessor()->enableAllBuses();
for (int i = 0; i < nChannels; ++i)
{
if (! isSynth)
graph.addConnection ({ { sourceNode->nodeID, i }, { pluginNode->nodeID, i } });
graph.addConnection ({ { pluginNode->nodeID, i }, { outputNode->nodeID, i } });
}
if (playAudio)
{
player.setProcessor (&graph);
deviceManager.initialise (nChannels, nChannels, nullptr, true);
deviceManager.addAudioCallback (&player);
}
if (showEditor)
{
if (pluginNode != nullptr)
{
editor = std::unique_ptr<AudioProcessorEditor> (pluginNode->getProcessor()->createEditor());
addAndMakeVisible (editor.get());
ComponentBoundsConstrainer* bc = editor->getConstrainer();
setSize (bc->getMinimumWidth(), bc->getMinimumHeight());
}
}
That won’t compile (I’ve just pulled the important bits out of a test app), but it should be enough to get you on your way.
2 Likes
IanB
January 19, 2018, 8:39pm
3
No t0m, one of my licensed vst’s, I have a few i’d like to try. Thanks very much for the code. I’ll do my best.
look at the PluginHost example project.
IanB
January 31, 2018, 1:08am
5
Still a bit of a noob at all this! I can’t get t0ms code working, and I’m studying the PluginHostDemo Thanks!