@@ -47,25 +47,25 @@ struct ABC : Module { | |||||
} | } | ||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
float a1 = inputs[A1_INPUT].value; | |||||
float b1 = inputs[B1_INPUT].getNormalVoltage(5.f) * 2.f*dsp::exponentialBipolar(80.f, params[B1_LEVEL_PARAM].value); | |||||
float c1 = inputs[C1_INPUT].getNormalVoltage(10.f) * dsp::exponentialBipolar(80.f, params[C1_LEVEL_PARAM].value); | |||||
float a1 = inputs[A1_INPUT].getVoltage(); | |||||
float b1 = inputs[B1_INPUT].getNormalVoltage(5.f) * 2.f*dsp::exponentialBipolar(80.f, params[B1_LEVEL_PARAM].getValue()); | |||||
float c1 = inputs[C1_INPUT].getNormalVoltage(10.f) * dsp::exponentialBipolar(80.f, params[C1_LEVEL_PARAM].getValue()); | |||||
float out1 = a1 * b1 / 5.f + c1; | float out1 = a1 * b1 / 5.f + c1; | ||||
float a2 = inputs[A2_INPUT].value; | |||||
float b2 = inputs[B2_INPUT].getNormalVoltage(5.f) * 2.f*dsp::exponentialBipolar(80.f, params[B2_LEVEL_PARAM].value); | |||||
float c2 = inputs[C2_INPUT].getNormalVoltage(10.f) * dsp::exponentialBipolar(80.f, params[C2_LEVEL_PARAM].value); | |||||
float a2 = inputs[A2_INPUT].getVoltage(); | |||||
float b2 = inputs[B2_INPUT].getNormalVoltage(5.f) * 2.f*dsp::exponentialBipolar(80.f, params[B2_LEVEL_PARAM].getValue()); | |||||
float c2 = inputs[C2_INPUT].getNormalVoltage(10.f) * dsp::exponentialBipolar(80.f, params[C2_LEVEL_PARAM].getValue()); | |||||
float out2 = a2 * b2 / 5.f + c2; | float out2 = a2 * b2 / 5.f + c2; | ||||
// Set outputs | // Set outputs | ||||
if (outputs[OUT1_OUTPUT].active) { | |||||
outputs[OUT1_OUTPUT].value = clip(out1 / 10.f) * 10.f; | |||||
if (outputs[OUT1_OUTPUT].isConnected()) { | |||||
outputs[OUT1_OUTPUT].setVoltage(clip(out1 / 10.f) * 10.f); | |||||
} | } | ||||
else { | else { | ||||
out2 += out1; | out2 += out1; | ||||
} | } | ||||
if (outputs[OUT2_OUTPUT].active) { | |||||
outputs[OUT2_OUTPUT].value = clip(out2 / 10.f) * 10.f; | |||||
if (outputs[OUT2_OUTPUT].isConnected()) { | |||||
outputs[OUT2_OUTPUT].setVoltage(clip(out2 / 10.f) * 10.f); | |||||
} | } | ||||
// Lights | // Lights | ||||
@@ -36,13 +36,13 @@ struct DualAtenuverter : Module { | |||||
} | } | ||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
float out1 = inputs[IN1_INPUT].value * params[ATEN1_PARAM].value + params[OFFSET1_PARAM].value; | |||||
float out2 = inputs[IN2_INPUT].value * params[ATEN2_PARAM].value + params[OFFSET2_PARAM].value; | |||||
float out1 = inputs[IN1_INPUT].getVoltage() * params[ATEN1_PARAM].getValue() + params[OFFSET1_PARAM].getValue(); | |||||
float out2 = inputs[IN2_INPUT].getVoltage() * params[ATEN2_PARAM].getValue() + params[OFFSET2_PARAM].getValue(); | |||||
out1 = clamp(out1, -10.f, 10.f); | out1 = clamp(out1, -10.f, 10.f); | ||||
out2 = clamp(out2, -10.f, 10.f); | out2 = clamp(out2, -10.f, 10.f); | ||||
outputs[OUT1_OUTPUT].value = out1; | |||||
outputs[OUT2_OUTPUT].value = out2; | |||||
outputs[OUT1_OUTPUT].setVoltage(out1); | |||||
outputs[OUT2_OUTPUT].setVoltage(out2); | |||||
lights[OUT1_POS_LIGHT].setSmoothBrightness(out1 / 5.f, args.sampleTime); | lights[OUT1_POS_LIGHT].setSmoothBrightness(out1 / 5.f, args.sampleTime); | ||||
lights[OUT1_NEG_LIGHT].setSmoothBrightness(-out1 / 5.f, args.sampleTime); | lights[OUT1_NEG_LIGHT].setSmoothBrightness(-out1 / 5.f, args.sampleTime); | ||||
lights[OUT2_POS_LIGHT].setSmoothBrightness(out2 / 5.f, args.sampleTime); | lights[OUT2_POS_LIGHT].setSmoothBrightness(out2 / 5.f, args.sampleTime); | ||||
@@ -51,14 +51,14 @@ struct EvenVCO : Module { | |||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
// Compute frequency, pitch is 1V/oct | // Compute frequency, pitch is 1V/oct | ||||
float pitch = 1.f + std::round(params[OCTAVE_PARAM].value) + params[TUNE_PARAM].value / 12.f; | |||||
pitch += inputs[PITCH1_INPUT].value + inputs[PITCH2_INPUT].value; | |||||
pitch += inputs[FM_INPUT].value / 4.f; | |||||
float pitch = 1.f + std::round(params[OCTAVE_PARAM].getValue()) + params[TUNE_PARAM].getValue() / 12.f; | |||||
pitch += inputs[PITCH1_INPUT].getVoltage() + inputs[PITCH2_INPUT].getVoltage(); | |||||
pitch += inputs[FM_INPUT].getVoltage() / 4.f; | |||||
float freq = dsp::FREQ_C4 * std::pow(2.f, pitch); | float freq = dsp::FREQ_C4 * std::pow(2.f, pitch); | ||||
freq = clamp(freq, 0.f, 20000.f); | freq = clamp(freq, 0.f, 20000.f); | ||||
// Pulse width | // Pulse width | ||||
float pw = params[PWM_PARAM].value + inputs[PWM_INPUT].value / 5.f; | |||||
float pw = params[PWM_PARAM].getValue() + inputs[PWM_INPUT].getVoltage() / 5.f; | |||||
const float minPw = 0.05; | const float minPw = 0.05; | ||||
pw = rescale(clamp(pw, -1.f, 1.f), -1.f, 1.f, minPw, 1.f - minPw); | pw = rescale(clamp(pw, -1.f, 1.f), -1.f, 1.f, minPw, 1.f - minPw); | ||||
@@ -108,11 +108,11 @@ struct EvenVCO : Module { | |||||
square += squareMinBlep.process(); | square += squareMinBlep.process(); | ||||
// Set outputs | // Set outputs | ||||
outputs[TRI_OUTPUT].value = 5.f*tri; | |||||
outputs[SINE_OUTPUT].value = 5.f*sine; | |||||
outputs[EVEN_OUTPUT].value = 5.f*even; | |||||
outputs[SAW_OUTPUT].value = 5.f*saw; | |||||
outputs[SQUARE_OUTPUT].value = 5.f*square; | |||||
outputs[TRI_OUTPUT].setVoltage(5.f*tri); | |||||
outputs[SINE_OUTPUT].setVoltage(5.f*sine); | |||||
outputs[EVEN_OUTPUT].setVoltage(5.f*even); | |||||
outputs[SAW_OUTPUT].setVoltage(5.f*saw); | |||||
outputs[SQUARE_OUTPUT].setVoltage(5.f*square); | |||||
} | } | ||||
}; | }; | ||||
@@ -97,20 +97,20 @@ struct Rampage : Module { | |||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
for (int c = 0; c < 2; c++) { | for (int c = 0; c < 2; c++) { | ||||
float in = inputs[IN_A_INPUT + c].value; | |||||
if (trigger[c].process(params[TRIGG_A_PARAM + c].value * 10.0 + inputs[TRIGG_A_INPUT + c].value / 2.0)) { | |||||
float in = inputs[IN_A_INPUT + c].getVoltage(); | |||||
if (trigger[c].process(params[TRIGG_A_PARAM + c].getValue() * 10.0 + inputs[TRIGG_A_INPUT + c].getVoltage() / 2.0)) { | |||||
gate[c] = true; | gate[c] = true; | ||||
} | } | ||||
if (gate[c]) { | if (gate[c]) { | ||||
in = 10.0; | in = 10.0; | ||||
} | } | ||||
float shape = params[SHAPE_A_PARAM + c].value; | |||||
float shape = params[SHAPE_A_PARAM + c].getValue(); | |||||
float delta = in - out[c]; | float delta = in - out[c]; | ||||
// Integrator | // Integrator | ||||
float minTime; | float minTime; | ||||
switch ((int) params[RANGE_A_PARAM + c].value) { | |||||
switch ((int) params[RANGE_A_PARAM + c].getValue()) { | |||||
case 0: minTime = 1e-2; break; | case 0: minTime = 1e-2; break; | ||||
case 1: minTime = 1e-3; break; | case 1: minTime = 1e-3; break; | ||||
default: minTime = 1e-1; break; | default: minTime = 1e-1; break; | ||||
@@ -121,7 +121,7 @@ struct Rampage : Module { | |||||
if (delta > 0) { | if (delta > 0) { | ||||
// Rise | // Rise | ||||
float riseCv = params[RISE_A_PARAM + c].value - inputs[EXP_CV_A_INPUT + c].value / 10.0 + inputs[RISE_CV_A_INPUT + c].value / 10.0; | |||||
float riseCv = params[RISE_A_PARAM + c].getValue() - inputs[EXP_CV_A_INPUT + c].getVoltage() / 10.0 + inputs[RISE_CV_A_INPUT + c].getVoltage() / 10.0; | |||||
riseCv = clamp(riseCv, 0.0f, 1.0f); | riseCv = clamp(riseCv, 0.0f, 1.0f); | ||||
float rise = minTime * std::pow(2.0, riseCv * 10.0); | float rise = minTime * std::pow(2.0, riseCv * 10.0); | ||||
out[c] += shapeDelta(delta, rise, shape) * args.sampleTime; | out[c] += shapeDelta(delta, rise, shape) * args.sampleTime; | ||||
@@ -132,7 +132,7 @@ struct Rampage : Module { | |||||
} | } | ||||
else if (delta < 0) { | else if (delta < 0) { | ||||
// Fall | // Fall | ||||
float fallCv = params[FALL_A_PARAM + c].value - inputs[EXP_CV_A_INPUT + c].value / 10.0 + inputs[FALL_CV_A_INPUT + c].value / 10.0; | |||||
float fallCv = params[FALL_A_PARAM + c].getValue() - inputs[EXP_CV_A_INPUT + c].getVoltage() / 10.0 + inputs[FALL_CV_A_INPUT + c].getVoltage() / 10.0; | |||||
fallCv = clamp(fallCv, 0.0f, 1.0f); | fallCv = clamp(fallCv, 0.0f, 1.0f); | ||||
float fall = minTime * std::pow(2.0, fallCv * 10.0); | float fall = minTime * std::pow(2.0, fallCv * 10.0); | ||||
out[c] += shapeDelta(delta, fall, shape) * args.sampleTime; | out[c] += shapeDelta(delta, fall, shape) * args.sampleTime; | ||||
@@ -140,7 +140,7 @@ struct Rampage : Module { | |||||
if (!falling) { | if (!falling) { | ||||
// End of cycle, check if we should turn the gate back on (cycle mode) | // End of cycle, check if we should turn the gate back on (cycle mode) | ||||
endOfCyclePulse[c].trigger(1e-3); | endOfCyclePulse[c].trigger(1e-3); | ||||
if (params[CYCLE_A_PARAM + c].value * 10.0 + inputs[CYCLE_A_INPUT + c].value >= 4.0) { | |||||
if (params[CYCLE_A_PARAM + c].getValue() * 10.0 + inputs[CYCLE_A_INPUT + c].getVoltage() >= 4.0) { | |||||
gate[c] = true; | gate[c] = true; | ||||
} | } | ||||
} | } | ||||
@@ -153,26 +153,26 @@ struct Rampage : Module { | |||||
out[c] = in; | out[c] = in; | ||||
} | } | ||||
outputs[RISING_A_OUTPUT + c].value = (rising ? 10.0 : 0.0); | |||||
outputs[FALLING_A_OUTPUT + c].value = (falling ? 10.0 : 0.0); | |||||
outputs[RISING_A_OUTPUT + c].setVoltage((rising ? 10.0 : 0.0)); | |||||
outputs[FALLING_A_OUTPUT + c].setVoltage((falling ? 10.0 : 0.0)); | |||||
lights[RISING_A_LIGHT + c].setSmoothBrightness(rising ? 1.0 : 0.0, args.sampleTime); | lights[RISING_A_LIGHT + c].setSmoothBrightness(rising ? 1.0 : 0.0, args.sampleTime); | ||||
lights[FALLING_A_LIGHT + c].setSmoothBrightness(falling ? 1.0 : 0.0, args.sampleTime); | lights[FALLING_A_LIGHT + c].setSmoothBrightness(falling ? 1.0 : 0.0, args.sampleTime); | ||||
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(args.sampleTime) ? 10.0 : 0.0); | |||||
outputs[OUT_A_OUTPUT + c].value = out[c]; | |||||
outputs[EOC_A_OUTPUT + c].setVoltage((endOfCyclePulse[c].process(args.sampleTime) ? 10.0 : 0.0)); | |||||
outputs[OUT_A_OUTPUT + c].setVoltage(out[c]); | |||||
lights[OUT_A_LIGHT + c].setSmoothBrightness(out[c] / 10.0, args.sampleTime); | lights[OUT_A_LIGHT + c].setSmoothBrightness(out[c] / 10.0, args.sampleTime); | ||||
} | } | ||||
// Logic | // Logic | ||||
float balance = params[BALANCE_PARAM].value; | |||||
float balance = params[BALANCE_PARAM].getValue(); | |||||
float a = out[0]; | float a = out[0]; | ||||
float b = out[1]; | float b = out[1]; | ||||
if (balance < 0.5) | if (balance < 0.5) | ||||
b *= 2.0 * balance; | b *= 2.0 * balance; | ||||
else if (balance > 0.5) | else if (balance > 0.5) | ||||
a *= 2.0 * (1.0 - balance); | a *= 2.0 * (1.0 - balance); | ||||
outputs[COMPARATOR_OUTPUT].value = (b > a ? 10.0 : 0.0); | |||||
outputs[MIN_OUTPUT].value = std::min(a, b); | |||||
outputs[MAX_OUTPUT].value = std::max(a, b); | |||||
outputs[COMPARATOR_OUTPUT].setVoltage((b > a ? 10.0 : 0.0)); | |||||
outputs[MIN_OUTPUT].setVoltage(std::min(a, b)); | |||||
outputs[MAX_OUTPUT].setVoltage(std::max(a, b)); | |||||
// Lights | // Lights | ||||
lights[COMPARATOR_LIGHT].setSmoothBrightness(outputs[COMPARATOR_OUTPUT].value / 10.0, args.sampleTime); | lights[COMPARATOR_LIGHT].setSmoothBrightness(outputs[COMPARATOR_OUTPUT].value / 10.0, args.sampleTime); | ||||
lights[MIN_LIGHT].setSmoothBrightness(outputs[MIN_OUTPUT].value / 10.0, args.sampleTime); | lights[MIN_LIGHT].setSmoothBrightness(outputs[MIN_OUTPUT].value / 10.0, args.sampleTime); | ||||
@@ -29,8 +29,8 @@ struct SlewLimiter : Module { | |||||
} | } | ||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
float in = inputs[IN_INPUT].value; | |||||
float shape = params[SHAPE_PARAM].value; | |||||
float in = inputs[IN_INPUT].getVoltage(); | |||||
float shape = params[SHAPE_PARAM].getValue(); | |||||
// minimum and maximum slopes in volts per second | // minimum and maximum slopes in volts per second | ||||
const float slewMin = 0.1; | const float slewMin = 0.1; | ||||
@@ -40,7 +40,7 @@ struct SlewLimiter : Module { | |||||
// Rise | // Rise | ||||
if (in > out) { | if (in > out) { | ||||
float rise = inputs[RISE_INPUT].value / 10.f + params[RISE_PARAM].value; | |||||
float rise = inputs[RISE_INPUT].getVoltage() / 10.f + params[RISE_PARAM].getValue(); | |||||
float slew = slewMax * std::pow(slewMin / slewMax, rise); | float slew = slewMax * std::pow(slewMin / slewMax, rise); | ||||
out += slew * crossfade(1.f, shapeScale * (in - out), shape) * args.sampleTime; | out += slew * crossfade(1.f, shapeScale * (in - out), shape) * args.sampleTime; | ||||
if (out > in) | if (out > in) | ||||
@@ -48,14 +48,14 @@ struct SlewLimiter : Module { | |||||
} | } | ||||
// Fall | // Fall | ||||
else if (in < out) { | else if (in < out) { | ||||
float fall = inputs[FALL_INPUT].value / 10.f + params[FALL_PARAM].value; | |||||
float fall = inputs[FALL_INPUT].getVoltage() / 10.f + params[FALL_PARAM].getValue(); | |||||
float slew = slewMax * std::pow(slewMin / slewMax, fall); | float slew = slewMax * std::pow(slewMin / slewMax, fall); | ||||
out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * args.sampleTime; | out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * args.sampleTime; | ||||
if (out < in) | if (out < in) | ||||
out = in; | out = in; | ||||
} | } | ||||
outputs[OUT_OUTPUT].value = out; | |||||
outputs[OUT_OUTPUT].setVoltage(out); | |||||
} | } | ||||
}; | }; | ||||
@@ -65,16 +65,16 @@ struct SpringReverb : Module { | |||||
} | } | ||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
float in1 = inputs[IN1_INPUT].value; | |||||
float in2 = inputs[IN2_INPUT].value; | |||||
float in1 = inputs[IN1_INPUT].getVoltage(); | |||||
float in2 = inputs[IN2_INPUT].getVoltage(); | |||||
const float levelScale = 0.030; | const float levelScale = 0.030; | ||||
const float levelBase = 25.0; | const float levelBase = 25.0; | ||||
float level1 = levelScale * dsp::exponentialBipolar(levelBase, params[LEVEL1_PARAM].value) * inputs[CV1_INPUT].getNormalVoltage(10.0) / 10.0; | |||||
float level2 = levelScale * dsp::exponentialBipolar(levelBase, params[LEVEL2_PARAM].value) * inputs[CV2_INPUT].getNormalVoltage(10.0) / 10.0; | |||||
float level1 = levelScale * dsp::exponentialBipolar(levelBase, params[LEVEL1_PARAM].getValue()) * inputs[CV1_INPUT].getNormalVoltage(10.0) / 10.0; | |||||
float level2 = levelScale * dsp::exponentialBipolar(levelBase, params[LEVEL2_PARAM].getValue()) * inputs[CV2_INPUT].getNormalVoltage(10.0) / 10.0; | |||||
float dry = in1 * level1 + in2 * level2; | float dry = in1 * level1 + in2 * level2; | ||||
// HPF on dry | // HPF on dry | ||||
float dryCutoff = 200.0 * std::pow(20.0, params[HPF_PARAM].value) * args.sampleTime; | |||||
float dryCutoff = 200.0 * std::pow(20.0, params[HPF_PARAM].getValue()) * args.sampleTime; | |||||
dryFilter.setCutoff(dryCutoff); | dryFilter.setCutoff(dryCutoff); | ||||
dryFilter.process(dry); | dryFilter.process(dry); | ||||
@@ -115,11 +115,11 @@ struct SpringReverb : Module { | |||||
if (outputBuffer.empty()) | if (outputBuffer.empty()) | ||||
return; | return; | ||||
float wet = outputBuffer.shift().samples[0]; | float wet = outputBuffer.shift().samples[0]; | ||||
float balance = clamp(params[WET_PARAM].value + inputs[MIX_CV_INPUT].value / 10.0f, 0.0f, 1.0f); | |||||
float balance = clamp(params[WET_PARAM].getValue() + inputs[MIX_CV_INPUT].getVoltage() / 10.0f, 0.0f, 1.0f); | |||||
float mix = crossfade(in1, wet, balance); | float mix = crossfade(in1, wet, balance); | ||||
outputs[WET_OUTPUT].value = clamp(wet, -10.0f, 10.0f); | |||||
outputs[MIX_OUTPUT].value = clamp(mix, -10.0f, 10.0f); | |||||
outputs[WET_OUTPUT].setVoltage(clamp(wet, -10.0f, 10.0f)); | |||||
outputs[MIX_OUTPUT].setVoltage(clamp(mix, -10.0f, 10.0f)); | |||||
// Set lights | // Set lights | ||||
float lightRate = 5.0 * args.sampleTime; | float lightRate = 5.0 * args.sampleTime; | ||||