--- linuxsampler/trunk/src/engines/common/AbstractVoice.h 2016/04/17 14:52:33 2878 +++ linuxsampler/trunk/src/engines/common/AbstractVoice.h 2016/04/19 14:07:53 2879 @@ -82,10 +82,9 @@ class AbstractVoice : public Voice { public: type_t Type; ///< Voice Type (bit field, a voice may have several types) - int MIDIKey; ///< MIDI key number of the key that triggered the voice - uint8_t MIDIVelocity; ///< MIDI velocity of the key that triggered the voice + NoteBase* pNote; ///< Note this voice belongs to and was caused by. int MIDIPan; ///< the current MIDI pan value plus the value from RegionInfo - + SignalUnitRack* const pSignalUnitRack; AbstractVoice(SignalUnitRack* pRack); @@ -115,6 +114,13 @@ return (Controller > 128) ? 0 : pEngineChannel->ControllerTable[Controller]; } + /// Keyboard key on which this voice should listen to transitional events (i.e. note-off events to release the voice). + inline uint8_t HostKey() const { return pNote->hostKey; } + /// Keyboard key which the voice should use for calculating any synthesis relevant parameters (i.e. pitch). + inline uint8_t MIDIKey() const { return pNote->cause.Param.Note.Key; } + /// MIDI note-on velocity value which the voice should use for calculating any synthesis relevant parameters (i.e. amplitude). + inline uint8_t MIDIVelocity() const { return pNote->cause.Param.Note.Velocity; } + void processCCEvents(RTList::Iterator& itEvent, uint End); void processPitchEvent(RTList::Iterator& itEvent); void processResonanceEvent(RTList::Iterator& itEvent);