Browse Source

Update to Rack v1 API

tags/v1.1.0
Andrew Belt 6 years ago
parent
commit
dceca3f422
4 changed files with 12 additions and 12 deletions
  1. +3
    -3
      src/EvenVCO.cpp
  2. +3
    -3
      src/Rampage.cpp
  3. +2
    -2
      src/SlewLimiter.cpp
  4. +4
    -4
      src/SpringReverb.cpp

+ 3
- 3
src/EvenVCO.cpp View File

@@ -63,7 +63,7 @@ struct EvenVCO : Module {
pw = rescale(clamp(pw, -1.f, 1.f), -1.f, 1.f, minPw, 1.f - minPw);

// 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;
phase += deltaPhase;

@@ -95,8 +95,8 @@ struct EvenVCO : Module {
triSquare += triSquareMinBlep.process();

// 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 doubleSaw = (phase < 0.5) ? (-1.f + 4.f*phase) : (-1.f + 4.f*(phase - 0.5));


+ 3
- 3
src/Rampage.cpp View File

@@ -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;
riseCv = clamp(riseCv, 0.0f, 1.0f);
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);
if (!rising) {
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;
fallCv = clamp(fallCv, 0.0f, 1.0f);
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);
if (!falling) {
// 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);
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);
outputs[EOC_A_OUTPUT + c].value = (endOfCyclePulse[c].process(APP->engine->getSampleTime()) ? 10.0 : 0.0);
outputs[OUT_A_OUTPUT + c].value = out[c];
lights[OUT_A_LIGHT + c].setBrightnessSmooth(out[c] / 10.0);
}


+ 2
- 2
src/SlewLimiter.cpp View File

@@ -42,7 +42,7 @@ struct SlewLimiter : Module {
if (in > out) {
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();
out += slew * crossfade(1.f, shapeScale * (in - out), shape) * APP->engine->getSampleTime();
if (out > in)
out = in;
}
@@ -50,7 +50,7 @@ struct SlewLimiter : Module {
else if (in < out) {
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();
out -= slew * crossfade(1.f, shapeScale * (out - in), shape) * APP->engine->getSampleTime();
if (out < in)
out = in;
}


+ 4
- 4
src/SpringReverb.cpp View File

@@ -74,7 +74,7 @@ struct SpringReverb : Module {
float dry = in1 * level1 + in2 * level2;

// 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.process(dry);

@@ -91,7 +91,7 @@ struct SpringReverb : Module {
float output[BLOCK_SIZE];
// Convert input buffer
{
inputSrc.setRates(app()->engine->getSampleRate(), 48000);
inputSrc.setRates(APP->engine->getSampleRate(), 48000);
int inLen = inputBuffer.size();
int outLen = BLOCK_SIZE;
inputSrc.process(inputBuffer.startData(), &inLen, (dsp::Frame<1>*) input, &outLen);
@@ -103,7 +103,7 @@ struct SpringReverb : Module {

// Convert output buffer
{
outputSrc.setRates(48000, app()->engine->getSampleRate());
outputSrc.setRates(48000, APP->engine->getSampleRate());
int inLen = BLOCK_SIZE;
int outLen = outputBuffer.capacity();
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);

// Set lights
float lightRate = 5.0 * app()->engine->getSampleTime();
float lightRate = 5.0 * APP->engine->getSampleTime();
vuFilter.setRate(lightRate);
vuFilter.process(std::abs(wet));
lightFilter.setRate(lightRate);


Loading…
Cancel
Save