28 |
|
|
29 |
/** @brief sine LFO |
/** @brief sine LFO |
30 |
*/ |
*/ |
31 |
template<range_type_t RANGE> |
template<LFO::range_type_t RANGE> |
32 |
class SineLFO : public LFOBase<RANGE> { |
class SineLFO : public LFOBase<RANGE> { |
33 |
public: |
public: |
34 |
|
|
47 |
*/ |
*/ |
48 |
inline float render() { |
inline float render() { |
49 |
uiLevel += c; |
uiLevel += c; |
50 |
if (RANGE == range_unsigned) |
if (RANGE == LFO::range_unsigned) |
51 |
return normalizer * (sin(c2 * (float)uiLevel) + 1.0f); |
return normalizer * (sin(c2 * (float)uiLevel) + 1.0f); |
52 |
else /* signed range */ |
else /* signed range */ |
53 |
return normalizer * sin(c2 * (float)uiLevel); |
return normalizer * sin(c2 * (float)uiLevel); |
63 |
|
|
64 |
//const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF... |
//const unsigned int intLimit = (unsigned int) -1; // all 0xFFFF... |
65 |
const float max = (this->InternalDepth + ExtControlValue * this->ExtControlDepthCoeff) * this->ScriptDepthFactor; |
const float max = (this->InternalDepth + ExtControlValue * this->ExtControlDepthCoeff) * this->ScriptDepthFactor; |
66 |
if (RANGE == range_unsigned) { |
if (RANGE == LFO::range_unsigned) { |
67 |
normalizer = max / 2.0f; |
normalizer = max / 2.0f; |
68 |
} else { // signed range |
} else { // signed range |
69 |
normalizer = max; |
normalizer = max; |
83 |
* @param SampleRate - current sample rate of the engines |
* @param SampleRate - current sample rate of the engines |
84 |
* audio output signal |
* audio output signal |
85 |
*/ |
*/ |
86 |
virtual void trigger(float Frequency, start_level_t StartLevel, uint16_t InternalDepth, uint16_t ExtControlDepth, bool FlipPhase, unsigned int SampleRate) { |
virtual void trigger(float Frequency, LFO::start_level_t StartLevel, uint16_t InternalDepth, uint16_t ExtControlDepth, bool FlipPhase, unsigned int SampleRate) { |
87 |
this->Frequency = Frequency; |
this->Frequency = Frequency; |
88 |
this->InternalDepth = (InternalDepth / 1200.0f) * this->Max; |
this->InternalDepth = (InternalDepth / 1200.0f) * this->Max; |
89 |
this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max; |
this->ExtControlDepthCoeff = (((float) ExtControlDepth / 1200.0f) / 127.0f) * this->Max; |