InstrumentTrack: make sure m_runningMidiNotes[x] does not become negative

Even though there's no known code path for this event to happen we
should always make sure m_runningMidiNotes[x] does not become negative
as this might mess up future key events.
This commit is contained in:
Tobias Doerffel
2011-07-02 14:41:17 +02:00
parent 83daa2d8fb
commit 14cfe77804

View File

@@ -386,6 +386,7 @@ void InstrumentTrack::processOutEvent( const midiEvent & _me,
if( k >= 0 && k < NumKeys &&
--m_runningMidiNotes[k] <= 0 )
{
m_runningMidiNotes[k] = qMax( 0, m_runningMidiNotes[k] );
m_instrument->handleMidiEvent(
midiEvent( MidiNoteOff, midiPort()->realOutputChannel(), k, 0 ),
_time );