Full title: How to let juce::Synthesiser receive mouse-played MIDI Notes from juce::MidiKeyboardComponent in a VST plugin?
I was following Joshua Hodge’s tutorial " Build a Sampler VST Plug-in with JUCE".
It needs a little changes to replicate his idea with current version of JUCE, but I made it:
Now I want to try adding a virtual MIDI keyboard like the one in the user interface of NI Kontakt / Addictive Drums / etc.
I managed to place the juce::MidiKeyboardComponent in the Plugin Editor, but I don’t know how to let the HelloSamplerAudioProcessor.mSampler (as juce::Synthesiser) receive and process MIDI input signals from HelloSamplerAudioProcessorEditor.keyboardComponent (as juce::MidiKeyboardComponent).
I found the following two tutorials but it looks like they are all talking about implementing this in a standalone app (not VST plugin):
Therefore, I decided to ask here for suggestions / instructions. Any hint will help.
P.S.: My familiar languages are Swift (mostly used) and C#. C++ seems to be comparatively messy managing some basic things. Now, Swift 5.9 (as a cross-platform language) has interoperability with C++, and I do wander whether JUCE is utilizable in Swift.
It explains how to handle MidiKeyboardState and wire it up so that your JUCE plugin/app receives them as standard MIDI events, as if they were coming over a normal MIDI cable … essentially, from the perspective of JUCE event-handling system, a MidiKeyboardComponent is funtionally equivalent to a normal MIDI device, inasmuch as they both send messages that get handled by the MidiKeyboardState::Listener…
Ah, I understand - yes, you must bite the bullet and take responsibility (as a developer) for the hierarchy of classes you are using and the means by which they get instantiated, and thus: “connected” together. That tutorial does make a bit of an effort to clear this up - it is however worthwhile to go through the tutorial slowly, step by step …
But you should definitely be at least familiar with the idea of adding Listener methods to your classes by including the MidiKeyboardState::Listener class in their definitions …