2
2
class LFOProcessor ::TypeParameter final : public AudioParameterChoice
3
3
{
4
4
public:
5
- TypeParameter ( ) :
5
+ TypeParameter (LFOProcessor& p ) :
6
6
AudioParameterChoice (ParameterID (" type" , 1 ), TRANS (" Type" ), getChoices(),
7
- static_cast <int > (LFOProcessor::LFOType::sine))
7
+ static_cast <int > (LFOProcessor::LFOType::sine)),
8
+ parentProc (p)
8
9
{
9
10
}
10
11
12
+ void valueChanged (int ) override
13
+ {
14
+ parentProc.setLFOType (parentProc.getLFOType (), true );
15
+ }
16
+
11
17
private:
18
+ LFOProcessor& parentProc;
19
+
12
20
static StringArray getChoices ()
13
21
{
14
22
StringArray choices;
@@ -18,6 +26,7 @@ class LFOProcessor::TypeParameter final : public AudioParameterChoice
18
26
choices.add (NEEDS_TRANS (" Triangle" ));
19
27
choices.add (NEEDS_TRANS (" Ramp" ));
20
28
choices.add (NEEDS_TRANS (" Sawtooth" ));
29
+ choices.add (NEEDS_TRANS (" Square" ));
21
30
choices.add (NEEDS_TRANS (" White Noise" ));
22
31
choices.add (NEEDS_TRANS (" Pink Noise" ));
23
32
choices.add (NEEDS_TRANS (" Blue Noise" ));
@@ -39,7 +48,7 @@ LFOProcessor::LFOProcessor (double minFreqHz, double maxFreqHz,
39
48
40
49
auto layout = createDefaultParameterLayout ();
41
50
42
- auto tp = std::make_unique<TypeParameter>( );
51
+ auto tp = std::make_unique<TypeParameter> (* this );
43
52
type = tp.get ();
44
53
layout.add (std::move (tp));
45
54
@@ -121,7 +130,7 @@ void LFOProcessor::prepareToPlay (const double newSampleRate, const int samplesP
121
130
122
131
if (isFirstRun)
123
132
{
124
- setLFOType (static_cast <LFOType> (type-> getIndex () ), true );
133
+ setLFOType (getLFOType ( ), true );
125
134
isFirstRun = false ;
126
135
}
127
136
}
@@ -138,6 +147,9 @@ void LFOProcessor::process (dsp::Oscillator<FloatType>& osc,
138
147
doubleOsc.setFrequency (v);
139
148
}
140
149
150
+ if (isBypassed ())
151
+ return ;
152
+
141
153
if (isMultiplying)
142
154
{
143
155
multer.setSize (buffer.getNumChannels (), buffer.getNumSamples (), false , true , true );
@@ -147,7 +159,6 @@ void LFOProcessor::process (dsp::Oscillator<FloatType>& osc,
147
159
148
160
{
149
161
dsp::ProcessContextReplacing<FloatType> context (abMulter);
150
- context.isBypassed = isBypassed ();
151
162
osc.process (context);
152
163
}
153
164
@@ -158,7 +169,6 @@ void LFOProcessor::process (dsp::Oscillator<FloatType>& osc,
158
169
{
159
170
dsp::AudioBlock<FloatType> audioBlock (buffer);
160
171
dsp::ProcessContextReplacing<FloatType> context (audioBlock);
161
- context.isBypassed = isBypassed ();
162
172
osc.process (context);
163
173
}
164
174
}
0 commit comments