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

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

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

revision 2221 by iliev, Thu Jul 28 17:17:42 2011 UTC revision 2222 by iliev, Thu Jul 28 18:24:12 2011 UTC
# Line 78  namespace LinuxSampler { namespace sfz { Line 78  namespace LinuxSampler { namespace sfz {
78                     GetSampleRate());                     GetSampleRate());
79      }      }
80            
81        
82        void FilEGUnit::Trigger() {
83            ::sfz::Region* const pRegion = pVoice->pRegion;
84            depth = pRegion->fileg_depth;
85            
86            // the length of the decay and release curves are dependent on the velocity
87            const double velrelease = 1 / pVoice->GetVelocityRelease(pVoice->MIDIVelocity);
88    
89            // set the delay trigger
90            uiDelayTrigger = (pRegion->fileg_delay + pRegion->fileg_vel2delay * velrelease) * GetSampleRate();
91            
92            EG.trigger(uint(pRegion->fileg_start * 10),
93                       std::max(0.0, pRegion->fileg_attack + pRegion->fileg_vel2attack * velrelease),
94                       std::max(0.0, pRegion->fileg_hold + pRegion->fileg_vel2hold * velrelease),
95                       std::max(0.0, pRegion->fileg_decay + pRegion->fileg_vel2decay * velrelease),
96                       uint(std::min(std::max(0.0, 10 * (pRegion->fileg_sustain + pRegion->fileg_vel2sustain * velrelease)), 1000.0)),
97                       std::max(0.0, pRegion->fileg_release + pRegion->fileg_vel2release * velrelease),
98                       GetSampleRate());
99        }
100        
101    
102      void LFOUnit::Increment() {      void LFOUnit::Increment() {
103          if (DelayStage()) return;          if (DelayStage()) return;
# Line 189  namespace LinuxSampler { namespace sfz { Line 209  namespace LinuxSampler { namespace sfz {
209          FilLFOUnit* u = &(GetRack()->suFilLFO);          FilLFOUnit* u = &(GetRack()->suFilLFO);
210          val = u->Active() ? RTMath::CentsToFreqRatioUnlimited(u->GetLevel() * u->pLfoInfo->cutoff) : 1;          val = u->Active() ? RTMath::CentsToFreqRatioUnlimited(u->GetLevel() * u->pLfoInfo->cutoff) : 1;
211                    
212            FilEGUnit* u2 = &(GetRack()->suFilEG);
213            val *= u2->Active() ? RTMath::CentsToFreqRatioUnlimited(u2->GetLevel() * u2->depth) : 1;
214            
215          for (int i = 0; i < GetRack()->filLFOs.size(); i++) {          for (int i = 0; i < GetRack()->filLFOs.size(); i++) {
216              LFOv2Unit* lfo = GetRack()->filLFOs[i];              LFOv2Unit* lfo = GetRack()->filLFOs[i];
217              if (!lfo->Active()) continue;              if (!lfo->Active()) continue;
# Line 242  namespace LinuxSampler { namespace sfz { Line 265  namespace LinuxSampler { namespace sfz {
265            
266            
267      SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice)      SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice)
268          : SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suPitchEG(this),          : SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this),
269          EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount),          EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount),
270          suAmpLFO(this), suPitchLFO(this), suFilLFO(this),          suAmpLFO(this), suPitchLFO(this), suFilLFO(this),
271          LFOs(maxLfoCount), filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount)          LFOs(maxLfoCount), filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount)
272      {      {
273          suEndpoint.pVoice = suVolEG.pVoice = suPitchEG.pVoice = voice;          suEndpoint.pVoice = suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice;
274          suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = voice;          suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = voice;
275                    
276          for (int i = 0; i < EGs.capacity(); i++) {          for (int i = 0; i < EGs.capacity(); i++) {
# Line 332  namespace LinuxSampler { namespace sfz { Line 355  namespace LinuxSampler { namespace sfz {
355          Units.clear();          Units.clear();
356                    
357          Units.add(&suVolEG);          Units.add(&suVolEG);
358            Units.add(&suFilEG);
359          Units.add(&suPitchEG);          Units.add(&suPitchEG);
360          Units.add(&suPitchLFO);          Units.add(&suPitchLFO);
361          Units.add(&suAmpLFO);          Units.add(&suAmpLFO);

Legend:
Removed from v.2221  
changed lines
  Added in v.2222

  ViewVC Help
Powered by ViewVC