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

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

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

revision 783 by persson, Sun Oct 2 14:40:52 2005 UTC revision 830 by persson, Sun Jan 15 18:23:11 2006 UTC
# Line 32  namespace LinuxSampler { namespace gig { Line 32  namespace LinuxSampler { namespace gig {
32      }      }
33    
34      void EGADSR::CalculateFadeOutCoeff(float FadeOutTime, float SampleRate) {      void EGADSR::CalculateFadeOutCoeff(float FadeOutTime, float SampleRate) {
35          const float killSteps = FadeOutTime * SampleRate;          const float killSteps = FadeOutTime * SampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE;
36          FadeOutCoeff = -1.0f / killSteps;          FadeOutCoeff = -1.0f / killSteps;
37      }      }
38    
# Line 200  namespace LinuxSampler { namespace gig { Line 200  namespace LinuxSampler { namespace gig {
200      void EGADSR::enterAttackStage(const uint PreAttack, const float AttackTime, const uint SampleRate) {      void EGADSR::enterAttackStage(const uint PreAttack, const float AttackTime, const uint SampleRate) {
201          Stage   = stage_attack;          Stage   = stage_attack;
202          Segment = segment_lin;          Segment = segment_lin;
203          // Measurements of GSt output shows that the real attack time  
204          // is about 65.5% of the value specified in the gig file.          if (AttackTime >= 0.0005f) {
205          StepsLeft = (int) (0.655f * AttackTime * SampleRate);              // Measurements of GSt output shows that the real attack time
206          if (StepsLeft) {              // is about 65.5% of the value specified in the gig file.
207                // The minimum attack value used is 0.032.
208                StepsLeft = int(0.655f * RTMath::Max(AttackTime, 0.032f) * SampleRate);
209              Level = (float) PreAttack / 1000.0;              Level = (float) PreAttack / 1000.0;
210              Coeff = 0.896f * (1.0f - Level) / StepsLeft; // max level is a bit lower if attack != 0              Coeff = 0.896f * (1.0f - Level) / StepsLeft; // max level is a bit lower if attack != 0
211          } else { // immediately jump to the next stage          } else { // attack is zero - immediately jump to the next stage
212              Level = 1.0;              Level = 1.0;
213              if (HoldAttack) enterAttackHoldStage();              if (HoldAttack) enterAttackHoldStage();
214              else            enterDecay1Part1Stage(SampleRate);              else            enterDecay1Part1Stage(SampleRate);
# Line 305  namespace LinuxSampler { namespace gig { Line 307  namespace LinuxSampler { namespace gig {
307      void EGADSR::enterEndStage() {      void EGADSR::enterEndStage() {
308          Stage   = stage_end;          Stage   = stage_end;
309          Segment = segment_end;          Segment = segment_end;
310            Level   = 0;
311      }      }
312    
313  }} // namespace LinuxSampler::gig  }} // namespace LinuxSampler::gig

Legend:
Removed from v.783  
changed lines
  Added in v.830

  ViewVC Help
Powered by ViewVC