-
-
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 sustain working when envelope is on #3730
Conversation
Cool! Issue: When I take a note with long decay, I release by letting go of the sustain pedal and, while it's decaying, hold it at a new level by pressing the sustain again. I don't think this is wanted behaviour for a synth although it very well could be how some machines work. |
I think it would have been easier if the sustain pedal stuff had been all done in |
Do you mean long release?
Do you want that when the sustain pedal is pressed again, it doesn't affect the release (that keeps fading out to silence)? |
Oops, yes... :)
Yes. If you let go of the sustain pedal, all keys that aren't pressed down should go into release and if you press down the sustain again this shouldn't hold released notes again. This is my understanding of how a common envelope generator should behave. |
Well, I don't know the common behavior. However, I think that sustain pedal shouldn't pause releasing. |
Done, now release isn't paused when sustain pedal is pressed again. |
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.
This works fine. I approve this PR with my suggested changes.
src/core/InstrumentSoundShaping.cpp
Outdated
@@ -137,7 +137,8 @@ void InstrumentSoundShaping::processAudioBuffer( sampleFrame* buffer, | |||
const f_cnt_t envTotalFrames = n->totalFramesPlayed(); | |||
f_cnt_t envReleaseBegin = envTotalFrames - n->releaseFramesDone() + n->framesBeforeRelease(); | |||
|
|||
if( n->isReleased() == false ) | |||
if( n->isReleased() == false || ( n->instrumentTrack()->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 should adapt the original code to your format.
n->isReleased() == false
--> !n->isReleased()
bool isReleaseStarted() const | ||
{ | ||
return m_releaseStarted; | ||
} |
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.
you stick this to the end of NotePlayHandle
but it belongs, logically, together with isReleased()
.
Please move isReleaseStarted()
to after isReleased()
and m_releaseStarted
to after m_released
.
Done, addressed your indications. |
@zonkmachine Are you going to backport this? Edit: Done via 31126b0, by @zonkmachine. |
* midi sustain working when envelope is on * pressing sustain pedal again doesn't pause release [cherry-picked from master]
* midi sustain working when envelope is on * pressing sustain pedal again doesn't pause release
* midi sustain working when envelope is on * pressing sustain pedal again doesn't pause release [cherry-picked from master]
Fixes #3537.
When sustain pedal is pressed
NotePlayHandle::play()
doesn't enter release phase.And in
InstrumentSoundShaping::processAudioBuffer()
, the envelope's release is posponed until the sustain pedal is released.