Skip to content

Commit 7929a65

Browse files
authored
Make Twist optionally exclude Engine from Randomization (#885)
* Make Twist optionally exclude Engine from Randomization Closes #884
1 parent a18ac70 commit 7929a65

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

src/VCO.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,6 @@ VCOWidget<oscType>::VCOWidget(VCOWidget<oscType>::M *module) : XTModuleWidget()
13731373
return "TRIG";
13741374
}
13751375
return VCOConfig<oscType>::retriggerLabel();
1376-
;
13771376
};
13781377
addChild(lab);
13791378
}

src/VCO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ template <int oscType> struct VCO : public modules::XTModule
240240
configParamNoRand(ABSOLUTE_UNISON, 0, 1, 0, "Absolute Unison");
241241
configParam(CHARACTER, 0, 2, 1, "Character Filter");
242242
configParam(DRIFT, 0, 1, 0, "Oscillator Drift", "%", 0, 100);
243-
configParam(FIXED_ATTENUATION, 0, 1, 1, "Output Attenuation");
243+
configParam(FIXED_ATTENUATION, 0, 1, 1, "Output Level", "%", 0, 100);
244244

245245
VCOConfig<oscType>::configureVCOSpecificParameters(this);
246246
config_osc->~Oscillator();

src/XTModule.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,13 @@ struct XTModule : public rack::Module
270270
{
271271
return configSwitch<T>(paramId, 0, 1, defaultValue, name, {"Off", "On"});
272272
}
273+
template <typename T = rack::SwitchQuantity>
274+
T *configOnOffNoRand(int paramId, float defaultValue, const std::string &name)
275+
{
276+
auto r = configSwitch<T>(paramId, 0, 1, defaultValue, name, {"Off", "On"});
277+
r->randomizeEnabled = false;
278+
return r;
279+
}
273280

274281
void snapCalculatedNames();
275282

src/vcoconfig/Twist.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,11 @@ template <> void VCOConfig<ot_twist>::oscillatorSpecificSetup(VCO<ot_twist> *m)
222222
template <> inline void VCOConfig<ot_twist>::configureVCOSpecificParameters(VCO<ot_twist> *m)
223223
{
224224
m->configOnOff(VCO<ot_twist>::ARBITRARY_SWITCH_0 + 0, 0, "Enable LPG on Trigger");
225+
m->configOnOffNoRand(VCO<ot_twist>::ARBITRARY_SWITCH_0 + 1, 0, "Randomize Includes Engine");
225226

226227
m->intStateForConfig[0] = m->inputs[VCO<ot_twist>::RETRIGGER].isConnected();
227228
m->intStateForConfig[1] = m->oscstorage->p[TwistOscillator::twist_lpg_response].deactivated;
228-
for (int i = 1; i < VCO<ot_twist>::n_arbitrary_switches; ++i)
229+
for (int i = 2; i < VCO<ot_twist>::n_arbitrary_switches; ++i)
229230
{
230231
m->configParam(VCO<ot_twist>::ARBITRARY_SWITCH_0 + i, 0, 1, 0, "Unused");
231232
}
@@ -260,6 +261,13 @@ template <> void VCOConfig<ot_twist>::processVCOSpecificParameters(VCO<ot_twist>
260261
deact = true;
261262
s->p[TwistOscillator::twist_lpg_response].deactivated = deact;
262263
}
264+
265+
auto l1 = (bool)(m->params[VCO<ot_twist>::ARBITRARY_SWITCH_0 + 1].getValue() > 0.5);
266+
auto epq = m->paramQuantities[VCO<ot_twist>::OSC_CTRL_PARAM_0 + TwistOscillator::twist_engine];
267+
if (epq->randomizeEnabled != l1)
268+
{
269+
epq->randomizeEnabled = l1;
270+
}
263271
}
264272

265273
template <> bool VCOConfig<ot_twist>::getVCOSpecificReInit(VCO<ot_twist> *m)
@@ -293,6 +301,18 @@ void VCOConfig<ot_twist>::oscillatorReInit(VCO<ot_twist> *m, Oscillator *o, floa
293301
o->init(pitch0);
294302
}
295303
}
304+
305+
template <> void VCOConfig<ot_twist>::addMenuItems(VCO<ot_twist> *m, rack::ui::Menu *toThis)
306+
{
307+
auto l1 = (int)std::round(m->params[VCO<ot_twist>::ARBITRARY_SWITCH_0 + 1].getValue());
308+
309+
toThis->addChild(rack::createMenuItem("Randomize Twist Engine", CHECKMARK(l1), [m, l1]() {
310+
m->params[VCO<ot_twist>::ARBITRARY_SWITCH_0 + 1].setValue(l1 ? 0 : 1);
311+
m->paramQuantities[VCO<ot_twist>::OSC_CTRL_PARAM_0 + TwistOscillator::twist_engine]
312+
->randomizeEnabled = !l1;
313+
}));
314+
}
315+
296316
} // namespace sst::surgext_rack::vco
297317

298318
#endif

0 commit comments

Comments
 (0)