Browse Source

Add override everywhere, change gSampleRate to engineGetSampleRate()

tags/v0.5.0
Andrew Belt 7 years ago
parent
commit
3e9b5ebf95
7 changed files with 21 additions and 21 deletions
  1. +1
    -1
      src/ABC.cpp
  2. +1
    -1
      src/DualAtenuverter.cpp
  3. +4
    -4
      src/EvenVCO.cpp
  4. +1
    -1
      src/Mixer.cpp
  5. +6
    -6
      src/Rampage.cpp
  6. +3
    -3
      src/SlewLimiter.cpp
  7. +5
    -5
      src/SpringReverb.cpp

+ 1
- 1
src/ABC.cpp View File

@@ -27,7 +27,7 @@ struct ABC : Module {
float lights[2] = {};

ABC() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
void step();
void step() override;
};




+ 1
- 1
src/DualAtenuverter.cpp View File

@@ -24,7 +24,7 @@ struct DualAtenuverter : Module {
float lights[2] = {};

DualAtenuverter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
void step();
void step() override;
};




+ 4
- 4
src/EvenVCO.cpp View File

@@ -45,7 +45,7 @@ struct EvenVCO : Module {
RCFilter triFilter;

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);

// Advance phase
float deltaPhase = clampf(freq / gSampleRate, 1e-6, 0.5);
float deltaPhase = clampf(freq / engineGetSampleRate(), 1e-6, 0.5);
float oldPhase = phase;
phase += deltaPhase;

@@ -110,8 +110,8 @@ void EvenVCO::step() {
triSquare += triSquareMinBLEP.shift();

// 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 doubleSaw = (phase < 0.5) ? (-1.0 + 4.0*phase) : (-1.0 + 4.0*(phase - 0.5));


+ 1
- 1
src/Mixer.cpp View File

@@ -25,7 +25,7 @@ struct Mixer : Module {
float lights[1] = {};

Mixer() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
void step();
void step() override;
};




+ 6
- 6
src/Rampage.cpp View File

@@ -68,7 +68,7 @@ struct Rampage : Module {
trigger[c].setThresholds(0.0, 4.0);
}
}
void step();
void step() override;
};


@@ -110,10 +110,10 @@ void Rampage::step() {

if (delta > 0) {
// 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);
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);
if (!rising) {
gate[c] = false;
@@ -121,10 +121,10 @@ void Rampage::step() {
}
else if (delta < 0) {
// 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);
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);
if (!falling) {
// 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[RISING_A_LIGHT + c].value = (rising ? 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_LIGHT + c].value = out[c] / 10.0;
}


+ 3
- 3
src/SlewLimiter.cpp View File

@@ -22,7 +22,7 @@ struct SlewLimiter : Module {
float out = 0.0;

SlewLimiter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {}
void step();
void step() override;
};


@@ -40,7 +40,7 @@ void ::SlewLimiter::step() {
if (in > out) {
float rise = inputs[RISE_INPUT].value + params[RISE_PARAM].value;
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)
out = in;
}
@@ -48,7 +48,7 @@ void ::SlewLimiter::step() {
else if (in < out) {
float fall = inputs[FALL_INPUT].value + params[FALL_PARAM].value;
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)
out = in;
}


+ 5
- 5
src/SpringReverb.cpp View File

@@ -173,7 +173,7 @@ struct SpringReverb : Module {

SpringReverb();
~SpringReverb();
void step();
void step() override;
};


@@ -196,7 +196,7 @@ void SpringReverb::step() {
float dry = in1 * level1 + in2 * level2;

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

@@ -213,7 +213,7 @@ void SpringReverb::step() {
float output[BLOCKSIZE];
// Convert input buffer
{
inputSrc.setRatio(48000.0 / gSampleRate);
inputSrc.setRatio(48000.0 / engineGetSampleRate());
int inLen = inputBuffer.size();
int outLen = BLOCKSIZE;
inputSrc.process(inputBuffer.startData(), &inLen, (Frame<1>*) input, &outLen);
@@ -225,7 +225,7 @@ void SpringReverb::step() {

// Convert output buffer
{
outputSrc.setRatio(gSampleRate / 48000.0);
outputSrc.setRatio(engineGetSampleRate() / 48000.0);
int inLen = BLOCKSIZE;
int outLen = outputBuffer.capacity();
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);

// Set lights
float lightRate = 5.0 / gSampleRate;
float lightRate = 5.0 / engineGetSampleRate();
vuFilter.setRate(lightRate);
vuFilter.process(fabsf(wet));
lightFilter.setRate(lightRate);


Loading…
Cancel
Save