@@ -41,7 +41,7 @@ struct Mutes : Module { | |||||
// Get input | // Get input | ||||
// Inputs are normalized to the input above it, so only set if connected | // Inputs are normalized to the input above it, so only set if connected | ||||
if (inputs[IN_INPUT + i].active) { | |||||
if (inputs[IN_INPUT + i].isConnected()) { | |||||
inputs[IN_INPUT + i].getVoltages(out); | inputs[IN_INPUT + i].getVoltages(out); | ||||
channels = inputs[IN_INPUT + i].getChannels(); | channels = inputs[IN_INPUT + i].getChannels(); | ||||
} | } | ||||
@@ -125,7 +125,7 @@ struct SEQ3 : Module { | |||||
bool gateIn = false; | bool gateIn = false; | ||||
if (running) { | if (running) { | ||||
if (inputs[EXT_CLOCK_INPUT].active) { | |||||
if (inputs[EXT_CLOCK_INPUT].isConnected()) { | |||||
// External clock | // External clock | ||||
if (clockTrigger.process(inputs[EXT_CLOCK_INPUT].getVoltage())) { | if (clockTrigger.process(inputs[EXT_CLOCK_INPUT].getVoltage())) { | ||||
setIndex(index + 1); | setIndex(index + 1); | ||||
@@ -88,7 +88,7 @@ struct Scope : Module { | |||||
// Are we waiting on the next trigger? | // Are we waiting on the next trigger? | ||||
if (bufferIndex >= BUFFER_SIZE) { | if (bufferIndex >= BUFFER_SIZE) { | ||||
// Trigger immediately if external but nothing plugged in, or in Lissajous mode | // Trigger immediately if external but nothing plugged in, or in Lissajous mode | ||||
if (lissajous || (external && !inputs[TRIG_INPUT].active)) { | |||||
if (lissajous || (external && !inputs[TRIG_INPUT].isConnected())) { | |||||
bufferIndex = 0; | bufferIndex = 0; | ||||
frameIndex = 0; | frameIndex = 0; | ||||
return; | return; | ||||
@@ -279,20 +279,20 @@ struct ScopeDisplay : TransparentWidget { | |||||
// Draw waveforms | // Draw waveforms | ||||
if (module->lissajous) { | if (module->lissajous) { | ||||
// X x Y | // X x Y | ||||
if (module->inputs[Scope::X_INPUT].active || module->inputs[Scope::Y_INPUT].active) { | |||||
if (module->inputs[Scope::X_INPUT].isConnected() || module->inputs[Scope::Y_INPUT].isConnected()) { | |||||
nvgStrokeColor(args.vg, nvgRGBA(0x9f, 0xe4, 0x36, 0xc0)); | nvgStrokeColor(args.vg, nvgRGBA(0x9f, 0xe4, 0x36, 0xc0)); | ||||
drawWaveform(args, valuesX, valuesY); | drawWaveform(args, valuesX, valuesY); | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
// Y | // Y | ||||
if (module->inputs[Scope::Y_INPUT].active) { | |||||
if (module->inputs[Scope::Y_INPUT].isConnected()) { | |||||
nvgStrokeColor(args.vg, nvgRGBA(0xe1, 0x02, 0x78, 0xc0)); | nvgStrokeColor(args.vg, nvgRGBA(0xe1, 0x02, 0x78, 0xc0)); | ||||
drawWaveform(args, valuesY, NULL); | drawWaveform(args, valuesY, NULL); | ||||
} | } | ||||
// X | // X | ||||
if (module->inputs[Scope::X_INPUT].active) { | |||||
if (module->inputs[Scope::X_INPUT].isConnected()) { | |||||
nvgStrokeColor(args.vg, nvgRGBA(0x28, 0xb0, 0xf3, 0xc0)); | nvgStrokeColor(args.vg, nvgRGBA(0x28, 0xb0, 0xf3, 0xc0)); | ||||
drawWaveform(args, valuesX, NULL); | drawWaveform(args, valuesX, NULL); | ||||
} | } | ||||
@@ -43,7 +43,7 @@ struct Unity : Module { | |||||
// Inputs | // Inputs | ||||
for (int j = 0; j < 6; j++) { | for (int j = 0; j < 6; j++) { | ||||
mix[i] += inputs[IN_INPUTS + 6 * i + j].getVoltage(); | mix[i] += inputs[IN_INPUTS + 6 * i + j].getVoltage(); | ||||
if (inputs[IN_INPUTS + 6 * i + j].active) | |||||
if (inputs[IN_INPUTS + 6 * i + j].isConnected()) | |||||
count[i]++; | count[i]++; | ||||
} | } | ||||
} | } | ||||
@@ -30,10 +30,10 @@ struct VCA : Module { | |||||
void stepChannel(InputIds in, ParamIds level, InputIds lin, InputIds exp, OutputIds out) { | void stepChannel(InputIds in, ParamIds level, InputIds lin, InputIds exp, OutputIds out) { | ||||
float v = inputs[in].getVoltage() * params[level].getValue(); | float v = inputs[in].getVoltage() * params[level].getValue(); | ||||
if (inputs[lin].active) | |||||
if (inputs[lin].isConnected()) | |||||
v *= clamp(inputs[lin].getVoltage() / 10.0f, 0.0f, 1.0f); | v *= clamp(inputs[lin].getVoltage() / 10.0f, 0.0f, 1.0f); | ||||
const float expBase = 50.0f; | const float expBase = 50.0f; | ||||
if (inputs[exp].active) | |||||
if (inputs[exp].isConnected()) | |||||
v *= rescale(std::pow(expBase, clamp(inputs[exp].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f); | v *= rescale(std::pow(expBase, clamp(inputs[exp].getVoltage() / 10.0f, 0.0f, 1.0f)), 1.0f, expBase, 0.0f, 1.0f); | ||||
outputs[out].setVoltage(v); | outputs[out].setVoltage(v); | ||||
} | } | ||||
@@ -92,7 +92,7 @@ struct VCF : Module { | |||||
} | } | ||||
void process(const ProcessArgs &args) override { | void process(const ProcessArgs &args) override { | ||||
if (!outputs[LPF_OUTPUT].active && !outputs[HPF_OUTPUT].active) { | |||||
if (!outputs[LPF_OUTPUT].isConnected() && !outputs[HPF_OUTPUT].isConnected()) { | |||||
outputs[LPF_OUTPUT].setVoltage(0.f); | outputs[LPF_OUTPUT].setVoltage(0.f); | ||||
outputs[HPF_OUTPUT].setVoltage(0.f); | outputs[HPF_OUTPUT].setVoltage(0.f); | ||||
return; | return; | ||||
@@ -112,7 +112,7 @@ struct VCF : Module { | |||||
// Set cutoff frequency | // Set cutoff frequency | ||||
float pitch = 0.f; | float pitch = 0.f; | ||||
if (inputs[FREQ_INPUT].active) | |||||
if (inputs[FREQ_INPUT].isConnected()) | |||||
pitch += inputs[FREQ_INPUT].getVoltage() * dsp::quadraticBipolar(params[FREQ_CV_PARAM].getValue()); | pitch += inputs[FREQ_INPUT].getVoltage() * dsp::quadraticBipolar(params[FREQ_CV_PARAM].getValue()); | ||||
pitch += params[FREQ_PARAM].getValue() * 10.f - 5.f; | pitch += params[FREQ_PARAM].getValue() * 10.f - 5.f; | ||||
pitch += dsp::quadraticBipolar(params[FINE_PARAM].getValue() * 2.f - 1.f) * 7.f / 12.f; | pitch += dsp::quadraticBipolar(params[FINE_PARAM].getValue() * 2.f - 1.f) * 7.f / 12.f; | ||||
@@ -135,10 +135,10 @@ struct VCF : Module { | |||||
} | } | ||||
// Set outputs | // Set outputs | ||||
if (outputs[LPF_OUTPUT].active) { | |||||
if (outputs[LPF_OUTPUT].isConnected()) { | |||||
outputs[LPF_OUTPUT].setVoltage(5.f * lowpassDecimator.process(lowpassBuf)); | outputs[LPF_OUTPUT].setVoltage(5.f * lowpassDecimator.process(lowpassBuf)); | ||||
} | } | ||||
if (outputs[HPF_OUTPUT].active) { | |||||
if (outputs[HPF_OUTPUT].isConnected()) { | |||||
outputs[HPF_OUTPUT].setVoltage(5.f * highpassDecimator.process(highpassBuf)); | outputs[HPF_OUTPUT].setVoltage(5.f * highpassDecimator.process(highpassBuf)); | ||||
} | } | ||||
*/ | */ | ||||
@@ -33,13 +33,13 @@ struct VCMixer : Module { | |||||
for (int i = 0; i < 4; i++) { | for (int i = 0; i < 4; i++) { | ||||
float ch = inputs[CH_INPUT + i].getVoltage(); | float ch = inputs[CH_INPUT + i].getVoltage(); | ||||
ch *= std::pow(params[LVL_PARAM + i].getValue(), 2.f); | ch *= std::pow(params[LVL_PARAM + i].getValue(), 2.f); | ||||
if (inputs[CV_INPUT + i].active) | |||||
if (inputs[CV_INPUT + i].isConnected()) | |||||
ch *= clamp(inputs[CV_INPUT + i].getVoltage() / 10.f, 0.f, 1.f); | ch *= clamp(inputs[CV_INPUT + i].getVoltage() / 10.f, 0.f, 1.f); | ||||
outputs[CH_OUTPUT + i].setVoltage(ch); | outputs[CH_OUTPUT + i].setVoltage(ch); | ||||
mix += ch; | mix += ch; | ||||
} | } | ||||
mix *= params[MIX_LVL_PARAM].getValue(); | mix *= params[MIX_LVL_PARAM].getValue(); | ||||
if (inputs[MIX_CV_INPUT].active) | |||||
if (inputs[MIX_CV_INPUT].isConnected()) | |||||
mix *= clamp(inputs[MIX_CV_INPUT].getVoltage() / 10.f, 0.f, 1.f); | mix *= clamp(inputs[MIX_CV_INPUT].getVoltage() / 10.f, 0.f, 1.f); | ||||
outputs[MIX_OUTPUT].setVoltage(mix); | outputs[MIX_OUTPUT].setVoltage(mix); | ||||
} | } | ||||
@@ -210,23 +210,23 @@ struct VCO : Module { | |||||
float pitchFine = 3.f * dsp::quadraticBipolar(params[FINE_PARAM].getValue()); | float pitchFine = 3.f * dsp::quadraticBipolar(params[FINE_PARAM].getValue()); | ||||
float pitchCv = 12.f * inputs[PITCH_INPUT].getVoltage(); | float pitchCv = 12.f * inputs[PITCH_INPUT].getVoltage(); | ||||
if (inputs[FM_INPUT].active) { | |||||
if (inputs[FM_INPUT].isConnected()) { | |||||
pitchCv += dsp::quadraticBipolar(params[FM_PARAM].getValue()) * 12.f * inputs[FM_INPUT].getVoltage(); | pitchCv += dsp::quadraticBipolar(params[FM_PARAM].getValue()) * 12.f * inputs[FM_INPUT].getVoltage(); | ||||
} | } | ||||
oscillator.setPitch(params[FREQ_PARAM].getValue(), pitchFine + pitchCv); | oscillator.setPitch(params[FREQ_PARAM].getValue(), pitchFine + pitchCv); | ||||
oscillator.setPulseWidth(params[PW_PARAM].getValue() + params[PWM_PARAM].getValue() * inputs[PW_INPUT].getVoltage() / 10.f); | oscillator.setPulseWidth(params[PW_PARAM].getValue() + params[PWM_PARAM].getValue() * inputs[PW_INPUT].getVoltage() / 10.f); | ||||
oscillator.syncEnabled = inputs[SYNC_INPUT].active; | |||||
oscillator.syncEnabled = inputs[SYNC_INPUT].isConnected(); | |||||
oscillator.process(args.sampleTime, inputs[SYNC_INPUT].getVoltage()); | oscillator.process(args.sampleTime, inputs[SYNC_INPUT].getVoltage()); | ||||
// Set output | // Set output | ||||
if (outputs[SIN_OUTPUT].active) | |||||
if (outputs[SIN_OUTPUT].isConnected()) | |||||
outputs[SIN_OUTPUT].setVoltage(5.f * oscillator.sin()); | outputs[SIN_OUTPUT].setVoltage(5.f * oscillator.sin()); | ||||
if (outputs[TRI_OUTPUT].active) | |||||
if (outputs[TRI_OUTPUT].isConnected()) | |||||
outputs[TRI_OUTPUT].setVoltage(5.f * oscillator.tri()); | outputs[TRI_OUTPUT].setVoltage(5.f * oscillator.tri()); | ||||
if (outputs[SAW_OUTPUT].active) | |||||
if (outputs[SAW_OUTPUT].isConnected()) | |||||
outputs[SAW_OUTPUT].setVoltage(5.f * oscillator.saw()); | outputs[SAW_OUTPUT].setVoltage(5.f * oscillator.saw()); | ||||
if (outputs[SQR_OUTPUT].active) | |||||
if (outputs[SQR_OUTPUT].isConnected()) | |||||
outputs[SQR_OUTPUT].setVoltage(5.f * oscillator.sqr()); | outputs[SQR_OUTPUT].setVoltage(5.f * oscillator.sqr()); | ||||
lights[PHASE_POS_LIGHT].setSmoothBrightness(oscillator.light(), args.sampleTime); | lights[PHASE_POS_LIGHT].setSmoothBrightness(oscillator.light(), args.sampleTime); | ||||
@@ -315,7 +315,7 @@ struct VCO2 : Module { | |||||
float pitchCv = params[FREQ_PARAM].getValue() + dsp::quadraticBipolar(params[FM_PARAM].getValue()) * 12.f * inputs[FM_INPUT].getVoltage(); | float pitchCv = params[FREQ_PARAM].getValue() + dsp::quadraticBipolar(params[FM_PARAM].getValue()) * 12.f * inputs[FM_INPUT].getVoltage(); | ||||
oscillator.setPitch(0.f, pitchCv); | oscillator.setPitch(0.f, pitchCv); | ||||
oscillator.syncEnabled = inputs[SYNC_INPUT].active; | |||||
oscillator.syncEnabled = inputs[SYNC_INPUT].isConnected(); | |||||
oscillator.process(deltaTime, inputs[SYNC_INPUT].getVoltage()); | oscillator.process(deltaTime, inputs[SYNC_INPUT].getVoltage()); | ||||