Midi file length?

recently I found that if I open some midi files in my application (using Juce midi file functions), the length of midi song that I’m trying to get with call to getLastTimestamp() is not equal to the length of the song that I see if I import the same midi to cubase for example.

For example, I can have long midi file with only one short note at the begining, and cubase will show full length of imported midi file afte importing, but my application will show lenght taking in account only the NotOff of that single note and throwing all the rest of the (empty) midi out.

I’ve checked midi specification and it shows that every midi track shall manadatory contain “end of track” message (if memory serves me well), but I can’t find these messages in most midi files I have.

Am I missing something?

I'm facing the exact same issue. Any news on this ? 

Huh? Either your file have a legal file ending consisting of an end-of-track midievent and that (i.e its timestamp) will indicate the end of the file. Or you haven't, in which case the length will be taken from the last midievent of the file. You can't have a midifile ending in silence if you don't have an end mark after the silence. It's like having a pause without and end. Or beginning...

Where did you find code to play a midi file using JUCE?