-
-
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
fixed recording of sustained midi notes #3710
Conversation
src/tracks/InstrumentTrack.cpp
Outdated
{ | ||
if (nph != NULL) | ||
{ | ||
if (nph->isReleased()) |
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.
I think using && is better than using many if() clauses. In if (A && B), B isn't evaluated when A is false, maybe you know it already.
So it is safe to write like if (nph != NULL && nph->isReleased()) and that will make the code cleaner.
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.
is safe to write like if (nph != NULL && nph->isReleased())
Or if you believe in such a thing... :) if (nph && nph->isReleased())
Should the target branch be master? #1700 is in 1.2.0 milestone. |
Yes, or we backport to stable-1.2. @serdnab I've tested this and it works fine. It can't be tested completely because of #3537. |
Made the shortening of the if's.
I will take a look at it. |
src/tracks/InstrumentTrack.cpp
Outdated
@@ -304,6 +311,25 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& ti | |||
} | |||
else | |||
{ | |||
if (isSustainPedalPressed()) |
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.
I think you can write this into an if else
with the else
above to simplify it further.
And then lines 324-326 can get one tab each.
Awesome! I restarted the Travis build. It sometimes will fail for reasons that are not related to the changes made. |
Addressed the remarks. |
So, drop the test and just let there be: |
I believe you misunderstood me. |
I believe you're right there... :)
This is true, but the |
@serdnab Or you can drop |
I am not explaining well, then you are not understanding. |
The only difference I see is that with dropping the test you have a built in safe guard in case of an unexpected state. When we get a pedal off command when |
@zonkmachine I suggest merging without more change. |
OK. Squashed and merged. Thank you so much Andrés for fixing a long standing bug! |
@zonkmachine backport? |
Fixes #1700.
This recovers the behavior done by 4b340f7, and later lost.
When a midinoteff comes from midi, and sustain pedal is pressed, the noteplayhandle pointer don't get nullified, so later, when sustain pedal is released, it can catch that pointer to emit the signal that recording of note is finished.