Browse Source

Add parameter labels and scaling.

tags/v1.0.1
Andrew Belt 5 years ago
parent
commit
0c433b4124
4 changed files with 30 additions and 42 deletions
  1. +12
    -12
      src/LFO.cpp
  2. +7
    -6
      src/Scope.cpp
  3. +9
    -22
      src/VCF.cpp
  4. +2
    -2
      src/VCO.cpp

+ 12
- 12
src/LFO.cpp View File

@@ -106,13 +106,13 @@ struct LFO : Module {

LFO() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(OFFSET_PARAM, 0.f, 1.f, 1.f);
configParam(INVERT_PARAM, 0.f, 1.f, 1.f);
configParam(FREQ_PARAM, -8.f, 10.f, 1.f);
configParam(FM1_PARAM, 0.f, 1.f, 0.f);
configParam(PW_PARAM, 0.f, 1.f, 0.5f);
configParam(FM2_PARAM, 0.f, 1.f, 0.f);
configParam(PWM_PARAM, 0.f, 1.f, 0.f);
configParam(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset");
configParam(INVERT_PARAM, 0.f, 1.f, 1.f, "Invert");
configParam(FREQ_PARAM, -8.f, 10.f, 1.f, "Frequency", " Hz", 2, 1);
configParam(FM1_PARAM, 0.f, 1.f, 0.f, "Frequency modulation 1", "%", 0.f, 100.f);
configParam(PW_PARAM, 0.f, 1.f, 0.5f, "Pulse width", "%", 0.f, 100.f);
configParam(FM2_PARAM, 0.f, 1.f, 0.f, "Frequency modulation 2", "%", 0.f, 100.f);
configParam(PWM_PARAM, 0.f, 1.f, 0.f, "Pulse width modulation", "%", 0.f, 100.f);
lightDivider.setDivision(16);
}

@@ -259,11 +259,11 @@ struct LFO2 : Module {

LFO2() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(OFFSET_PARAM, 0.f, 1.f, 1.f);
configParam(INVERT_PARAM, 0.f, 1.f, 1.f);
configParam(FREQ_PARAM, -8.f, 10.f, 1.f);
configParam(WAVE_PARAM, 0.f, 3.f, 1.5f);
configParam(FM_PARAM, 0.f, 1.f, 0.5f);
configParam(OFFSET_PARAM, 0.f, 1.f, 1.f, "Offset");
configParam(INVERT_PARAM, 0.f, 1.f, 1.f, "Invert");
configParam(FREQ_PARAM, -8.f, 10.f, 1.f, "Frequency", " Hz", 2, 1);
configParam(WAVE_PARAM, 0.f, 3.f, 1.5f, "Wave");
configParam(FM_PARAM, 0.f, 1.f, 0.5f, "Frequency modulation", "%", 0.f, 100.f);
lightDivider.setDivision(16);
}



+ 7
- 6
src/Scope.cpp View File

@@ -49,13 +49,14 @@ struct Scope : Module {

Scope() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(X_SCALE_PARAM, -2.f, 8.f, 0.f);
configParam(X_POS_PARAM, -10.f, 10.f, 0.f);
configParam(Y_SCALE_PARAM, -2.f, 8.f, 0.f);
configParam(Y_POS_PARAM, -10.f, 10.f, 0.f);
configParam(TIME_PARAM, 6.f, 16.f, 14.f);
configParam(X_SCALE_PARAM, -2.f, 8.f, 0.f, "X scale", " V/div", 1/2.f, 5);
configParam(X_POS_PARAM, -10.f, 10.f, 0.f, "X position", " V");
configParam(Y_SCALE_PARAM, -2.f, 8.f, 0.f, "Y scale", " V/div", 1/2.f, 5);
configParam(Y_POS_PARAM, -10.f, 10.f, 0.f, "Y position", " V");
const float timeBase = (float) BUFFER_SIZE / 6;
configParam(TIME_PARAM, 6.f, 16.f, 14.f, "Time", " ms/div", 1/2.f, 1000 * timeBase);
configParam(LISSAJOUS_PARAM, 0.f, 1.f, 0.f);
configParam(TRIG_PARAM, -10.f, 10.f, 0.f);
configParam(TRIG_PARAM, -10.f, 10.f, 0.f, "Trigger position", " V");
configParam(EXTERNAL_PARAM, 0.f, 1.f, 0.f);
}



+ 9
- 22
src/VCF.cpp View File

@@ -32,7 +32,7 @@ struct LadderFilter {
}

void setCutoff(T cutoff) {
omega0 = 2*M_PI * cutoff;
omega0 = 2 * T(M_PI) * cutoff;
}

void process(T input, T dt) {
@@ -93,11 +93,12 @@ struct VCF : Module {

VCF() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS);
configParam(FREQ_PARAM, 0.f, 1.f, 0.5f, "Frequency");
// Multiply and offset for backward patch compatibility
configParam(FREQ_PARAM, 0.f, 1.f, 0.5f, "Frequency", " Hz", std::pow(2, 10.f), dsp::FREQ_C4 / std::pow(2, 5.f));
configParam(FINE_PARAM, 0.f, 1.f, 0.5f, "Fine frequency");
configParam(RES_PARAM, 0.f, 1.f, 0.f, "Resonance");
configParam(FREQ_CV_PARAM, -1.f, 1.f, 0.f, "Frequency modulation");
configParam(DRIVE_PARAM, 0.f, 1.f, 0.f, "Drive");
configParam(RES_PARAM, 0.f, 1.f, 0.f, "Resonance", "%", 0.f, 100.f);
configParam(FREQ_CV_PARAM, -1.f, 1.f, 0.f, "Frequency modulation", "%", 0.f, 100.f);
configParam(DRIVE_PARAM, 0.f, 1.f, 0.f, "Drive", "", 0, 11);
}

void onReset() override {
@@ -127,11 +128,7 @@ struct VCF : Module {
float_4 input = float_4::load(inputs[IN_INPUT].getVoltages(c)) / 5.f;

// Drive gain
float_4 drive = driveParam;
if (inputs[DRIVE_INPUT].isPolyphonic())
drive += float_4::load(inputs[DRIVE_INPUT].getVoltages(c)) / 10.f;
else
drive += inputs[DRIVE_INPUT].getVoltage() / 10.f;
float_4 drive = driveParam + inputs[DRIVE_INPUT].getPolyVoltageSimd<float_4>(c) / 10.f;
drive = clamp(drive, 0.f, 1.f);
float_4 gain = simd::pow(1.f + drive, 5);
input *= gain;
@@ -140,22 +137,12 @@ struct VCF : Module {
input += 1e-6f * (2.f * random::uniform() - 1.f);

// Set resonance
float_4 resonance = resParam;
if (inputs[RES_INPUT].isPolyphonic())
resonance += float_4::load(inputs[RES_INPUT].getVoltages(c)) / 10.f;
else
resonance += inputs[RES_INPUT].getVoltage() / 10.f;
float_4 resonance = resParam + inputs[RES_INPUT].getPolyVoltageSimd<float_4>(c) / 10.f;
resonance = clamp(resonance, 0.f, 1.f);
filter->resonance = simd::pow(resonance, 2) * 10.f;

// Get pitch
float_4 pitch = 0.f;
if (inputs[FREQ_INPUT].isPolyphonic())
pitch += float_4::load(inputs[FREQ_INPUT].getVoltages(c)) * freqCvParam;
else
pitch += inputs[FREQ_INPUT].getVoltage() * freqCvParam;
pitch += freqParam;
pitch += fineParam;
float_4 pitch = freqParam + fineParam + inputs[FREQ_INPUT].getPolyVoltageSimd<float_4>(c) * freqCvParam;
// Set cutoff
float_4 cutoff = dsp::FREQ_C4 * simd::pow(2.f, pitch);
cutoff = clamp(cutoff, 1.f, 8000.f);


+ 2
- 2
src/VCO.cpp View File

@@ -199,7 +199,7 @@ struct VCO : Module {
configParam(SYNC_PARAM, 0.f, 1.f, 1.f, "Hard sync");
configParam(FREQ_PARAM, -54.f, 54.f, 0.f, "Frequency", " Hz", dsp::FREQ_SEMITONE, dsp::FREQ_C4);
configParam(FINE_PARAM, -1.f, 1.f, 0.f, "Fine frequency");
configParam(FM_PARAM, 0.f, 1.f, 0.f, "Frequency modulation");
configParam(FM_PARAM, 0.f, 1.f, 0.f, "Frequency modulation", "%", 0.f, 100.f);
configParam(PW_PARAM, 0.f, 1.f, 0.5f, "Pulse width", "%", 0.f, 100.f);
configParam(PWM_PARAM, 0.f, 1.f, 0.f, "Pulse width modulation", "%", 0.f, 100.f);
}
@@ -305,7 +305,7 @@ struct VCO2 : Module {
configParam(SYNC_PARAM, 0.f, 1.f, 1.f, "Hard sync");
configParam(FREQ_PARAM, -54.f, 54.f, 0.f, "Frequency", " Hz", dsp::FREQ_SEMITONE, dsp::FREQ_C4);
configParam(WAVE_PARAM, 0.f, 3.f, 1.5f, "Wave");
configParam(FM_PARAM, 0.f, 1.f, 0.f, "Frequency modulation");
configParam(FM_PARAM, 0.f, 1.f, 0.f, "Frequency modulation", "%", 0.f, 100.f);
}

void process(const ProcessArgs &args) override {


Loading…
Cancel
Save