@@ -97,7 +97,13 @@ struct ADEnvelope { | |||||
stage = STAGE_OFF; | stage = STAGE_OFF; | ||||
env = envLinear = 0.0f; | 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: | private: | ||||
@@ -58,6 +58,7 @@ struct Kickall : Module { | |||||
configParam(BEND_PARAM, 0.f, 1.f, 0.f, "Pitch envelope attenuator"); | configParam(BEND_PARAM, 0.f, 1.f, 0.f, "Pitch envelope attenuator"); | ||||
volume.attackTime = 0.01; | volume.attackTime = 0.01; | ||||
volume.attackShape = 0.5; | |||||
volume.decayShape = 3.0; | volume.decayShape = 3.0; | ||||
pitch.attackTime = 0.00165; | pitch.attackTime = 0.00165; | ||||
pitch.decayShape = 3.0; | pitch.decayShape = 3.0; | ||||
@@ -75,8 +76,8 @@ struct Kickall : Module { | |||||
// TODO: check values | // TODO: check values | ||||
if (trigger.process(inputs[TRIGG_INPUT].getVoltage() / 2.0f + params[TRIGG_BUTTON_PARAM].getValue() * 10.0)) { | 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); | const float vcaGain = clamp(inputs[VOLUME_INPUT].getNormalVoltage(10.f) / 10.f, 0.f, 1.0f); | ||||
@@ -83,7 +83,7 @@ struct Percall : Module { | |||||
for (int i = 0; i < 4; i++) { | 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))) { | 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 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) { | if ((i % 2) && params[CHOKE_PARAMS + i / 2].getValue() && envs[i - 1].stage == ADEnvelope::STAGE_ATTACK) { | ||||