--- linuxsampler/trunk/src/engines/gig/Voice.cpp 2009/10/25 22:22:52 2015 +++ linuxsampler/trunk/src/engines/gig/Voice.cpp 2010/01/30 10:30:02 2055 @@ -3,8 +3,8 @@ * LinuxSampler - modular, streaming capable sampler * * * * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * - * Copyright (C) 2005 - 2009 Christian Schoenebeck * - * Copyright (C) 2009 Grigor Iliev * + * Copyright (C) 2005 - 2008 Christian Schoenebeck * + * Copyright (C) 2009 - 2010 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 * @@ -33,11 +33,11 @@ namespace LinuxSampler { namespace gig { Voice::Voice() { - pEngine = NULL; + pEngine = NULL; + pEG1 = &EG1; } Voice::~Voice() { - } EngineChannel* Voice::GetGigEngineChannel() { @@ -359,7 +359,7 @@ pLFO3->update(pLFO3->ExtController ? GetGigEngineChannel()->ControllerTable[pLFO3->ExtController] : 0); } } - + float Voice::CalculateCutoffBase(uint8_t MIDIKeyVelocity) { float cutoff = pRegion->GetVelocityCutoff(MIDIKeyVelocity); if (pRegion->VCFKeyboardTracking) { @@ -450,4 +450,16 @@ return ctrl; } + void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { + EG1.trigger(uint(RgnInfo.EG1PreAttack), + RgnInfo.EG1Attack * egInfo.Attack, + RgnInfo.EG1Hold, + RgnInfo.EG1Decay1 * egInfo.Decay * velrelease, + RgnInfo.EG1Decay2 * egInfo.Decay * velrelease, + RgnInfo.EG1InfiniteSustain, + uint(RgnInfo.EG1Sustain), + RgnInfo.EG1Release * egInfo.Release * velrelease, + velocityAttenuation, + sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); + } }} // namespace LinuxSampler::gig