I seem to be one of the few users to use the MIDI import/export feature as part of my song-mapping pipeline, so thanks for not removing it! :D
After updating from an old version however, I noticed and debugged multiple regressions:
- Exporting always fails due to nil FormatVersion in Song
- Opening a MIDI file without a tempo message crashes due to Nan current-time text position
I could fix them locally with the following patch on commit 61c5349:
diff --git a/src/base/USong.pas b/src/base/USong.pas
index e0c365e5..2276bcd9 100644
--- a/src/base/USong.pas
+++ b/src/base/USong.pas
@@ -389,6 +389,8 @@ constructor TSong.Create();
Self.Vocals := PATH_NONE();
Self.Background:= PATH_NONE();
Self.Video := PATH_NONE();
+
+ Self.FormatVersion := TVersion.Create();
end;
// This may be changed, when we rewrite song select code.
diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas
index ca6ece76..5bcbfe8d 100644
--- a/src/screens/UScreenEditConvert.pas
+++ b/src/screens/UScreenEditConvert.pas
@@ -837,6 +837,11 @@ procedure TScreenEditConvert.OnShow;
MidiFile.Filename := fFileName;
try
MidiFile.ReadFile;
+ // midi file might not contain any tempo messages, default to 120 bpm
+ if MidiFile.GetFusPerTick = 0.0 then
+ begin
+ MidiFile.Bpm := 120;
+ end;
FileOpened := true;
except
MidiFile.Free;
I seem to be one of the few users to use the MIDI import/export feature as part of my song-mapping pipeline, so thanks for not removing it! :D
After updating from an old version however, I noticed and debugged multiple regressions:
I could fix them locally with the following patch on commit 61c5349: