Barotrauma Client Doc
Barotrauma.Sounds.BiQuad Class Referenceabstract

Represents a biquad-filter. More...

Inheritance diagram for Barotrauma.Sounds.BiQuad:
Barotrauma.Sounds.BandpassFilter Barotrauma.Sounds.HighShelfFilter Barotrauma.Sounds.HighpassFilter Barotrauma.Sounds.LowShelfFilter Barotrauma.Sounds.LowpassFilter Barotrauma.Sounds.NotchFilter Barotrauma.Sounds.PeakFilter

Public Member Functions

float Process (float input)
 Processes a single input sample and returns the result. More...
 
void Process (float[] input)
 Processes multiple input samples. More...
 

Protected Member Functions

 BiQuad (int sampleRate, double frequency, double q, double gainDb)
 Initializes a new instance of the BiQuad class. More...
 
abstract void CalculateBiQuadCoefficients ()
 Calculates all coefficients. More...
 

Protected Attributes

double A0
 The a0 value. More...
 
double A1
 The a1 value. More...
 
double A2
 The a2 value. More...
 
double B1
 The b1 value. More...
 
double B2
 The b2 value. More...
 
readonly double _q
 The q value. More...
 
readonly double _gainDB
 The gain value in dB. More...
 
double Z1
 The z1 value. More...
 
double Z2
 The z2 value. More...
 
readonly double _frequency
 
readonly int _sampleRate
 Gets the sample rate. More...
 

Static Protected Attributes

static readonly double DefaultQ = 1.0 / Math.Sqrt(2)
 
const double DefaultGainDb = 6.0
 

Detailed Description

Represents a biquad-filter.

Definition at line 45 of file SoundFilters.cs.

Constructor & Destructor Documentation

◆ BiQuad()

Barotrauma.Sounds.BiQuad.BiQuad ( int  sampleRate,
double  frequency,
double  q,
double  gainDb 
)
protected

Initializes a new instance of the BiQuad class.

Parameters
sampleRateThe sample rate.
frequencyThe frequency.
qThe q.
Exceptions
System.ArgumentOutOfRangeExceptionsampleRate or frequency or q

Definition at line 108 of file SoundFilters.cs.

Member Function Documentation

◆ CalculateBiQuadCoefficients()

abstract void Barotrauma.Sounds.BiQuad.CalculateBiQuadCoefficients ( )
protectedpure virtual

◆ Process() [1/2]

float Barotrauma.Sounds.BiQuad.Process ( float  input)

Processes a single input sample and returns the result.

Parameters
inputThe input sample to process.
Returns
The result of the processed input sample.

Definition at line 138 of file SoundFilters.cs.

◆ Process() [2/2]

void Barotrauma.Sounds.BiQuad.Process ( float[]  input)

Processes multiple input samples.

Parameters
inputThe input samples to process.

The result of the calculation gets stored within the input array.

Definition at line 151 of file SoundFilters.cs.

Member Data Documentation

◆ _frequency

readonly double Barotrauma.Sounds.BiQuad._frequency
protected

Definition at line 85 of file SoundFilters.cs.

◆ _gainDB

readonly double Barotrauma.Sounds.BiQuad._gainDB
protected

The gain value in dB.

Definition at line 75 of file SoundFilters.cs.

◆ _q

readonly double Barotrauma.Sounds.BiQuad._q
protected

The q value.

Definition at line 71 of file SoundFilters.cs.

◆ _sampleRate

readonly int Barotrauma.Sounds.BiQuad._sampleRate
protected

Gets the sample rate.

Definition at line 90 of file SoundFilters.cs.

◆ A0

double Barotrauma.Sounds.BiQuad.A0
protected

The a0 value.

Definition at line 50 of file SoundFilters.cs.

◆ A1

double Barotrauma.Sounds.BiQuad.A1
protected

The a1 value.

Definition at line 54 of file SoundFilters.cs.

◆ A2

double Barotrauma.Sounds.BiQuad.A2
protected

The a2 value.

Definition at line 58 of file SoundFilters.cs.

◆ B1

double Barotrauma.Sounds.BiQuad.B1
protected

The b1 value.

Definition at line 62 of file SoundFilters.cs.

◆ B2

double Barotrauma.Sounds.BiQuad.B2
protected

The b2 value.

Definition at line 66 of file SoundFilters.cs.

◆ DefaultGainDb

const double Barotrauma.Sounds.BiQuad.DefaultGainDb = 6.0
staticprotected

Definition at line 93 of file SoundFilters.cs.

◆ DefaultQ

readonly double Barotrauma.Sounds.BiQuad.DefaultQ = 1.0 / Math.Sqrt(2)
staticprotected

Definition at line 92 of file SoundFilters.cs.

◆ Z1

double Barotrauma.Sounds.BiQuad.Z1
protected

The z1 value.

Definition at line 79 of file SoundFilters.cs.

◆ Z2

double Barotrauma.Sounds.BiQuad.Z2
protected

The z2 value.

Definition at line 83 of file SoundFilters.cs.