Skip to content

Commit 9df7efe

Browse files
committed
Fix lp filter and test.
1 parent 4d813c0 commit 9df7efe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/nodegraph/source/common/NodeGraphOperations.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ namespace l::nodegraph {
255255

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

261261
cutoff *= cutoff;
262-
float rc = resonance * cutoff;
262+
float rc = 1.0f - resonance * cutoff;
263263

264264
mState0 = rc * mState0 - cutoff * (mState1 + inputValue);
265265
mState1 = rc * mState1 + cutoff * mState0;

packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ TEST(NodeGraph, FilterLowpass) {
9696
NodeGraph<GraphFilterLowpass> nodeLowpass;
9797

9898
float cutoff = 0.8f;
99-
float resonance = 0.1f;
99+
float resonance = 0.9f;
100100
float input = 1.3f;
101101

102102
nodeLowpass.SetInput(0, &cutoff);

0 commit comments

Comments
 (0)