NotePlayHandle: send correct MidiNoteOff events if base note changed

When changing an InstrumentTrack's base note while NotePlayHandles are
active, they will send a wrong MidiNoteOff event due to the masterKey()
translation in InstrumentTrack::processOutEvent().

Therefore in NotePlayHandle remember the original base note value and
add the difference between original and current base note to the value
returned by NotePlayHandle::key(). Fixes hanging notes in MIDI-based
instruments such as ZynAddSubFX.

Furthermore some coding style improvements.

Closes #3146975.
This commit is contained in:
Tobias Doerffel committed 2010-12-31 13:23:08 +01:00
1 parent 65a0313807
commit a9717c0cc3
6 files changed
+109 -88

No files matched your search

+3 -3
View File
@@ -1,7 +1,7 @@
/*
* InstrumentFunctions.cpp - models for instrument-function-tab
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -167,7 +167,7 @@ void ChordCreator::processNote( notePlayHandle * _n )
// at the same time we only add sub-notes if nothing of the note was
// played yet, because otherwise we would add chord-subnotes every
// time an audio-buffer is rendered...
if( ( ( _n->isBaseNote() &&
if( ( ( _n->isTopNote() &&
_n->instrumentTrack()->isArpeggiatorEnabled() == false ) ||
_n->isPartOfArpeggio() ) &&
_n->totalFramesPlayed() == 0 &&
@@ -288,7 +288,7 @@ Arpeggiator::~Arpeggiator()
void Arpeggiator::processNote( notePlayHandle * _n )
{
const int base_note_key = _n->key();
if( _n->isBaseNote() == false ||
if( _n->isTopNote() == false ||
!m_arpEnabledModel.value() ||
( _n->released() && _n->releaseFramesDone() >=
_n->actualReleaseFramesToDo() ) )