Greetings,
Having as base the plugin JUCE template from projucer i want to generate a midi message in PluginEditor (on a button click for example) and send it out to wherever my plugin is connected to, making it sort of like the built in juce::MidiKeyboard.
From what i understood all messages pass in PluginAudioProcessor::processBlock, but i wasn’t able to see any message.
Generating midi message
auto message = juce::MidiMessage::noteOn (10, 60, (juce::uint8) 100);
midibuffer.addEvent(message);
Declared in Editor header:
juce::MidiBuffer midibuffer;
PluginAudioProcessor& audioProcessor;
My processBlock:
void PluginAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
for (const auto metadata : midiMessages)
{
const auto msg = metadata.getMessage();
if (msg.isNoteOn()){
DBG("note on!");
};
}
}
My questions are:
- how does processBlock know a message was generated in a child component
- if i should use the midibuffer where should it be declared
- how does juce output these internally generated midi messages since it has no definite “sendmidi(message)” type of command.
I am not concerned about the duration or handling, my goal with this example is to just send a midi note of type ‘on’ and be able to pass it to somewhere (ie. using Audio Plugin Host)