Browse Source

Fix Scope crash and VCA-1 appearance when module is NULL

tags/v1.0.1
Andrew Belt 5 years ago
parent
commit
cf6bef9c78
2 changed files with 6 additions and 2 deletions
  1. +3
    -0
      src/Scope.cpp
  2. +3
    -2
      src/VCA.cpp

+ 3
- 0
src/Scope.cpp View File

@@ -246,6 +246,9 @@ struct ScopeDisplay : TransparentWidget {
}

void draw(NVGcontext *vg) override {
if (!module)
return;

float gainX = powf(2.0f, roundf(module->params[Scope::X_SCALE_PARAM].value));
float gainY = powf(2.0f, roundf(module->params[Scope::Y_SCALE_PARAM].value));
float offsetX = module->params[Scope::X_POS_PARAM].value;


+ 3
- 2
src/VCA.cpp View File

@@ -111,8 +111,9 @@ struct VCA_1VUKnob : Knob {
}

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

nvgBeginPath(vg);
nvgRoundedRect(vg, 0, 0, box.size.x, box.size.y, 2.0);
@@ -126,7 +127,7 @@ struct VCA_1VUKnob : Knob {
for (int i = 0; i < segs; i++) {
float value = quantity->getValue();
float segValue = clamp(value * segs - (segs - i - 1), 0.f, 1.f);
float amplitude = value * module->lastCv;
float amplitude = value * lastCv;
float segAmplitude = clamp(amplitude * segs - (segs - i - 1), 0.f, 1.f);
nvgBeginPath(vg);
nvgRect(vg, r.pos.x, r.pos.y + r.size.y / segs * i + 0.5,


Loading…
Cancel
Save