Writing sysex messages issue


#1

In MidiFile::writeTrack() writeVariableLengthInt() adds the length of the message right after the sysex type:

            else if ((statusByte & 0xf0) == 0xf0)  // Write sysex message with length bytes.
            {
                out.writeByte ((char) statusByte);

                ++data;
                --dataSize;

                MidiFileHelpers::writeVariableLengthInt (out, dataSize);
            }

So for example a regular tempo message (FF 51 03 tt tt tt) turns into FF 5 51 03 tt tt tt


#2

Are you really looking for a sysex message ?
The tempo message shown in your post is a standard MIDI File event, not a MIDI system exclusive message.
Did you use MidiMessage::tempoMetaEvent to built your event ?

Robert


#3

I stand corrected, it’s really not a sysex event, and I do use MidiMessage::tempoMetaEvent()
Jules added this code like 10 days ago, and now meta events get written not as they should be.


#4

Doh! Sorry, looks like a typo. I think that line should read:

else if (statusByte == 0xf0) // Write sysex message with length bytes.

Thanks for letting me know!


#5

That was my typo, sorry!

http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=8078&hilit=Joerg&start=15


#6

Thanks a lot for your correction of writeTrack, Joerg. I was going crazy as to why some of my tracks were becoming unreadable after save. I would never have put Jules’ code in doubt… :wink: