Browse Source

Fix incorrect behaviour in AD envelopes for non-linear shapes

tags/v1.1.0^2
hemmer 3 years ago
parent
commit
80db8f3ac6
3 changed files with 10 additions and 3 deletions
  1. +6
    -0
      src/Common.hpp
  2. +3
    -2
      src/Kickall.cpp
  3. +1
    -1
      src/Percall.cpp

+ 6
- 0
src/Common.hpp View File

@@ -97,7 +97,13 @@ struct ADEnvelope {
stage = STAGE_OFF;
env = envLinear = 0.0f;
}
}

void trigger() {
stage = ADEnvelope::STAGE_ATTACK;
// non-linear envelopes won't retrigger at the correct starting point if
// attackShape != decayShape, so we advance the linear envelope
envLinear = std::pow(env, 1.0f / attackShape);
}

private:


+ 3
- 2
src/Kickall.cpp View File

@@ -58,6 +58,7 @@ struct Kickall : Module {
configParam(BEND_PARAM, 0.f, 1.f, 0.f, "Pitch envelope attenuator");
volume.attackTime = 0.01;
volume.attackShape = 0.5;
volume.decayShape = 3.0;
pitch.attackTime = 0.00165;
pitch.decayShape = 3.0;
@@ -75,8 +76,8 @@ struct Kickall : Module {
// TODO: check values
if (trigger.process(inputs[TRIGG_INPUT].getVoltage() / 2.0f + params[TRIGG_BUTTON_PARAM].getValue() * 10.0)) {
volume.stage = ADEnvelope::STAGE_ATTACK;
pitch.stage = ADEnvelope::STAGE_ATTACK;
volume.trigger();
pitch.trigger();
}
const float vcaGain = clamp(inputs[VOLUME_INPUT].getNormalVoltage(10.f) / 10.f, 0.f, 1.0f);


+ 1
- 1
src/Percall.cpp View File

@@ -83,7 +83,7 @@ struct Percall : Module {
for (int i = 0; i < 4; i++) {
if (trigger[i].process(rescale(inputs[TRIG_INPUTS + i].getVoltage(), 0.1f, 2.f, 0.f, 1.f))) {
envs[i].stage = ADEnvelope::STAGE_ATTACK;
envs[i].trigger();
}
// if choke is enabled, and current channel is odd and left channel is in attack
if ((i % 2) && params[CHOKE_PARAMS + i / 2].getValue() && envs[i - 1].stage == ADEnvelope::STAGE_ATTACK) {


Loading…
Cancel
Save