diff --git a/plugin/chassis.cpp b/plugin/chassis.cpp index b3d440f..b83f45e 100644 --- a/plugin/chassis.cpp +++ b/plugin/chassis.cpp @@ -27,20 +27,37 @@ Chassis::Chassis() : Plugin(kParameterCount, 0, 0) { // one parameter, no progr void Chassis::initParameter(uint32_t index, Parameter ¶meter) { switch (index) { - case k_saw: + case k_saw: parameter.hints = kParameterIsAutomatable | kParameterIsBoolean; parameter.name = "Saw"; parameter.symbol = "saw"; parameter.ranges.min = 0.0f; parameter.ranges.max = 127.0f; parameter.ranges.def = 0.0f; + break; + + case k_sqr: + parameter.hints = kParameterIsAutomatable | kParameterIsBoolean; + parameter.name = "Square"; + parameter.symbol = "sqr"; + parameter.ranges.min = 0.0f; + parameter.ranges.max = 127.0f; + parameter.ranges.def = 0.0f; + break; } + } void Chassis::setParameterValue(uint32_t index, float value) { switch (index) { case k_saw: s.p.saw = value / 127.0f; + break; + case k_sqr: + s.p.sqr = value / 127.0f; + break; + + } } diff --git a/plugin/chassis.hpp b/plugin/chassis.hpp index 4ab8302..0280a8e 100644 --- a/plugin/chassis.hpp +++ b/plugin/chassis.hpp @@ -30,6 +30,7 @@ class Chassis : public Plugin { public: enum Parameters { k_saw, + k_sqr, kParameterCount }; diff --git a/plugin/voice.cpp b/plugin/voice.cpp index 04e1bdd..e811c1a 100644 --- a/plugin/voice.cpp +++ b/plugin/voice.cpp @@ -55,39 +55,14 @@ void Voice::off() { } void Voice::run(Synth &s, float *buffer, uint32_t samples) { - float y, t; - env = ((target - env) * 0.1) + env; + float y; + env = ((target - env) * 0.01) + env; for (uint32_t i = 0; i < samples; i++) { - - // prepare the delay slot - out = delay; - delay = 0; phase += omega; - //delay = 1-(2*phase); + if (phase > 1) phase -= 1; + y = (2 * phase) - 1; + y -= blep(phase, omega); - if (phase > 1.0f) { - phase -= 1.0f; - - t = phase / omega; - out -= (t*t*t) - 0.5 * (t*t*t*t); - //delay -= (2 * t) - (t * t) - 1; - - t = 1-(phase / omega); - delay = (t*t*t) - 0.5 * (t*t*t*t); - //out -= (2*t) + (t*t) + 1; - - } - - delay += (phase); - - -y = 0.5 * (out-0.5) * env;// * s.p.saw; - - - - - // y -= blep(phase, omega); - - buffer[i] += y;// (0.25 * y * env) * s.p.saw; + buffer[i] += (0.25 * y * env) * s.p.saw; } }