/[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 242 by schoenebeck, Wed Sep 15 13:59:08 2004 UTC revision 246 by schoenebeck, Sun Sep 19 14:12:55 2004 UTC
# Line 118  namespace LinuxSampler { namespace gig { Line 118  namespace LinuxSampler { namespace gig {
118    
119          Type            = type_normal;          Type            = type_normal;
120          Active          = true;          Active          = true;
121          MIDIKey         = pNoteOnEvent->Key;          MIDIKey         = pNoteOnEvent->Param.Note.Key;
122          pRegion         = pInstrument->GetRegion(MIDIKey);          pRegion         = pInstrument->GetRegion(MIDIKey);
123          PlaybackState   = playback_state_ram; // we always start playback from RAM cache and switch then to disk if needed          PlaybackState   = playback_state_ram; // we always start playback from RAM cache and switch then to disk if needed
124          Delay           = pNoteOnEvent->FragmentPos();          Delay           = pNoteOnEvent->FragmentPos();
# Line 149  namespace LinuxSampler { namespace gig { Line 149  namespace LinuxSampler { namespace gig {
149                              pEngine->LaunchVoice(pNoteOnEvent, iNewLayer, ReleaseTriggerVoice);                              pEngine->LaunchVoice(pNoteOnEvent, iNewLayer, ReleaseTriggerVoice);
150                      break;                      break;
151                  case ::gig::dimension_velocity:                  case ::gig::dimension_velocity:
152                      DimValues[i] = pNoteOnEvent->Velocity;                      DimValues[i] = pNoteOnEvent->Param.Note.Velocity;
153                      break;                      break;
154                  case ::gig::dimension_channelaftertouch:                  case ::gig::dimension_channelaftertouch:
155                      DimValues[i] = 0; //TODO: we currently ignore this dimension                      DimValues[i] = 0; //TODO: we currently ignore this dimension
# Line 159  namespace LinuxSampler { namespace gig { Line 159  namespace LinuxSampler { namespace gig {
159                      DimValues[i] = (uint) ReleaseTriggerVoice;                      DimValues[i] = (uint) ReleaseTriggerVoice;
160                      break;                      break;
161                  case ::gig::dimension_keyboard:                  case ::gig::dimension_keyboard:
162                      DimValues[i] = (uint) pNoteOnEvent->Key;                      DimValues[i] = (uint) pNoteOnEvent->Param.Note.Key;
163                      break;                      break;
164                  case ::gig::dimension_modwheel:                  case ::gig::dimension_modwheel:
165                      DimValues[i] = pEngine->ControllerTable[1];                      DimValues[i] = pEngine->ControllerTable[1];
# Line 245  namespace LinuxSampler { namespace gig { Line 245  namespace LinuxSampler { namespace gig {
245                  CrossfadeVolume = 1.0f; //TODO: aftertouch not supported yet                  CrossfadeVolume = 1.0f; //TODO: aftertouch not supported yet
246                  break;                  break;
247              case ::gig::attenuation_ctrl_t::type_velocity:              case ::gig::attenuation_ctrl_t::type_velocity:
248                  CrossfadeVolume = CrossfadeAttenuation(pNoteOnEvent->Velocity);                  CrossfadeVolume = CrossfadeAttenuation(pNoteOnEvent->Param.Note.Velocity);
249                  break;                  break;
250              case ::gig::attenuation_ctrl_t::type_controlchange: //FIXME: currently not sample accurate              case ::gig::attenuation_ctrl_t::type_controlchange: //FIXME: currently not sample accurate
251                  CrossfadeVolume = CrossfadeAttenuation(pEngine->ControllerTable[pDimRgn->AttenuationController.controller_number]);                  CrossfadeVolume = CrossfadeAttenuation(pEngine->ControllerTable[pDimRgn->AttenuationController.controller_number]);
# Line 255  namespace LinuxSampler { namespace gig { Line 255  namespace LinuxSampler { namespace gig {
255                  CrossfadeVolume = 1.0f;                  CrossfadeVolume = 1.0f;
256          }          }
257    
258            PanLeft  = float(RTMath::Max(pDimRgn->Pan, 0)) / -64.0f;
259            PanRight = float(RTMath::Min(pDimRgn->Pan, 0)) /  63.0f;
260    
261          pSample = pDimRgn->pSample; // sample won't change until the voice is finished          pSample = pDimRgn->pSample; // sample won't change until the voice is finished
262    
263          Pos = pDimRgn->SampleStartOffset; // offset where we should start playback of sample (0 - 2000 sample points)          Pos = pDimRgn->SampleStartOffset; // offset where we should start playback of sample (0 - 2000 sample points)
# Line 293  namespace LinuxSampler { namespace gig { Line 296  namespace LinuxSampler { namespace gig {
296    
297          // calculate initial pitch value          // calculate initial pitch value
298          {          {
299              double pitchbasecents = pDimRgn->FineTune * 10;              double pitchbasecents = pDimRgn->FineTune * 10 + (int) pEngine->ScaleTuning[MIDIKey % 12];
300              if (pDimRgn->PitchTrack) pitchbasecents += (MIDIKey - (int) pDimRgn->UnityNote) * 100;              if (pDimRgn->PitchTrack) pitchbasecents += (MIDIKey - (int) pDimRgn->UnityNote) * 100;
301              this->PitchBase = RTMath::CentsToFreqRatio(pitchbasecents) * (double(pSample->SamplesPerSecond) / double(pEngine->pAudioOutputDevice->SampleRate()));              this->PitchBase = RTMath::CentsToFreqRatio(pitchbasecents) * (double(pSample->SamplesPerSecond) / double(pEngine->pAudioOutputDevice->SampleRate()));
302              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
303          }          }
304    
305    
306          Volume = pDimRgn->GetVelocityAttenuation(pNoteOnEvent->Velocity) / 32768.0f; // we downscale by 32768 to convert from int16 value range to DSP value range (which is -1.0..1.0)          Volume = pDimRgn->GetVelocityAttenuation(pNoteOnEvent->Param.Note.Velocity) / 32768.0f; // we downscale by 32768 to convert from int16 value range to DSP value range (which is -1.0..1.0)
307    
308    
309          // setup EG 1 (VCA EG)          // setup EG 1 (VCA EG)
# Line 315  namespace LinuxSampler { namespace gig { Line 318  namespace LinuxSampler { namespace gig {
318                      eg1controllervalue = 0; // TODO: aftertouch not yet supported                      eg1controllervalue = 0; // TODO: aftertouch not yet supported
319                      break;                      break;
320                  case ::gig::eg1_ctrl_t::type_velocity:                  case ::gig::eg1_ctrl_t::type_velocity:
321                      eg1controllervalue = pNoteOnEvent->Velocity;                      eg1controllervalue = pNoteOnEvent->Param.Note.Velocity;
322                      break;                      break;
323                  case ::gig::eg1_ctrl_t::type_controlchange: // MIDI control change controller                  case ::gig::eg1_ctrl_t::type_controlchange: // MIDI control change controller
324                      eg1controllervalue = pEngine->ControllerTable[pDimRgn->EG1Controller.controller_number];                      eg1controllervalue = pEngine->ControllerTable[pDimRgn->EG1Controller.controller_number];
# Line 354  namespace LinuxSampler { namespace gig { Line 357  namespace LinuxSampler { namespace gig {
357                      eg2controllervalue = 0; // TODO: aftertouch not yet supported                      eg2controllervalue = 0; // TODO: aftertouch not yet supported
358                      break;                      break;
359                  case ::gig::eg2_ctrl_t::type_velocity:                  case ::gig::eg2_ctrl_t::type_velocity:
360                      eg2controllervalue = pNoteOnEvent->Velocity;                      eg2controllervalue = pNoteOnEvent->Param.Note.Velocity;
361                      break;                      break;
362                  case ::gig::eg2_ctrl_t::type_controlchange: // MIDI control change controller                  case ::gig::eg2_ctrl_t::type_controlchange: // MIDI control change controller
363                      eg2controllervalue = pEngine->ControllerTable[pDimRgn->EG2Controller.controller_number];                      eg2controllervalue = pEngine->ControllerTable[pDimRgn->EG2Controller.controller_number];
# Line 582  namespace LinuxSampler { namespace gig { Line 585  namespace LinuxSampler { namespace gig {
585    
586              // calculate cutoff frequency              // calculate cutoff frequency
587              float cutoff = (!VCFCutoffCtrl.controller)              float cutoff = (!VCFCutoffCtrl.controller)
588                  ? exp((float) (127 - pNoteOnEvent->Velocity) * (float) pDimRgn->VCFVelocityScale * 6.2E-5f * FILTER_CUTOFF_COEFF) * FILTER_CUTOFF_MAX                  ? exp((float) (127 - pNoteOnEvent->Param.Note.Velocity) * (float) pDimRgn->VCFVelocityScale * 6.2E-5f * FILTER_CUTOFF_COEFF) * FILTER_CUTOFF_MAX
589                  : exp((float) VCFCutoffCtrl.value * 0.00787402f * FILTER_CUTOFF_COEFF) * FILTER_CUTOFF_MAX;                  : exp((float) VCFCutoffCtrl.value * 0.00787402f * FILTER_CUTOFF_COEFF) * FILTER_CUTOFF_MAX;
590    
591              // calculate resonance              // calculate resonance
592              float resonance = (float) VCFResonanceCtrl.value * 0.00787f;   // 0.0..1.0              float resonance = (float) VCFResonanceCtrl.value * 0.00787f;   // 0.0..1.0
593              if (pDimRgn->VCFKeyboardTracking) {              if (pDimRgn->VCFKeyboardTracking) {
594                  resonance += (float) (pNoteOnEvent->Key - pDimRgn->VCFKeyboardTrackingBreakpoint) * 0.00787f;                  resonance += (float) (pNoteOnEvent->Param.Note.Key - pDimRgn->VCFKeyboardTrackingBreakpoint) * 0.00787f;
595              }              }
596              Constrain(resonance, 0.0, 1.0); // correct resonance if outside allowed value range (0.0..1.0)              Constrain(resonance, 0.0, 1.0); // correct resonance if outside allowed value range (0.0..1.0)
597    
# Line 657  namespace LinuxSampler { namespace gig { Line 660  namespace LinuxSampler { namespace gig {
660    
661              case playback_state_ram: {              case playback_state_ram: {
662                      if (RAMLoop) InterpolateAndLoop(Samples, (sample_t*) pSample->GetCache().pStart, Delay);                      if (RAMLoop) InterpolateAndLoop(Samples, (sample_t*) pSample->GetCache().pStart, Delay);
663                      else         Interpolate(Samples, (sample_t*) pSample->GetCache().pStart, Delay);                      else         InterpolateNoLoop(Samples, (sample_t*) pSample->GetCache().pStart, Delay);
664                      if (DiskVoice) {                      if (DiskVoice) {
665                          // check if we reached the allowed limit of the sample RAM cache                          // check if we reached the allowed limit of the sample RAM cache
666                          if (Pos > MaxRAMPos) {                          if (Pos > MaxRAMPos) {
# Line 691  namespace LinuxSampler { namespace gig { Line 694  namespace LinuxSampler { namespace gig {
694                      }                      }
695    
696                      sample_t* ptr = DiskStreamRef.pStream->GetReadPtr(); // get the current read_ptr within the ringbuffer where we read the samples from                      sample_t* ptr = DiskStreamRef.pStream->GetReadPtr(); // get the current read_ptr within the ringbuffer where we read the samples from
697                      Interpolate(Samples, ptr, Delay);                      InterpolateNoLoop(Samples, ptr, Delay);
698                      DiskStreamRef.pStream->IncrementReadPos(RTMath::DoubleToInt(Pos) * pSample->Channels);                      DiskStreamRef.pStream->IncrementReadPos(RTMath::DoubleToInt(Pos) * pSample->Channels);
699                      Pos -= RTMath::DoubleToInt(Pos);                      Pos -= RTMath::DoubleToInt(Pos);
700                  }                  }
# Line 749  namespace LinuxSampler { namespace gig { Line 752  namespace LinuxSampler { namespace gig {
752              while (pCCEvent && pCCEvent->FragmentPos() <= Delay) pCCEvent = pEngine->pCCEvents->next();              while (pCCEvent && pCCEvent->FragmentPos() <= Delay) pCCEvent = pEngine->pCCEvents->next();
753          }          }
754          while (pCCEvent) {          while (pCCEvent) {
755              if (pCCEvent->Controller) { // if valid MIDI controller              if (pCCEvent->Param.CC.Controller) { // if valid MIDI controller
756                  #if ENABLE_FILTER                  #if ENABLE_FILTER
757                  if (pCCEvent->Controller == VCFCutoffCtrl.controller) {                  if (pCCEvent->Param.CC.Controller == VCFCutoffCtrl.controller) {
758                      pEngine->pSynthesisEvents[Event::destination_vcfc]->alloc_assign(*pCCEvent);                      pEngine->pSynthesisEvents[Event::destination_vcfc]->alloc_assign(*pCCEvent);
759                  }                  }
760                  if (pCCEvent->Controller == VCFResonanceCtrl.controller) {                  if (pCCEvent->Param.CC.Controller == VCFResonanceCtrl.controller) {
761                      pEngine->pSynthesisEvents[Event::destination_vcfr]->alloc_assign(*pCCEvent);                      pEngine->pSynthesisEvents[Event::destination_vcfr]->alloc_assign(*pCCEvent);
762                  }                  }
763                  #endif // ENABLE_FILTER                  #endif // ENABLE_FILTER
764                  if (pCCEvent->Controller == pLFO1->ExtController) {                  if (pCCEvent->Param.CC.Controller == pLFO1->ExtController) {
765                      pLFO1->SendEvent(pCCEvent);                      pLFO1->SendEvent(pCCEvent);
766                  }                  }
767                  #if ENABLE_FILTER                  #if ENABLE_FILTER
768                  if (pCCEvent->Controller == pLFO2->ExtController) {                  if (pCCEvent->Param.CC.Controller == pLFO2->ExtController) {
769                      pLFO2->SendEvent(pCCEvent);                      pLFO2->SendEvent(pCCEvent);
770                  }                  }
771                  #endif // ENABLE_FILTER                  #endif // ENABLE_FILTER
772                  if (pCCEvent->Controller == pLFO3->ExtController) {                  if (pCCEvent->Param.CC.Controller == pLFO3->ExtController) {
773                      pLFO3->SendEvent(pCCEvent);                      pLFO3->SendEvent(pCCEvent);
774                  }                  }
775                  if (pDimRgn->AttenuationController.type == ::gig::attenuation_ctrl_t::type_controlchange &&                  if (pDimRgn->AttenuationController.type == ::gig::attenuation_ctrl_t::type_controlchange &&
776                      pCCEvent->Controller == pDimRgn->AttenuationController.controller_number) { // if crossfade event                      pCCEvent->Param.CC.Controller == pDimRgn->AttenuationController.controller_number) { // if crossfade event
777                      pEngine->pSynthesisEvents[Event::destination_vca]->alloc_assign(*pCCEvent);                      pEngine->pSynthesisEvents[Event::destination_vca]->alloc_assign(*pCCEvent);
778                  }                  }
779              }              }
# Line 800  namespace LinuxSampler { namespace gig { Line 803  namespace LinuxSampler { namespace gig {
803                  // calculate the influence length of this event (in sample points)                  // calculate the influence length of this event (in sample points)
804                  uint end = (pNextVCOEvent) ? pNextVCOEvent->FragmentPos() : Samples;                  uint end = (pNextVCOEvent) ? pNextVCOEvent->FragmentPos() : Samples;
805    
806                  pitch = RTMath::CentsToFreqRatio(((double) pVCOEvent->Pitch / 8192.0) * 200.0); // +-two semitones = +-200 cents                  pitch = RTMath::CentsToFreqRatio(((double) pVCOEvent->Param.Pitch.Pitch / 8192.0) * 200.0); // +-two semitones = +-200 cents
807    
808                  // apply pitch value to the pitch parameter sequence                  // apply pitch value to the pitch parameter sequence
809                  for (uint i = pVCOEvent->FragmentPos(); i < end; i++) {                  for (uint i = pVCOEvent->FragmentPos(); i < end; i++) {
# Line 826  namespace LinuxSampler { namespace gig { Line 829  namespace LinuxSampler { namespace gig {
829                  // calculate the influence length of this event (in sample points)                  // calculate the influence length of this event (in sample points)
830                  uint end = (pNextVCAEvent) ? pNextVCAEvent->FragmentPos() : Samples;                  uint end = (pNextVCAEvent) ? pNextVCAEvent->FragmentPos() : Samples;
831    
832                  crossfadevolume = CrossfadeAttenuation(pVCAEvent->Value);                  crossfadevolume = CrossfadeAttenuation(pVCAEvent->Param.CC.Value);
833    
834                  float effective_volume = crossfadevolume * this->Volume * pEngine->GlobalVolume;                  float effective_volume = crossfadevolume * this->Volume * pEngine->GlobalVolume;
835    
# Line 855  namespace LinuxSampler { namespace gig { Line 858  namespace LinuxSampler { namespace gig {
858                  // calculate the influence length of this event (in sample points)                  // calculate the influence length of this event (in sample points)
859                  uint end = (pNextCutoffEvent) ? pNextCutoffEvent->FragmentPos() : Samples;                  uint end = (pNextCutoffEvent) ? pNextCutoffEvent->FragmentPos() : Samples;
860    
861                  cutoff = exp((float) pCutoffEvent->Value * 0.00787402f * FILTER_CUTOFF_COEFF) * FILTER_CUTOFF_MAX - FILTER_CUTOFF_MIN;                  cutoff = exp((float) pCutoffEvent->Param.CC.Value * 0.00787402f * FILTER_CUTOFF_COEFF) * FILTER_CUTOFF_MAX - FILTER_CUTOFF_MIN;
862    
863                  // apply cutoff frequency to the cutoff parameter sequence                  // apply cutoff frequency to the cutoff parameter sequence
864                  for (uint i = pCutoffEvent->FragmentPos(); i < end; i++) {                  for (uint i = pCutoffEvent->FragmentPos(); i < end; i++) {
# Line 881  namespace LinuxSampler { namespace gig { Line 884  namespace LinuxSampler { namespace gig {
884                  uint end = (pNextResonanceEvent) ? pNextResonanceEvent->FragmentPos() : Samples;                  uint end = (pNextResonanceEvent) ? pNextResonanceEvent->FragmentPos() : Samples;
885    
886                  // convert absolute controller value to differential                  // convert absolute controller value to differential
887                  int ctrldelta = pResonanceEvent->Value - VCFResonanceCtrl.value;                  int ctrldelta = pResonanceEvent->Param.CC.Value - VCFResonanceCtrl.value;
888                  VCFResonanceCtrl.value = pResonanceEvent->Value;                  VCFResonanceCtrl.value = pResonanceEvent->Param.CC.Value;
889    
890                  float resonancedelta = (float) ctrldelta * 0.00787f; // 0.0..1.0                  float resonancedelta = (float) ctrldelta * 0.00787f; // 0.0..1.0
891    
# Line 893  namespace LinuxSampler { namespace gig { Line 896  namespace LinuxSampler { namespace gig {
896    
897                  pResonanceEvent = pNextResonanceEvent;                  pResonanceEvent = pNextResonanceEvent;
898              }              }
899              if (pResonanceEventList->last()) VCFResonanceCtrl.fvalue = pResonanceEventList->last()->Value * 0.00787f; // needed for initialization of parameter matrix next time              if (pResonanceEventList->last()) VCFResonanceCtrl.fvalue = pResonanceEventList->last()->Param.CC.Value * 0.00787f; // needed for initialization of parameter matrix next time
900          }          }
901      #endif // ENABLE_FILTER      #endif // ENABLE_FILTER
902      }      }
# Line 945  namespace LinuxSampler { namespace gig { Line 948  namespace LinuxSampler { namespace gig {
948      #endif // ENABLE_FILTER      #endif // ENABLE_FILTER
949    
950      /**      /**
951       *  Interpolates the input audio data (no loop).       *  Interpolates the input audio data (without looping).
952       *       *
953       *  @param Samples - number of sample points to be rendered in this audio       *  @param Samples - number of sample points to be rendered in this audio
954       *                   fragment cycle       *                   fragment cycle
955       *  @param pSrc    - pointer to input sample data       *  @param pSrc    - pointer to input sample data
956       *  @param Skip    - number of sample points to skip in output buffer       *  @param Skip    - number of sample points to skip in output buffer
957       */       */
958      void Voice::Interpolate(uint Samples, sample_t* pSrc, uint Skip) {      void Voice::InterpolateNoLoop(uint Samples, sample_t* pSrc, uint Skip) {
959          int i = Skip;          int i = Skip;
960    
961          // FIXME: assuming either mono or stereo          // FIXME: assuming either mono or stereo
962          if (this->pSample->Channels == 2) { // Stereo Sample          if (this->pSample->Channels == 2) { // Stereo Sample
963              while (i < Samples) {              while (i < Samples) InterpolateStereo(pSrc, i);
                 InterpolateOneStep_Stereo(pSrc, i,  
                                           pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                           pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                           pEngine->pBasicFilterParameters[i],  
                                           pEngine->pMainFilterParameters[i]);  
             }  
964          }          }
965          else { // Mono Sample          else { // Mono Sample
966              while (i < Samples) {              while (i < Samples) InterpolateMono(pSrc, i);
                 InterpolateOneStep_Mono(pSrc, i,  
                                         pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                         pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                         pEngine->pBasicFilterParameters[i],  
                                         pEngine->pMainFilterParameters[i]);  
             }  
967          }          }
968      }      }
969    
# Line 992  namespace LinuxSampler { namespace gig { Line 983  namespace LinuxSampler { namespace gig {
983              if (pSample->LoopPlayCount) {              if (pSample->LoopPlayCount) {
984                  // render loop (loop count limited)                  // render loop (loop count limited)
985                  while (i < Samples && LoopCyclesLeft) {                  while (i < Samples && LoopCyclesLeft) {
986                      InterpolateOneStep_Stereo(pSrc, i,                      InterpolateStereo(pSrc, i);
                                               pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                               pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                               pEngine->pBasicFilterParameters[i],  
                                               pEngine->pMainFilterParameters[i]);  
987                      if (Pos > pSample->LoopEnd) {                      if (Pos > pSample->LoopEnd) {
988                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);;                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);;
989                          LoopCyclesLeft--;                          LoopCyclesLeft--;
990                      }                      }
991                  }                  }
992                  // render on without loop                  // render on without loop
993                  while (i < Samples) {                  while (i < Samples) InterpolateStereo(pSrc, i);
                     InterpolateOneStep_Stereo(pSrc, i,  
                                               pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                               pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                               pEngine->pBasicFilterParameters[i],  
                                               pEngine->pMainFilterParameters[i]);  
                 }  
994              }              }
995              else { // render loop (endless loop)              else { // render loop (endless loop)
996                  while (i < Samples) {                  while (i < Samples) {
997                      InterpolateOneStep_Stereo(pSrc, i,                      InterpolateStereo(pSrc, i);
                                               pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                               pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                               pEngine->pBasicFilterParameters[i],  
                                               pEngine->pMainFilterParameters[i]);  
998                      if (Pos > pSample->LoopEnd) {                      if (Pos > pSample->LoopEnd) {
999                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);
1000                      }                      }
# Line 1028  namespace LinuxSampler { namespace gig { Line 1005  namespace LinuxSampler { namespace gig {
1005              if (pSample->LoopPlayCount) {              if (pSample->LoopPlayCount) {
1006                  // render loop (loop count limited)                  // render loop (loop count limited)
1007                  while (i < Samples && LoopCyclesLeft) {                  while (i < Samples && LoopCyclesLeft) {
1008                      InterpolateOneStep_Mono(pSrc, i,                      InterpolateMono(pSrc, i);
                                             pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                             pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                             pEngine->pBasicFilterParameters[i],  
                                             pEngine->pMainFilterParameters[i]);  
1009                      if (Pos > pSample->LoopEnd) {                      if (Pos > pSample->LoopEnd) {
1010                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);;                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);;
1011                          LoopCyclesLeft--;                          LoopCyclesLeft--;
1012                      }                      }
1013                  }                  }
1014                  // render on without loop                  // render on without loop
1015                  while (i < Samples) {                  while (i < Samples) InterpolateMono(pSrc, i);
                     InterpolateOneStep_Mono(pSrc, i,  
                                             pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                             pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                             pEngine->pBasicFilterParameters[i],  
                                             pEngine->pMainFilterParameters[i]);  
                 }  
1016              }              }
1017              else { // render loop (endless loop)              else { // render loop (endless loop)
1018                  while (i < Samples) {                  while (i < Samples) {
1019                      InterpolateOneStep_Mono(pSrc, i,                      InterpolateMono(pSrc, i);
                                             pEngine->pSynthesisParameters[Event::destination_vca][i],  
                                             pEngine->pSynthesisParameters[Event::destination_vco][i],  
                                             pEngine->pBasicFilterParameters[i],  
                                             pEngine->pMainFilterParameters[i]);  
1020                      if (Pos > pSample->LoopEnd) {                      if (Pos > pSample->LoopEnd) {
1021                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);;                          Pos = pSample->LoopStart + fmod(Pos - pSample->LoopEnd, pSample->LoopSize);;
1022                      }                      }

Legend:
Removed from v.242  
changed lines
  Added in v.246

  ViewVC Help
Powered by ViewVC