Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note
m_frequencyNeedsUpdate = true;
}

bool isReleaseStarted() const
{
return m_releaseStarted;
}
Copy link
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.


private:
class BaseDetuning
{
Expand Down Expand Up @@ -319,6 +324,8 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note
Origin m_origin;

bool m_frequencyNeedsUpdate; // used to update pitch

bool m_releaseStarted;
} ;


Expand Down
3 changes: 2 additions & 1 deletion src/core/InstrumentSoundShaping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
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()

!n->isReleaseStarted() ) )
{
envReleaseBegin += frames;
}
Expand Down
8 changes: 6 additions & 2 deletions src/core/NotePlayHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
m_songGlobalParentOffset( 0 ),
m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack->midiPort()->realOutputChannel() ),
m_origin( origin ),
m_frequencyNeedsUpdate( false )
m_frequencyNeedsUpdate( false ),
m_releaseStarted( false )
{
lock();
if( hasParent() == false )
Expand Down Expand Up @@ -248,8 +249,11 @@ void NotePlayHandle::play( sampleFrame * _working_buffer )
m_instrumentTrack->playNote( this, _working_buffer );
}

if( m_released )
if( m_released && (!instrumentTrack()->isSustainPedalPressed() ||
m_releaseStarted) )
{
m_releaseStarted = true;

f_cnt_t todo = framesThisPeriod;

// if this note is base-note for arpeggio, always set
Expand Down