Skip to content

Midi sustain working when envelope is on#3730

Merged
zonkmachine merged 3 commits into
LMMS:masterfrom
serdnab:sus-env
Aug 2, 2017
Merged

Midi sustain working when envelope is on#3730
zonkmachine merged 3 commits into
LMMS:masterfrom
serdnab:sus-env

Conversation

@serdnab

@serdnab serdnab commented Jul 26, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

@serdnab

serdnab commented Jul 29, 2017

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor

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
Copy Markdown
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

serdnab commented Jul 30, 2017

Copy link
Copy Markdown
Contributor Author

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

@zonkmachine zonkmachine left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread src/core/InstrumentSoundShaping.cpp Outdated
f_cnt_t envReleaseBegin = envTotalFrames - n->releaseFramesDone() + n->framesBeforeRelease();

if( n->isReleased() == false )
if( n->isReleased() == false || ( n->instrumentTrack()->isSustainPedalPressed() &&

Copy link
Copy Markdown
Contributor

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()

Comment thread include/NotePlayHandle.h Outdated
bool isReleaseStarted() const
{
return m_releaseStarted;
}

Copy link
Copy Markdown
Contributor

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

serdnab commented Aug 2, 2017

Copy link
Copy Markdown
Contributor Author

Done, addressed your indications.

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

PhysSong commented Aug 2, 2017

Copy link
Copy Markdown
Member

@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