Sending MIDI output from the GUI

I have a project with both Plugin wants midi input and produces midi output enabled. I want to send MIDI note on/off from the GUI to the host.
When I click on a button on the interface I use this code to send a midi note:

processor.keyboardState.noteOn(1, 60, 127);

All is fine, my synth class reads the note on and plays. The problem is, the DAW doesn't record that note.

What should I do to "pass" the midi data to the host?


You'd have to generate midi note on/off events and send them to the host

Even if I do this directly in the process block:

midiMessages.addEvent(MidiMessage::noteOn(1, 60, 127.0f),1);

the synth (that I have in processBlock) gets the note but the host doesn't. So, how do I send my midi buffer to the host?

(Again produces midi output is enabled)

but you have mixed up the two versions of MidiMessage::noteOn, I think.

static MidiMessage noteOn (int channel, int noteNumber, float velocity) wants velocity in the range 0.0  to 1.0, whereas
static MidiMessage noteOn (int channel, int noteNumber, uint8 velocity). wants it between 1 and 127.

Perhaps testing your plugin in the plugin host demo would help you debug it.

ops, yes it was a typo but still, after I do 

midiMessages.addEvent(MidiMessage::noteOn(1, 60, 1.0f),1);

I then call my synth with 

synth->renderNextBlock (buffer, midiMessages, 0, nmSamples);

and it works fine, I can hear the note playing BUT if I record no midi messages/notes are passed to the host. Why?