Browse Source

Add ExponentialSlewLimiter. Add "Poly" tag. Tweak appearance of port and cable widgets.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
c127afdf1b
5 changed files with 38 additions and 12 deletions
  1. +19
    -0
      include/dsp/filter.hpp
  2. +1
    -1
      include/engine/Light.hpp
  3. +2
    -2
      src/app/CableWidget.cpp
  4. +15
    -9
      src/app/LightWidget.cpp
  5. +1
    -0
      src/plugin.cpp

+ 19
- 0
include/dsp/filter.hpp View File

@@ -64,6 +64,25 @@ struct SlewLimiter {
};


struct ExponentialSlewLimiter {
float riseLambda = 1.f;
float fallLambda = 1.f;
float out = 0.f;

float process(float in) {
if (in > out) {
float y = out + (in - out) * riseLambda;
out = (out == y) ? in : y;
}
else if (in < out) {
float y = out + (in - out) * fallLambda;
out = (out == y) ? in : y;
}
return out;
}
};


/** Applies exponential smoothing to a signal with the ODE
dy/dt = x * lambda
*/


+ 1
- 1
include/engine/Light.hpp View File

@@ -31,7 +31,7 @@ struct Light {
// Fade out light with lambda = framerate
// Use 44.1k here to avoid the call to Engine::getSampleRate().
// This is close enough to look okay up to 96k
value += (v - value) * frames * 120.f / 44100.f;
value += (v - value) * frames * 30.f / 44100.f;
}
else {
// Immediately illuminate light


+ 2
- 2
src/app/CableWidget.cpp View File

@@ -216,7 +216,7 @@ void CableWidget::draw(const widget::DrawContext &ctx) {
// Draw opaque if mouse is hovering over a connected port
if (output->channels > 1) {
// Increase thickness if output port is polyphonic
thickness = 8;
thickness = 7;
}

if (outputPort->hovered || inputPort->hovered) {
@@ -224,7 +224,7 @@ void CableWidget::draw(const widget::DrawContext &ctx) {
}
else if (output->channels == 0) {
// Draw translucent cable if not active (i.e. 0 channels)
opacity *= 0.25;
opacity *= 0.5;
}
}
else {


+ 15
- 9
src/app/LightWidget.cpp View File

@@ -18,28 +18,34 @@ void LightWidget::drawLight(const widget::DrawContext &ctx) {
nvgCircle(ctx.vg, radius, radius, radius);

// Background
nvgFillColor(ctx.vg, bgColor);
nvgFill(ctx.vg);
if (bgColor.a > 0.0) {
nvgFillColor(ctx.vg, bgColor);
nvgFill(ctx.vg);
}

// Foreground
nvgFillColor(ctx.vg, color);
nvgFill(ctx.vg);
if (color.a > 0.0) {
nvgFillColor(ctx.vg, color);
nvgFill(ctx.vg);
}

// Border
nvgStrokeWidth(ctx.vg, 0.5);
nvgStrokeColor(ctx.vg, borderColor);
nvgStroke(ctx.vg);
if (borderColor.a > 0.0) {
nvgStrokeWidth(ctx.vg, 0.5);
nvgStrokeColor(ctx.vg, borderColor);
nvgStroke(ctx.vg);
}
}

void LightWidget::drawHalo(const widget::DrawContext &ctx) {
float radius = box.size.x / 2.0;
float oradius = radius + 15.0;
float oradius = 4.0 * radius;

nvgBeginPath(ctx.vg);
nvgRect(ctx.vg, radius - oradius, radius - oradius, 2*oradius, 2*oradius);

NVGpaint paint;
NVGcolor icol = color::mult(color, 0.08);
NVGcolor icol = color::mult(color, 0.07);
NVGcolor ocol = nvgRGB(0, 0, 0);
paint = nvgRadialGradient(ctx.vg, radius, radius, radius, oradius, icol, ocol);
nvgFillPaint(ctx.vg, paint);


+ 1
- 0
src/plugin.cpp View File

@@ -577,6 +577,7 @@ const std::vector<std::string> allowedTags = {
"VCO",
"Panning",
"Phaser",
"Poly",
"Physical Modeling",
"Quad", // The core functionality times four. If multiple channels are a requirement for the module to exist (ring modulator, mixer, etc), it is not a Quad module.
"Quantizer",


Loading…
Cancel
Save