--- linuxsampler/trunk/src/engines/gig/Voice.cpp 2013/01/08 12:00:45 2396 +++ linuxsampler/trunk/src/engines/gig/Voice.cpp 2014/05/18 17:38:25 2559 @@ -4,7 +4,7 @@ * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * * Copyright (C) 2005 - 2008 Christian Schoenebeck * - * Copyright (C) 2009 - 2012 Christian Schoenebeck and Grigor Iliev * + * Copyright (C) 2009 - 2013 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; @@ -181,9 +193,15 @@ Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) { EGInfo eg; // (eg1attack is different from the others) - eg.Attack = (pRegion->EG1ControllerAttackInfluence) ? - 1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ? - 1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0; + if (pRegion->EG1Attack < 1e-8 && // attack in gig == 0 + (pRegion->EG1ControllerAttackInfluence == 0 || + eg1ControllerValue <= 10)) { // strange GSt special case + eg.Attack = 0; // this will force the attack to be 0 in the call to EG1.trigger + } else { + eg.Attack = (pRegion->EG1ControllerAttackInfluence) ? + 1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ? + 1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0; + } eg.Decay = (pRegion->EG1ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence) * eg1ControllerValue : 1.0; eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0; @@ -444,13 +462,13 @@ void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { EG1.trigger(pRegion->EG1PreAttack, - pRegion->EG1Attack * egInfo.Attack, + RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack, pRegion->EG1Hold, pRegion->EG1Decay1 * egInfo.Decay * velrelease, pRegion->EG1Decay2 * egInfo.Decay * velrelease, pRegion->EG1InfiniteSustain, pRegion->EG1Sustain, - pRegion->EG1Release * egInfo.Release * velrelease, + RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release, velocityAttenuation, sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); }