Generating midi messages


#1

I am currently writing a plugin that not only modifies incoming midi messages but also generates midi message even when there are no incoming midi messages. The problem i am having is that although I understand how to generate new midi messages based on incoming messages, I cannot generate new midi messages when there are no incoming messages as I am not sure how to fill the sample-base timestamp for a given message.

I can see from the wrappers that incoming messages timestamps are sampleframes, and that I can get the current timestamp from the AudioPlayHead class, but that timestamp is not in the sampleframe format, so I wondered how I can convert that into sampleframe for a midimessage.


#2

Timestamps are based on the Time::getMillisecondCounter time, so you could base your timestamp on that?


#3

so your saying in the constructor for the Midimessage class:

MidiMessage (const int byte1,
const int byte2,
const int byte3,
const double timeStamp = 0);

I can use Time::getMillisecondCounter() as the value for timeStamp?


#4

All I’m saying is that the timestamps are synced to that time base. Have a look at what actually happens in the native midi code to make sure - I can’t remember the details offhand.