--- linuxsampler/trunk/src/engines/common/MidiKeyboardManager.h 2010/08/29 11:10:36 2120 +++ linuxsampler/trunk/src/engines/common/MidiKeyboardManager.h 2010/09/14 17:09:08 2121 @@ -96,6 +96,30 @@ virtual void PreProcessSostenutoPedalDown() { } virtual void PostProcessSostenutoPedalDown() { } }; + + /** + * This is the base class for class MidiKeyboardManager::MidiKey. It is + * not intended to be instantiated directly. Instead it just defines + * the part of class MidiKey which is not dependant on a C++ template + * parameter. + */ + class MidiKeyBase { + public: + bool KeyPressed; ///< Is true if the respective MIDI key is currently pressed. + bool Active; ///< If the key contains active voices. + bool ReleaseTrigger; ///< If we have to launch release triggered voice(s) when the key is released + Pool::Iterator itSelf; ///< hack to allow fast deallocation of the key from the list of active keys + RTList* pEvents; ///< Key specific events (only Note-on, Note-off and sustain pedal currently) + int VoiceTheftsQueued; ///< Amount of voices postponed due to shortage of voices. + uint32_t* pRoundRobinIndex; ///< For the round robin dimension: current articulation for this key, will be incremented for each note on + uint8_t Velocity; ///< Latest Note-on velocity for this key + unsigned long NoteOnTime; ///< Time for latest Note-on event for this key + float Volume; ///< Individual volume level for this MIDI key (usually 1.0f unless Roland GS NRPN 0x1Ann was received, nn reflecting the note number, see EngineBase::ProcessHardcodedControllers()) + float PanLeft; ///< Individual volume balance (left channel coefficient) for this MIDI key (usually 1.0f unless Roland GS NRPN 0x1Cnn was received, nn reflecting the note number, see EngineBase::ProcessHardcodedControllers()) + float PanRight; ///< Individual volume balance (right channel coefficient) for this MIDI key (usually 1.0f unless Roland GS NRPN 0x1Cnn was received, nn reflecting the note number, see EngineBase::ProcessHardcodedControllers()) + optional ReverbSend; ///< Optional individual reverb send level for this MIDI key (usually not set, unless Roland GS NRPN 0x1Dnn was received, nn reflecting the note number, see EngineBase::ProcessHardcodedControllers()) + optional ChorusSend; ///< Optional individual chorus send level for this MIDI key (usually not set, unless Roland GS NRPN 0x1Enn was received, nn reflecting the note number, see EngineBase::ProcessHardcodedControllers()) + }; template class MidiKeyboardManager { @@ -115,18 +139,9 @@ * * Reflects runtime informations for one MIDI key. */ - class MidiKey { + class MidiKey : public MidiKeyBase { public: - RTList* pActiveVoices; ///< Contains the active voices associated with the MIDI key. - bool KeyPressed; ///< Is true if the respective MIDI key is currently pressed. - bool Active; ///< If the key contains active voices. - bool ReleaseTrigger; ///< If we have to launch release triggered voice(s) when the key is released - Pool::Iterator itSelf; ///< hack to allow fast deallocation of the key from the list of active keys - RTList* pEvents; ///< Key specific events (only Note-on, Note-off and sustain pedal currently) - int VoiceTheftsQueued; ///< Amount of voices postponed due to shortage of voices. - uint32_t* pRoundRobinIndex; ///< For the round robin dimension: current articulation for this key, will be incremented for each note on - uint8_t Velocity; ///< Latest Note-on velocity for this key - unsigned long NoteOnTime; ///< Time for latest Note-on event for this key + RTList* pActiveVoices; ///< Contains the active voices associated with the MIDI key. MidiKey() { pActiveVoices = NULL; @@ -135,6 +150,9 @@ ReleaseTrigger = false; pEvents = NULL; VoiceTheftsQueued = 0; + Volume = 1.0f; + PanLeft = 1.0f; + PanRight = 1.0f; } void Reset() { @@ -145,6 +163,11 @@ ReleaseTrigger = false; itSelf = Pool::Iterator(); VoiceTheftsQueued = 0; + Volume = 1.0f; + PanLeft = 1.0f; + PanRight = 1.0f; + ReverbSend = optional::nothing; + ChorusSend = optional::nothing; } };