Problem with timestamps

Hey, guys. Here is my code from the process block. The problem is, that when I fill buffer with method addEvent(), timestamps are ignored and when I am testing my program in host, all of the events are executed immidiately ignoring timestamps and sample numbers. Could you help to define, what the problem is.
P.S: i ve already checked timestamps of messages and they are abcolutely right.

MidiBuffer ourBuffer;
MidiMessage m;
int time;

for (int i = 0; i < sequence.getNumEvents(); i++)
m = sequence.getEventPointer(i)->message;
ourBuffer.addEvent(m, m.getTimeStamp() * 44100);

I’m assuming you are reading from a MIDI file.
Before you call midiFile.getTrack() to get the MidiMessageSequence, you need to call midiFile.convertTimestampTicksToSeconds(); to make m.getTimeStamp() return seconds instead of ticks.

No no no, i am setting midi messages in editor by myself

Then the error must be in the way you are creating the sequence.

The only thing I would add to your code would be:

ourBuffer.addEvent(m, roundDoubleToInt(m.getTimeStamp() * getSampleRate()));

The host is asking you to provide the MIDI to be played in a single buffer. You’re dumping your entire file into it.

Always run your code in the debugger! If you did, then this would have triggered an assertion to tell you that you were giving it notes that were beyond the range of the buffer.