aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/mt32/synth.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-10-23 13:02:05 +0000
committerTorbjörn Andersson2004-10-23 13:02:05 +0000
commit4d8bc9862cac82349421270f22f9206c6b445ec8 (patch)
treeb2ceff2a6420c2154fa887ea81a32ddda18ac903 /backends/midi/mt32/synth.cpp
parent07a6802dff96d170e7bdc0811655a73a7e7220e0 (diff)
downloadscummvm-rg350-4d8bc9862cac82349421270f22f9206c6b445ec8.tar.gz
scummvm-rg350-4d8bc9862cac82349421270f22f9206c6b445ec8.tar.bz2
scummvm-rg350-4d8bc9862cac82349421270f22f9206c6b445ec8.zip
Cleanup
svn-id: r15662
Diffstat (limited to 'backends/midi/mt32/synth.cpp')
-rw-r--r--backends/midi/mt32/synth.cpp59
1 files changed, 21 insertions, 38 deletions
diff --git a/backends/midi/mt32/synth.cpp b/backends/midi/mt32/synth.cpp
index eca2cae04e..084919437d 100644
--- a/backends/midi/mt32/synth.cpp
+++ b/backends/midi/mt32/synth.cpp
@@ -94,52 +94,35 @@ int axtoi(char *str) {
return result;
}
-typedef struct {
- unsigned int length; /* size of filter */
- float *history; /* pointer to history in filter */
- float *coef; /* pointer to coefficients of filter */
-} FILTER;
-
-
-#define FILTER_SECTIONS 2 /* 2 filter sections for 24 db/oct filter */
-
-typedef struct {
- double a0, a1, a2; /* numerator coefficients */
- double b0, b1, b2; /* denominator coefficients */
-} BIQUAD;
+struct FILTER {
+ unsigned int length; // size of filter
+ float *history; // pointer to history in filter
+ float *coef; // pointer to coefficients of filter
+};
-BIQUAD ProtoCoef[FILTER_SECTIONS]; /* Filter prototype coefficients,
- 1 for each filter section */
+#define FILTER_SECTIONS 2 // 2 filter sections for 24 db/oct filter
-void prewarp(double *a0, double *a1, double *a2, double fc, double fs);
-void bilinear(
- double a0, double a1, double a2, /* numerator coefficients */
- double b0, double b1, double b2, /* denominator coefficients */
- double *k, /* overall gain factor */
- double fs, /* sampling rate */
- float *coef); /* pointer to 4 iir coefficients */
+struct BIQUAD {
+ double a0, a1, a2; // numerator coefficients
+ double b0, b1, b2; // denominator coefficients
+};
+// Filter prototype coefficients, 1 for each filter section
+BIQUAD ProtoCoef[FILTER_SECTIONS];
-/*
- * ----------------------------------------------------------
- * Pre-warp the coefficients of a numerator or denominator.
- * Note that a0 is assumed to be 1, so there is no wrapping
- * of it.
- * ----------------------------------------------------------
+/**
+ * Pre-warp the coefficients of a numerator or denominator. Note that a0 is
+ * assumed to be 1, so there is no wrapping of it.
*/
-void prewarp(
- double *a0, double *a1, double *a2,
- double fc, double fs)
-{
- double wp, pi;
- pi = 4.0 * atan(1.0);
- wp = 2.0 * fs * tan(pi * fc / fs);
+void prewarp(double *a0, double *a1, double *a2, double fc, double fs) {
+ double wp;
- *a2 = (*a2) / (wp * wp);
- *a1 = (*a1) / wp;
-}
+ wp = 2.0 * fs * tan(PI * fc / fs);
+ *a2 = (*a2) / (wp * wp);
+ *a1 = (*a1) / wp;
+}
/*
* ----------------------------------------------------------