How to output to default device?

Ok, i can load a preset (fxp) from disk and assign it to the connected VST plugin.
My next question is: How do i get the inputs from that VST plugin and send it to my default output device so that i can actually hear that preset?

Can this preset also be assigned to the MidiKeyboardComponent so that it can be played with that component without having an external VST plugin be connected?

Have a look at the plugin host example for how to play a VST.

Not sure what you mean about playing the preset without a VST… (???) That isn’t something that makes any sense, as a preset is just some parameters for the VST to use.

Honestly, for a newbie like me, this example is quite difficult to understand, and i think that i would only need about 5% of the code this example uses. Isn’t there another example which does the output stuff more straight and with less classes/code? Thank you!

All VST plugins and virtual instruments derive from AudioProcessor. If you have this instanciated, you can use an AudioProcessorPlayer which will call the processBlock method of your plugin to create (or process) audio data.
The AudioProcessorPlayer derives from AudioIODeviceCallback, so you can set the AudioProcessorPlayer as callback for the AudioIODevice using AudioIODevice::start (myAudioProcessorPlayer).

Thats the condensed form, but there are several steps necessary, if you want to build it from scratch…

The MidiKeyboardComponent creates midi data, i.e. noteOn and noteOff events. You cannot hear these. So you can “play” the KeyboardComponent, but it produces no sound. To do that you need any kind of virtual instrument, which comes usually as plugin/VST (depending on platform and host).

1 Like

Thank you very much Daniel.
Well, if it’s avoidable, it don’t want to build it from scratch, but so far i didn’t find an example or tutorial i could use (and understand) for my (i guess not too ambitous) needs.
Therefore if you can some code or a link which does outputting the preset sounds from a VST i would be very much interested in it :slight_smile:

EDIT: And btw. i’m trying to write an application, not a plugin. When using the host example the following elements are needed. Please tell me which classes from Juce i need and which i need to extend for getting the desired output.

EDIT2: I got it working!

Hi Ricochet, I am very much a JUCE noob too! I am in the same position you are, or rather recently were in…that is trying to figure out the class hierarchy and what the minimum objects required to implement the VST audio routing of your “demo app” screen capture above.

I basically am trying to take what you have, multiplied times 3 and route the output via a MixerAudioSource to an ASIO device but I’m still wrestling with…“Do I use AudioProcessor, AudioPluginInstance, AudioProcessorPlayer, etc…and then what?!?”.

I know I need to spend many more hours with the code and API docs. I hope to log some serious time this weekend. If you have any code snippet you would care to share on what was required to achieve the above I would be very much appreciative.

Thank you!

Hi Joeduf,

the following Gist helped me very much to understand what i need to connect input and output nodes, and in the middle having a VST plugin:

In short: You can use an AudioProcessorGraph to add and connect your needed nodes together.
Good luck!

Thanks! I got it working finally! Daniel’s comments above helped as well.

I’ve been reading every message and every topic I could find in the forum and I’m learning more every hour!

If I can solve how to add multiple MIDI input devices to an Audio Processor Graph (read this wasn’t possible) or use my old playground test code with three Midi Input callbacks to feed one audio processor graph then I will basically see light at the end of the tunnel! The rest is just GUI and Serialization! Woohoo! Today was a good day!

Did I mention I LOVE Juce?!?