Browse Source

Use VUMeter in Unity

tags/v0.5.0
Andrew Belt 7 years ago
parent
commit
b6a321a8ad
2 changed files with 6 additions and 8 deletions
  1. +1
    -5
      src/8vert.cpp
  2. +5
    -3
      src/Unity.cpp

+ 1
- 5
src/8vert.cpp View File

@@ -35,11 +35,7 @@ _8vertWidget::_8vertWidget() {
_8vert *module = new _8vert(); _8vert *module = new _8vert();
setModule(module); setModule(module);
box.size = Vec(8 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT); box.size = Vec(8 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT);

SVGPanel *panel = new SVGPanel();
panel->box.size = box.size;
panel->setBackground(SVG::load(assetPlugin(plugin, "res/8vert.svg")));
addChild(panel);
setPanel(SVG::load(assetPlugin(plugin, "res/8vert.svg")));


addChild(createScrew<ScrewSilver>(Vec(15, 0))); addChild(createScrew<ScrewSilver>(Vec(15, 0)));
addChild(createScrew<ScrewSilver>(Vec(box.size.x - 30, 0))); addChild(createScrew<ScrewSilver>(Vec(box.size.x - 30, 0)));


+ 5
- 3
src/Unity.cpp View File

@@ -1,4 +1,5 @@
#include "Fundamental.hpp" #include "Fundamental.hpp"
#include "dsp/vumeter.hpp"




struct Unity : Module { struct Unity : Module {
@@ -79,10 +80,11 @@ void Unity::step() {
outputs[MIX1_OUTPUT + 2*i].value = mix[i]; outputs[MIX1_OUTPUT + 2*i].value = mix[i];
outputs[INV1_OUTPUT + 2*i].value = -mix[i]; outputs[INV1_OUTPUT + 2*i].value = -mix[i];
// Lights // Lights
float dB = logf(fabsf(mix[i] / 10.0)) / logf(20.0) * 10.0;
VUMeter vuMeter;
vuMeter.dBInterval = 6.0;
vuMeter.setValue(mix[i] / 10.0);
for (int j = 0; j < 5; j++) { for (int j = 0; j < 5; j++) {
float b = clampf(dB / 3.0 + 1 + j, 0.0, 1.0);
lights[VU1_LIGHT + 5*i + j].setBrightnessSmooth(b);
lights[VU1_LIGHT + 5*i + j].setBrightnessSmooth(vuMeter.getBrightness(j));
} }
} }
} }


Loading…
Cancel
Save