Created
July 28, 2020 20:01
-
-
Save Xenakios/960fc01066713520215aac645c90479d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void test_ap_player() | |
{ | |
int sr = 44100; | |
int bufsize = 512; | |
ScopedJuceInitialiser_GUI mm; | |
AudioProcessorGraph graph; | |
using IOProc = AudioProcessorGraph::AudioGraphIOProcessor; | |
auto innode = graph.addNode(std::make_unique<IOProc>(IOProc::audioInputNode)); | |
auto outnode = graph.addNode(std::make_unique<IOProc>(IOProc::audioOutputNode)); | |
innode->getProcessor()->setPlayConfigDetails(1, 2, sr, bufsize); | |
innode->getProcessor()->prepareToPlay(sr, bufsize); | |
outnode->getProcessor()->setPlayConfigDetails(2, 2, sr, bufsize); | |
outnode->getProcessor()->prepareToPlay(sr, bufsize); | |
AudioPluginFormatManager plugman; | |
plugman.addDefaultFormats(); | |
PluginDescription desc; | |
desc.pluginFormatName = "VST"; | |
desc.fileOrIdentifier = "/Library/Audio/Plug-Ins/VST/ValhallaDelay.vst"; | |
String err; | |
std::unique_ptr<AudioProcessor> plug = plugman.createPluginInstance(desc, sr, bufsize, err); | |
std::cout << err << "\n"; | |
plug->setPlayConfigDetails(2, 2, sr, bufsize); | |
plug->prepareToPlay(sr, bufsize); | |
auto plugnode = graph.addNode(std::move(plug)); | |
graph.addConnection({{ innode->nodeID, 0 },{ plugnode->nodeID, 0 }}); | |
graph.addConnection({{ innode->nodeID, 0 },{ plugnode->nodeID, 1 }}); | |
graph.addConnection({{ plugnode->nodeID, 0 },{ outnode->nodeID, 0 }}); | |
graph.addConnection({{ plugnode->nodeID, 1 },{ outnode->nodeID, 1 }}); | |
graph.setPlayConfigDetails(2, 2, sr, bufsize); | |
graph.prepareToPlay(sr, bufsize); | |
AudioProcessorPlayer player; | |
player.setProcessor(&graph); | |
AudioDeviceManager devman; | |
devman.initialiseWithDefaultDevices(2, 2); | |
devman.addAudioCallback(&player); | |
int foo; | |
std::cin >> foo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment