MidiPort: introduced internal base velocity property

In order to keep compatibility with projects created with LMMS < 1.0.0
we maintain a property specifying the base velocity (i.e. the velocity
sent to MIDI-based instruments at volume=100%). For new projects this
always will be 64 while compat code enforces a value of 127 for old
projects.

We can also think about hiding the new groupbox in order to hide
complexity from the user.

Closes #430.
This commit is contained in:
Tobias Doerffel
2014-03-17 21:55:20 +01:00
parent f32c89bd13
commit 5e2d299360
10 changed files with 68 additions and 20 deletions

View File

@@ -106,9 +106,11 @@ NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
if( !isTopNote() || !instrumentTrack->isArpeggioEnabled() )
{
const int baseVelocity = m_instrumentTrack->midiPort()->baseVelocity();
// send MidiNoteOn event
m_instrumentTrack->processOutEvent(
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity() ),
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ),
MidiTime::fromFrames( offset(), engine::framesPerTick() ) );
}
}
@@ -152,7 +154,9 @@ void NotePlayHandle::setVolume( volume_t _volume )
{
note::setVolume( _volume );
m_instrumentTrack->processOutEvent( MidiEvent( MidiKeyPressure, midiChannel(), midiKey(), midiVelocity() ) );
const int baseVelocity = m_instrumentTrack->midiPort()->baseVelocity();
m_instrumentTrack->processOutEvent( MidiEvent( MidiKeyPressure, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ) );
}