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.
This commit is contained in:
Tobias Doerffel
2014-02-24 23:24:11 +01:00
parent a18604d574
commit b28b00ff23

View File

@@ -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<f_cnt_t>( 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<f_cnt_t>( totalFramesPlayed() / engine::framesPerTick() ) ) );
m_instrumentTrack->midiNoteOff( *this );
}
m_released = true;
}