Skip to content
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

Merged
merged 3 commits into from
Aug 2, 2017
Merged

Midi sustain working when envelope is on #3730

merged 3 commits into from
Aug 2, 2017

Conversation

serdnab
Copy link
Contributor

@serdnab serdnab commented Jul 26, 2017

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.

@zonkmachine
Copy link
Member

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.

@zonkmachine
Copy link
Member

I think it would have been easier if the sustain pedal stuff had been all done in InstrumentTrack.cpp from start.

@serdnab
Copy link
Contributor Author

serdnab commented Jul 29, 2017

When I take a note with long decay

Do you mean long release?

I don't think this is wanted behaviour for a synth

Do you want that when the sustain pedal is pressed again, it doesn't affect the release (that keeps fading out to silence)?

@zonkmachine
Copy link
Member

Do you mean long release?

Oops, yes... :)

Do you want that when the sustain pedal is pressed again, it doesn't affect the release

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.
What does @LMMS/developers say?

@PhysSong
Copy link
Member

Well, I don't know the common behavior. However, I think that sustain pedal shouldn't pause releasing.
Actually I have another solution for this issue, though it isn't tested.

@serdnab
Copy link
Contributor Author

serdnab commented Jul 30, 2017

Done, now release isn't paused when sustain pedal is pressed again.

Copy link
Member

@zonkmachine zonkmachine left a 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.

@@ -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() &&
Copy link
Member

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;
}
Copy link
Member

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.

@zonkmachine zonkmachine added this to the 1.2.0 milestone Jul 31, 2017
@serdnab
Copy link
Contributor Author

serdnab commented Aug 2, 2017

Done, addressed your indications.

@zonkmachine zonkmachine merged commit 44028c8 into LMMS:master Aug 2, 2017
@PhysSong
Copy link
Member

PhysSong commented Aug 2, 2017

@zonkmachine Are you going to backport this?

Edit: Done via 31126b0, by @zonkmachine.

zonkmachine pushed a commit that referenced this pull request Aug 2, 2017
* midi sustain working when envelope is on

* pressing sustain pedal again doesn't pause release

[cherry-picked from master]
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
* midi sustain working when envelope is on

* pressing sustain pedal again doesn't pause release
sdasda7777 pushed a commit to sdasda7777/lmms that referenced this pull request Jun 28, 2022
* midi sustain working when envelope is on

* pressing sustain pedal again doesn't pause release

[cherry-picked from master]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants