Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note
return m_released;
}

bool isReleaseStarted() const
{
return m_releaseStarted;
}

/*! Returns total numbers of frames played so far */
f_cnt_t totalFramesPlayed() const
{
Expand Down Expand Up @@ -297,6 +302,7 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note
// release of note
NotePlayHandleList m_subNotes; // used for chords and arpeggios
volatile bool m_released; // indicates whether note is released
bool m_releaseStarted;
bool m_hasParent; // indicates whether note has parent
NotePlayHandle * m_parent; // parent note
bool m_hadChildren;
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() || ( n->instrumentTrack()->isSustainPedalPressed() &&
!n->isReleaseStarted() ) )
{
envReleaseBegin += frames;
}
Expand Down
6 changes: 5 additions & 1 deletion src/core/NotePlayHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
m_releaseFramesDone( 0 ),
m_subNotes(),
m_released( false ),
m_releaseStarted( false ),
m_hasParent( parent != NULL ),
m_parent( parent ),
m_hadChildren( 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