Closed mpflanzer closed 13 years ago
Please get me yours code first.
The code in comments produces a playable file, the file created with the deltatimed event isn't playable.
MIDIClockTime length = 100;
MIDIClockTime time = 0;
MIDIMultiTrack *track = new MIDIMultiTrack(2);
//MIDITimedMessage event;
MIDIDeltaTimedMessage event;
// add some events to the second track
for(unsigned int i = 0; i < 10; ++i)
{
//event.SetTime(time);
event.SetDeltaTime(100);
event.SetNoteOn(0, note, 127);
this->track->GetTrack(1)->PutEvent(event);
//event.SetTime(time += length);
event.SetDeltaTime(100);
event.SetNoteOff(0, note, 0);
this->track->GetTrack(1)->PutEvent(event);
}
(new MIDIFileWriteMultiTrack(track, new MIDIFileWriteStreamFileName("filename.mid")))->Write(2, 100);
Yours code is right. I make update the lib near end of this week.
Thank you for your quick help. Just don't rush yourself. For the moment I will take the version with the absolute times and when you updated I will change to the relative one.
It's ok, please test new version and close issue if all work.
It's all fine now. Thanks :)
If I use the example "create_midifile.cpp" to create a midifile and everything works correct but I would like to use a MIDIDeltaTimedMessage instead of MIDITimedMessage. The problem is if I change all SetTime( t += dt ) to SetDeltaTime( dt ) and of course the MIDITimedMessage to MIDIDeltaTimedMessage leaving all the rest of the code untouched I cannot play the midifile anymore. While searching for my mistake I took a closer look at the PutEvent-method and realized that there is only a version for the TimedMessage and none for a DeltaTimed one. So is there at the moment no possibility to create a track with DeltaTimedMessages or is there a mistake in my code?