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

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

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

revision 80 by schoenebeck, Sun May 23 19:16:33 2004 UTC revision 97 by schoenebeck, Mon May 31 19:28:09 2004 UTC
# Line 156  namespace LinuxSampler { namespace gig { Line 156  namespace LinuxSampler { namespace gig {
156                  float pos_fract = this->Pos - pos_int;             // fractional part of position                  float pos_fract = this->Pos - pos_int;             // fractional part of position
157                  pos_int <<= 1;                  pos_int <<= 1;
158    
                 #if 0 //ENABLE_FILTER  
                     UpdateFilter_Stereo(cutoff + FILTER_CUTOFF_MIN, resonance);  
                 #endif // ENABLE_FILTER  
   
159                  #if USE_LINEAR_INTERPOLATION                  #if USE_LINEAR_INTERPOLATION
160                      #if ENABLE_FILTER                      #if ENABLE_FILTER
161                          // left channel                          // left channel
# Line 184  namespace LinuxSampler { namespace gig { Line 180  namespace LinuxSampler { namespace gig {
180                      #if ENABLE_FILTER                      #if ENABLE_FILTER
181                          pOutputLeft[i] += this->FilterLeft.Apply(&bq_base, &bq_main, effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0));                          pOutputLeft[i] += this->FilterLeft.Apply(&bq_base, &bq_main, effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0));
182                      #else // no filter                      #else // no filter
183                          pOutputRight[i] += effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0);                          pOutputLeft[i] += effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0);
184                      #endif // ENABLE_FILTER                      #endif // ENABLE_FILTER
185    
186                      //calculate right channel                      //calculate right channel
# Line 196  namespace LinuxSampler { namespace gig { Line 192  namespace LinuxSampler { namespace gig {
192                      b   = 2 * x1 + xm1 - (5 * x0 + x2) / 2;                      b   = 2 * x1 + xm1 - (5 * x0 + x2) / 2;
193                      c   = (x1 - xm1) / 2;                      c   = (x1 - xm1) / 2;
194                      #if ENABLE_FILTER                      #if ENABLE_FILTER
195                          pOutputLeft[i++] += this->FilterRight.Apply(&bq_base, &bq_main, effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0));                          pOutputRight[i++] += this->FilterRight.Apply(&bq_base, &bq_main, effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0));
196                      #else // no filter                      #else // no filter
197                          pOutputRight[i++] += effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0);                          pOutputRight[i++] += effective_volume * ((((a * pos_fract) + b) * pos_fract + c) * pos_fract + x0);
198                      #endif // ENABLE_FILTER                      #endif // ENABLE_FILTER
# Line 204  namespace LinuxSampler { namespace gig { Line 200  namespace LinuxSampler { namespace gig {
200    
201                  this->Pos += pitch;                  this->Pos += pitch;
202              }              }
203    
204              inline void InterpolateOneStep_Mono(sample_t* pSrc, int& i, float& effective_volume, float& pitch,  biquad_param_t& bq_base, biquad_param_t& bq_main) {              inline void InterpolateOneStep_Mono(sample_t* pSrc, int& i, float& effective_volume, float& pitch,  biquad_param_t& bq_base, biquad_param_t& bq_main) {
205                  int   pos_int   = RTMath::DoubleToInt(this->Pos);  // integer position                  int   pos_int   = RTMath::DoubleToInt(this->Pos);  // integer position
206                  float pos_fract = this->Pos - pos_int;             // fractional part of position                  float pos_fract = this->Pos - pos_int;             // fractional part of position
207    
                 #if 0 //ENABLE_FILTER  
                     UpdateFilter_Mono(cutoff + FILTER_CUTOFF_MIN, resonance);  
                 #endif // ENABLE_FILTER  
   
208                  #if USE_LINEAR_INTERPOLATION                  #if USE_LINEAR_INTERPOLATION
209                      float sample_point  = effective_volume * (pSrc[pos_int] + pos_fract * (pSrc[pos_int+1] - pSrc[pos_int]));                      float sample_point  = effective_volume * (pSrc[pos_int] + pos_fract * (pSrc[pos_int+1] - pSrc[pos_int]));
210                  #else // polynomial interpolation                  #else // polynomial interpolation
# Line 234  namespace LinuxSampler { namespace gig { Line 227  namespace LinuxSampler { namespace gig {
227    
228                  this->Pos += pitch;                  this->Pos += pitch;
229              }              }
230  #if 0  
             inline void UpdateFilter_Stereo(float cutoff, float& resonance) {  
                 if (!(++FilterUpdateCounter % FILTER_UPDATE_PERIOD) && (cutoff != FilterLeft.Cutoff() || resonance != FilterLeft.Resonance())) {  
                     FilterLeft.SetParameters(cutoff, resonance, SampleRate);  
                     FilterRight.SetParameters(cutoff, resonance, SampleRate);  
                 }  
             }  
             inline void UpdateFilter_Mono(float cutoff, float& resonance) {  
                 if (!(++FilterUpdateCounter % FILTER_UPDATE_PERIOD) && (cutoff != FilterLeft.Cutoff() || resonance != FilterLeft.Resonance())) {  
                     FilterLeft.SetParameters(cutoff, resonance, SampleRate);  
                 }  
             }  
 #endif  
231              inline float Constrain(float ValueToCheck, float Min, float Max) {              inline float Constrain(float ValueToCheck, float Min, float Max) {
232                  if      (ValueToCheck > Max) ValueToCheck = Max;                  if      (ValueToCheck > Max) ValueToCheck = Max;
233                  else if (ValueToCheck < Min) ValueToCheck = Min;                  else if (ValueToCheck < Min) ValueToCheck = Min;

Legend:
Removed from v.80  
changed lines
  Added in v.97

  ViewVC Help
Powered by ViewVC