Output a sequence of midi notes?


I’m trying to create a plugin that will output a sequence of MIDI notes. At present I have it outputting a note at the start of every bar. The output is sent to a sampler and all works fine. If I add more notes to my midibuffer they don’t seem to get through as I would expect. The following code puts note in my buffer. This is done my filter constructor.

midiBuffer.addEvent(MidiMessage(MidiMessage::noteOff(1, (int)(60))),2050);
midiBuffer.addEvent(MidiMessage(MidiMessage::noteOff(1, (int)(60))),26050);

If the timestamp is a sample count I’d expect the second note to start half a second after the first but it doesn’t? What’s the best approach to take if I want to output a sequence of midi notes, the one I’m taking is obviously not right? I’ve searched through the forum but came up short. Any help is much appreciated.