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

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

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

revision 2055 by persson, Sat Jan 30 10:30:02 2010 UTC revision 2072 by persson, Sat Mar 20 11:37:52 2010 UTC
# Line 27  Line 27 
27  #include "Engine.h"  #include "Engine.h"
28  #include "EngineChannel.h"  #include "EngineChannel.h"
29    
30    #define LN_10_DIV_20 0.115129254649702
31    
32  namespace LinuxSampler { namespace sfz {  namespace LinuxSampler { namespace sfz {
33    
34      Voice::Voice() {      Voice::Voice() {
# Line 95  namespace LinuxSampler { namespace sfz { Line 97  namespace LinuxSampler { namespace sfz {
97          ri.VCFType       = ::gig::vcf_type_lowpass; // TODO:          ri.VCFType       = ::gig::vcf_type_lowpass; // TODO:
98          ri.VCFResonance  = 0; // TODO:          ri.VCFResonance  = 0; // TODO:
99    
100          ri.ReleaseTriggerDecay = 0;          // rt_decay is in dB. Precalculate a suitable value for exp in
101            // GetReleaseTriggerAttenuation: -ln(10) / 20 * rt_decay
102            ri.ReleaseTriggerDecay = -LN_10_DIV_20 * pRegion->rt_decay;
103    
104          return ri;          return ri;
105      }      }
# Line 109  namespace LinuxSampler { namespace sfz { Line 113  namespace LinuxSampler { namespace sfz {
113      }      }
114    
115      double Voice::GetSampleAttenuation() {      double Voice::GetSampleAttenuation() {
116          return 1.0; // TODO:          return exp(LN_10_DIV_20 * pRegion->volume);
117      }      }
118    
119      double Voice::GetVelocityAttenuation(uint8_t MIDIKeyVelocity) {      double Voice::GetVelocityAttenuation(uint8_t MIDIKeyVelocity) {
# Line 492  namespace LinuxSampler { namespace sfz { Line 496  namespace LinuxSampler { namespace sfz {
496          return 0;          return 0;
497      }      }
498    
499        float Voice::GetReleaseTriggerAttenuation(float noteLength) {
500            // pow(10, -rt_decay * noteLength / 20):
501            return expf(RgnInfo.ReleaseTriggerDecay * noteLength);
502        }
503    
504  }} // namespace LinuxSampler::sfz  }} // namespace LinuxSampler::sfz

Legend:
Removed from v.2055  
changed lines
  Added in v.2072

  ViewVC Help
Powered by ViewVC