@@ -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 * APP->engine->getSampleTime(), 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 * APP->engine->getSampleTime(); | |||||
tri *= (1.f - 40.f * APP->engine->getSampleTime()); | |||||
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)); | ||||
@@ -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) * APP->engine->getSampleTime(); | |||||
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) * APP->engine->getSampleTime(); | |||||
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) | ||||
@@ -157,7 +157,7 @@ struct Rampage : Module { | |||||
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[RISING_A_LIGHT + c].setBrightnessSmooth(rising ? 1.0 : 0.0); | ||||
lights[FALLING_A_LIGHT + c].setBrightnessSmooth(falling ? 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); | |||||
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(APP->engine->getSampleTime()) ? 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].setBrightnessSmooth(out[c] / 10.0); | ||||
} | } | ||||
@@ -42,7 +42,7 @@ struct SlewLimiter : Module { | |||||
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); | float slew = slewMax * powf(slewMin / slewMax, rise); | ||||
out += slew * crossfade(1.f, shapeScale * (in - out), shape) * app()->engine->getSampleTime(); | |||||
out += slew * crossfade(1.f, shapeScale * (in - out), shape) * APP->engine->getSampleTime(); | |||||
if (out > in) | if (out > in) | ||||
out = in; | out = in; | ||||
} | } | ||||
@@ -50,7 +50,7 @@ struct SlewLimiter : Module { | |||||
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); | float slew = slewMax * powf(slewMin / slewMax, fall); | ||||
out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * app()->engine->getSampleTime(); | |||||
out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * APP->engine->getSampleTime(); | |||||
if (out < in) | if (out < in) | ||||
out = in; | out = in; | ||||
} | } | ||||
@@ -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) * APP->engine->getSampleTime(); | |||||
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(APP->engine->getSampleRate(), 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, APP->engine->getSampleRate()); | |||||
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,7 +122,7 @@ 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 * APP->engine->getSampleTime(); | |||||
vuFilter.setRate(lightRate); | vuFilter.setRate(lightRate); | ||||
vuFilter.process(std::abs(wet)); | vuFilter.process(std::abs(wet)); | ||||
lightFilter.setRate(lightRate); | lightFilter.setRate(lightRate); | ||||