Skip to content

Commit

Permalink
Add amplitude to main node. Duh
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Dec 30, 2024
1 parent 9852d51 commit e53dc04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/dsp/matrix_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ struct OutputNode : EnvelopeSupport<Patch::OutputNode>, ModulationSupport<Patch:
mech::scale_by<blockSize>(finalEnvLevel, output[0], output[1]);

// Apply main output
auto lv = level;
auto lv = std::clamp(level + levMod, 0.f, 1.f);
auto v = 1.f - velSen * (1.f - voiceValues.velocity);
lv = 0.15 * std::clamp(v * lv * lv * lv, 0.f, 1.f);
mech::scale_by<blockSize>(lv, output[0], output[1]);
Expand Down Expand Up @@ -504,6 +504,7 @@ struct OutputNode : EnvelopeSupport<Patch::OutputNode>, ModulationSupport<Patch:
#endif
}

float levMod{0.f};
float panMod{0.f};
float depthAtten{1.0};

Expand All @@ -512,6 +513,7 @@ struct OutputNode : EnvelopeSupport<Patch::OutputNode>, ModulationSupport<Patch:
depthAtten = 1.f;
attackMod = 0.f;
panMod = 0.f;
levMod = 0.f;

if (!anySources)
return;
Expand All @@ -531,6 +533,9 @@ struct OutputNode : EnvelopeSupport<Patch::OutputNode>, ModulationSupport<Patch:
case Patch::OutputNode::PAN:
panMod += d * *sourcePointers[i];
break;
case Patch::OutputNode::DIRECT:
levMod += d * *sourcePointers[i];
break;
case Patch::OutputNode::DEPTH_ATTEN:
depthAtten *= 1.0 - d * (1.0 - std::clamp(*sourcePointers[i], 0.f, 1.f));
break;
Expand Down
10 changes: 8 additions & 2 deletions src/synth/patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,15 +800,21 @@ struct Patch
{
SKIP = -1,
NONE = 0,
DIRECT = 10,
PAN = 15,
DEPTH_ATTEN = 20,

ENV_ATTACK = 40,
};

std::vector<std::pair<TargetID, std::string>> targetList{
{TargetID::NONE, "Off"}, {TargetID::SKIP, ""}, {TargetID::DEPTH_ATTEN, "Env Sens"},
{TargetID::PAN, "Pan"}, {TargetID::SKIP, ""}, {TargetID::ENV_ATTACK, "Env Attack"},
{TargetID::NONE, "Off"},
{TargetID::SKIP, ""},
{TargetID::DIRECT, "Amplitude"},
{TargetID::DEPTH_ATTEN, "Env Sens"},
{TargetID::PAN, "Pan"},
{TargetID::SKIP, ""},
{TargetID::ENV_ATTACK, "Env Attack"},
};

OutputNode()
Expand Down

0 comments on commit e53dc04

Please sign in to comment.