@@ -46,7 +46,7 @@ struct ABC : Module { | |||||
params[C2_LEVEL_PARAM].config(-1.0, 1.0, 0.0, "C2 Level"); | params[C2_LEVEL_PARAM].config(-1.0, 1.0, 0.0, "C2 Level"); | ||||
} | } | ||||
void step() override { | |||||
void process(const ProcessArgs &args) override { | |||||
float a1 = inputs[A1_INPUT].value; | 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 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 c1 = inputs[C1_INPUT].getNormalVoltage(10.f) * dsp::exponentialBipolar(80.f, params[C1_LEVEL_PARAM].value); | ||||
@@ -69,10 +69,10 @@ struct ABC : Module { | |||||
} | } | ||||
// Lights | // Lights | ||||
lights[OUT1_POS_LIGHT].setBrightnessSmooth(std::max(0.f, out1 / 5.f)); | |||||
lights[OUT1_NEG_LIGHT].setBrightnessSmooth(std::max(0.f, -out1 / 5.f)); | |||||
lights[OUT2_POS_LIGHT].setBrightnessSmooth(std::max(0.f, out2 / 5.f)); | |||||
lights[OUT2_NEG_LIGHT].setBrightnessSmooth(std::max(0.f, -out2 / 5.f)); | |||||
lights[OUT1_POS_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_NEG_LIGHT].setSmoothBrightness(-out2 / 5.f, args.sampleTime); | |||||
} | } | ||||
}; | }; | ||||
@@ -35,7 +35,7 @@ struct DualAtenuverter : Module { | |||||
params[OFFSET2_PARAM].config(-10.0, 10.0, 0.0, "Ch 2 offset", " V"); | params[OFFSET2_PARAM].config(-10.0, 10.0, 0.0, "Ch 2 offset", " V"); | ||||
} | } | ||||
void step() override { | |||||
void process(const ProcessArgs &args) override { | |||||
float out1 = inputs[IN1_INPUT].value * params[ATEN1_PARAM].value + params[OFFSET1_PARAM].value; | 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 out2 = inputs[IN2_INPUT].value * params[ATEN2_PARAM].value + params[OFFSET2_PARAM].value; | ||||
out1 = clamp(out1, -10.f, 10.f); | out1 = clamp(out1, -10.f, 10.f); | ||||
@@ -43,10 +43,10 @@ struct DualAtenuverter : Module { | |||||
outputs[OUT1_OUTPUT].value = out1; | outputs[OUT1_OUTPUT].value = out1; | ||||
outputs[OUT2_OUTPUT].value = out2; | outputs[OUT2_OUTPUT].value = out2; | ||||
lights[OUT1_POS_LIGHT].setBrightnessSmooth(std::max(0.f, out1 / 5.f)); | |||||
lights[OUT1_NEG_LIGHT].setBrightnessSmooth(std::max(0.f, -out1 / 5.f)); | |||||
lights[OUT2_POS_LIGHT].setBrightnessSmooth(std::max(0.f, out2 / 5.f)); | |||||
lights[OUT2_NEG_LIGHT].setBrightnessSmooth(std::max(0.f, -out2 / 5.f)); | |||||
lights[OUT1_POS_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_NEG_LIGHT].setSmoothBrightness(-out2 / 5.f, args.sampleTime); | |||||
} | } | ||||
}; | }; | ||||
@@ -49,7 +49,7 @@ struct EvenVCO : Module { | |||||
params[PWM_PARAM].config(-1.0, 1.0, 0.0, "Pulse width"); | params[PWM_PARAM].config(-1.0, 1.0, 0.0, "Pulse width"); | ||||
} | } | ||||
void step() 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; | 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[PITCH1_INPUT].value + inputs[PITCH2_INPUT].value; | ||||
@@ -63,7 +63,7 @@ struct EvenVCO : Module { | |||||
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); | ||||
// Advance phase | // Advance phase | ||||
float deltaPhase = clamp(freq * APP->engine->getSampleTime(), 1e-6f, 0.5f); | |||||
float deltaPhase = clamp(freq * args.sampleTime, 1e-6f, 0.5f); | |||||
float oldPhase = phase; | float oldPhase = phase; | ||||
phase += deltaPhase; | phase += deltaPhase; | ||||
@@ -95,8 +95,8 @@ struct EvenVCO : Module { | |||||
triSquare += triSquareMinBlep.process(); | triSquare += triSquareMinBlep.process(); | ||||
// Integrate square for triangle | // Integrate square for triangle | ||||
tri += 4.f * triSquare * freq * APP->engine->getSampleTime(); | |||||
tri *= (1.f - 40.f * APP->engine->getSampleTime()); | |||||
tri += 4.f * triSquare * freq * args.sampleTime; | |||||
tri *= (1.f - 40.f * args.sampleTime); | |||||
float sine = -std::cos(2*M_PI * phase); | float sine = -std::cos(2*M_PI * phase); | ||||
float doubleSaw = (phase < 0.5) ? (-1.f + 4.f*phase) : (-1.f + 4.f*(phase - 0.5)); | float doubleSaw = (phase < 0.5) ? (-1.f + 4.f*phase) : (-1.f + 4.f*(phase - 0.5)); | ||||
@@ -35,17 +35,17 @@ struct Mixer : Module { | |||||
params[CH4_PARAM].config(0.0, 1.0, 0.0, "Ch 4 level", "%", 0, 100); | params[CH4_PARAM].config(0.0, 1.0, 0.0, "Ch 4 level", "%", 0, 100); | ||||
} | } | ||||
void step() override { | |||||
float in1 = inputs[IN1_INPUT].value * params[CH1_PARAM].value; | |||||
float in2 = inputs[IN2_INPUT].value * params[CH2_PARAM].value; | |||||
float in3 = inputs[IN3_INPUT].value * params[CH3_PARAM].value; | |||||
float in4 = inputs[IN4_INPUT].value * params[CH4_PARAM].value; | |||||
void process(const ProcessArgs &args) override { | |||||
float in1 = inputs[IN1_INPUT].getVoltage() * params[CH1_PARAM].getValue(); | |||||
float in2 = inputs[IN2_INPUT].getVoltage() * params[CH2_PARAM].getValue(); | |||||
float in3 = inputs[IN3_INPUT].getVoltage() * params[CH3_PARAM].getValue(); | |||||
float in4 = inputs[IN4_INPUT].getVoltage() * params[CH4_PARAM].getValue(); | |||||
float out = in1 + in2 + in3 + in4; | float out = in1 + in2 + in3 + in4; | ||||
outputs[OUT1_OUTPUT].value = out; | |||||
outputs[OUT2_OUTPUT].value = -out; | |||||
lights[OUT_POS_LIGHT].setBrightnessSmooth(out / 5.f); | |||||
lights[OUT_NEG_LIGHT].setBrightnessSmooth(-out / 5.f); | |||||
outputs[OUT1_OUTPUT].setVoltage(out); | |||||
outputs[OUT2_OUTPUT].setVoltage(-out); | |||||
lights[OUT_POS_LIGHT].setSmoothBrightness(out / 5.f, args.sampleTime); | |||||
lights[OUT_NEG_LIGHT].setSmoothBrightness(-out / 5.f, args.sampleTime); | |||||
} | } | ||||
}; | }; | ||||
@@ -4,7 +4,7 @@ | |||||
static float shapeDelta(float delta, float tau, float shape) { | static float shapeDelta(float delta, float tau, float shape) { | ||||
float lin = sgn(delta) * 10.f / tau; | float lin = sgn(delta) * 10.f / tau; | ||||
if (shape < 0.f) { | if (shape < 0.f) { | ||||
float log = sgn(delta) * 40.f / tau / (std::abs(delta) + 1.f); | |||||
float log = sgn(delta) * 40.f / tau / (std::fabs(delta) + 1.f); | |||||
return crossfade(lin, log, -shape * 0.95f); | return crossfade(lin, log, -shape * 0.95f); | ||||
} | } | ||||
else { | else { | ||||
@@ -95,7 +95,7 @@ struct Rampage : Module { | |||||
params[BALANCE_PARAM].config(0.0, 1.0, 0.5, "Balance"); | params[BALANCE_PARAM].config(0.0, 1.0, 0.5, "Balance"); | ||||
} | } | ||||
void step() 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; | 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)) { | if (trigger[c].process(params[TRIGG_A_PARAM + c].value * 10.0 + inputs[TRIGG_A_INPUT + c].value / 2.0)) { | ||||
@@ -124,7 +124,7 @@ struct Rampage : Module { | |||||
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].value - inputs[EXP_CV_A_INPUT + c].value / 10.0 + inputs[RISE_CV_A_INPUT + c].value / 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) * APP->engine->getSampleTime(); | |||||
out[c] += shapeDelta(delta, rise, shape) * args.sampleTime; | |||||
rising = (in - out[c] > 1e-3); | rising = (in - out[c] > 1e-3); | ||||
if (!rising) { | if (!rising) { | ||||
gate[c] = false; | gate[c] = false; | ||||
@@ -135,7 +135,7 @@ struct Rampage : Module { | |||||
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].value - inputs[EXP_CV_A_INPUT + c].value / 10.0 + inputs[FALL_CV_A_INPUT + c].value / 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) * APP->engine->getSampleTime(); | |||||
out[c] += shapeDelta(delta, fall, shape) * args.sampleTime; | |||||
falling = (in - out[c] < -1e-3); | falling = (in - out[c] < -1e-3); | ||||
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) | ||||
@@ -155,11 +155,11 @@ struct Rampage : Module { | |||||
outputs[RISING_A_OUTPUT + c].value = (rising ? 10.0 : 0.0); | outputs[RISING_A_OUTPUT + c].value = (rising ? 10.0 : 0.0); | ||||
outputs[FALLING_A_OUTPUT + c].value = (falling ? 10.0 : 0.0); | outputs[FALLING_A_OUTPUT + c].value = (falling ? 10.0 : 0.0); | ||||
lights[RISING_A_LIGHT + c].setBrightnessSmooth(rising ? 1.0 : 0.0); | |||||
lights[FALLING_A_LIGHT + c].setBrightnessSmooth(falling ? 1.0 : 0.0); | |||||
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(APP->engine->getSampleTime()) ? 10.0 : 0.0); | |||||
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); | |||||
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(args.sampleTime) ? 10.0 : 0.0); | |||||
outputs[OUT_A_OUTPUT + c].value = out[c]; | outputs[OUT_A_OUTPUT + c].value = out[c]; | ||||
lights[OUT_A_LIGHT + c].setBrightnessSmooth(out[c] / 10.0); | |||||
lights[OUT_A_LIGHT + c].setSmoothBrightness(out[c] / 10.0, args.sampleTime); | |||||
} | } | ||||
// Logic | // Logic | ||||
@@ -174,9 +174,9 @@ struct Rampage : Module { | |||||
outputs[MIN_OUTPUT].value = std::min(a, b); | outputs[MIN_OUTPUT].value = std::min(a, b); | ||||
outputs[MAX_OUTPUT].value = std::max(a, b); | outputs[MAX_OUTPUT].value = std::max(a, b); | ||||
// Lights | // Lights | ||||
lights[COMPARATOR_LIGHT].setBrightnessSmooth(outputs[COMPARATOR_OUTPUT].value / 10.0); | |||||
lights[MIN_LIGHT].setBrightnessSmooth(outputs[MIN_OUTPUT].value / 10.0); | |||||
lights[MAX_LIGHT].setBrightnessSmooth(outputs[MAX_OUTPUT].value / 10.0); | |||||
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[MAX_LIGHT].setSmoothBrightness(outputs[MAX_OUTPUT].value / 10.0, args.sampleTime); | |||||
} | } | ||||
}; | }; | ||||
@@ -28,7 +28,7 @@ struct SlewLimiter : Module { | |||||
params[FALL_PARAM].config(0.0, 1.0, 0.0, "Fall time"); | params[FALL_PARAM].config(0.0, 1.0, 0.0, "Fall time"); | ||||
} | } | ||||
void step() override { | |||||
void process(const ProcessArgs &args) override { | |||||
float in = inputs[IN_INPUT].value; | float in = inputs[IN_INPUT].value; | ||||
float shape = params[SHAPE_PARAM].value; | float shape = params[SHAPE_PARAM].value; | ||||
@@ -41,16 +41,16 @@ 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].value / 10.f + params[RISE_PARAM].value; | ||||
float slew = slewMax * powf(slewMin / slewMax, rise); | |||||
out += slew * crossfade(1.f, shapeScale * (in - out), shape) * APP->engine->getSampleTime(); | |||||
float slew = slewMax * std::pow(slewMin / slewMax, rise); | |||||
out += slew * crossfade(1.f, shapeScale * (in - out), shape) * args.sampleTime; | |||||
if (out > in) | if (out > in) | ||||
out = in; | out = in; | ||||
} | } | ||||
// 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].value / 10.f + params[FALL_PARAM].value; | ||||
float slew = slewMax * powf(slewMin / slewMax, fall); | |||||
out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * APP->engine->getSampleTime(); | |||||
float slew = slewMax * std::pow(slewMin / slewMax, fall); | |||||
out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * args.sampleTime; | |||||
if (out < in) | if (out < in) | ||||
out = in; | out = in; | ||||
} | } | ||||
@@ -64,7 +64,7 @@ struct SpringReverb : Module { | |||||
delete convolver; | delete convolver; | ||||
} | } | ||||
void step() override { | |||||
void process(const ProcessArgs &args) override { | |||||
float in1 = inputs[IN1_INPUT].value; | float in1 = inputs[IN1_INPUT].value; | ||||
float in2 = inputs[IN2_INPUT].value; | float in2 = inputs[IN2_INPUT].value; | ||||
const float levelScale = 0.030; | const float levelScale = 0.030; | ||||
@@ -74,7 +74,7 @@ struct SpringReverb : Module { | |||||
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) * APP->engine->getSampleTime(); | |||||
float dryCutoff = 200.0 * std::pow(20.0, params[HPF_PARAM].value) * args.sampleTime; | |||||
dryFilter.setCutoff(dryCutoff); | dryFilter.setCutoff(dryCutoff); | ||||
dryFilter.process(dry); | dryFilter.process(dry); | ||||
@@ -91,7 +91,7 @@ struct SpringReverb : Module { | |||||
float output[BLOCK_SIZE]; | float output[BLOCK_SIZE]; | ||||
// Convert input buffer | // Convert input buffer | ||||
{ | { | ||||
inputSrc.setRates(APP->engine->getSampleRate(), 48000); | |||||
inputSrc.setRates(args.sampleRate, 48000); | |||||
int inLen = inputBuffer.size(); | int inLen = inputBuffer.size(); | ||||
int outLen = BLOCK_SIZE; | int outLen = BLOCK_SIZE; | ||||
inputSrc.process(inputBuffer.startData(), &inLen, (dsp::Frame<1>*) input, &outLen); | inputSrc.process(inputBuffer.startData(), &inLen, (dsp::Frame<1>*) input, &outLen); | ||||
@@ -103,7 +103,7 @@ struct SpringReverb : Module { | |||||
// Convert output buffer | // Convert output buffer | ||||
{ | { | ||||
outputSrc.setRates(48000, APP->engine->getSampleRate()); | |||||
outputSrc.setRates(48000, args.sampleRate); | |||||
int inLen = BLOCK_SIZE; | int inLen = BLOCK_SIZE; | ||||
int outLen = outputBuffer.capacity(); | int outLen = outputBuffer.capacity(); | ||||
outputSrc.process((dsp::Frame<1>*) output, &inLen, outputBuffer.endData(), &outLen); | outputSrc.process((dsp::Frame<1>*) output, &inLen, outputBuffer.endData(), &outLen); | ||||
@@ -122,11 +122,11 @@ struct SpringReverb : Module { | |||||
outputs[MIX_OUTPUT].value = clamp(mix, -10.0f, 10.0f); | outputs[MIX_OUTPUT].value = clamp(mix, -10.0f, 10.0f); | ||||
// Set lights | // Set lights | ||||
float lightRate = 5.0 * APP->engine->getSampleTime(); | |||||
float lightRate = 5.0 * args.sampleTime; | |||||
vuFilter.setRate(lightRate); | vuFilter.setRate(lightRate); | ||||
vuFilter.process(std::abs(wet)); | |||||
vuFilter.process(std::fabs(wet)); | |||||
lightFilter.setRate(lightRate); | lightFilter.setRate(lightRate); | ||||
lightFilter.process(std::abs(dry*50.0)); | |||||
lightFilter.process(std::fabs(dry*50.0)); | |||||
float vuValue = vuFilter.peak(); | float vuValue = vuFilter.peak(); | ||||
for (int i = 0; i < 7; i++) { | for (int i = 0; i < 7; i++) { | ||||