From 9df7efea1d2bd2d8d82e88687b9d6e68b076e78c Mon Sep 17 00:00:00 2001 From: lnd3 Date: Wed, 4 Sep 2024 01:18:21 +0200 Subject: [PATCH] Fix lp filter and test. --- packages/nodegraph/source/common/NodeGraphOperations.cpp | 4 ++-- packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nodegraph/source/common/NodeGraphOperations.cpp b/packages/nodegraph/source/common/NodeGraphOperations.cpp index 93223301..b824ee61 100644 --- a/packages/nodegraph/source/common/NodeGraphOperations.cpp +++ b/packages/nodegraph/source/common/NodeGraphOperations.cpp @@ -255,11 +255,11 @@ namespace l::nodegraph { void GraphFilterLowpass::Process(std::vector& inputs, std::vector& 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; diff --git a/packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp b/packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp index d669cbab..3f33f159 100644 --- a/packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp +++ b/packages/nodegraph/tests/common/NodeGraphSchemaTest.cpp @@ -96,7 +96,7 @@ TEST(NodeGraph, FilterLowpass) { NodeGraph nodeLowpass; float cutoff = 0.8f; - float resonance = 0.1f; + float resonance = 0.9f; float input = 1.3f; nodeLowpass.SetInput(0, &cutoff);