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

Diff of /linuxsampler/trunk/src/engines/gig/Voice.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 630 by persson, Sat Jun 11 14:51:49 2005 UTC
# Line 61  namespace LinuxSampler { namespace gig { Line 61  namespace LinuxSampler { namespace gig {
61          KeyGroup = 0;          KeyGroup = 0;
62          SynthesisMode = 0; // set all mode bits to 0 first          SynthesisMode = 0; // set all mode bits to 0 first
63          // select synthesis implementation (currently either pure C++ or MMX+SSE(1))          // select synthesis implementation (currently either pure C++ or MMX+SSE(1))
64          #if ARCH_X86          #if CONFIG_ASM && ARCH_X86
65          SYNTHESIS_MODE_SET_IMPLEMENTATION(SynthesisMode, Features::supportsMMX() && Features::supportsSSE());          SYNTHESIS_MODE_SET_IMPLEMENTATION(SynthesisMode, Features::supportsMMX() && Features::supportsSSE());
66          #else          #else
67          SYNTHESIS_MODE_SET_IMPLEMENTATION(SynthesisMode, false);          SYNTHESIS_MODE_SET_IMPLEMENTATION(SynthesisMode, false);
# Line 269  namespace LinuxSampler { namespace gig { Line 269  namespace LinuxSampler { namespace gig {
269          pSample = pDimRgn->pSample; // sample won't change until the voice is finished          pSample = pDimRgn->pSample; // sample won't change until the voice is finished
270          if (!pSample || !pSample->SamplesTotal) return -1; // no need to continue if sample is silent          if (!pSample || !pSample->SamplesTotal) return -1; // no need to continue if sample is silent
271    
272            // calculate volume
273            const double velocityAttenuation = pDimRgn->GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity);
274    
275            Volume = velocityAttenuation / 32768.0f; // we downscale by 32768 to convert from int16 value range to DSP value range (which is -1.0..1.0)
276    
277            Volume *= pDimRgn->SampleAttenuation;
278    
279            // the volume of release triggered samples depends on note length
280            if (ReleaseTriggerVoice) {
281                float noteLength = float(pEngine->FrameTime + Delay -
282                                         pEngineChannel->pMIDIKeyInfo[MIDIKey].NoteOnTime) / pEngine->SampleRate;
283                float attenuation = 1 - 0.01053 * (256 >> pDimRgn->ReleaseTriggerDecay) * noteLength;
284                if (attenuation <= 0) return -1;
285                Volume *= attenuation;
286            }
287    
288          // select channel mode (mono or stereo)          // select channel mode (mono or stereo)
289          SYNTHESIS_MODE_SET_CHANNELS(SynthesisMode, pSample->Channels == 2);          SYNTHESIS_MODE_SET_CHANNELS(SynthesisMode, pSample->Channels == 2);
290    
# Line 333  namespace LinuxSampler { namespace gig { Line 349  namespace LinuxSampler { namespace gig {
349              this->PitchBend = RTMath::CentsToFreqRatio(((double) PitchBend / 8192.0) * 200.0); // pitchbend wheel +-2 semitones = 200 cents              this->PitchBend = RTMath::CentsToFreqRatio(((double) PitchBend / 8192.0) * 200.0); // pitchbend wheel +-2 semitones = 200 cents
350          }          }
351    
         const double velocityAttenuation = pDimRgn->GetVelocityAttenuation(itNoteOnEvent->Param.Note.Velocity);  
   
         Volume = velocityAttenuation / 32768.0f; // we downscale by 32768 to convert from int16 value range to DSP value range (which is -1.0..1.0)  
   
         Volume *= pDimRgn->SampleAttenuation;  
   
352          // the length of the decay and release curves are dependent on the velocity          // the length of the decay and release curves are dependent on the velocity
353          const double velrelease = 1 / pDimRgn->GetVelocityRelease(itNoteOnEvent->Param.Note.Velocity);          const double velrelease = 1 / pDimRgn->GetVelocityRelease(itNoteOnEvent->Param.Note.Velocity);
354    

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

  ViewVC Help
Powered by ViewVC