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:
@@ -58,7 +58,8 @@ private:
|
||||
LcdSpinBox * m_fixedOutputNoteSpinBox;
|
||||
QToolButton * m_wpBtn;
|
||||
|
||||
LcdSpinBox* m_baseVelocitySpinBox;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -140,9 +140,9 @@ public:
|
||||
return m_data.m_param[1];
|
||||
}
|
||||
|
||||
volume_t volume() const
|
||||
volume_t volume( int midiBaseVelocity ) const
|
||||
{
|
||||
return (volume_t)( velocity() * MaxVolume / MidiMaxVelocity );
|
||||
return (volume_t)( velocity() * DefaultVolume / midiBaseVelocity );
|
||||
}
|
||||
|
||||
const void* sourcePort() const
|
||||
|
||||
@@ -53,6 +53,7 @@ class MidiPort : public Model, public SerializingObject
|
||||
mapPropertyFromModel(int,fixedOutputVelocity,setFixedOutputVelocity,m_fixedOutputVelocityModel);
|
||||
mapPropertyFromModel(int,fixedOutputNote,setFixedOutputNote,m_fixedOutputNoteModel);
|
||||
mapPropertyFromModel(int,outputProgram,setOutputProgram,m_outputProgramModel);
|
||||
mapPropertyFromModel(int,baseVelocity,setBaseVelocity,m_baseVelocityModel);
|
||||
mapPropertyFromModel(bool,isReadable,setReadable,m_readableModel);
|
||||
mapPropertyFromModel(bool,isWritable,setWritable,m_writableModel);
|
||||
public:
|
||||
@@ -151,6 +152,7 @@ private:
|
||||
IntModel m_fixedOutputVelocityModel;
|
||||
IntModel m_fixedOutputNoteModel;
|
||||
IntModel m_outputProgramModel;
|
||||
IntModel m_baseVelocityModel;
|
||||
BoolModel m_readableModel;
|
||||
BoolModel m_writableModel;
|
||||
|
||||
|
||||
@@ -176,9 +176,9 @@ public:
|
||||
return m_volume;
|
||||
}
|
||||
|
||||
int midiVelocity() const
|
||||
int midiVelocity( int midiBaseVelocity ) const
|
||||
{
|
||||
return qMin( MidiMaxVelocity, getVolume() * MidiMaxVelocity / MaxVolume );
|
||||
return qMin( MidiMaxVelocity, getVolume() * midiBaseVelocity / DefaultVolume );
|
||||
}
|
||||
|
||||
inline panning_t getPanning() const
|
||||
|
||||
Reference in New Issue
Block a user