mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-14 12:08:33 -04:00
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:
@@ -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 ) ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user