/[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 614 by persson, Mon Jun 6 16:54:20 2005 UTC revision 688 by schoenebeck, Thu Jul 14 12:25:20 2005 UTC
# Line 25  Line 25 
25    
26  namespace LinuxSampler { namespace gig {  namespace LinuxSampler { namespace gig {
27    
28      const float EGADSR::FadeOutCoeff(CalculateFadeOutCoeff());      void EGADSR::CalculateFadeOutCoeff(float FadeOutTime, float SampleRate) {
29            const float killSteps = FadeOutTime * SampleRate;
30      float EGADSR::CalculateFadeOutCoeff() {          FadeOutCoeff = -1.0f / killSteps;
         const float sampleRate = 44100.0; // even if the sample rate will be 192kHz it won't hurt at all  
         const float killSteps  = CONFIG_EG_MIN_RELEASE_TIME * sampleRate;  
         return -1.0f / killSteps;  
31      }      }
32    
33      EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) {      EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) {
# Line 38  namespace LinuxSampler { namespace gig { Line 35  namespace LinuxSampler { namespace gig {
35          this->ModulationDestination = ModulationDestination;          this->ModulationDestination = ModulationDestination;
36          Stage = stage_end;          Stage = stage_end;
37          Level = 0.0;          Level = 0.0;
38            CalculateFadeOutCoeff(CONFIG_EG_MIN_RELEASE_TIME, 44100.0); // even if the sample rate will be 192kHz it won't hurt at all
39      }      }
40    
41      /**      /**
# Line 250  namespace LinuxSampler { namespace gig { Line 248  namespace LinuxSampler { namespace gig {
248                          pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level;                          pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level;
249                      }                      }
250                      Stage = stage_end;                      Stage = stage_end;
251                      if (Level > -FadeOutCoeff) dmsg(1,("EGADSR: Warning, final fade out level too high, may result in click sound!\n"));                      if (Level > -FadeOutCoeff) dmsg(2,("EGADSR: Warning, final fade out level too high, may result in click sound!\n"));
252                  } //Fall through here instead of breaking otherwise we can get back into stage_fadeout and loop forever!                  } //Fall through here instead of breaking otherwise we can get back into stage_fadeout and loop forever!
253                  case stage_end: {                  case stage_end: {
254                      while (iSample < TotalSamples) {                      while (iSample < TotalSamples) {

Legend:
Removed from v.614  
changed lines
  Added in v.688

  ViewVC Help
Powered by ViewVC