summaryrefslogtreecommitdiff
path: root/muse2/muse/midifile.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-10-24 20:11:20 +0000
committerTim E. Real <termtech@rogers.com>2011-10-24 20:11:20 +0000
commit0a9435c034b725be5f5ddc0c5870946141832005 (patch)
tree742cafbead8dd25b90e84063f1d872b838bc4e0e /muse2/muse/midifile.cpp
parent8e9529fd272cbf58dd955841440ea28297963816 (diff)
Fixed bug #3293339: Midi file export SMF format 0 broken. Please see ChangeLog.
Diffstat (limited to 'muse2/muse/midifile.cpp')
-rw-r--r--muse2/muse/midifile.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/muse2/muse/midifile.cpp b/muse2/muse/midifile.cpp
index a94644ff..2db2855d 100644
--- a/muse2/muse/midifile.cpp
+++ b/muse2/muse/midifile.cpp
@@ -568,9 +568,9 @@ void MidiFile::writeEvent(const MidiPlayEvent* event)
int nstat = event->type();
// we dont save meta data into smf type 0 files:
-
- if (MusEGlobal::config.smfFormat == 0 && nstat == ME_META)
- return;
+ // Oct 16, 2011: Apparently it is legal to do that. Part of fix for bug tracker 3293339.
+ //if (MusEGlobal::config.smfFormat == 0 && nstat == ME_META)
+ // return;
nstat |= c;
//
@@ -621,24 +621,45 @@ bool MidiFile::write()
writeLong(6); // header len
writeShort(MusEGlobal::config.smfFormat);
if (MusEGlobal::config.smfFormat == 0) {
- writeShort(1);
+ /*
+ //writeShort(1); // Removed. Bug tracker 3293339
MidiFileTrack dst;
for (iMidiFileTrack i = _tracks->begin(); i != _tracks->end(); ++i) {
MPEventList* sl = &((*i)->events);
for (iMPEvent ie = sl->begin(); ie != sl->end(); ++ie)
+ {
+ // ALERT: Observed a problem here, apparently some of the events are being added too fast.
+ // The dump below tells me some of the events (sysex/meta) are missing from the list!
+ // Apparently it's a timing problem. Very puzzling.
+ // Attempting wild-guess fix now to eliminate multiple MidiFileTracks in MusE::exportMidi()...
+ // Nope. Didn't help. Now that it's a single MidiFileTrack, try skipping this section altogether...
+ // Yes that appears to have fixed it. Weird. What's the difference - the local 'dst' variable ?
+ // Or are there still lurking problems, or something more fundamentally wrong with Event or MPEvent?
+ printf("MidiFile::write adding event to dst:\n"); // REMOVE Tim.
+ ie->dump(); // REMOVE Tim.
dst.events.add(*ie);
+ }
}
writeShort(1);
writeShort(_division);
writeTrack(&dst);
+ */
+
+ writeShort(1);
+ //writeShort(_division);
+ //if(!_tracks->empty())
+ // writeTrack(*(_tracks->begin()));
+
}
else {
+
+
writeShort(ntracks);
-
+ }
writeShort(_division);
for (ciMidiFileTrack i = _tracks->begin(); i != _tracks->end(); ++i)
writeTrack(*i);
- }
+/// }
return (ferror(fp) != 0);
}