21 |
#ifndef __LS_LFOBASE_H__ |
#ifndef __LS_LFOBASE_H__ |
22 |
#define __LS_LFOBASE_H__ |
#define __LS_LFOBASE_H__ |
23 |
|
|
24 |
#include "../../common/global.h" |
#include "../LFO.h" |
25 |
#include "../../common/RTMath.h" |
#include "../../common/RTMath.h" |
26 |
|
|
|
// IDs of the two possible implementations |
|
|
// we get the implementation to pick from config.h |
|
|
// the implementation IDs should be the same like in benchmarks/triang.cpp ! |
|
|
#define INT_MATH_SOLUTION 2 |
|
|
#define DI_HARMONIC_SOLUTION 3 |
|
|
#define INT_ABS_MATH_SOLUTION 5 |
|
|
|
|
27 |
#include <math.h> |
#include <math.h> |
28 |
#include <stdint.h> |
#include <stdint.h> |
29 |
|
|
30 |
namespace LinuxSampler { |
namespace LinuxSampler { |
31 |
|
|
32 |
// *************** types *************** |
/** @brief POD base for all LFO implementations. |
33 |
// * |
* |
34 |
|
* This structure acts as POD (Plain Old Data structure) base for all LFO |
35 |
/** |
* implementations. For efficiency reasons all our LFOs are C++ template |
36 |
* Whether the LFO should have positive AND negative value range |
* classes. By deriving all those LFO C++ templase classes from this |
37 |
* (signed) or only a positive value range (unsigned). |
* POD structure, it allows us to at least do a unified @code delete for |
38 |
*/ |
* any LFO object, which would not work on @code void* pointers (correctly). |
39 |
enum range_type_t { |
* |
40 |
range_signed, ///< LFO's level will wave between -max ... +max |
* ATM this is actually only used in LFO.cpp. |
|
range_unsigned ///< LFO's level will wave between 0 ... +max |
|
|
}; |
|
|
|
|
|
/** |
|
|
* Defines the start level of the LFO wave within the given value range. |
|
41 |
*/ |
*/ |
42 |
enum start_level_t { |
struct LFOPOD { |
|
start_level_max, ///< wave starts from given max. level |
|
|
start_level_mid, ///< wave starts from the middle of the given value range |
|
|
start_level_min ///< wave starts from given min. level |
|
43 |
}; |
}; |
44 |
|
|
45 |
/** @brief LFO (abstract base class) |
/** @brief LFO (abstract base class) |
46 |
* |
* |
47 |
* Abstract base class for all Low Frequency Oscillator implementations. |
* Abstract base class for all Low Frequency Oscillator implementations. |
48 |
*/ |
*/ |
49 |
template<range_type_t RANGE> |
template<LFO::range_type_t RANGE> |
50 |
class LFOBase { |
class LFOBase : public LFOPOD { |
51 |
public: |
public: |
52 |
|
|
53 |
// *************** attributes *************** |
// *************** attributes *************** |
110 |
* @param SampleRate - current sample rate of the engines |
* @param SampleRate - current sample rate of the engines |
111 |
* audio output signal |
* audio output signal |
112 |
*/ |
*/ |
113 |
virtual void trigger(float Frequency, start_level_t StartLevel, uint16_t InternalDepth, uint16_t ExtControlDepth, bool FlipPhase, unsigned int SampleRate) = 0; |
virtual void trigger(float Frequency, LFO::start_level_t StartLevel, uint16_t InternalDepth, uint16_t ExtControlDepth, bool FlipPhase, unsigned int SampleRate) = 0; |
114 |
|
|
115 |
protected: |
protected: |
116 |
float Max; |
float Max; |