@@ -27,7 +27,7 @@ struct ABC : Module { | |||||
float lights[2] = {}; | float lights[2] = {}; | ||||
ABC() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | ABC() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -24,7 +24,7 @@ struct DualAtenuverter : Module { | |||||
float lights[2] = {}; | float lights[2] = {}; | ||||
DualAtenuverter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | DualAtenuverter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -45,7 +45,7 @@ struct EvenVCO : Module { | |||||
RCFilter triFilter; | RCFilter triFilter; | ||||
EvenVCO(); | EvenVCO(); | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -78,7 +78,7 @@ void EvenVCO::step() { | |||||
pw = rescalef(clampf(pw, -1.0, 1.0), -1.0, 1.0, minPw, 1.0-minPw); | pw = rescalef(clampf(pw, -1.0, 1.0), -1.0, 1.0, minPw, 1.0-minPw); | ||||
// Advance phase | // Advance phase | ||||
float deltaPhase = clampf(freq / gSampleRate, 1e-6, 0.5); | |||||
float deltaPhase = clampf(freq / engineGetSampleRate(), 1e-6, 0.5); | |||||
float oldPhase = phase; | float oldPhase = phase; | ||||
phase += deltaPhase; | phase += deltaPhase; | ||||
@@ -110,8 +110,8 @@ void EvenVCO::step() { | |||||
triSquare += triSquareMinBLEP.shift(); | triSquare += triSquareMinBLEP.shift(); | ||||
// Integrate square for triangle | // Integrate square for triangle | ||||
tri += 4.0 * triSquare * freq / gSampleRate; | |||||
tri *= (1.0 - 40.0 / gSampleRate); | |||||
tri += 4.0 * triSquare * freq / engineGetSampleRate(); | |||||
tri *= (1.0 - 40.0 / engineGetSampleRate()); | |||||
float sine = -cosf(2*M_PI * phase); | float sine = -cosf(2*M_PI * phase); | ||||
float doubleSaw = (phase < 0.5) ? (-1.0 + 4.0*phase) : (-1.0 + 4.0*(phase - 0.5)); | float doubleSaw = (phase < 0.5) ? (-1.0 + 4.0*phase) : (-1.0 + 4.0*(phase - 0.5)); | ||||
@@ -25,7 +25,7 @@ struct Mixer : Module { | |||||
float lights[1] = {}; | float lights[1] = {}; | ||||
Mixer() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | Mixer() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -68,7 +68,7 @@ struct Rampage : Module { | |||||
trigger[c].setThresholds(0.0, 4.0); | trigger[c].setThresholds(0.0, 4.0); | ||||
} | } | ||||
} | } | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -110,10 +110,10 @@ void Rampage::step() { | |||||
if (delta > 0) { | if (delta > 0) { | ||||
// Rise | // Rise | ||||
float riseCv = params[RISE_A_PARAM + c].value - inputs[EXP_CV_A_INPUT + c].value + 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 = clampf(riseCv, 0.0, 1.0); | riseCv = clampf(riseCv, 0.0, 1.0); | ||||
float rise = minTime * powf(2.0, riseCv * 10.0); | float rise = minTime * powf(2.0, riseCv * 10.0); | ||||
out[c] += shapeDelta(delta, rise, shape) / gSampleRate; | |||||
out[c] += shapeDelta(delta, rise, shape) / engineGetSampleRate(); | |||||
rising = (in - out[c] > 1e-3); | rising = (in - out[c] > 1e-3); | ||||
if (!rising) { | if (!rising) { | ||||
gate[c] = false; | gate[c] = false; | ||||
@@ -121,10 +121,10 @@ void Rampage::step() { | |||||
} | } | ||||
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 + 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 = clampf(fallCv, 0.0, 1.0); | fallCv = clampf(fallCv, 0.0, 1.0); | ||||
float fall = minTime * powf(2.0, fallCv * 10.0); | float fall = minTime * powf(2.0, fallCv * 10.0); | ||||
out[c] += shapeDelta(delta, fall, shape) / gSampleRate; | |||||
out[c] += shapeDelta(delta, fall, shape) / engineGetSampleRate(); | |||||
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) | ||||
@@ -146,7 +146,7 @@ void Rampage::step() { | |||||
outputs[FALLING_A_OUTPUT + c].value = (falling ? 10.0 : 0.0); | outputs[FALLING_A_OUTPUT + c].value = (falling ? 10.0 : 0.0); | ||||
outputs[RISING_A_LIGHT + c].value = (rising ? 1.0 : 0.0); | outputs[RISING_A_LIGHT + c].value = (rising ? 1.0 : 0.0); | ||||
outputs[FALLING_A_LIGHT + c].value = (falling ? 1.0 : 0.0); | outputs[FALLING_A_LIGHT + c].value = (falling ? 1.0 : 0.0); | ||||
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(1.0 / gSampleRate) ? 10.0 : 0.0); | |||||
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(1.0 / engineGetSampleRate()) ? 10.0 : 0.0); | |||||
outputs[OUT_A_OUTPUT + c].value = out[c]; | outputs[OUT_A_OUTPUT + c].value = out[c]; | ||||
outputs[OUT_A_LIGHT + c].value = out[c] / 10.0; | outputs[OUT_A_LIGHT + c].value = out[c] / 10.0; | ||||
} | } | ||||
@@ -22,7 +22,7 @@ struct SlewLimiter : Module { | |||||
float out = 0.0; | float out = 0.0; | ||||
SlewLimiter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | SlewLimiter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -40,7 +40,7 @@ void ::SlewLimiter::step() { | |||||
if (in > out) { | if (in > out) { | ||||
float rise = inputs[RISE_INPUT].value + params[RISE_PARAM].value; | float rise = inputs[RISE_INPUT].value + params[RISE_PARAM].value; | ||||
float slew = slewMax * powf(slewMin / slewMax, rise); | float slew = slewMax * powf(slewMin / slewMax, rise); | ||||
out += slew * crossf(1.0, shapeScale * (in - out), shape) / gSampleRate; | |||||
out += slew * crossf(1.0, shapeScale * (in - out), shape) / engineGetSampleRate(); | |||||
if (out > in) | if (out > in) | ||||
out = in; | out = in; | ||||
} | } | ||||
@@ -48,7 +48,7 @@ void ::SlewLimiter::step() { | |||||
else if (in < out) { | else if (in < out) { | ||||
float fall = inputs[FALL_INPUT].value + params[FALL_PARAM].value; | float fall = inputs[FALL_INPUT].value + params[FALL_PARAM].value; | ||||
float slew = slewMax * powf(slewMin / slewMax, fall); | float slew = slewMax * powf(slewMin / slewMax, fall); | ||||
out -= slew * crossf(1.0, shapeScale * (out - in), shape) / gSampleRate; | |||||
out -= slew * crossf(1.0, shapeScale * (out - in), shape) / engineGetSampleRate(); | |||||
if (out < in) | if (out < in) | ||||
out = in; | out = in; | ||||
} | } | ||||
@@ -173,7 +173,7 @@ struct SpringReverb : Module { | |||||
SpringReverb(); | SpringReverb(); | ||||
~SpringReverb(); | ~SpringReverb(); | ||||
void step(); | |||||
void step() override; | |||||
}; | }; | ||||
@@ -196,7 +196,7 @@ void SpringReverb::step() { | |||||
float dry = in1 * level1 + in2 * level2; | float dry = in1 * level1 + in2 * level2; | ||||
// HPF on dry | // HPF on dry | ||||
float dryCutoff = 200.0 * powf(20.0, params[HPF_PARAM].value) / gSampleRate; | |||||
float dryCutoff = 200.0 * powf(20.0, params[HPF_PARAM].value) / engineGetSampleRate(); | |||||
dryFilter.setCutoff(dryCutoff); | dryFilter.setCutoff(dryCutoff); | ||||
dryFilter.process(dry); | dryFilter.process(dry); | ||||
@@ -213,7 +213,7 @@ void SpringReverb::step() { | |||||
float output[BLOCKSIZE]; | float output[BLOCKSIZE]; | ||||
// Convert input buffer | // Convert input buffer | ||||
{ | { | ||||
inputSrc.setRatio(48000.0 / gSampleRate); | |||||
inputSrc.setRatio(48000.0 / engineGetSampleRate()); | |||||
int inLen = inputBuffer.size(); | int inLen = inputBuffer.size(); | ||||
int outLen = BLOCKSIZE; | int outLen = BLOCKSIZE; | ||||
inputSrc.process(inputBuffer.startData(), &inLen, (Frame<1>*) input, &outLen); | inputSrc.process(inputBuffer.startData(), &inLen, (Frame<1>*) input, &outLen); | ||||
@@ -225,7 +225,7 @@ void SpringReverb::step() { | |||||
// Convert output buffer | // Convert output buffer | ||||
{ | { | ||||
outputSrc.setRatio(gSampleRate / 48000.0); | |||||
outputSrc.setRatio(engineGetSampleRate() / 48000.0); | |||||
int inLen = BLOCKSIZE; | int inLen = BLOCKSIZE; | ||||
int outLen = outputBuffer.capacity(); | int outLen = outputBuffer.capacity(); | ||||
outputSrc.process((Frame<1>*) output, &inLen, outputBuffer.endData(), &outLen); | outputSrc.process((Frame<1>*) output, &inLen, outputBuffer.endData(), &outLen); | ||||
@@ -244,7 +244,7 @@ void SpringReverb::step() { | |||||
outputs[MIX_OUTPUT].value =clampf(mix, -10.0, 10.0); | outputs[MIX_OUTPUT].value =clampf(mix, -10.0, 10.0); | ||||
// Set lights | // Set lights | ||||
float lightRate = 5.0 / gSampleRate; | |||||
float lightRate = 5.0 / engineGetSampleRate(); | |||||
vuFilter.setRate(lightRate); | vuFilter.setRate(lightRate); | ||||
vuFilter.process(fabsf(wet)); | vuFilter.process(fabsf(wet)); | ||||
lightFilter.setRate(lightRate); | lightFilter.setRate(lightRate); | ||||