@@ -16,6 +16,7 @@ enum Waveform
1616 SINEXP,
1717};
1818
19+
1920struct Algos
2021{
2122 static double arctan (double x) { return std::atan (x); }
@@ -63,27 +64,45 @@ struct Algos
6364 }
6465};
6566
66- class Shaper
67+ enum KLfoTimes
68+ {
69+ t2beat = 0 ,
70+ t3_2beat,
71+ t1beat,
72+ t3_4beat,
73+ t2_3beat,
74+ t1_2beat,
75+ t1_3beat,
76+ t1_4beat,
77+ t1_6beat,
78+ t1_8beat,
79+ t1_16beat,
80+ tnum_lfo_times,
81+ };
82+ static std::vector<std::string> lfo_times = {" 2/1" , " 3/2" , " 1/1" , " 3/4" , " 2/3" , " 1/2" , " 1/3" , " 1/4" , " 1/6" , " 1/8" , " 1/16" };
83+
84+
85+
86+ class Lfo
6787{
6888public:
69- Shaper (iplug::IParam* pre , iplug::IParam* post , iplug::IParam* mix, iplug::IParam* wavetype, iplug::IParam* clip);
70- double process (double x);
71- void updateParams ();
89+ Lfo (iplug::IParam* isHostClocked, iplug::IParam* freq, iplug::IParam* ratio, iplug::IParam* amp, iplug::IParam* offset) :
90+ isHostClockedParam (isHostClocked), freqParam(freq), ratioParam(ratio), ampParam(amp), offsetParam(offset) {}
91+ void process ();
92+ double getVal ();
93+ static double getRatio (KLfoTimes time);
94+ void updateParams (double sampleRate, double samplesPerBeat, double samplePos);
7295
7396private:
74- std::function<double (double )> algo = myAlgos.arctan;
75- Waveform waveType = ARCTAN;
76- iplug::IParam* pregainParam = nullptr ;
77- iplug::IParam* postgainParam = nullptr ;
78- iplug::IParam* mixParam = nullptr ;
79- iplug::IParam* waveParam = nullptr ;
80- iplug::IParam* clipParam = nullptr ;
81- Algos myAlgos;
82- double pregain = 1 ;
83- double postgain = 1 ;
84- double mix = 0 ;
85- double clip = 3.0 ;
86- Waveform wave = ARCTAN;
97+ iplug::IParam* isHostClockedParam = nullptr ;
98+ iplug::IParam* freqParam = nullptr ;
99+ iplug::IParam* ratioParam = nullptr ;
100+ iplug::IParam* ampParam = nullptr ;
101+ iplug::IParam* offsetParam = nullptr ;
102+ double wavelength = 1 ;
103+ double amp = 1 ;
104+ double offset = 0 ;
105+ double phase = 0 ;
87106};
88107
89108class VuMeter
@@ -102,3 +121,43 @@ class VuMeter
102121};
103122
104123
124+
125+
126+ class Shaper
127+ {
128+ public:
129+ Shaper (iplug::IParam* pre , iplug::IParam* post , iplug::IParam* mix, iplug::IParam* wavetype, iplug::IParam* clip,
130+ iplug::IParam* preGainLfo, iplug::IParam* postGainLfo, iplug::IParam* mixLfo, iplug::IParam* clipLfo, Lfo* lfoPtr);
131+ double process (double x);
132+ void updateParams ();
133+
134+
135+ Lfo* lfo = nullptr ;
136+ private:
137+ std::function<double (double )> algo = myAlgos.arctan;
138+ Waveform waveType = ARCTAN;
139+ iplug::IParam* pregainParam = nullptr ;
140+ iplug::IParam* postgainParam = nullptr ;
141+ iplug::IParam* mixParam = nullptr ;
142+ iplug::IParam* waveParam = nullptr ;
143+ iplug::IParam* clipParam = nullptr ;
144+
145+ iplug::IParam* preGainLfoParam = nullptr ;
146+ iplug::IParam* postGainLfoParam = nullptr ;
147+ iplug::IParam* mixLfoParam = nullptr ;
148+ iplug::IParam* clipLfoParam = nullptr ;
149+
150+ Algos myAlgos;
151+
152+ double pregain = 1 ;
153+ double pregainLfo = 0 ;
154+ double postgain = 1 ;
155+ double postgainLfo = 0 ;
156+ double mix = 0 ;
157+ double mixLfo = 0 ;
158+ double clip = 3.0 ;
159+ double clipLfo = 0 ;
160+
161+ Waveform wave = ARCTAN;
162+ };
163+
0 commit comments