From e3b09d597fc18eadb3c91baa7ec5a2d35fcc7e52 Mon Sep 17 00:00:00 2001 From: darkstar Date: Sat, 24 Mar 2018 23:15:53 +0100 Subject: [PATCH] Sound: Fix filter initializations (float vs. double) --- src/sound/filters.h | 124 ++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/sound/filters.h b/src/sound/filters.h index 9535417..ae60a2a 100644 --- a/src/sound/filters.h +++ b/src/sound/filters.h @@ -3,15 +3,15 @@ /* fc=350Hz */ static inline float low_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.00049713569693400649, - 0.00099427139386801299, - 0.00049713569693400649 + 0.00049713569693400649f, + 0.00099427139386801299f, + 0.00049713569693400649f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.93522955470669530000, - 0.93726236021404663000 + 1.00000000000000000000f, + -1.93522955470669530000f, + 0.93726236021404663000f }; static float y[2][NCoef+1]; /* output samples */ @@ -36,15 +36,15 @@ static inline float low_iir(int i, float NewSample) { /* fc=350Hz */ static inline float low_cut_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.96839970114733542000, - -1.93679940229467080000, - 0.96839970114733542000 + 0.96839970114733542000f, + -1.93679940229467080000f, + 0.96839970114733542000f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.93522955471202770000, - 0.93726236021916731000 + 1.00000000000000000000f, + -1.93522955471202770000f, + 0.93726236021916731000f }; static float y[2][NCoef+1]; /* output samples */ @@ -69,15 +69,15 @@ static inline float low_cut_iir(int i, float NewSample) { /* fc=3.5kHz */ static inline float high_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.72248704753064896000, - -1.44497409506129790000, - 0.72248704753064896000 + 0.72248704753064896000f, + -1.44497409506129790000f, + 0.72248704753064896000f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.36640781670578510000, - 0.52352474706139873000 + 1.00000000000000000000f, + -1.36640781670578510000f, + 0.52352474706139873000f }; static float y[2][NCoef+1]; /* output samples */ static float x[2][NCoef+1]; /* input samples */ @@ -101,15 +101,15 @@ static inline float high_iir(int i, float NewSample) { /* fc=3.5kHz */ static inline float high_cut_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.03927726802250377400, - 0.07855453604500754700, - 0.03927726802250377400 + 0.03927726802250377400f, + 0.07855453604500754700f, + 0.03927726802250377400f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.36640781666419950000, - 0.52352474703279628000 + 1.00000000000000000000f, + -1.36640781666419950000f, + 0.52352474703279628000f }; static float y[2][NCoef+1]; /* output samples */ static float x[2][NCoef+1]; /* input samples */ @@ -137,25 +137,25 @@ static inline float high_cut_iir(int i, float NewSample) { /* fc=3.2kHz */ static inline float sb_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.03356837051492005100, - 0.06713674102984010200, - 0.03356837051492005100 + 0.03356837051492005100f, + 0.06713674102984010200f, + 0.03356837051492005100f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.41898265221812010000, - 0.55326988968868285000 + 1.00000000000000000000f, + -1.41898265221812010000f, + 0.55326988968868285000f }; /* float ACoef[NCoef+1] = { - 0.17529642630084405000, - 0.17529642630084405000 + 0.17529642630084405000f, + 0.17529642630084405000f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -0.64940759319751051000 + 1.00000000000000000000f, + -0.64940759319751051000f };*/ static float y[2][NCoef+1]; /* output samples */ static float x[2][NCoef+1]; /* input samples */ @@ -184,15 +184,15 @@ static inline float sb_iir(int i, float NewSample) { /* fc=150Hz */ static inline float adgold_highpass_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.98657437157334349000, - -1.97314874314668700000, - 0.98657437157334349000 + 0.98657437157334349000f, + -1.97314874314668700000f, + 0.98657437157334349000f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.97223372919758360000, - 0.97261396931534050000 + 1.00000000000000000000f, + -1.97223372919758360000f, + 0.97261396931534050000f }; static float y[2][NCoef+1]; /* output samples */ @@ -217,15 +217,15 @@ static inline float adgold_highpass_iir(int i, float NewSample) { /* fc=150Hz */ static inline float adgold_lowpass_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.00009159473951071446, - 0.00018318947902142891, - 0.00009159473951071446 + 0.00009159473951071446f, + 0.00018318947902142891f, + 0.00009159473951071446f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.97223372919526560000, - 0.97261396931306277000 + 1.00000000000000000000f, + -1.97223372919526560000f, + 0.97261396931306277000f }; static float y[2][NCoef+1]; /* output samples */ @@ -250,15 +250,15 @@ static inline float adgold_lowpass_iir(int i, float NewSample) { /* fc=56Hz */ static inline float adgold_pseudo_stereo_iir(float NewSample) { float ACoef[NCoef+1] = { - 0.00001409030866231767, - 0.00002818061732463533, - 0.00001409030866231767 + 0.00001409030866231767f, + 0.00002818061732463533f, + 0.00001409030866231767f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.98733021473466760000, - 0.98738361004063568000 + 1.00000000000000000000f, + -1.98733021473466760000f, + 0.98738361004063568000f }; static float y[NCoef+1]; /* output samples */ @@ -283,15 +283,15 @@ static inline float adgold_pseudo_stereo_iir(float NewSample) { /* fc=3.2kHz - probably incorrect */ static inline float dss_iir(float NewSample) { float ACoef[NCoef+1] = { - 0.03356837051492005100, - 0.06713674102984010200, - 0.03356837051492005100 + 0.03356837051492005100f, + 0.06713674102984010200f, + 0.03356837051492005100f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -1.41898265221812010000, - 0.55326988968868285000 + 1.00000000000000000000f, + -1.41898265221812010000f, + 0.55326988968868285000f }; static float y[NCoef+1]; /* output samples */ @@ -318,13 +318,13 @@ static inline float dss_iir(float NewSample) { /*Basic high pass to remove DC bias. fc=10Hz*/ static inline float dac_iir(int i, float NewSample) { float ACoef[NCoef+1] = { - 0.99901119820285345000, - -0.99901119820285345000 + 0.99901119820285345000f, + -0.99901119820285345000f }; float BCoef[NCoef+1] = { - 1.00000000000000000000, - -0.99869185905052738000 + 1.00000000000000000000f, + -0.99869185905052738000f }; static float y[2][NCoef+1]; /* output samples */