31 |
* This is a triangle Low Frequency Oscillator which uses pure integer |
* This is a triangle Low Frequency Oscillator which uses pure integer |
32 |
* math (without branches) to synthesize the triangular wave. |
* math (without branches) to synthesize the triangular wave. |
33 |
*/ |
*/ |
34 |
template<range_type_t RANGE> |
template<LFO::range_type_t RANGE> |
35 |
class LFOTriangleIntAbsMath : public LFOTriangleIntMath<RANGE> { |
class LFOTriangleIntAbsMath : public LFOTriangleIntMath<RANGE> { |
36 |
public: |
public: |
37 |
/** |
/** |
49 |
*/ |
*/ |
50 |
inline float render() { |
inline float render() { |
51 |
this->iLevel += this->c; |
this->iLevel += this->c; |
52 |
if (RANGE == range_unsigned) |
if (RANGE == LFO::range_unsigned) |
53 |
return this->normalizer * (float) (abs(this->iLevel)); |
return this->normalizer * (float) (abs(this->iLevel)); |
54 |
else /* signed range */ |
else /* signed range */ |
55 |
return this->normalizer * (float) (abs(this->iLevel)) + this->offset; |
return this->normalizer * (float) (abs(this->iLevel)) + this->offset; |