/[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 239 by schoenebeck, Sun Sep 12 14:48:19 2004 UTC revision 251 by schoenebeck, Mon Sep 20 12:27:48 2004 UTC
# Line 27  namespace LinuxSampler { namespace gig { Line 27  namespace LinuxSampler { namespace gig {
27      const float EGADSR::EndCoeff(CalculateEndCoeff());      const float EGADSR::EndCoeff(CalculateEndCoeff());
28    
29      float EGADSR::CalculateEndCoeff() {      float EGADSR::CalculateEndCoeff() {
30          const double sampleRate = 44100.0; // even if the sample rate will be 192kHz it won't hurt at all          const float sampleRate = 44100.0; // even if the sample rate will be 192kHz it won't hurt at all
31          const double killSteps  = EG_MIN_RELEASE_TIME * sampleRate;          const float killSteps  = EG_MIN_RELEASE_TIME * sampleRate;
32          return float(exp(1.0 / killSteps) - 1.0);          return 1.0f / killSteps;
33      }      }
34    
35      EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) {      EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) {
# Line 170  namespace LinuxSampler { namespace gig { Line 170  namespace LinuxSampler { namespace gig {
170                      break;                      break;
171                  }                  }
172                  case stage_end: {                  case stage_end: {
173                      while (iSample < TotalSamples) {                      int to_process   = RTMath::Min(int(Level / EndCoeff), TotalSamples - iSample);
174                          Level += Level * EndCoeff;                      int process_end  = iSample + to_process;
175                        while (iSample < process_end) {
176                            Level += EndCoeff;
177                          pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level;                          pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level;
178                      }                      }
179                        while (iSample < TotalSamples) {
180                            pEngine->pSynthesisParameters[ModulationDestination][iSample++] = 0.0f;
181                        }
182                      break;                      break;
183                  }                  }
184              }              }

Legend:
Removed from v.239  
changed lines
  Added in v.251

  ViewVC Help
Powered by ViewVC