Browse Source

Update to Rack v1 API

tags/v1.0.1
Andrew Belt 5 years ago
parent
commit
0c7a04aaf4
2 changed files with 28 additions and 16 deletions
  1. +2
    -2
      src/VCA.cpp
  2. +26
    -14
      src/VCO.cpp

+ 2
- 2
src/VCA.cpp View File

@@ -111,7 +111,7 @@ struct VCA_1VUKnob : Knob {
}

void draw(NVGcontext *vg) override {
if (!quantity)
if (!paramQuantity)
return;
float lastCv = module ? module->lastCv : 1.f;

@@ -125,7 +125,7 @@ struct VCA_1VUKnob : Knob {
Rect r = box.zeroPos().grow(margin);

for (int i = 0; i < segs; i++) {
float value = quantity->getValue();
float value = paramQuantity->getValue();
float segValue = clamp(value * segs - (segs - i - 1), 0.f, 1.f);
float amplitude = value * lastCv;
float segAmplitude = clamp(amplitude * segs - (segs - i - 1), 0.f, 1.f);


+ 26
- 14
src/VCO.cpp View File

@@ -194,14 +194,21 @@ struct VCO : Module {
VoltageControlledOscillator<16, 16> oscillator;

VCO() {
setup(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
params[MODE_PARAM].setup(0.f, 1.f, 1.f, "Mode");
params[SYNC_PARAM].setup(0.f, 1.f, 1.f, "Sync");
params[FREQ_PARAM].setup(-54.0f, 54.0f, 0.0f, "Frequency", " Hz", std::pow(2, 1/12.f), dsp::FREQ_C4);
params[FINE_PARAM].setup(-1.0f, 1.0f, 0.0f, "Fine frequency");
params[FM_PARAM].setup(0.0f, 1.0f, 0.0f, "Frequency modulation");
params[PW_PARAM].setup(0.0f, 1.0f, 0.5f, "Pulse width", "%", 0.f, 100.f);
params[PWM_PARAM].setup(0.0f, 1.0f, 0.0f, "Pulse width modulation", "%", 0.f, 100.f);
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
params[MODE_PARAM].config(0.f, 1.f, 1.f);
paramInfos[MODE_PARAM].config("Mode");
params[SYNC_PARAM].config(0.f, 1.f, 1.f);
paramInfos[SYNC_PARAM].config("Sync");
params[FREQ_PARAM].config(-54.0f, 54.0f, 0.0f);
paramInfos[FREQ_PARAM].config("Frequency", " Hz", std::pow(2, 1/12.f), dsp::FREQ_C4);
params[FINE_PARAM].config(-1.0f, 1.0f, 0.0f);
paramInfos[FINE_PARAM].config("Fine frequency");
params[FM_PARAM].config(0.0f, 1.0f, 0.0f);
paramInfos[FM_PARAM].config("Frequency modulation");
params[PW_PARAM].config(0.0f, 1.0f, 0.5f);
paramInfos[PW_PARAM].config("Pulse width", "%", 0.f, 100.f);
params[PWM_PARAM].config(0.0f, 1.0f, 0.0f);
paramInfos[PWM_PARAM].config("Pulse width modulation", "%", 0.f, 100.f);
}
void step() override;
};
@@ -303,12 +310,17 @@ struct VCO2 : Module {
VoltageControlledOscillator<8, 8> oscillator;

VCO2() {
setup(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
params[MODE_PARAM].setup(0.f, 1.f, 1.f, "Mode");
params[SYNC_PARAM].setup(0.f, 1.f, 1.f, "Sync");
params[FREQ_PARAM].setup(-54.0f, 54.0f, 0.0f, "Frequency", " Hz", std::pow(2, 1/12.f), dsp::FREQ_C4);
params[WAVE_PARAM].setup(0.0f, 3.0f, 1.5f, "Wave");
params[FM_PARAM].setup(0.0f, 1.0f, 0.0f, "Frequency modulation");
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
params[MODE_PARAM].config(0.f, 1.f, 1.f);
paramInfos[MODE_PARAM].config("Mode");
params[SYNC_PARAM].config(0.f, 1.f, 1.f);
paramInfos[SYNC_PARAM].config("Sync");
params[FREQ_PARAM].config(-54.0f, 54.0f, 0.0f);
paramInfos[FREQ_PARAM].config("Frequency", " Hz", std::pow(2, 1/12.f), dsp::FREQ_C4);
params[WAVE_PARAM].config(0.0f, 3.0f, 1.5f);
paramInfos[WAVE_PARAM].config("Wave");
params[FM_PARAM].config(0.0f, 1.0f, 0.0f);
paramInfos[FM_PARAM].config("Frequency modulation");
}
void step() override;
};


Loading…
Cancel
Save