/[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 2225 by iliev, Tue Aug 2 13:44:57 2011 UTC revision 2226 by iliev, Wed Aug 3 09:12:09 2011 UTC
# Line 98  namespace LinuxSampler { namespace sfz { Line 98  namespace LinuxSampler { namespace sfz {
98                     GetSampleRate());                     GetSampleRate());
99      }      }
100            
101        
102        LFOUnit::LFOUnit(const LFOUnit& Unit): SfzSignalUnit(Unit), suFadeEG(static_cast<SfzSignalUnitRack*>(Unit.pRack)) {
103            Copy(Unit);
104        }
105    
106      void LFOUnit::Increment() {      void LFOUnit::Increment() {
107          if (DelayStage()) return;          if (DelayStage()) return;
# Line 105  namespace LinuxSampler { namespace sfz { Line 109  namespace LinuxSampler { namespace sfz {
109          SignalUnit::Increment();          SignalUnit::Increment();
110                    
111          Level = pLFO->Render();          Level = pLFO->Render();
112            if (suFadeEG.Active()) Level *= suFadeEG.GetLevel();
113      }      }
114            
115      void LFOUnit::Trigger() {      void LFOUnit::Trigger() {
# Line 113  namespace LinuxSampler { namespace sfz { Line 118  namespace LinuxSampler { namespace sfz {
118                    
119          // set the delay trigger          // set the delay trigger
120          uiDelayTrigger = pLfoInfo->delay * GetSampleRate();          uiDelayTrigger = pLfoInfo->delay * GetSampleRate();
121            if(pLfoInfo->fade != 0 || !pLfoInfo->fade_oncc.empty()) {
122                float f = pLfoInfo->fade;
123                for (int i = 0; i < pLfoInfo->fade_oncc.size(); i++) {
124                    int val = pVoice->GetControllerValue(pLfoInfo->fade_oncc[i].Controller);
125                    f += (val / 127.0f) * pLfoInfo->fade_oncc[i].Influence;
126                }
127                
128                if (f != 0) {
129                    suFadeEG.uiDelayTrigger = pLfoInfo->delay * GetSampleRate();
130                    suFadeEG.EG.trigger(0, f, 0, 0, 1000, 0, GetSampleRate());
131                }
132            }
133      }      }
134            
135      void LFOv1Unit::Trigger() {      void LFOv1Unit::Trigger() {
# Line 165  namespace LinuxSampler { namespace sfz { Line 182  namespace LinuxSampler { namespace sfz {
182            
183      void AmpLFOUnit::Trigger() {      void AmpLFOUnit::Trigger() {
184          ::sfz::Region* const pRegion = pVoice->pRegion;          ::sfz::Region* const pRegion = pVoice->pRegion;
185          pLfoInfo->delay = pRegion->amplfo_delay;          pLfoInfo->delay  = pRegion->amplfo_delay;
186          pLfoInfo->freq = pRegion->amplfo_freq;          pLfoInfo->freq   = pRegion->amplfo_freq;
187            pLfoInfo->fade   = pRegion->amplfo_fade;
188          pLfoInfo->volume = pRegion->amplfo_depth;          pLfoInfo->volume = pRegion->amplfo_depth;
189                    
190          LFOv1Unit::Trigger();          LFOv1Unit::Trigger();
# Line 175  namespace LinuxSampler { namespace sfz { Line 193  namespace LinuxSampler { namespace sfz {
193      void PitchLFOUnit::Trigger() {      void PitchLFOUnit::Trigger() {
194          ::sfz::Region* const pRegion = pVoice->pRegion;          ::sfz::Region* const pRegion = pVoice->pRegion;
195          pLfoInfo->delay = pRegion->pitchlfo_delay;          pLfoInfo->delay = pRegion->pitchlfo_delay;
196          pLfoInfo->freq = pRegion->pitchlfo_freq;          pLfoInfo->freq  = pRegion->pitchlfo_freq;
197            pLfoInfo->fade  = pRegion->pitchlfo_fade;
198          pLfoInfo->pitch = pRegion->pitchlfo_depth;          pLfoInfo->pitch = pRegion->pitchlfo_depth;
199                    
200          LFOv1Unit::Trigger();          LFOv1Unit::Trigger();
# Line 183  namespace LinuxSampler { namespace sfz { Line 202  namespace LinuxSampler { namespace sfz {
202            
203      void FilLFOUnit::Trigger() {      void FilLFOUnit::Trigger() {
204          ::sfz::Region* const pRegion = pVoice->pRegion;          ::sfz::Region* const pRegion = pVoice->pRegion;
205          pLfoInfo->delay = pRegion->fillfo_delay;          pLfoInfo->delay  = pRegion->fillfo_delay;
206          pLfoInfo->freq = pRegion->fillfo_freq;          pLfoInfo->freq   = pRegion->fillfo_freq;
207            pLfoInfo->fade   = pRegion->fillfo_fade;
208          pLfoInfo->cutoff = pRegion->fillfo_depth;          pLfoInfo->cutoff = pRegion->fillfo_depth;
209                    
210          LFOv1Unit::Trigger();          LFOv1Unit::Trigger();
# Line 331  namespace LinuxSampler { namespace sfz { Line 351  namespace LinuxSampler { namespace sfz {
351      {      {
352          suEndpoint.pVoice = suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice;          suEndpoint.pVoice = suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice;
353          suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = voice;          suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = voice;
354          suPitchLFO.suDepthCC.pVoice = voice;          suPitchLFO.suDepthCC.pVoice = suPitchLFO.suFadeEG.pVoice = voice;
355            suFilLFO.suFadeEG.pVoice = voice;
356            suAmpLFO.suFadeEG.pVoice = voice;
357                    
358          for (int i = 0; i < EGs.capacity(); i++) {          for (int i = 0; i < EGs.capacity(); i++) {
359              EGs[i] = new EGv2Unit(this);              EGs[i] = new EGv2Unit(this);
# Line 341  namespace LinuxSampler { namespace sfz { Line 363  namespace LinuxSampler { namespace sfz {
363          for (int i = 0; i < LFOs.capacity(); i++) {          for (int i = 0; i < LFOs.capacity(); i++) {
364              LFOs[i] = new LFOv2Unit(this);              LFOs[i] = new LFOv2Unit(this);
365              LFOs[i]->pVoice = voice;              LFOs[i]->pVoice = voice;
366                LFOs[i]->suFadeEG.pVoice = voice;
367              LFOs[i]->suPitchOnCC.pVoice = voice;              LFOs[i]->suPitchOnCC.pVoice = voice;
368          }          }
369      }      }
# Line 429  namespace LinuxSampler { namespace sfz { Line 452  namespace LinuxSampler { namespace sfz {
452          Units.add(&suPitchEG);          Units.add(&suPitchEG);
453          Units.add(&suPitchLFO);          Units.add(&suPitchLFO);
454          Units.add(&suPitchLFO.suDepthCC);          Units.add(&suPitchLFO.suDepthCC);
455            Units.add(&suPitchLFO.suFadeEG);
456          Units.add(&suAmpLFO);          Units.add(&suAmpLFO);
457            Units.add(&suAmpLFO.suFadeEG);
458          Units.add(&suFilLFO);          Units.add(&suFilLFO);
459            Units.add(&suFilLFO.suFadeEG);
460                    
461          for (int i = 0; i < EGs.size(); i++) {          for (int i = 0; i < EGs.size(); i++) {
462              Units.add(EGs[i]);              Units.add(EGs[i]);
# Line 438  namespace LinuxSampler { namespace sfz { Line 464  namespace LinuxSampler { namespace sfz {
464                    
465          for (int i = 0; i < LFOs.size(); i++) {          for (int i = 0; i < LFOs.size(); i++) {
466              Units.add(LFOs[i]);              Units.add(LFOs[i]);
467                Units.add(&(LFOs[i]->suFadeEG));
468              Units.add(&(LFOs[i]->suPitchOnCC));              Units.add(&(LFOs[i]->suPitchOnCC));
469          }          }
470                    

Legend:
Removed from v.2225  
changed lines
  Added in v.2226

  ViewVC Help
Powered by ViewVC