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
2010-12-31 13:13:45 +01:00
parent 65a0313807
commit a9717c0cc3
6 changed files with 109 additions and 88 deletions

View File

@@ -608,7 +608,7 @@ void sf2Instrument::playNote( notePlayHandle * _n, sampleFrame * )
}
fluid_synth_noteon( m_synth, m_channel, midiNote,
_n->getMidiVelocity() );
_n->midiVelocity() );
// get new voice and save it
fluid_synth_get_voicelist( m_synth, voices, poly, -1 );