@@ -7,9 +7,6 @@ include ../../plugin.mk | |||||
dist: all | dist: all | ||||
ifndef VERSION | |||||
$(error VERSION is not set.) | |||||
endif | |||||
mkdir -p dist/Befaco | mkdir -p dist/Befaco | ||||
cp LICENSE* dist/Befaco/ | cp LICENSE* dist/Befaco/ | ||||
cp plugin.* dist/Befaco/ | cp plugin.* dist/Befaco/ | ||||
@@ -26,42 +26,36 @@ struct ABC : Module { | |||||
float lights[2] = {}; | float lights[2] = {}; | ||||
ABC(); | |||||
ABC() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | |||||
void step(); | void step(); | ||||
}; | }; | ||||
ABC::ABC() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
} | |||||
static float clip(float x) { | static float clip(float x) { | ||||
x = clampf(x, -2.0, 2.0); | x = clampf(x, -2.0, 2.0); | ||||
return x / powf(1.0 + powf(x, 24.0), 1/24.0); | return x / powf(1.0 + powf(x, 24.0), 1/24.0); | ||||
} | } | ||||
void ABC::step() { | void ABC::step() { | ||||
float a1 = getf(inputs[A1_INPUT]); | |||||
float b1 = getf(inputs[B1_INPUT], 5.0) * 2.0*exponentialBipolar(80.0, params[B1_LEVEL_PARAM]); | |||||
float c1 = getf(inputs[C1_INPUT], 10.0) * exponentialBipolar(80.0, params[C1_LEVEL_PARAM]); | |||||
float a1 = inputs[A1_INPUT].value; | |||||
float b1 = inputs[B1_INPUT].normalize(5.0) * 2.0*exponentialBipolar(80.0, params[B1_LEVEL_PARAM].value); | |||||
float c1 = inputs[C1_INPUT].normalize(10.0) * exponentialBipolar(80.0, params[C1_LEVEL_PARAM].value); | |||||
float out1 = a1 * b1 / 5.0 + c1; | float out1 = a1 * b1 / 5.0 + c1; | ||||
float a2 = getf(inputs[A2_INPUT]); | |||||
float b2 = getf(inputs[B2_INPUT], 5.0) * 2.0*exponentialBipolar(80.0, params[B2_LEVEL_PARAM]); | |||||
float c2 = getf(inputs[C2_INPUT], 20.0) * exponentialBipolar(80.0, params[C2_LEVEL_PARAM]); | |||||
float a2 = inputs[A2_INPUT].value; | |||||
float b2 = inputs[B2_INPUT].normalize(5.0) * 2.0*exponentialBipolar(80.0, params[B2_LEVEL_PARAM].value); | |||||
float c2 = inputs[C2_INPUT].normalize(20.0) * exponentialBipolar(80.0, params[C2_LEVEL_PARAM].value); | |||||
float out2 = a2 * b2 / 5.0 + c2; | float out2 = a2 * b2 / 5.0 + c2; | ||||
// Set outputs | // Set outputs | ||||
if (outputs[OUT1_OUTPUT]) { | |||||
*outputs[OUT1_OUTPUT] = clip(out1 / 10.0) * 10.0; | |||||
if (outputs[OUT1_OUTPUT].active) { | |||||
outputs[OUT1_OUTPUT].value = clip(out1 / 10.0) * 10.0; | |||||
} | } | ||||
else { | else { | ||||
out2 += out1; | out2 += out1; | ||||
} | } | ||||
if (outputs[OUT2_OUTPUT]) { | |||||
*outputs[OUT2_OUTPUT] = clip(out2 / 10.0) * 10.0; | |||||
if (outputs[OUT2_OUTPUT].active) { | |||||
outputs[OUT2_OUTPUT].value = clip(out2 / 10.0) * 10.0; | |||||
} | } | ||||
lights[0] = out1 / 5.0; | lights[0] = out1 / 5.0; | ||||
lights[1] = out2 / 5.0; | lights[1] = out2 / 5.0; | ||||
@@ -23,25 +23,19 @@ struct DualAtenuverter : Module { | |||||
float lights[2] = {}; | float lights[2] = {}; | ||||
DualAtenuverter(); | |||||
DualAtenuverter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | |||||
void step(); | void step(); | ||||
}; | }; | ||||
DualAtenuverter::DualAtenuverter() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
} | |||||
void DualAtenuverter::step() { | void DualAtenuverter::step() { | ||||
float out1 = getf(inputs[IN1_INPUT]) * params[ATEN1_PARAM] + params[OFFSET1_PARAM]; | |||||
float out2 = getf(inputs[IN2_INPUT]) * params[ATEN2_PARAM] + params[OFFSET2_PARAM]; | |||||
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; | |||||
out1 = clampf(out1, -10.0, 10.0); | out1 = clampf(out1, -10.0, 10.0); | ||||
out2 = clampf(out2, -10.0, 10.0); | out2 = clampf(out2, -10.0, 10.0); | ||||
setf(outputs[OUT1_OUTPUT], out1); | |||||
setf(outputs[OUT2_OUTPUT], out2); | |||||
outputs[OUT1_OUTPUT].value = out1; | |||||
outputs[OUT2_OUTPUT].value = out2; | |||||
lights[0] = out1 / 5.0; | lights[0] = out1 / 5.0; | ||||
lights[1] = out2 / 5.0; | lights[1] = out2 / 5.0; | ||||
} | } | ||||
@@ -48,11 +48,7 @@ struct EvenVCO : Module { | |||||
}; | }; | ||||
EvenVCO::EvenVCO() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
EvenVCO::EvenVCO() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) { | |||||
triSquareMinBLEP.minblep = minblep_16_32; | triSquareMinBLEP.minblep = minblep_16_32; | ||||
triSquareMinBLEP.oversample = 32; | triSquareMinBLEP.oversample = 32; | ||||
triMinBLEP.minblep = minblep_16_32; | triMinBLEP.minblep = minblep_16_32; | ||||
@@ -69,14 +65,14 @@ EvenVCO::EvenVCO() { | |||||
void EvenVCO::step() { | void EvenVCO::step() { | ||||
// Compute frequency, pitch is 1V/oct | // Compute frequency, pitch is 1V/oct | ||||
float pitch = 1.0 + roundf(params[OCTAVE_PARAM]) + params[TUNE_PARAM] / 12.0; | |||||
pitch += getf(inputs[PITCH1_INPUT]) + getf(inputs[PITCH2_INPUT]); | |||||
pitch += getf(inputs[FM_INPUT]) / 4.0; | |||||
float pitch = 1.0 + roundf(params[OCTAVE_PARAM].value) + params[TUNE_PARAM].value / 12.0; | |||||
pitch += inputs[PITCH1_INPUT].value + inputs[PITCH2_INPUT].value; | |||||
pitch += inputs[FM_INPUT].value / 4.0; | |||||
float freq = 261.626 * powf(2.0, pitch); | float freq = 261.626 * powf(2.0, pitch); | ||||
freq = clampf(freq, 0.0, 20000.0); | freq = clampf(freq, 0.0, 20000.0); | ||||
// Pulse width | // Pulse width | ||||
float pw = params[PWM_PARAM] + getf(inputs[PWM_INPUT]) / 5.0; | |||||
float pw = params[PWM_PARAM].value + inputs[PWM_INPUT].value / 5.0; | |||||
const float minPw = 0.05; | const float minPw = 0.05; | ||||
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); | ||||
@@ -126,11 +122,11 @@ void EvenVCO::step() { | |||||
square += squareMinBLEP.shift(); | square += squareMinBLEP.shift(); | ||||
// Set outputs | // Set outputs | ||||
setf(outputs[TRI_OUTPUT], 5.0*tri); | |||||
setf(outputs[SINE_OUTPUT], 5.0*sine); | |||||
setf(outputs[EVEN_OUTPUT], 5.0*even); | |||||
setf(outputs[SAW_OUTPUT], 5.0*saw); | |||||
setf(outputs[SQUARE_OUTPUT], 5.0*square); | |||||
outputs[TRI_OUTPUT].value = 5.0*tri; | |||||
outputs[SINE_OUTPUT].value = 5.0*sine; | |||||
outputs[EVEN_OUTPUT].value = 5.0*even; | |||||
outputs[SAW_OUTPUT].value = 5.0*saw; | |||||
outputs[SQUARE_OUTPUT].value = 5.0*square; | |||||
} | } | ||||
@@ -24,26 +24,20 @@ struct Mixer : Module { | |||||
float lights[1] = {}; | float lights[1] = {}; | ||||
Mixer(); | |||||
Mixer() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | |||||
void step(); | void step(); | ||||
}; | }; | ||||
Mixer::Mixer() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
} | |||||
void Mixer::step() { | void Mixer::step() { | ||||
float in1 = getf(inputs[IN1_INPUT]) * params[CH1_PARAM]; | |||||
float in2 = getf(inputs[IN2_INPUT]) * params[CH2_PARAM]; | |||||
float in3 = getf(inputs[IN3_INPUT]) * params[CH3_PARAM]; | |||||
float in4 = getf(inputs[IN4_INPUT]) * params[CH4_PARAM]; | |||||
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; | |||||
float out = in1 + in2 + in3 + in4; | float out = in1 + in2 + in3 + in4; | ||||
setf(outputs[OUT1_OUTPUT], out); | |||||
setf(outputs[OUT2_OUTPUT], -out); | |||||
outputs[OUT1_OUTPUT].value = out; | |||||
outputs[OUT2_OUTPUT].value = -out; | |||||
lights[0] = out / 5.0; | lights[0] = out / 5.0; | ||||
} | } | ||||
@@ -61,23 +61,17 @@ struct Rampage : Module { | |||||
float risingBLight = 0.0; | float risingBLight = 0.0; | ||||
float fallingBLight = 0.0; | float fallingBLight = 0.0; | ||||
Rampage(); | |||||
Rampage() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | |||||
void step(); | void step(); | ||||
}; | }; | ||||
Rampage::Rampage() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
} | |||||
void Rampage::step() { | void Rampage::step() { | ||||
// TEMP | // TEMP | ||||
float outA = getf(inputs[IN_A_INPUT]); | |||||
float outB = getf(inputs[IN_B_INPUT]); | |||||
setf(outputs[OUT_A_OUTPUT], outA); | |||||
setf(outputs[OUT_B_OUTPUT], outB); | |||||
float outA = inputs[IN_A_INPUT].value; | |||||
float outB = inputs[IN_B_INPUT].value; | |||||
outputs[OUT_A_OUTPUT].value = outA; | |||||
outputs[OUT_B_OUTPUT].value = outB; | |||||
outALight = outA / 10.0; | outALight = outA / 10.0; | ||||
outBLight = outB / 10.0; | outBLight = outB / 10.0; | ||||
@@ -88,8 +82,8 @@ void Rampage::step() { | |||||
lastOut = out; \ | lastOut = out; \ | ||||
float rising = slope > slopeThreshold ? 10.0 : 0.0; \ | float rising = slope > slopeThreshold ? 10.0 : 0.0; \ | ||||
float falling = slope < -slopeThreshold ? 10.0 : 0.0; \ | float falling = slope < -slopeThreshold ? 10.0 : 0.0; \ | ||||
setf(outputs[rising], rising); \ | |||||
setf(outputs[falling], falling); \ | |||||
outputs[rising].value = rising; \ | |||||
outputs[falling].value = falling; \ | |||||
risingLight = rising / 10.0; \ | risingLight = rising / 10.0; \ | ||||
fallingLight = falling / 10.0; \ | fallingLight = falling / 10.0; \ | ||||
} | } | ||||
@@ -97,16 +91,16 @@ void Rampage::step() { | |||||
SLOPE(outB, lastOutB, RISING_B_OUTPUT, FALLING_B_OUTPUT, risingBLight, fallingBLight) | SLOPE(outB, lastOutB, RISING_B_OUTPUT, FALLING_B_OUTPUT, risingBLight, fallingBLight) | ||||
// Analog logic processor | // Analog logic processor | ||||
float balance = params[BALANCE_PARAM]; | |||||
float balance = params[BALANCE_PARAM].value; | |||||
const float balancePower = 0.5; | const float balancePower = 0.5; | ||||
outA *= powf(1.0 - balance, balancePower); | outA *= powf(1.0 - balance, balancePower); | ||||
outB *= powf(balance, balancePower); | outB *= powf(balance, balancePower); | ||||
float max = fmaxf(outA, outB); | float max = fmaxf(outA, outB); | ||||
float min = fminf(outA, outB); | float min = fminf(outA, outB); | ||||
float comparator = outB > outA ? 10.0 : 0.0; | float comparator = outB > outA ? 10.0 : 0.0; | ||||
setf(outputs[MAX_OUTPUT], max); | |||||
setf(outputs[MIN_OUTPUT], min); | |||||
setf(outputs[COMPARATOR_OUTPUT], comparator); | |||||
outputs[MAX_OUTPUT].value = max; | |||||
outputs[MIN_OUTPUT].value = min; | |||||
outputs[COMPARATOR_OUTPUT].value = comparator; | |||||
maxLight = max / 10.0; | maxLight = max / 10.0; | ||||
minLight = min / 10.0; | minLight = min / 10.0; | ||||
comparatorLight = comparator / 20.0; | comparatorLight = comparator / 20.0; | ||||
@@ -21,20 +21,14 @@ struct SlewLimiter : Module { | |||||
float out = 0.0; | float out = 0.0; | ||||
SlewLimiter(); | |||||
SlewLimiter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} | |||||
void step(); | void step(); | ||||
}; | }; | ||||
::SlewLimiter::SlewLimiter() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
} | |||||
void ::SlewLimiter::step() { | void ::SlewLimiter::step() { | ||||
float in = getf(inputs[IN_INPUT]); | |||||
float shape = params[SHAPE_PARAM]; | |||||
float in = inputs[IN_INPUT].value; | |||||
float shape = params[SHAPE_PARAM].value; | |||||
// minimum and maximum slopes in volts per second | // minimum and maximum slopes in volts per second | ||||
const float slewMin = 0.1; | const float slewMin = 0.1; | ||||
@@ -44,7 +38,7 @@ void ::SlewLimiter::step() { | |||||
// Rise | // Rise | ||||
if (in > out) { | if (in > out) { | ||||
float rise = getf(inputs[RISE_INPUT]) + params[RISE_PARAM]; | |||||
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) / gSampleRate; | ||||
if (out > in) | if (out > in) | ||||
@@ -52,14 +46,14 @@ void ::SlewLimiter::step() { | |||||
} | } | ||||
// Fall | // Fall | ||||
else if (in < out) { | else if (in < out) { | ||||
float fall = getf(inputs[FALL_INPUT]) + params[FALL_PARAM]; | |||||
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) / gSampleRate; | ||||
if (out < in) | if (out < in) | ||||
out = in; | out = in; | ||||
} | } | ||||
setf(outputs[OUT_OUTPUT], out); | |||||
outputs[OUT_OUTPUT].value = out; | |||||
} | } | ||||
@@ -175,11 +175,7 @@ struct SpringReverb : Module { | |||||
}; | }; | ||||
SpringReverb::SpringReverb() { | |||||
params.resize(NUM_PARAMS); | |||||
inputs.resize(NUM_INPUTS); | |||||
outputs.resize(NUM_OUTPUTS); | |||||
SpringReverb::SpringReverb() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) { | |||||
convolver = new RealTimeConvolver(BLOCKSIZE); | convolver = new RealTimeConvolver(BLOCKSIZE); | ||||
convolver->setKernel(springReverbIR, springReverbIRLen); | convolver->setKernel(springReverbIR, springReverbIRLen); | ||||
} | } | ||||
@@ -189,16 +185,16 @@ SpringReverb::~SpringReverb() { | |||||
} | } | ||||
void SpringReverb::step() { | void SpringReverb::step() { | ||||
float in1 = getf(inputs[IN1_INPUT]); | |||||
float in2 = getf(inputs[IN2_INPUT]); | |||||
float in1 = inputs[IN1_INPUT].value; | |||||
float in2 = inputs[IN2_INPUT].value; | |||||
const float levelScale = 0.030; | const float levelScale = 0.030; | ||||
const float levelBase = 25.0; | const float levelBase = 25.0; | ||||
float level1 = levelScale * exponentialBipolar(levelBase, params[LEVEL1_PARAM]) * getf(inputs[CV1_INPUT], 10.0) / 10.0; | |||||
float level2 = levelScale * exponentialBipolar(levelBase, params[LEVEL2_PARAM]) * getf(inputs[CV2_INPUT], 10.0) / 10.0; | |||||
float level1 = levelScale * exponentialBipolar(levelBase, params[LEVEL1_PARAM].value) * inputs[CV1_INPUT].normalize(10.0) / 10.0; | |||||
float level2 = levelScale * exponentialBipolar(levelBase, params[LEVEL2_PARAM].value) * inputs[CV2_INPUT].normalize(10.0) / 10.0; | |||||
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]) / gSampleRate; | |||||
float dryCutoff = 200.0 * powf(20.0, params[HPF_PARAM].value) / gSampleRate; | |||||
dryFilter.setCutoff(dryCutoff); | dryFilter.setCutoff(dryCutoff); | ||||
dryFilter.process(dry); | dryFilter.process(dry); | ||||
@@ -239,11 +235,11 @@ void SpringReverb::step() { | |||||
if (outputBuffer.empty()) | if (outputBuffer.empty()) | ||||
return; | return; | ||||
float wet = outputBuffer.shift().samples[0]; | float wet = outputBuffer.shift().samples[0]; | ||||
float crossfade = clampf(params[WET_PARAM] + getf(inputs[MIX_CV_INPUT]) / 10.0, 0.0, 1.0); | |||||
float crossfade = clampf(params[WET_PARAM].value + inputs[MIX_CV_INPUT].value / 10.0, 0.0, 1.0); | |||||
float mix = crossf(in1, wet, crossfade); | float mix = crossf(in1, wet, crossfade); | ||||
setf(outputs[WET_OUTPUT], clampf(wet, -10.0, 10.0)); | |||||
setf(outputs[MIX_OUTPUT], clampf(mix, -10.0, 10.0)); | |||||
outputs[WET_OUTPUT].value =clampf(wet, -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 / gSampleRate; | ||||