@@ -57,27 +57,27 @@ void DistrhoPluginAmplitudeImposer::initAudioPort(bool input, uint32_t index, Au
5757 switch (index)
5858 {
5959 case 0 :
60+ port.name = " Input Left (Audio)" ;
61+ port.symbol = " in_left_audio" ;
62+ port.groupId = kPortGroupStereo ;
63+ break ;
64+ case 1 :
65+ port.name = " Input Right (Audio)" ;
66+ port.symbol = " in_right_audio" ;
67+ port.groupId = kPortGroupStereo ;
68+ break ;
69+ case 2 :
6070 port.name = " Input Left (Amp Env)" ;
6171 port.symbol = " in_left_amp" ;
6272 port.groupId = kPortGroupAmpEnv ;
6373 port.hints = kAudioPortIsSidechain ;
6474 break ;
65- case 1 :
75+ case 3 :
6676 port.name = " Input Right (Amp Env)" ;
6777 port.symbol = " in_right_amp" ;
6878 port.groupId = kPortGroupAmpEnv ;
6979 port.hints = kAudioPortIsSidechain ;
7080 break ;
71- case 2 :
72- port.name = " Input Left (Audio)" ;
73- port.symbol = " in_left_audio" ;
74- port.groupId = kPortGroupAudio ;
75- break ;
76- case 3 :
77- port.name = " Input Right (Audio)" ;
78- port.symbol = " in_right_audio" ;
79- port.groupId = kPortGroupAudio ;
80- break ;
8181 }
8282 }
8383 else
@@ -127,10 +127,6 @@ void DistrhoPluginAmplitudeImposer::initPortGroup(uint32_t groupId, PortGroup& p
127127 portGroup.name = " Amp Env" ;
128128 portGroup.symbol = " amp_env" ;
129129 break ;
130- case kPortGroupAudio :
131- portGroup.name = " Audio" ;
132- portGroup.symbol = " audio" ;
133- break ;
134130 }
135131}
136132
@@ -194,10 +190,10 @@ void DistrhoPluginAmplitudeImposer::activate()
194190
195191void DistrhoPluginAmplitudeImposer::run (const float ** inputs, float ** outputs, uint32_t frames)
196192{
197- const float * const in1 = inputs[0 ];
198- const float * const in2 = inputs[1 ];
199- const float * const in3 = inputs[2 ];
200- const float * const in4 = inputs[3 ];
193+ const float * const in1 = inputs[0 ];
194+ const float * const in2 = inputs[1 ];
195+ const float * const env1 = inputs[2 ];
196+ const float * const env2 = inputs[3 ];
201197 /* */ float * const out1 = outputs[0 ];
202198 /* */ float * const out2 = outputs[1 ];
203199
@@ -208,26 +204,26 @@ void DistrhoPluginAmplitudeImposer::run(const float** inputs, float** outputs, u
208204 for (uint32_t i=0 ; i<frames; ++i)
209205 {
210206 // calculate envelope from 1st two inputs
211- tmp = std::abs (in1 [i]);
207+ tmp = std::abs (env1 [i]);
212208 /* */ if (tmp > ampEnvelope_l)
213209 ampEnvelope_l = tmp;
214210 else if (tmp < ampEnvelope_l)
215211 ampEnvelope_l -= envDecay;
216212
217- tmp = std::abs (in2 [i]);
213+ tmp = std::abs (env2 [i]);
218214 /* */ if (tmp > ampEnvelope_r)
219215 ampEnvelope_r = tmp;
220216 else if (tmp < ampEnvelope_r)
221217 ampEnvelope_r -= envDecay;
222218
223219 // calculate envelope from 2nd two inputs
224- tmp = std::abs (in3 [i]);
220+ tmp = std::abs (in1 [i]);
225221 /* */ if (tmp > audioEnvelope_l)
226222 audioEnvelope_l = tmp;
227223 else if (tmp < audioEnvelope_l)
228224 audioEnvelope_l -= envDecay;
229225
230- tmp = std::abs (in4 [i]);
226+ tmp = std::abs (in2 [i]);
231227 /* */ if (tmp > audioEnvelope_r)
232228 audioEnvelope_r = tmp;
233229 else if (tmp < audioEnvelope_r)
@@ -246,26 +242,26 @@ void DistrhoPluginAmplitudeImposer::run(const float** inputs, float** outputs, u
246242 // work out whether we need to multiply audio input
247243 if (audioEnvelope_l > fThreshold )
248244 {
249- tempin.left = in3 [i];
245+ tempin.left = in1 [i];
250246 }
251247 else
252248 {
253249 if (audioEnvelope_l > 0 .001f )
254- tempin.left = in3 [i] * (fThreshold /audioEnvelope_l);
250+ tempin.left = in1 [i] * (fThreshold /audioEnvelope_l);
255251 else
256- tempin.left = in3 [i] * (fThreshold /0 .001f ); // so it'll decay away smoothly
252+ tempin.left = in1 [i] * (fThreshold /0 .001f ); // so it'll decay away smoothly
257253 }
258254
259255 if (audioEnvelope_r > fThreshold )
260256 {
261- tempin.right = in4 [i];
257+ tempin.right = in2 [i];
262258 }
263259 else
264260 {
265261 if (audioEnvelope_r > 0 .001f )
266- tempin.right = in4 [i] * (fThreshold /audioEnvelope_r);
262+ tempin.right = in2 [i] * (fThreshold /audioEnvelope_r);
267263 else
268- tempin.right = in4 [i] * (fThreshold /0 .001f );
264+ tempin.right = in2 [i] * (fThreshold /0 .001f );
269265 }
270266
271267 // calculate output
0 commit comments