From b28b00ff2346f81694d821d39736fb6b58cc089b Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 24 Feb 2014 23:24:11 +0100 Subject: [PATCH] NotePlayHandle: emit midiNoteOff() signal in noteOff() Instead of emitting InstrumentTrack::midiNoteOff() in destructor of NotePlayHandle do this where it actually happens -> noteOff(). Fixes length of recorded notes when there's e.g. a long release. Closes #378. --- src/core/NotePlayHandle.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/NotePlayHandle.cpp b/src/core/NotePlayHandle.cpp index b40c335b7..00539279f 100644 --- a/src/core/NotePlayHandle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -120,13 +120,6 @@ NotePlayHandle::~NotePlayHandle() { noteOff( 0 ); - // inform attached components about MIDI finished (used for recording in Piano Roll) - if( m_origin == OriginMidiInput ) - { - setLength( MidiTime( static_cast( totalFramesPlayed() / engine::framesPerTick() ) ) ); - m_instrumentTrack->midiNoteOff( *this ); - } - if( isTopNote() ) { delete m_baseDetuning; @@ -362,6 +355,13 @@ void NotePlayHandle::noteOff( const f_cnt_t _s ) MidiTime::fromFrames( m_framesBeforeRelease, engine::framesPerTick() ) ); } + // inform attached components about MIDI finished (used for recording in Piano Roll) + if( m_origin == OriginMidiInput ) + { + setLength( MidiTime( static_cast( totalFramesPlayed() / engine::framesPerTick() ) ) ); + m_instrumentTrack->midiNoteOff( *this ); + } + m_released = true; }