2 |
* * |
* * |
3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2011 Grigor Iliev * |
* Copyright (C) 2011 - 2012 Grigor Iliev * |
6 |
* * |
* * |
7 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
8 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
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 |
int GetCurveCount(); |
int GetCurveCount(); |
75 |
::sfz::Curve* GetCurve(int idx); |
::sfz::Curve* GetCurve(int idx); |
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 |
|
|
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) { } |
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: |
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 |
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(); |
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; |
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 |
|
|
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 |
|
|
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; |
477 |
|
|
478 |
virtual void Trigger(); |
virtual void Trigger(); |
479 |
virtual void EnterFadeOutStage(); |
virtual void EnterFadeOutStage(); |
480 |
|
virtual void EnterFadeOutStage(int maxFadeOutSteps); |
481 |
|
|
482 |
/** Called when the engine is set and the engine's pools are ready to use. */ |
/** Called when the engine is set and the engine's pools are ready to use. */ |
483 |
void InitRTLists(); |
void InitRTLists(); |
484 |
|
|
485 |
/** Invoked when the voice gone inactive. */ |
/** Invoked when the voice gone inactive. */ |
486 |
void Reset(); |
void Reset(); |
487 |
|
|
488 |
|
void CalculateFadeOutCoeff(float FadeOutTime, float SampleRate); |
489 |
|
|
490 |
|
virtual void UpdateEqSettings(EqSupport* pEqSupport); |
491 |
|
|
492 |
friend class EndpointUnit; |
friend class EndpointUnit; |
493 |
}; |
}; |