-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Midi import: various small improvements #2006
Conversation
@@ -394,8 +401,8 @@ bool MidiImport::readSMF( TrackContainer* tc ) | |||
{ | |||
smfMidiChannel * ch = chs[evt->chan].create( tc, trackName ); | |||
Alg_note_ptr noteEvt = dynamic_cast<Alg_note_ptr>( evt ); | |||
|
|||
Note n( noteEvt->get_duration() * ticksPerBeat, | |||
double ticks = MidiTime( noteEvt->get_duration() * ticksPerBeat ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is ticks declared as double instead of int? MidiTime only offers an int() cast operator, so casting to double should not give any benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aimed for the least possible change here. noteEvt->get_duration()
returns a double, so there was a double going in to the constructor before.
Just built your branch, and attempting to import "Sylver - Love is an Angel" from http://www.eurokdj.com/ringtones/index_midis.php reliably results in a crash, whereas it works with only warnings in master from a few days ago (edit: it works in current master as well):
v.s. expected output:
Note that I don't have any soundfonts installed (I've never used midi in lmms before). |
Also, I'd recommend that you add some inline documentation explaining why the code calls |
@Wallacoloo, #1984 is the fix for that crash. Left my variant of that code out of this as that part was taken care of elsewhere. Guess I could rebase this now. |
Should be enough to add the object to the automation pattern only once, as the objModel variable that is added will always be the same for the same value of ccid, which indexes the ccs array. This will speed up creation of automation tracks for MIDI CCs and pitch bend.
Too short notes had their duration rounded down to 0 on import, as MIDI precision allows way shorter notes than LMMS, and portsmf reports the duration as a double, where a beat == 1.0. Was going to use ceil() first, but that might round some notes up to a slightly longer duration.
Name the automation tracks like "[MIDI trackname] CC ##". And don't call the automation track creation function for every CC event, as it now will involve constructing a QString.
This should keep LMMS responsive from the window managers POV, unless the user selects a huge enough default sound font that loading it takes too long.
AFAIK, this is how the General MIDI standard says it should be.
changed an odd type juggling into something slightly saner.
Added a few tweaks suggested by @midi-pascal and @tresf on the lmms-dev mailing list. |
This would be very nice to have this PR integrated to the master branch. |
Absolutely, merged. Added to changelog. FYI, @softrabbit has the ability to merge his own, so this is more a matter of waiting on peer review. |
Midi import: various small improvements
Are you sure? I always get the text "Only those with write access to this repository can merge pull requests." and no obvious way to merge, so I've assumed that's the way it's meant to be. |
Sorry. Fixed. :)
|
Wonderfull 👍 |
A little mixed bag of short modifications here, longer descriptions are with their respective commits.