Skip to content

Commit

Permalink
update filter.d
Browse files Browse the repository at this point in the history
  • Loading branch information
ZILtoid1991 committed May 27, 2024
1 parent adabd82 commit fe18515
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pixelperfectengine/src/pixelperfectengine/audio/base/filter.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ public struct IIRBank {
}
}
}
/**
* Defines a filter primarily designed for certan control values (volume, etc) to stop them
* from introducing unwanted noise to the output signal.
* Filter formula: y_n0 = x * (1 - a) + y_n1 * (a / 3) + y_n2 * (a / 3) + y_n3 * (a / 3).
*/
public struct CtrlValFilter {
__m128 filterLine = __m128(0);
__m128 filterCoeff = __m128([1.0, 0.0, 0.0, 0.0]);
/**
* Filters the input value `targetVal` against `filterLine`, then returns the filtered
*/
pragma (inline, true)
float output(float targetVal) @nogc @safe pure nothrow {
filterLine[0] = targetVal;
Expand Down

0 comments on commit fe18515

Please sign in to comment.