/[svn]/linuxsampler/trunk/src/engines/gig/Voice.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/gig/Voice.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2407 by schoenebeck, Tue Jan 8 12:00:45 2013 UTC revision 2408 by persson, Sat Feb 2 08:22:49 2013 UTC
# Line 4  Line 4 
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *   *   Copyright (C) 2005 - 2008 Christian Schoenebeck                       *
7   *   Copyright (C) 2009 - 2012 Christian Schoenebeck and Grigor Iliev      *   *   Copyright (C) 2009 - 2013 Christian Schoenebeck and Grigor Iliev      *
8   *                                                                         *   *                                                                         *
9   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
10   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 181  namespace LinuxSampler { namespace gig { Line 181  namespace LinuxSampler { namespace gig {
181      Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) {      Voice::EGInfo Voice::CalculateEG1ControllerInfluence(double eg1ControllerValue) {
182          EGInfo eg;          EGInfo eg;
183          // (eg1attack is different from the others)          // (eg1attack is different from the others)
184          eg.Attack  = (pRegion->EG1ControllerAttackInfluence)  ?          if (pRegion->EG1Attack < 1e-8 && // attack in gig == 0
185              1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ?              (pRegion->EG1ControllerAttackInfluence == 0 ||
186                                    1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0;               eg1ControllerValue <= 10)) { // strange GSt special case
187                eg.Attack = 0; // this will force the attack to be 0 in the call to EG1.trigger
188            } else {
189                eg.Attack  = (pRegion->EG1ControllerAttackInfluence)  ?
190                    1 + 0.031 * (double) (pRegion->EG1ControllerAttackInfluence == 1 ?
191                                          1 : 1 << pRegion->EG1ControllerAttackInfluence) * eg1ControllerValue : 1.0;
192            }
193          eg.Decay   = (pRegion->EG1ControllerDecayInfluence)   ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence)   * eg1ControllerValue : 1.0;          eg.Decay   = (pRegion->EG1ControllerDecayInfluence)   ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerDecayInfluence)   * eg1ControllerValue : 1.0;
194          eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0;          eg.Release = (pRegion->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pRegion->EG1ControllerReleaseInfluence) * eg1ControllerValue : 1.0;
195    
# Line 444  namespace LinuxSampler { namespace gig { Line 450  namespace LinuxSampler { namespace gig {
450    
451      void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {      void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) {
452          EG1.trigger(pRegion->EG1PreAttack,          EG1.trigger(pRegion->EG1PreAttack,
453                      pRegion->EG1Attack * egInfo.Attack,                      RTMath::Max(pRegion->EG1Attack, 0.0316) * egInfo.Attack,
454                      pRegion->EG1Hold,                      pRegion->EG1Hold,
455                      pRegion->EG1Decay1 * egInfo.Decay * velrelease,                      pRegion->EG1Decay1 * egInfo.Decay * velrelease,
456                      pRegion->EG1Decay2 * egInfo.Decay * velrelease,                      pRegion->EG1Decay2 * egInfo.Decay * velrelease,
457                      pRegion->EG1InfiniteSustain,                      pRegion->EG1InfiniteSustain,
458                      pRegion->EG1Sustain,                      pRegion->EG1Sustain,
459                      pRegion->EG1Release * egInfo.Release * velrelease,                      RTMath::Max(pRegion->EG1Release * velrelease, 0.014) * egInfo.Release,
460                      velocityAttenuation,                      velocityAttenuation,
461                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);                      sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE);
462      }      }

Legend:
Removed from v.2407  
changed lines
  Added in v.2408

  ViewVC Help
Powered by ViewVC