--- linuxsampler/trunk/src/engines/gig/Voice.cpp 2013/02/02 08:22:49 2408 +++ linuxsampler/trunk/src/engines/gig/Voice.cpp 2016/10/19 12:28:40 3017 @@ -4,7 +4,7 @@ * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * * Copyright (C) 2005 - 2008 Christian Schoenebeck * - * Copyright (C) 2009 - 2013 Christian Schoenebeck and Grigor Iliev * + * Copyright (C) 2009 - 2015 Christian Schoenebeck and Grigor Iliev * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -124,6 +124,18 @@ } } + void Voice::ProcessChannelPressureEvent(RTList::Iterator& itEvent) { + if (itEvent->Type == Event::type_channel_pressure) { // if (valid) MIDI channel pressure (aftertouch) event + if (pRegion->AttenuationController.type == ::gig::attenuation_ctrl_t::type_channelaftertouch) { + CrossfadeSmoother.update(AbstractEngine::CrossfadeCurve[CrossfadeAttenuation(itEvent->Param.ChannelPressure.Value)]); + } + } + } + + void Voice::ProcessPolyphonicKeyPressureEvent(RTList::Iterator& itEvent) { + // Not used so far + } + void Voice::ProcessCutoffEvent(RTList::Iterator& itEvent) { int ccvalue = itEvent->Param.CC.Value; if (VCFCutoffCtrl.value == ccvalue) return; @@ -329,7 +341,7 @@ break; case ::gig::lfo3_ctrl_aftertouch: lfo3_internal_depth = 0; - pLFO3->ExtController = 128; + pLFO3->ExtController = CTRL_TABLE_IDX_AFTERTOUCH; bLFO3Enabled = true; break; case ::gig::lfo3_ctrl_internal_modwheel: @@ -339,7 +351,7 @@ break; case ::gig::lfo3_ctrl_internal_aftertouch: lfo3_internal_depth = pRegion->LFO3InternalDepth; - pLFO3->ExtController = 128; + pLFO3->ExtController = CTRL_TABLE_IDX_AFTERTOUCH; bLFO3Enabled = (lfo3_internal_depth > 0 || pRegion->LFO3ControlDepth > 0); break; default: @@ -361,7 +373,7 @@ float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); if (pRegion->VCFKeyboardTracking) { - cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey - pRegion->VCFKeyboardTrackingBreakpoint) * 100); + cutoff *= RTMath::CentsToFreqRatioUnlimited((MIDIKey() - pRegion->VCFKeyboardTrackingBreakpoint) * 100); } return cutoff; } @@ -414,7 +426,7 @@ ctrl = 83; break; case ::gig::vcf_cutoff_ctrl_aftertouch: - ctrl = 128; + ctrl = CTRL_TABLE_IDX_AFTERTOUCH; break; case ::gig::vcf_cutoff_ctrl_none: default: @@ -475,7 +487,7 @@ } void Voice::ProcessGroupEvent(RTList::Iterator& itEvent) { - dmsg(4,("Voice %x processGroupEvents event type=%d", this, itEvent->Type)); + dmsg(4,("Voice %p processGroupEvents event type=%d", (void*)this, itEvent->Type)); // TODO: The SustainPedal condition could be wrong, maybe the // check should be if this Voice is in release stage or is a @@ -486,9 +498,9 @@ // note should be stopped at all, because it doesn't sound naturally // with a drumkit. // -- Christian, 2013-01-08 - if (itEvent->Param.Note.Key != MIDIKey /*|| + if (itEvent->Param.Note.Key != HostKey() /*|| !GetGigEngineChannel()->SustainPedal*/) { - dmsg(4,("Voice %x - kill", this)); + dmsg(4,("Voice %p - kill", (void*)this)); // kill the voice fast pEG1->enterFadeOutStage();