-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Several fixes, improving robustness and compatibility with MIDI files. #2
Conversation
…midi event (skip meta events)
…type 0 to 1 conversion
I added three more fixes:
The fix was just to put the variables in the loop that goes over the tracks when writing, so that they are reset before writing each track. The third fix was: In the SMF conversion from type 0 (single-track) to 1 (multi-track) files, the times for the events were converted back to delta time at the end, but not for the meta-event track aka track 0. This caused some software like AIMP to report a very long song length (and of course meta events didn't get triggered at the right time). Now this is fixed too. |
Nice work @Boscop :) I'll leave this up a little longer to give nicklan a chance to reply, otherwise I'll merge. |
@nicklan Any comments? :) |
@mitchmindtree Can you merge, please :) |
I added some things that I found necessary in my usage:
Err(Error::new(ErrorKind::InvalidData, "file ends before it should"))
.The reverse operation would be easy to add, too, but I haven't had a need for it.
After these fixes, I haven't encountered a MIDI file that this lib couldn't handle. In fact, some MIDI files that AIMP 3 can't parse/play (e.g. certain type 0 one-track files) and that freeze MidiEditor.exe (like when a MIDI file ends before it should) are handled fine by this lib now.