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

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

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

revision 2244 by iliev, Thu Aug 18 11:32:33 2011 UTC revision 2299 by iliev, Sun Dec 11 20:50:31 2011 UTC
# Line 66  namespace LinuxSampler { namespace sfz { Line 66  namespace LinuxSampler { namespace sfz {
66              virtual void Trigger();              virtual void Trigger();
67                            
68              void SetCCs(::sfz::Array<int>& pCC);              void SetCCs(::sfz::Array<int>& pCC);
69                void SetCCs(::sfz::Array<float>& pCC);
70              void SetCCs(ArrayList< ::sfz::CC>& cc);              void SetCCs(ArrayList< ::sfz::CC>& cc);
71                            
72              virtual void AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth);              virtual void AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth, float Step);
73                            
74              inline int GetCurveCount();              int GetCurveCount();
75              inline ::sfz::Curve* GetCurve(int idx);              ::sfz::Curve* GetCurve(int idx);
76                            
77              double GetSampleRate();              double GetSampleRate();
78      };      };
# Line 95  namespace LinuxSampler { namespace sfz { Line 96  namespace LinuxSampler { namespace sfz {
96              SmoothCCUnit(SfzSignalUnitRack* rack, Listener* l = NULL): CurveCCUnit(rack, l), pSmoothers(NULL) { }              SmoothCCUnit(SfzSignalUnitRack* rack, Listener* l = NULL): CurveCCUnit(rack, l), pSmoothers(NULL) { }
97              virtual ~SmoothCCUnit();              virtual ~SmoothCCUnit();
98                            
99              virtual void AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth);              virtual void AddSmoothCC(uint8_t Controller, float Influence, short int Curve, float Smooth, float Step);
100              virtual void RemoveAllCCs() { CurveCCUnit::RemoveAllCCs(); pSmoothers->clear(); }              virtual void RemoveAllCCs() { CurveCCUnit::RemoveAllCCs(); pSmoothers->clear(); }
101              virtual void InitCCList(Pool<CC>* pCCPool, Pool<Smoother>* pSmootherPool);              virtual void InitCCList(Pool<CC>* pCCPool, Pool<Smoother>* pSmootherPool);
102                            
# Line 103  namespace LinuxSampler { namespace sfz { Line 104  namespace LinuxSampler { namespace sfz {
104      };      };
105            
106            
107        class EqUnitSupport {
108            public:
109                EqUnitSupport(SfzSignalUnitRack* pRack, Voice* pVoice = NULL);
110                
111                SmoothCCUnit suEq1GainOnCC;
112                SmoothCCUnit suEq2GainOnCC;
113                SmoothCCUnit suEq3GainOnCC;
114                
115                SmoothCCUnit suEq1FreqOnCC;
116                SmoothCCUnit suEq2FreqOnCC;
117                SmoothCCUnit suEq3FreqOnCC;
118                
119                SmoothCCUnit suEq1BwOnCC;
120                SmoothCCUnit suEq2BwOnCC;
121                SmoothCCUnit suEq3BwOnCC;
122                
123                void SetVoice(Voice* pVoice);
124                void ImportUnits(SfzSignalUnitRack* pRack);
125                void ResetUnits();
126                void InitCCLists(Pool<CCSignalUnit::CC>* pCCPool, Pool<Smoother>* pSmootherPool);
127        };
128        
129        
130      class XFInCCUnit: public CCUnit {      class XFInCCUnit: public CCUnit {
131          public:          public:
132              XFInCCUnit(SfzSignalUnitRack* rack, Listener* l = NULL): CCUnit(rack, l) { }              XFInCCUnit(SfzSignalUnitRack* rack, Listener* l = NULL): CCUnit(rack, l) { }
# Line 177  namespace LinuxSampler { namespace sfz { Line 201  namespace LinuxSampler { namespace sfz {
201              EGv1Unit(SfzSignalUnitRack* rack): EGUnit<EGADSR>(rack), depth(0) { }              EGv1Unit(SfzSignalUnitRack* rack): EGUnit<EGADSR>(rack), depth(0) { }
202      };      };
203            
204      class EGv2Unit: public EGUnit< ::LinuxSampler::sfz::EG> {      class EGv2Unit: public EGUnit< ::LinuxSampler::sfz::EG>, public EqUnitSupport {
205          protected:          protected:
206              ::sfz::EG egInfo;              ::sfz::EG egInfo;
207          public:          public:
# Line 272  namespace LinuxSampler { namespace sfz { Line 296  namespace LinuxSampler { namespace sfz {
296                  SfzSignalUnit::Copy(Unit);                  SfzSignalUnit::Copy(Unit);
297              }              }
298                            
             virtual bool  Active() { return pLfoInfo->freq > 0; }  
299              virtual void  Trigger();              virtual void  Trigger();
300              virtual void  Increment();              virtual void  Increment();
301              virtual float GetLevel() { return Level; }              virtual float GetLevel() { return Level; }
# Line 293  namespace LinuxSampler { namespace sfz { Line 316  namespace LinuxSampler { namespace sfz {
316              virtual void Trigger();              virtual void Trigger();
317      };      };
318            
319      class LFOv2Unit: public LFOUnit {      class LFOv2Unit: public LFOUnit, public EqUnitSupport {
320          protected:          protected:
321              FixedArray<AbstractLfo*> lfos;              FixedArray<AbstractLfo*> lfos;
322              LfoBase<LFOSigned>                       lfo0; // triangle              LfoBase<LFOSigned>                       lfo0; // triangle
# Line 316  namespace LinuxSampler { namespace sfz { Line 339  namespace LinuxSampler { namespace sfz {
339              LFOv2Unit(SfzSignalUnitRack* rack);              LFOv2Unit(SfzSignalUnitRack* rack);
340                            
341              virtual void Trigger();              virtual void Trigger();
342                virtual bool  Active() { return true; }
343      };      };
344            
345      class AmpLFOUnit: public LFOv1Unit {      class AmpLFOUnit: public LFOv1Unit {
# Line 355  namespace LinuxSampler { namespace sfz { Line 379  namespace LinuxSampler { namespace sfz {
379    
380              virtual void Trigger();              virtual void Trigger();
381    
382              /** The endpoint should be active until the volume EG is active. */              /**
383                 * The endpoint should be active until the volume EG is active.
384                 * This method determines the end of the voice playback.
385                 */
386              virtual bool Active();              virtual bool Active();
387                            
388              virtual float GetVolume();              virtual float GetVolume();
# Line 371  namespace LinuxSampler { namespace sfz { Line 398  namespace LinuxSampler { namespace sfz {
398              }              }
399                            
400              virtual float CalculateFilterCutoff(float cutoff);              virtual float CalculateFilterCutoff(float cutoff);
401                
402                float  GetInfluence(::sfz::Array< ::sfz::optional<float> >& cc);
403                float  GetInfluence(::sfz::Array< ::sfz::optional<int> >& cc);
404      };      };
405            
406            
407      class SfzSignalUnitRack : public SignalUnitRack {      class SfzSignalUnitRack : public SignalUnitRack, public EqUnitSupport {
408          private:          private:
409              EndpointUnit  suEndpoint;              EndpointUnit  suEndpoint;
410              AmpEGUnit     suVolEG;              AmpEGUnit     suVolEG;
# Line 388  namespace LinuxSampler { namespace sfz { Line 418  namespace LinuxSampler { namespace sfz {
418              // SFZ v2              // SFZ v2
419                            
420              SmoothCCUnit suVolOnCC;              SmoothCCUnit suVolOnCC;
421                SmoothCCUnit suPitchOnCC;
422                SmoothCCUnit suCutoffOnCC;
423                SmoothCCUnit suResOnCC;
424                            
425              FixedArray<EGv2Unit*> EGs;              FixedArray<EGv2Unit*> EGs;
426                            
# Line 403  namespace LinuxSampler { namespace sfz { Line 436  namespace LinuxSampler { namespace sfz {
436              // used for optimization - contains only the ones that are modulating resonance              // used for optimization - contains only the ones that are modulating resonance
437              FixedArray<EGv2Unit*> resEGs;              FixedArray<EGv2Unit*> resEGs;
438                            
439              // used for optimization - contains only the ones that are modulating pitch              // used for optimization - contains only the ones that are modulating pan
440              FixedArray<EGv2Unit*> panEGs;              FixedArray<EGv2Unit*> panEGs;
441                            
442                // used for optimization - contains only the ones that are modulating EQ
443                FixedArray<EGv2Unit*> eqEGs;
444                
445                            
446              FixedArray<LFOv2Unit*> LFOs;              FixedArray<LFOv2Unit*> LFOs;
447                            
# Line 424  namespace LinuxSampler { namespace sfz { Line 460  namespace LinuxSampler { namespace sfz {
460              // used for optimization - contains only the ones that are modulating pan              // used for optimization - contains only the ones that are modulating pan
461              FixedArray<LFOv2Unit*> panLFOs;              FixedArray<LFOv2Unit*> panLFOs;
462                            
463                // used for optimization - contains only the ones that are modulating EQ
464                FixedArray<LFOv2Unit*> eqLFOs;
465                
466    
467          public:          public:
468              Voice* const pVoice;              Voice* const pVoice;
# Line 445  namespace LinuxSampler { namespace sfz { Line 484  namespace LinuxSampler { namespace sfz {
484              /** Invoked when the voice gone inactive. */              /** Invoked when the voice gone inactive. */
485              void Reset();              void Reset();
486                            
487                virtual void UpdateEqSettings(EqSupport* pEqSupport);
488                
489              friend class EndpointUnit;              friend class EndpointUnit;
490      };      };
491  }} // namespace LinuxSampler::sfz  }} // namespace LinuxSampler::sfz

Legend:
Removed from v.2244  
changed lines
  Added in v.2299

  ViewVC Help
Powered by ViewVC