Skip to content

Commit

Permalink
Fix lp filter and test.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuscu committed Sep 3, 2024
1 parent 4d813c0 commit 9df7efe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/nodegraph/source/common/NodeGraphOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ namespace l::nodegraph {

void GraphFilterLowpass::Process(std::vector<NodeGraphInput>& inputs, std::vector<NodeGraphOutput>& outputs) {
float cutoff = inputs.at(0).Get();
float resonance = inputs.at(1).Get();
float resonance = 1.0f - inputs.at(1).Get();
float inputValue = inputs.at(2).Get();

cutoff *= cutoff;
float rc = resonance * cutoff;
float rc = 1.0f - resonance * cutoff;

mState0 = rc * mState0 - cutoff * (mState1 + inputValue);
mState1 = rc * mState1 + cutoff * mState0;
Expand Down
2 changes: 1 addition & 1 deletion packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ TEST(NodeGraph, FilterLowpass) {
NodeGraph<GraphFilterLowpass> nodeLowpass;

float cutoff = 0.8f;
float resonance = 0.1f;
float resonance = 0.9f;
float input = 1.3f;

nodeLowpass.SetInput(0, &cutoff);
Expand Down

0 comments on commit 9df7efe

Please sign in to comment.