Audio Plugin Midi Out

Hi,
hope someone can help me. I want to make an arpeggiator inside a plugin synth and it would be great if i can send the midi events to the host. The idea is that the user can record the plugin generated arpeggiator midi output within the host.
I read in other posts that i can send Midi events to the host by adding midi events to the MidiBuffer in processBlock. Something like this:

void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) { MidiMessage midiMessage = MidiMessage::noteOn(1, 100, (uint8)100); // edit // midiMessage.noteOn(1, 100, (uint8)100); // edit midiMessages.addEvent(midiMessage, 0); }
I would expect that the host would record the noteOn event at every buffer if i run the code above, but it didnt. I also didnt clear the MidiBuffer in previous plugins and it looks that the host does not process those events too. Think i really missed something. Can someone tell me how this Midi Out works and how i can send midi to the host for recording?

noteOn() is a static method.

Thanks, fixed that. Its still not working. The docs say that i should clear the messages and every message that stays in the Buffer will be processed by the host. Maybe i just have to check the hosts midi/plugin settings… will make some more tests.

Make sure you have

#define JucePlugin_ProducesMidiOutput   1

If I’m not mistaken in Audio Unit you can’t send events to the host, in VST you can for sure, donno about RTAS.

[quote=“Shlomi”]Make sure you have

#define JucePlugin_ProducesMidiOutput   1

If I’m not mistaken in Audio Unit you can’t send events to the host, in VST you can for sure, donno about RTAS.[/quote]
Thanks a lot. Forgot this, but i still have problems recording the midi output in reaper. I will try it in cubase tomorrow. Maybe i skip this task if it does not work in AU and some hosts anyway. Its not that important, just thought it would be a nice feature :slight_smile: