Browse Source

VCO light changed to relative pitch CV, LFO light changed to sine of

phase
tags/v0.5.0
Andrew Belt 6 years ago
parent
commit
10306ace5f
2 changed files with 10 additions and 6 deletions
  1. +5
    -2
      src/LFO.cpp
  2. +5
    -4
      src/VCO.cpp

+ 5
- 2
src/LFO.cpp View File

@@ -59,6 +59,9 @@ struct LFOGenerator {
float sqr = (phase < pw) ^ invert ? 1.0 : -1.0;
return offset ? sqr + 1.0 : sqr;
}
float light() {
return sinf(2*M_PI * phase);
}
};


@@ -109,7 +112,7 @@ void LFO::step() {
outputs[SAW_OUTPUT].value = 5.0 * generator.saw();
outputs[SQR_OUTPUT].value = 5.0 * generator.sqr();

lights[0] = -1.0 + 2.0*generator.phase;
lights[0] = generator.light();
}


@@ -200,7 +203,7 @@ void LFO2::step() {
interp = crossf(generator.saw(), generator.sqr(), wave - 2.0);
outputs[INTERP_OUTPUT].value = 5.0 * interp;

lights[0] = -1.0 + 2.0*generator.phase;
lights[0] = generator.light();
}




+ 5
- 4
src/VCO.cpp View File

@@ -197,11 +197,12 @@ void VCO::step() {
oscillator.analog = params[MODE_PARAM].value > 0.0;
oscillator.soft = params[SYNC_PARAM].value <= 0.0;

float pitchCv = 12.0 * inputs[PITCH_INPUT].value + 3.0 * quadraticBipolar(params[FINE_PARAM].value);
float pitchFine = 3.0 * quadraticBipolar(params[FINE_PARAM].value);
float pitchCv = 12.0 * inputs[PITCH_INPUT].value;
if (inputs[FM_INPUT].active) {
pitchCv += quadraticBipolar(params[FM_PARAM].value) * 12.0 * inputs[FM_INPUT].value;
}
oscillator.setPitch(params[FREQ_PARAM].value, pitchCv);
oscillator.setPitch(params[FREQ_PARAM].value, pitchFine + pitchCv);
oscillator.setPulseWidth(params[PW_PARAM].value + params[PWM_PARAM].value * inputs[PW_INPUT].value / 10.0);
oscillator.syncEnabled = inputs[SYNC_INPUT].active;

@@ -217,7 +218,7 @@ void VCO::step() {
if (outputs[SQR_OUTPUT].active)
outputs[SQR_OUTPUT].value = 5.0 * oscillator.sqr();

outputs[PITCH_LIGHT].value = rescalef(oscillator.pitch, -48.0, 48.0, -1.0, 1.0);
outputs[PITCH_LIGHT].value = pitchCv / 12.0;
}


@@ -310,7 +311,7 @@ void VCO2::step() {
out = crossf(oscillator.saw(), oscillator.sqr(), wave - 2.0);
outputs[OUT_OUTPUT].value = 5.0 * out;

outputs[PITCH_LIGHT].value = rescalef(oscillator.pitch, -48.0, 48.0, -1.0, 1.0);
outputs[PITCH_LIGHT].value = pitchCv / 12.0;
}




Loading…
Cancel
Save