-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Cavern.Filters { | ||
/// <summary> | ||
/// Simple first-order biquad filter with the option to invert the phase response. | ||
/// </summary> | ||
public abstract class PhaseSwappableBiquadFilter : BiquadFilter { | ||
/// <summary> | ||
/// Biquad filters usually achieve their effect by delaying lower frequencies. Phase swapping delays higher frequencies. | ||
/// </summary> | ||
public bool PhaseSwapped { | ||
get => phaseSwapped; | ||
set { | ||
phaseSwapped = value; | ||
Reset(CenterFreq, Q, Gain); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// State of phase swapping to be used when the filter is reset. | ||
/// </summary> | ||
protected bool phaseSwapped = false; | ||
|
||
/// <inheritdoc/> | ||
protected PhaseSwappableBiquadFilter(int sampleRate, double centerFreq) : base(sampleRate, centerFreq) { } | ||
|
||
/// <inheritdoc/> | ||
protected PhaseSwappableBiquadFilter(int sampleRate, double centerFreq, double q) : base(sampleRate, centerFreq, q) { } | ||
|
||
/// <inheritdoc/> | ||
protected PhaseSwappableBiquadFilter(int sampleRate, double centerFreq, double q, double gain) : | ||
base(sampleRate, centerFreq, q, gain) { } | ||
} | ||
} |