/[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 2263 by iliev, Sat Aug 20 14:01:36 2011 UTC revision 2264 by iliev, Mon Aug 22 10:00:01 2011 UTC
# Line 399  namespace LinuxSampler { namespace sfz { Line 399  namespace LinuxSampler { namespace sfz {
399          RTList<CC>::Iterator end  = pCtrls->end();          RTList<CC>::Iterator end  = pCtrls->end();
400          for(; ctrl != end; ++ctrl) {          for(; ctrl != end; ++ctrl) {
401              (*ctrl).Value = pVoice->GetControllerValue((*ctrl).Controller);              (*ctrl).Value = pVoice->GetControllerValue((*ctrl).Controller);
402              if ((*ctrl).pSmoother != NULL) (*ctrl).pSmoother->setValue((*ctrl).Value);              if ((*ctrl).pSmoother != NULL) {
403                    if ((*ctrl).Step > 0) {
404                        float val = Normalize((*ctrl).Value, (*ctrl).Curve) * (*ctrl).Influence;
405                        (*ctrl).pSmoother->setValue( ((int) (val / (*ctrl).Step)) * (*ctrl).Step );
406                    } else {
407                        (*ctrl).pSmoother->setValue((*ctrl).Value);
408                    }
409                }
410          }          }
411          CCSignalUnit::Trigger();          CCSignalUnit::Trigger();
412      }      }
# Line 417  namespace LinuxSampler { namespace sfz { Line 424  namespace LinuxSampler { namespace sfz {
424              if (cc[i].Influence != 0) {              if (cc[i].Influence != 0) {
425                  short int curve = cc[i].Curve;                  short int curve = cc[i].Curve;
426                  if (curve >= GetCurveCount()) curve = -1;                  if (curve >= GetCurveCount()) curve = -1;
427                  AddSmoothCC(cc[i].Controller, cc[i].Influence, curve, cc[i].Smooth);                  AddSmoothCC(cc[i].Controller, cc[i].Influence, curve, cc[i].Smooth, cc[i].Step);
428              }              }
429          }          }
430      }      }
431            
432      void CCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth) {      void CCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth, float Step) {
433          AddCC(Controller, Influence, Curve);          AddCC(Controller, Influence, Curve, NULL, Step);
434      }      }
435            
436      int CCUnit::GetCurveCount() {      int CCUnit::GetCurveCount() {
# Line 443  namespace LinuxSampler { namespace sfz { Line 450  namespace LinuxSampler { namespace sfz {
450          if (pSmoothers != NULL) delete pSmoothers;          if (pSmoothers != NULL) delete pSmoothers;
451      }      }
452            
453      void SmoothCCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth) {      void SmoothCCUnit::AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth, float Step) {
454          if (Smooth > 0) {          if (Smooth > 0) {
455              if (pSmoothers->poolIsEmpty()) {              if (pSmoothers->poolIsEmpty()) {
456                  std::cerr << "Maximum number of smoothers reached" << std::endl;                  std::cerr << "Maximum number of smoothers reached" << std::endl;
# Line 451  namespace LinuxSampler { namespace sfz { Line 458  namespace LinuxSampler { namespace sfz {
458              }              }
459              Smoother* smoother = &(*(pSmoothers->allocAppend()));              Smoother* smoother = &(*(pSmoothers->allocAppend()));
460              smoother->trigger(Smooth / 1000.0f, GetSampleRate());              smoother->trigger(Smooth / 1000.0f, GetSampleRate());
461              AddCC(Controller, Influence, Curve, smoother);              AddCC(Controller, Influence, Curve, smoother, Step);
462          } else {          } else {
463              AddCC(Controller, Influence, Curve);              AddCC(Controller, Influence, Curve, NULL, Step);
464          }          }
465      }      }
466            
# Line 641  namespace LinuxSampler { namespace sfz { Line 648  namespace LinuxSampler { namespace sfz {
648      }      }
649            
650      float EndpointUnit::GetPitch() {      float EndpointUnit::GetPitch() {
651          double p;          double p = GetRack()->suPitchOnCC.Active() ? RTMath::CentsToFreqRatioUnlimited(GetRack()->suPitchOnCC.GetLevel()) : 1;
652            
653          EGv1Unit* u = &(GetRack()->suPitchEG);          EGv1Unit* u = &(GetRack()->suPitchEG);
654          p = u->Active() ? RTMath::CentsToFreqRatioUnlimited(u->GetLevel() * u->depth) : 1;          p *= u->Active() ? RTMath::CentsToFreqRatioUnlimited(u->GetLevel() * u->depth) : 1;
655                    
656          for (int i = 0; i < GetRack()->pitchEGs.size(); i++) {          for (int i = 0; i < GetRack()->pitchEGs.size(); i++) {
657              EGv2Unit* eg = GetRack()->pitchEGs[i];              EGv2Unit* eg = GetRack()->pitchEGs[i];
# Line 727  namespace LinuxSampler { namespace sfz { Line 735  namespace LinuxSampler { namespace sfz {
735      SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice)      SfzSignalUnitRack::SfzSignalUnitRack(Voice* voice)
736          : SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this),          : SignalUnitRack(MaxUnitCount), pVoice(voice), suEndpoint(this), suVolEG(this), suFilEG(this), suPitchEG(this),
737          EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), filEGs(maxEgCount), resEGs(maxEgCount), panEGs(maxEgCount),          EGs(maxEgCount), volEGs(maxEgCount), pitchEGs(maxEgCount), filEGs(maxEgCount), resEGs(maxEgCount), panEGs(maxEgCount),
738          suVolOnCC(this), suCutoffOnCC(this), suResOnCC(this),          suVolOnCC(this), suPitchOnCC(this), suCutoffOnCC(this), suResOnCC(this),
739          suAmpLFO(this), suPitchLFO(this), suFilLFO(this),          suAmpLFO(this), suPitchLFO(this), suFilLFO(this),
740          LFOs(maxLfoCount), volLFOs(maxLfoCount), pitchLFOs(maxLfoCount),          LFOs(maxLfoCount), volLFOs(maxLfoCount), pitchLFOs(maxLfoCount),
741          filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount)          filLFOs(maxLfoCount), resLFOs(maxLfoCount), panLFOs(maxLfoCount)
742      {      {
743          suEndpoint.pVoice = suEndpoint.suXFInCC.pVoice = suEndpoint.suXFOutCC.pVoice = suEndpoint.suPanOnCC.pVoice = voice;          suEndpoint.pVoice = suEndpoint.suXFInCC.pVoice = suEndpoint.suXFOutCC.pVoice = suEndpoint.suPanOnCC.pVoice = voice;
744          suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice;          suVolEG.pVoice = suFilEG.pVoice = suPitchEG.pVoice = voice;
745          suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = suVolOnCC.pVoice = suCutoffOnCC.pVoice = suResOnCC.pVoice = voice;          suAmpLFO.pVoice = suPitchLFO.pVoice = suFilLFO.pVoice = voice;
746            suVolOnCC.pVoice = suPitchOnCC.pVoice = suCutoffOnCC.pVoice = suResOnCC.pVoice = voice;
747          suPitchLFO.suDepthOnCC.pVoice = suPitchLFO.suFadeEG.pVoice = suPitchLFO.suFreqOnCC.pVoice = voice;          suPitchLFO.suDepthOnCC.pVoice = suPitchLFO.suFadeEG.pVoice = suPitchLFO.suFreqOnCC.pVoice = voice;
748          suFilLFO.suFadeEG.pVoice = suFilLFO.suDepthOnCC.pVoice = suFilLFO.suFreqOnCC.pVoice = voice;          suFilLFO.suFadeEG.pVoice = suFilLFO.suDepthOnCC.pVoice = suFilLFO.suFreqOnCC.pVoice = voice;
749          suAmpLFO.suFadeEG.pVoice = suAmpLFO.suDepthOnCC.pVoice = suAmpLFO.suFreqOnCC.pVoice = voice;          suAmpLFO.suFadeEG.pVoice = suAmpLFO.suDepthOnCC.pVoice = suAmpLFO.suFreqOnCC.pVoice = voice;
# Line 780  namespace LinuxSampler { namespace sfz { Line 789  namespace LinuxSampler { namespace sfz {
789          Pool<Smoother>* pSmootherPool = pVoice->pEngine->pSmootherPool;          Pool<Smoother>* pSmootherPool = pVoice->pEngine->pSmootherPool;
790                    
791          suVolOnCC.InitCCList(pCCPool, pSmootherPool);          suVolOnCC.InitCCList(pCCPool, pSmootherPool);
792            suPitchOnCC.InitCCList(pCCPool, pSmootherPool);
793          suCutoffOnCC.InitCCList(pCCPool, pSmootherPool);          suCutoffOnCC.InitCCList(pCCPool, pSmootherPool);
794          suResOnCC.InitCCList(pCCPool, pSmootherPool);          suResOnCC.InitCCList(pCCPool, pSmootherPool);
795          suEndpoint.suXFInCC.InitCCList(pCCPool, pSmootherPool);          suEndpoint.suXFInCC.InitCCList(pCCPool, pSmootherPool);
# Line 831  namespace LinuxSampler { namespace sfz { Line 841  namespace LinuxSampler { namespace sfz {
841          ::sfz::Region* const pRegion = pVoice->pRegion;          ::sfz::Region* const pRegion = pVoice->pRegion;
842                    
843          suVolOnCC.SetCCs(pRegion->volume_oncc);          suVolOnCC.SetCCs(pRegion->volume_oncc);
844            suPitchOnCC.SetCCs(pRegion->pitch_oncc);
845          suCutoffOnCC.SetCCs(pRegion->cutoff_oncc);          suCutoffOnCC.SetCCs(pRegion->cutoff_oncc);
846          suResOnCC.SetCCs(pRegion->resonance_oncc);          suResOnCC.SetCCs(pRegion->resonance_oncc);
847                    
# Line 939  namespace LinuxSampler { namespace sfz { Line 950  namespace LinuxSampler { namespace sfz {
950          Units.clear();          Units.clear();
951                    
952          Units.add(&suVolOnCC);          Units.add(&suVolOnCC);
953            Units.add(&suPitchOnCC);
954          Units.add(&suCutoffOnCC);          Units.add(&suCutoffOnCC);
955          Units.add(&suResOnCC);          Units.add(&suResOnCC);
956                    
# Line 1004  namespace LinuxSampler { namespace sfz { Line 1016  namespace LinuxSampler { namespace sfz {
1016            
1017      void SfzSignalUnitRack::Reset() {      void SfzSignalUnitRack::Reset() {
1018          suVolOnCC.RemoveAllCCs();          suVolOnCC.RemoveAllCCs();
1019            suPitchOnCC.RemoveAllCCs();
1020          suCutoffOnCC.RemoveAllCCs();          suCutoffOnCC.RemoveAllCCs();
1021          suResOnCC.RemoveAllCCs();          suResOnCC.RemoveAllCCs();
1022          suEndpoint.suXFInCC.RemoveAllCCs();          suEndpoint.suXFInCC.RemoveAllCCs();

Legend:
Removed from v.2263  
changed lines
  Added in v.2264

  ViewVC Help
Powered by ViewVC