aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2010-12-16 01:25:08 +0000
committermusil <tmusil@users.sourceforge.net>2010-12-16 01:25:08 +0000
commit1eff33db5a509bab793cc4003c4a49532d4a4d65 (patch)
tree4c3297dd68b547d9690b126586084125e253a234
parent1de3651ffd54c37a2a5cc318e108b5193b6308e2 (diff)
without warning at function pointer
svn path=/trunk/externals/iemlib/; revision=14655
-rw-r--r--iemlib1/src/filter~.c748
1 files changed, 383 insertions, 365 deletions
diff --git a/iemlib1/src/filter~.c b/iemlib1/src/filter~.c
index c26b4c8..8469d58 100644
--- a/iemlib1/src/filter~.c
+++ b/iemlib1/src/filter~.c
@@ -1,7 +1,7 @@
/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
-iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008 */
+iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2010 */
#include "m_pd.h"
@@ -10,9 +10,13 @@ iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008
/* ---------- filter~ - slow dynamic filter-kernel 1. and 2. order ----------- */
-/* ---------- with double precision option ----------------------------------- */
+/* ---------- now with single and double precision option -------------------- */
-typedef struct _float_filter_para_tilde
+typedef struct _filter_tilde_sp_para t_filter_tilde_sp_para;
+
+typedef void (*filt_calc_sp_fun_ptr)(t_filter_tilde_sp_para *);
+
+struct _filter_tilde_sp_para
{
t_float wn1;// old wn of biquad recursion
t_float wn2;// two times old wn of biquad recursion
@@ -43,10 +47,14 @@ typedef struct _float_filter_para_tilde
int filter_function_is_highpass;// flag is HIGH if filter has highpass characteristic
int filter_function_is_first_order;// flag is HIGH if filter is first order
int event_mask;// a three bit mask: Bit 0 is HIGH during frequency ramp, Bit 1 is HIGH during damping ramp, Bit 2 is HIGH during frequency shift ramp
- void (*calc)();
-} t_float_filter_para_tilde;
+ filt_calc_sp_fun_ptr calc;
+};
+
+typedef struct _filter_tilde_dp_para t_filter_tilde_dp_para;
-typedef struct _double_filter_para_tilde
+typedef void (*filt_calc_dp_fun_ptr)(t_filter_tilde_dp_para*);
+
+struct _filter_tilde_dp_para
{
double wn1;// old wn of biquad recursion
double wn2;// two times old wn of biquad recursion
@@ -77,28 +85,38 @@ typedef struct _double_filter_para_tilde
int filter_function_is_highpass;// flag is HIGH if filter has highpass characteristic
int filter_function_is_first_order;// flag is HIGH if filter is first order
int event_mask;// a three bit mask: Bit 0 is HIGH during frequency ramp, Bit 1 is HIGH during damping ramp, Bit 2 is HIGH during frequency shift ramp
- void (*calc)();
-} t_double_filter_para_tilde;
+ filt_calc_dp_fun_ptr calc;
+};
+
+typedef union _filt_para
+{
+ t_filter_tilde_sp_para sp;
+ t_filter_tilde_dp_para dp;
+} t_filt_para;
typedef struct _filter_tilde
{
- t_object x_obj;
- t_float_filter_para_tilde fp;
- t_double_filter_para_tilde dp;
- int precision_d1_f0;
- void *x_debug_outlet;
- t_atom x_at[5];
- t_float x_msi;
+ t_object x_obj;
+ t_filt_para para;
+ int precision_dp1_sp0;
+ t_outlet *x_debug_outlet;
+ t_atom x_at[5];
+ t_float x_msi;
} t_filter_tilde;
static t_class *filter_tilde_class;
-static void filter_tilde_snafu(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_dummy(t_filter_tilde_sp_para *x)
+{
+
+}
+
+static void filter_tilde_dp_dummy(t_filter_tilde_dp_para *x)
{
}
-static void filter_tilde_lp1(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_lp1(t_filter_tilde_sp_para *x)
{
t_float al;
@@ -108,7 +126,7 @@ static void filter_tilde_lp1(t_float_filter_para_tilde *x)
x->b1 = (al - 1.0f)*x->a0;
}
-static void filter_tilde_lp2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_lp2(t_filter_tilde_sp_para *x)
{
t_float l, al, bl2, rcp;
@@ -123,7 +141,7 @@ static void filter_tilde_lp2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - bl2);
}
-static void filter_tilde_hp1(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_hp1(t_filter_tilde_sp_para *x)
{
t_float al, rcp;
@@ -134,7 +152,7 @@ static void filter_tilde_hp1(t_float_filter_para_tilde *x)
x->b1 = rcp*(al - 1.0f);
}
-static void filter_tilde_hp2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_hp2(t_filter_tilde_sp_para *x)
{
t_float l, al, bl2, rcp;
@@ -149,7 +167,7 @@ static void filter_tilde_hp2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - bl2);
}
-static void filter_tilde_rp2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_rp2(t_filter_tilde_sp_para *x)
{
t_float l, al, l2, rcp;
@@ -163,7 +181,7 @@ static void filter_tilde_rp2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_bp2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_bp2(t_filter_tilde_sp_para *x)
{
t_float l, al, l2, rcp;
@@ -177,7 +195,7 @@ static void filter_tilde_bp2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_bs2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_bs2(t_filter_tilde_sp_para *x)
{
t_float l, al, l2, rcp;
@@ -192,7 +210,7 @@ static void filter_tilde_bs2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_rpw2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_rpw2(t_filter_tilde_sp_para *x)
{
t_float l, al, l2, rcp;
@@ -206,7 +224,7 @@ static void filter_tilde_rpw2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_bpw2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_bpw2(t_filter_tilde_sp_para *x)
{
t_float l, al, l2, rcp;
@@ -220,7 +238,7 @@ static void filter_tilde_bpw2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_bsw2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_bsw2(t_filter_tilde_sp_para *x)
{
t_float l, al, l2, rcp;
@@ -235,7 +253,7 @@ static void filter_tilde_bsw2(t_float_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_ap1(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_ap1(t_filter_tilde_sp_para *x)
{
t_float al;
@@ -244,7 +262,7 @@ static void filter_tilde_ap1(t_float_filter_para_tilde *x)
x->b1 = -x->a0;
}
-static void filter_tilde_ap2(t_float_filter_para_tilde *x)
+static void filter_tilde_sp_ap2(t_filter_tilde_sp_para *x)
{
t_float l, al, bl2, rcp;
@@ -272,7 +290,7 @@ t_float l, al, l2, rcp;
x->b2 = rcp*(l2 - al);
}*/
-static void filter_tilde_dlp1(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_lp1(t_filter_tilde_dp_para *x)
{
double al;
@@ -282,7 +300,7 @@ static void filter_tilde_dlp1(t_double_filter_para_tilde *x)
x->b1 = (al - 1.0)*x->a0;
}
-static void filter_tilde_dlp2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_lp2(t_filter_tilde_dp_para *x)
{
double l, al, bl2, rcp;
@@ -297,7 +315,7 @@ static void filter_tilde_dlp2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - bl2);
}
-static void filter_tilde_dhp1(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_hp1(t_filter_tilde_dp_para *x)
{
double al, rcp;
@@ -308,7 +326,7 @@ static void filter_tilde_dhp1(t_double_filter_para_tilde *x)
x->b1 = rcp*(al - 1.0);
}
-static void filter_tilde_dhp2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_hp2(t_filter_tilde_dp_para *x)
{
double l, al, bl2, rcp;
@@ -323,7 +341,7 @@ static void filter_tilde_dhp2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - bl2);
}
-static void filter_tilde_drp2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_rp2(t_filter_tilde_dp_para *x)
{
double l, al, l2, rcp;
@@ -337,7 +355,7 @@ static void filter_tilde_drp2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_dbp2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_bp2(t_filter_tilde_dp_para *x)
{
double l, al, l2, rcp;
@@ -351,7 +369,7 @@ static void filter_tilde_dbp2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_dbs2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_bs2(t_filter_tilde_dp_para *x)
{
double l, al, l2, rcp;
@@ -366,7 +384,7 @@ static void filter_tilde_dbs2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_drpw2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_rpw2(t_filter_tilde_dp_para *x)
{
double l, al, l2, rcp;
@@ -380,7 +398,7 @@ static void filter_tilde_drpw2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_dbpw2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_bpw2(t_filter_tilde_dp_para *x)
{
double l, al, l2, rcp;
@@ -394,7 +412,7 @@ static void filter_tilde_dbpw2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_dbsw2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_bsw2(t_filter_tilde_dp_para *x)
{
double l, al, l2, rcp;
@@ -409,7 +427,7 @@ static void filter_tilde_dbsw2(t_double_filter_para_tilde *x)
x->b2 = rcp*(al - l2);
}
-static void filter_tilde_dap1(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_ap1(t_filter_tilde_dp_para *x)
{
double al;
@@ -418,7 +436,7 @@ static void filter_tilde_dap1(t_double_filter_para_tilde *x)
x->b1 = -x->a0;
}
-static void filter_tilde_dap2(t_double_filter_para_tilde *x)
+static void filter_tilde_dp_ap2(t_filter_tilde_dp_para *x)
{
double l, al, bl2, rcp;
@@ -432,7 +450,7 @@ static void filter_tilde_dap2(t_double_filter_para_tilde *x)
x->b2 = -x->a0;
}
-static void filter_tilde_dsp_tick(t_float_filter_para_tilde *x)
+static void filter_tilde_dsp_sp_tick(t_filter_tilde_sp_para *x)
{
if(x->event_mask)
{
@@ -528,7 +546,7 @@ static void filter_tilde_dsp_tick(t_float_filter_para_tilde *x)
}
}
-static void filter_tilde_dsp_dtick(t_double_filter_para_tilde *x)
+static void filter_tilde_dsp_dp_tick(t_filter_tilde_dp_para *x)
{
if(x->event_mask)
{
@@ -624,17 +642,17 @@ static void filter_tilde_dsp_dtick(t_double_filter_para_tilde *x)
}
}
-static t_int *filter_tilde_perform_2o(t_int *w)
+static t_int *filter_tilde_sp_perform_2o(t_int *w)
{
t_float *in = (float *)(w[1]);
t_float *out = (float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- t_float wn0, wn1=x->fp.wn1, wn2=x->fp.wn2;
- t_float a0=x->fp.a0, a1=x->fp.a1, a2=x->fp.a2;
- t_float b1=x->fp.b1, b2=x->fp.b2;
+ t_float wn0, wn1=x->para.sp.wn1, wn2=x->para.sp.wn2;
+ t_float a0=x->para.sp.a0, a1=x->para.sp.a1, a2=x->para.sp.a2;
+ t_float b1=x->para.sp.b1, b2=x->para.sp.b2;
- filter_tilde_dsp_tick(&x->fp);
+ filter_tilde_dsp_sp_tick(&x->para.sp);
for(i=0; i<n; i++)
{
wn0 = *in++ + b1*wn1 + b2*wn2;
@@ -648,8 +666,8 @@ static t_int *filter_tilde_perform_2o(t_int *w)
if(IEM_DENORMAL(wn1))
wn1 = 0.0f;
- x->fp.wn1 = wn1;
- x->fp.wn2 = wn2;
+ x->para.sp.wn1 = wn1;
+ x->para.sp.wn2 = wn2;
return(w+5);
}
/* yn0 = *out;
@@ -663,19 +681,19 @@ xn1 = xn0;
*************************
y/x = (a0 + a1*z-1 + a2*z-2)/(1 - b1*z-1 - b2*z-2);*/
-static t_int *filter_tilde_perf8_2o(t_int *w)
+static t_int *filter_tilde_sp_perf8_2o(t_int *w)
{
t_float *in = (float *)(w[1]);
t_float *out = (float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
t_float wn[10];
- t_float a0=x->fp.a0, a1=x->fp.a1, a2=x->fp.a2;
- t_float b1=x->fp.b1, b2=x->fp.b2;
+ t_float a0=x->para.sp.a0, a1=x->para.sp.a1, a2=x->para.sp.a2;
+ t_float b1=x->para.sp.b1, b2=x->para.sp.b2;
- filter_tilde_dsp_tick(&x->fp);
- wn[0] = x->fp.wn2;
- wn[1] = x->fp.wn1;
+ filter_tilde_dsp_sp_tick(&x->para.sp);
+ wn[0] = x->para.sp.wn2;
+ wn[1] = x->para.sp.wn1;
for(i=0; i<n; i+=8, in+=8, out+=8)
{
wn[2] = in[0] + b1*wn[1] + b2*wn[0];
@@ -703,22 +721,22 @@ static t_int *filter_tilde_perf8_2o(t_int *w)
if(IEM_DENORMAL(wn[1]))
wn[1] = 0.0f;
- x->fp.wn1 = wn[1];
- x->fp.wn2 = wn[0];
+ x->para.sp.wn1 = wn[1];
+ x->para.sp.wn2 = wn[0];
return(w+5);
}
-static t_int *filter_tilde_perform_1o(t_int *w)
+static t_int *filter_tilde_sp_perform_1o(t_int *w)
{
t_float *in = (float *)(w[1]);
t_float *out = (float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- t_float wn0, wn1=x->fp.wn1;
- t_float a0=x->fp.a0, a1=x->fp.a1;
- t_float b1=x->fp.b1;
+ t_float wn0, wn1=x->para.sp.wn1;
+ t_float a0=x->para.sp.a0, a1=x->para.sp.a1;
+ t_float b1=x->para.sp.b1;
- filter_tilde_dsp_tick(&x->fp);
+ filter_tilde_dsp_sp_tick(&x->para.sp);
for(i=0; i<n; i++)
{
wn0 = *in++ + b1*wn1;
@@ -729,22 +747,22 @@ static t_int *filter_tilde_perform_1o(t_int *w)
if(IEM_DENORMAL(wn1))
wn1 = 0.0f;
- x->fp.wn1 = wn1;
+ x->para.sp.wn1 = wn1;
return(w+5);
}
-static t_int *filter_tilde_perf8_1o(t_int *w)
+static t_int *filter_tilde_sp_perf8_1o(t_int *w)
{
t_float *in = (float *)(w[1]);
t_float *out = (float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
t_float wn[9];
- t_float a0=x->fp.a0, a1=x->fp.a1;
- t_float b1=x->fp.b1;
+ t_float a0=x->para.sp.a0, a1=x->para.sp.a1;
+ t_float b1=x->para.sp.b1;
- filter_tilde_dsp_tick(&x->fp);
- wn[0] = x->fp.wn1;
+ filter_tilde_dsp_sp_tick(&x->para.sp);
+ wn[0] = x->para.sp.wn1;
for(i=0; i<n; i+=8, in+=8, out+=8)
{
wn[1] = in[0] + b1*wn[0];
@@ -769,21 +787,21 @@ static t_int *filter_tilde_perf8_1o(t_int *w)
if(IEM_DENORMAL(wn[0]))
wn[0] = 0.0f;
- x->fp.wn1 = wn[0];
+ x->para.sp.wn1 = wn[0];
return(w+5);
}
-static t_int *filter_tilde_dperform_2o(t_int *w)
+static t_int *filter_tilde_dp_perform_2o(t_int *w)
{
t_float *in = (t_float *)(w[1]);
t_float *out = (t_float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- double wn0, wn1=x->dp.wn1, wn2=x->dp.wn2;
- double a0=x->dp.a0, a1=x->dp.a1, a2=x->dp.a2;
- double b1=x->dp.b1, b2=x->dp.b2;
+ double wn0, wn1=x->para.dp.wn1, wn2=x->para.dp.wn2;
+ double a0=x->para.dp.a0, a1=x->para.dp.a1, a2=x->para.dp.a2;
+ double b1=x->para.dp.b1, b2=x->para.dp.b2;
- filter_tilde_dsp_dtick(&x->dp);
+ filter_tilde_dsp_dp_tick(&x->para.dp);
for(i=0; i<n; i++)
{
wn0 = (double)(*in++) + b1*wn1 + b2*wn2;
@@ -797,8 +815,8 @@ static t_int *filter_tilde_dperform_2o(t_int *w)
// if(IEM_DENORMAL(wn1))
// wn1 = 0.0f;
- x->dp.wn1 = wn1;
- x->dp.wn2 = wn2;
+ x->para.dp.wn1 = wn1;
+ x->para.dp.wn2 = wn2;
return(w+5);
}
/* yn0 = *out;
@@ -812,19 +830,19 @@ xn1 = xn0;
*************************
y/x = (a0 + a1*z-1 + a2*z-2)/(1 - b1*z-1 - b2*z-2);*/
-static t_int *filter_tilde_dperf8_2o(t_int *w)
+static t_int *filter_tilde_dp_perf8_2o(t_int *w)
{
t_float *in = (t_float *)(w[1]);
t_float *out = (t_float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
double wn[10];
- double a0=x->dp.a0, a1=x->dp.a1, a2=x->dp.a2;
- double b1=x->dp.b1, b2=x->dp.b2;
+ double a0=x->para.dp.a0, a1=x->para.dp.a1, a2=x->para.dp.a2;
+ double b1=x->para.dp.b1, b2=x->para.dp.b2;
- filter_tilde_dsp_dtick(&x->dp);
- wn[0] = x->dp.wn2;
- wn[1] = x->dp.wn1;
+ filter_tilde_dsp_dp_tick(&x->para.dp);
+ wn[0] = x->para.dp.wn2;
+ wn[1] = x->para.dp.wn1;
for(i=0; i<n; i+=8, in+=8, out+=8)
{
wn[2] = (double)(in[0]) + b1*wn[1] + b2*wn[0];
@@ -882,22 +900,22 @@ static t_int *filter_tilde_dperf8_2o(t_int *w)
*/
- x->dp.wn1 = wn[1];
- x->dp.wn2 = wn[0];
+ x->para.dp.wn1 = wn[1];
+ x->para.dp.wn2 = wn[0];
return(w+5);
}
-static t_int *filter_tilde_dperform_1o(t_int *w)
+static t_int *filter_tilde_dp_perform_1o(t_int *w)
{
t_float *in = (t_float *)(w[1]);
t_float *out = (t_float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- double wn0, wn1=x->dp.wn1;
- double a0=x->dp.a0, a1=x->dp.a1;
- double b1=x->dp.b1;
+ double wn0, wn1=x->para.dp.wn1;
+ double a0=x->para.dp.a0, a1=x->para.dp.a1;
+ double b1=x->para.dp.b1;
- filter_tilde_dsp_dtick(&x->dp);
+ filter_tilde_dsp_dp_tick(&x->para.dp);
for(i=0; i<n; i++)
{
wn0 = (double)(*in++) + b1*wn1;
@@ -908,22 +926,22 @@ static t_int *filter_tilde_dperform_1o(t_int *w)
// if(IEM_DENORMAL(wn1))
// wn1 = 0.0f;
- x->dp.wn1 = wn1;
+ x->para.dp.wn1 = wn1;
return(w+5);
}
-static t_int *filter_tilde_dperf8_1o(t_int *w)
+static t_int *filter_tilde_dp_perf8_1o(t_int *w)
{
t_float *in = (t_float *)(w[1]);
t_float *out = (t_float *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
double wn[9];
- double a0=x->dp.a0, a1=x->dp.a1;
- double b1=x->dp.b1;
+ double a0=x->para.dp.a0, a1=x->para.dp.a1;
+ double b1=x->para.dp.b1;
- filter_tilde_dsp_dtick(&x->dp);
- wn[0] = x->dp.wn1;
+ filter_tilde_dsp_dp_tick(&x->para.dp);
+ wn[0] = x->para.dp.wn1;
for(i=0; i<n; i+=8, in+=8, out+=8)
{
wn[1] = (double)(in[0]) + b1*wn[0];
@@ -948,145 +966,145 @@ static t_int *filter_tilde_dperf8_1o(t_int *w)
// if(IEM_DENORMAL(wn[0]))
// wn[0] = 0.0f;
- x->dp.wn1 = wn[0];
+ x->para.dp.wn1 = wn[0];
return(w+5);
}
static void filter_tilde_ft4(t_filter_tilde *x, t_float t)
{
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
double dt=(double)t;
- int di = (int)((x->dp.ticks_per_interpol_time)*dt+0.49999);
+ int di = (int)((x->para.dp.ticks_per_interpol_time)*dt+0.49999);
- x->dp.interpol_time = dt;
+ x->para.dp.interpol_time = dt;
if(di <= 0)
{
- x->dp.ticks = 1;
- x->dp.rcp_ticks = 1.0;
+ x->para.dp.ticks = 1;
+ x->para.dp.rcp_ticks = 1.0;
}
else
{
- x->dp.ticks = di;
- x->dp.rcp_ticks = 1.0 / (double)di;
+ x->para.dp.ticks = di;
+ x->para.dp.rcp_ticks = 1.0 / (double)di;
}
}
else
{
- int i = (int)((x->fp.ticks_per_interpol_time)*t+0.49999f);
+ int i = (int)((x->para.sp.ticks_per_interpol_time)*t+0.49999f);
- x->fp.interpol_time = t;
+ x->para.sp.interpol_time = t;
if(i <= 0)
{
- x->fp.ticks = 1;
- x->fp.rcp_ticks = 1.0;
+ x->para.sp.ticks = 1;
+ x->para.sp.rcp_ticks = 1.0;
}
else
{
- x->fp.ticks = i;
- x->fp.rcp_ticks = 1.0 / (t_float)i;
+ x->para.sp.ticks = i;
+ x->para.sp.rcp_ticks = 1.0 / (t_float)i;
}
}
}
static void filter_tilde_ft3(t_filter_tilde *x, t_float b)
{
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
double db=(double)b;
if(db <= 0.0)
db = 0.000001;
- if(x->dp.filter_function_is_highpass)
+ if(x->para.dp.filter_function_is_highpass)
db = 1.0 / db;
- if(db != x->dp.cur_b)
+ if(db != x->para.dp.cur_b)
{
- x->dp.end_b = db;
- x->dp.counter_b = x->dp.ticks;
- x->dp.delta_b = exp(log(db/x->dp.cur_b)*x->dp.rcp_ticks);
- x->dp.event_mask |= 4;/*set event_mask_bit 2 = 1*/
+ x->para.dp.end_b = db;
+ x->para.dp.counter_b = x->para.dp.ticks;
+ x->para.dp.delta_b = exp(log(db/x->para.dp.cur_b)*x->para.dp.rcp_ticks);
+ x->para.dp.event_mask |= 4;/*set event_mask_bit 2 = 1*/
}
}
else
{
if(b <= 0.0f)
b = 0.000001f;
- if(x->fp.filter_function_is_highpass)
+ if(x->para.sp.filter_function_is_highpass)
b = 1.0f / b;
- if(b != x->fp.cur_b)
+ if(b != x->para.sp.cur_b)
{
- x->fp.end_b = b;
- x->fp.counter_b = x->fp.ticks;
- x->fp.delta_b = exp(log(b/x->fp.cur_b)*x->fp.rcp_ticks);
- x->fp.event_mask |= 4;/*set event_mask_bit 2 = 1*/
+ x->para.sp.end_b = b;
+ x->para.sp.counter_b = x->para.sp.ticks;
+ x->para.sp.delta_b = exp(log(b/x->para.sp.cur_b)*x->para.sp.rcp_ticks);
+ x->para.sp.event_mask |= 4;/*set event_mask_bit 2 = 1*/
}
}
}
static void filter_tilde_ft2(t_filter_tilde *x, t_float a)
{
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
double da=(double)a;
if(da <= 0.0)
da = 0.000001;
- if(x->dp.inlet3_is_Q1_or_damping0)
+ if(x->para.dp.inlet3_is_Q1_or_damping0)
da = 1.0 / da;
- if(x->dp.filter_function_is_highpass)
- da /= x->dp.cur_b;
- if(da != x->dp.cur_a)
+ if(x->para.dp.filter_function_is_highpass)
+ da /= x->para.dp.cur_b;
+ if(da != x->para.dp.cur_a)
{
- x->dp.end_a = da;
- x->dp.counter_a = x->dp.ticks;
- x->dp.delta_a = exp(log(da/x->dp.cur_a)*x->dp.rcp_ticks);
- x->dp.event_mask |= 2;/*set event_mask_bit 1 = 1*/
+ x->para.dp.end_a = da;
+ x->para.dp.counter_a = x->para.dp.ticks;
+ x->para.dp.delta_a = exp(log(da/x->para.dp.cur_a)*x->para.dp.rcp_ticks);
+ x->para.dp.event_mask |= 2;/*set event_mask_bit 1 = 1*/
}
}
else
{
if(a <= 0.0f)
a = 0.000001f;
- if(x->fp.inlet3_is_Q1_or_damping0)
+ if(x->para.sp.inlet3_is_Q1_or_damping0)
a = 1.0f / a;
- if(x->fp.filter_function_is_highpass)
- a /= x->fp.cur_b;
- if(a != x->fp.cur_a)
+ if(x->para.sp.filter_function_is_highpass)
+ a /= x->para.sp.cur_b;
+ if(a != x->para.sp.cur_a)
{
- x->fp.end_a = a;
- x->fp.counter_a = x->fp.ticks;
- x->fp.delta_a = exp(log(a/x->fp.cur_a)*x->fp.rcp_ticks);
- x->fp.event_mask |= 2;/*set event_mask_bit 1 = 1*/
+ x->para.sp.end_a = a;
+ x->para.sp.counter_a = x->para.sp.ticks;
+ x->para.sp.delta_a = exp(log(a/x->para.sp.cur_a)*x->para.sp.rcp_ticks);
+ x->para.sp.event_mask |= 2;/*set event_mask_bit 1 = 1*/
}
}
}
static void filter_tilde_ft1(t_filter_tilde *x, t_float f)
{
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
double df=(double)f;
if(df <= 0.0)
df = 0.000001;
- if(df != x->dp.cur_f)
+ if(df != x->para.dp.cur_f)
{
- x->dp.end_f = df;
- x->dp.counter_f = x->dp.ticks;
- x->dp.delta_f = exp(log(df/x->dp.cur_f)*x->dp.rcp_ticks);
- x->dp.event_mask |= 1;/*set event_mask_bit 0 = 1*/
+ x->para.dp.end_f = df;
+ x->para.dp.counter_f = x->para.dp.ticks;
+ x->para.dp.delta_f = exp(log(df/x->para.dp.cur_f)*x->para.dp.rcp_ticks);
+ x->para.dp.event_mask |= 1;/*set event_mask_bit 0 = 1*/
}
}
else
{
if(f <= 0.0f)
f = 0.000001f;
- if(f != x->fp.cur_f)
+ if(f != x->para.sp.cur_f)
{
- x->fp.end_f = f;
- x->fp.counter_f = x->fp.ticks;
- x->fp.delta_f = exp(log(f/x->fp.cur_f)*x->fp.rcp_ticks);
- x->fp.event_mask |= 1;/*set event_mask_bit 0 = 1*/
+ x->para.sp.end_f = f;
+ x->para.sp.counter_f = x->para.sp.ticks;
+ x->para.sp.delta_f = exp(log(f/x->para.sp.cur_f)*x->para.sp.rcp_ticks);
+ x->para.sp.event_mask |= 1;/*set event_mask_bit 0 = 1*/
}
}
}
@@ -1094,21 +1112,21 @@ static void filter_tilde_ft1(t_filter_tilde *x, t_float f)
static void filter_tilde_print(t_filter_tilde *x)
{
// post("fb1 = %g, fb2 = %g, ff1 = %g, ff2 = %g, ff3 = %g", x->b1, x->b2, x->a0, x->a1, x->a2);
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
- x->x_at[0].a_w.w_float = (t_float)x->dp.b1;
- x->x_at[1].a_w.w_float = (t_float)x->dp.b2;
- x->x_at[2].a_w.w_float = (t_float)x->dp.a0;
- x->x_at[3].a_w.w_float = (t_float)x->dp.a1;
- x->x_at[4].a_w.w_float = (t_float)x->dp.a2;
+ x->x_at[0].a_w.w_float = (t_float)x->para.dp.b1;
+ x->x_at[1].a_w.w_float = (t_float)x->para.dp.b2;
+ x->x_at[2].a_w.w_float = (t_float)x->para.dp.a0;
+ x->x_at[3].a_w.w_float = (t_float)x->para.dp.a1;
+ x->x_at[4].a_w.w_float = (t_float)x->para.dp.a2;
}
else
{
- x->x_at[0].a_w.w_float = x->fp.b1;
- x->x_at[1].a_w.w_float = x->fp.b2;
- x->x_at[2].a_w.w_float = x->fp.a0;
- x->x_at[3].a_w.w_float = x->fp.a1;
- x->x_at[4].a_w.w_float = x->fp.a2;
+ x->x_at[0].a_w.w_float = x->para.sp.b1;
+ x->x_at[1].a_w.w_float = x->para.sp.b2;
+ x->x_at[2].a_w.w_float = x->para.sp.a0;
+ x->x_at[3].a_w.w_float = x->para.sp.a1;
+ x->x_at[4].a_w.w_float = x->para.sp.a2;
}
outlet_list(x->x_debug_outlet, &s_list, 5, x->x_at);
}
@@ -1117,90 +1135,90 @@ static void filter_tilde_dsp(t_filter_tilde *x, t_signal **sp)
{
int i, n=(int)sp[0]->s_n;
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
double si, co, f;
- x->dp.pi_over_sr = 3.14159265358979323846 / (double)(sp[0]->s_sr);
- x->dp.ticks_per_interpol_time = 0.001 * (double)(sp[0]->s_sr) / (double)n;
- i = (int)((x->dp.ticks_per_interpol_time)*(x->dp.interpol_time)+0.49999);
+ x->para.dp.pi_over_sr = 3.14159265358979323846 / (double)(sp[0]->s_sr);
+ x->para.dp.ticks_per_interpol_time = 0.001 * (double)(sp[0]->s_sr) / (double)n;
+ i = (int)((x->para.dp.ticks_per_interpol_time)*(x->para.dp.interpol_time)+0.49999);
if(i <= 0)
{
- x->dp.ticks = 1;
- x->dp.rcp_ticks = 1.0;
+ x->para.dp.ticks = 1;
+ x->para.dp.rcp_ticks = 1.0;
}
else
{
- x->dp.ticks = i;
- x->dp.rcp_ticks = 1.0 / (double)i;
+ x->para.dp.ticks = i;
+ x->para.dp.rcp_ticks = 1.0 / (double)i;
}
- f = x->dp.cur_f * x->dp.pi_over_sr;
+ f = x->para.dp.cur_f * x->para.dp.pi_over_sr;
if(f < 1.0e-20)
- x->dp.cur_l = 1.0e20;
+ x->para.dp.cur_l = 1.0e20;
else if(f > 1.57079632)
- x->dp.cur_l = 0.0;
+ x->para.dp.cur_l = 0.0;
else
{
si = sin(f);
co = cos(f);
- x->dp.cur_l = co/si;
+ x->para.dp.cur_l = co/si;
}
- if(x->dp.filter_function_is_first_order)
+ if(x->para.dp.filter_function_is_first_order)
{
if(n&7)
- dsp_add(filter_tilde_dperform_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_dp_perform_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
else
- dsp_add(filter_tilde_dperf8_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_dp_perf8_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
}
else
{
if(n&7)
- dsp_add(filter_tilde_dperform_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_dp_perform_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
else
- dsp_add(filter_tilde_dperf8_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_dp_perf8_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
}
}
else
{
t_float si, co, f;
- x->fp.pi_over_sr = 3.14159265358979323846f / (t_float)(sp[0]->s_sr);
- x->fp.ticks_per_interpol_time = 0.001f * (t_float)(sp[0]->s_sr) / (t_float)n;
- i = (int)((x->fp.ticks_per_interpol_time)*(x->fp.interpol_time)+0.49999f);
+ x->para.sp.pi_over_sr = 3.14159265358979323846f / (t_float)(sp[0]->s_sr);
+ x->para.sp.ticks_per_interpol_time = 0.001f * (t_float)(sp[0]->s_sr) / (t_float)n;
+ i = (int)((x->para.sp.ticks_per_interpol_time)*(x->para.sp.interpol_time)+0.49999f);
if(i <= 0)
{
- x->fp.ticks = 1;
- x->fp.rcp_ticks = 1.0f;
+ x->para.sp.ticks = 1;
+ x->para.sp.rcp_ticks = 1.0f;
}
else
{
- x->fp.ticks = i;
- x->fp.rcp_ticks = 1.0f / (t_float)i;
+ x->para.sp.ticks = i;
+ x->para.sp.rcp_ticks = 1.0f / (t_float)i;
}
- f = x->fp.cur_f * x->fp.pi_over_sr;
+ f = x->para.sp.cur_f * x->para.sp.pi_over_sr;
if(f < 1.0e-20f)
- x->fp.cur_l = 1.0e20f;
+ x->para.sp.cur_l = 1.0e20f;
else if(f > 1.57079632f)
- x->fp.cur_l = 0.0f;
+ x->para.sp.cur_l = 0.0f;
else
{
si = sin(f);
co = cos(f);
- x->fp.cur_l = co/si;
+ x->para.sp.cur_l = co/si;
}
- if(x->fp.filter_function_is_first_order)
+ if(x->para.sp.filter_function_is_first_order)
{
if(n&7)
- dsp_add(filter_tilde_perform_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_sp_perform_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
else
- dsp_add(filter_tilde_perf8_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_sp_perf8_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
}
else
{
if(n&7)
- dsp_add(filter_tilde_perform_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_sp_perform_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
else
- dsp_add(filter_tilde_perf8_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
+ dsp_add(filter_tilde_sp_perf8_2o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
}
}
}
@@ -1225,51 +1243,51 @@ static void *filter_tilde_new(t_symbol *s, int argc, t_atom *argv)
x->x_at[3].a_type = A_FLOAT;
x->x_at[4].a_type = A_FLOAT;
- x->dp.delta_f = 0.0;
- x->dp.delta_a = 0.0;
- x->dp.delta_b = 0.0;
- x->dp.interpol_time = 0.0;
- x->dp.wn1 = 0.0;
- x->dp.wn2 = 0.0;
- x->dp.a0 = 0.0;
- x->dp.a1 = 0.0;
- x->dp.a2 = 0.0;
- x->dp.b1 = 0.0;
- x->dp.b2 = 0.0;
- x->dp.pi_over_sr = 3.14159265358979323846 / 44100.0;
- x->dp.event_mask = 1;
- x->dp.counter_f = 1;
- x->dp.counter_a = 0;
- x->dp.counter_b = 0;
- x->dp.filter_function_is_first_order = 0;
+ x->para.dp.delta_f = 0.0;
+ x->para.dp.delta_a = 0.0;
+ x->para.dp.delta_b = 0.0;
+ x->para.dp.interpol_time = 0.0;
+ x->para.dp.wn1 = 0.0;
+ x->para.dp.wn2 = 0.0;
+ x->para.dp.a0 = 0.0;
+ x->para.dp.a1 = 0.0;
+ x->para.dp.a2 = 0.0;
+ x->para.dp.b1 = 0.0;
+ x->para.dp.b2 = 0.0;
+ x->para.dp.pi_over_sr = 3.14159265358979323846 / 44100.0;
+ x->para.dp.event_mask = 1;
+ x->para.dp.counter_f = 1;
+ x->para.dp.counter_a = 0;
+ x->para.dp.counter_b = 0;
+ x->para.dp.filter_function_is_first_order = 0;
- x->fp.delta_f = 0.0f;
- x->fp.delta_a = 0.0f;
- x->fp.delta_b = 0.0f;
- x->fp.interpol_time = 0.0f;
- x->fp.wn1 = 0.0f;
- x->fp.wn2 = 0.0f;
- x->fp.a0 = 0.0f;
- x->fp.a1 = 0.0f;
- x->fp.a2 = 0.0f;
- x->fp.b1 = 0.0f;
- x->fp.b2 = 0.0f;
- x->fp.pi_over_sr = 3.14159265358979323846f / 44100.0f;
- x->fp.event_mask = 1;
- x->fp.counter_f = 1;
- x->fp.counter_a = 0;
- x->fp.counter_b = 0;
- x->fp.filter_function_is_first_order = 0;
+ x->para.sp.delta_f = 0.0f;
+ x->para.sp.delta_a = 0.0f;
+ x->para.sp.delta_b = 0.0f;
+ x->para.sp.interpol_time = 0.0f;
+ x->para.sp.wn1 = 0.0f;
+ x->para.sp.wn2 = 0.0f;
+ x->para.sp.a0 = 0.0f;
+ x->para.sp.a1 = 0.0f;
+ x->para.sp.a2 = 0.0f;
+ x->para.sp.b1 = 0.0f;
+ x->para.sp.b2 = 0.0f;
+ x->para.sp.pi_over_sr = 3.14159265358979323846f / 44100.0f;
+ x->para.sp.event_mask = 1;
+ x->para.sp.counter_f = 1;
+ x->para.sp.counter_a = 0;
+ x->para.sp.counter_b = 0;
+ x->para.sp.filter_function_is_first_order = 0;
if((argc >= 1) && IS_A_SYMBOL(argv,0))
filt_typ = atom_getsymbolarg(0, argc, argv);
if(filt_typ->s_name[0] == 'd')
- x->precision_d1_f0 = 1;
+ x->precision_dp1_sp0 = 1;
else
- x->precision_d1_f0 = 0;
+ x->precision_dp1_sp0 = 0;
- if(x->precision_d1_f0)
+ if(x->precision_dp1_sp0)
{
double si, co, f=0.0, a=0.0, b=0.0, interpol=0.0;
@@ -1280,17 +1298,17 @@ static void *filter_tilde_new(t_symbol *s, int argc, t_atom *argv)
b = (double)atom_getfloatarg(3, argc, argv);
interpol = (double)atom_getfloatarg(4, argc, argv);
}
- x->dp.cur_f = f;
- f *= x->dp.pi_over_sr;
+ x->para.dp.cur_f = f;
+ f *= x->para.dp.pi_over_sr;
if(f < 1.0e-20)
- x->dp.cur_l = 1.0e20;
+ x->para.dp.cur_l = 1.0e20;
else if(f > 1.57079632)
- x->dp.cur_l = 0.0;
+ x->para.dp.cur_l = 0.0;
else
{
si = sin(f);
co = cos(f);
- x->dp.cur_l = co/si;
+ x->para.dp.cur_l = co/si;
}
if(a <= 0.0)
a = 0.000001;
@@ -1299,128 +1317,128 @@ static void *filter_tilde_new(t_symbol *s, int argc, t_atom *argv)
if(interpol <= 0.0)
interpol = 0.0;
- x->dp.interpol_time = interpol;
- x->dp.ticks_per_interpol_time = 0.001 * 44100.0 / 64.0;
- i = (int)((x->dp.ticks_per_interpol_time)*(x->dp.interpol_time)+0.49999);
+ x->para.dp.interpol_time = interpol;
+ x->para.dp.ticks_per_interpol_time = 0.001 * 44100.0 / 64.0;
+ i = (int)((x->para.dp.ticks_per_interpol_time)*(x->para.dp.interpol_time)+0.49999);
if(i <= 0)
{
- x->dp.ticks = 1;
- x->dp.rcp_ticks = 1.0;
+ x->para.dp.ticks = 1;
+ x->para.dp.rcp_ticks = 1.0;
}
else
{
- x->dp.ticks = i;
- x->dp.rcp_ticks = 1.0 / (double)i;
+ x->para.dp.ticks = i;
+ x->para.dp.rcp_ticks = 1.0 / (double)i;
}
- x->dp.cur_b = b;
- x->dp.cur_a = 1.0/a; /*"a" is default Q*/
- x->dp.inlet3_is_Q1_or_damping0 = 1;
- x->dp.filter_function_is_highpass = 0;
- x->dp.calc = filter_tilde_snafu;
+ x->para.dp.cur_b = b;
+ x->para.dp.cur_a = 1.0/a; /*"a" is default Q*/
+ x->para.dp.inlet3_is_Q1_or_damping0 = 1;
+ x->para.dp.filter_function_is_highpass = 0;
+ x->para.dp.calc = filter_tilde_dp_dummy;
if(filt_typ->s_name)
{
if(filt_typ == gensym("dap1"))
{
- x->dp.calc = filter_tilde_dap1;
- x->dp.a1 = 1.0;
- x->dp.filter_function_is_first_order = 1;
+ x->para.dp.calc = filter_tilde_dp_ap1;
+ x->para.dp.a1 = 1.0;
+ x->para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dap2"))
{
- x->dp.calc = filter_tilde_dap2;
- x->dp.a2 = 1.0;
+ x->para.dp.calc = filter_tilde_dp_ap2;
+ x->para.dp.a2 = 1.0;
}
else if(filt_typ == gensym("dap1c"))
{
- x->dp.calc = filter_tilde_dap1;
- x->dp.a1 = 1.0;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was damping*/
- x->dp.filter_function_is_first_order = 1;
+ x->para.dp.calc = filter_tilde_dp_ap1;
+ x->para.dp.a1 = 1.0;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was damping*/
+ x->para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dap2c"))
{
- x->dp.calc = filter_tilde_dap2;
- x->dp.a2 = 1.0;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was damping*/
+ x->para.dp.calc = filter_tilde_dp_ap2;
+ x->para.dp.a2 = 1.0;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was damping*/
}
else if(filt_typ == gensym("dbpq2"))
{
- x->dp.calc = filter_tilde_dbp2;
+ x->para.dp.calc = filter_tilde_dp_bp2;
}
else if(filt_typ == gensym("drbpq2"))
{
- x->dp.calc = filter_tilde_drp2;
+ x->para.dp.calc = filter_tilde_dp_rp2;
}
else if(filt_typ == gensym("dbsq2"))
{
- x->dp.calc = filter_tilde_dbs2;
+ x->para.dp.calc = filter_tilde_dp_bs2;
}
else if(filt_typ == gensym("dbpw2"))
{
- x->dp.calc = filter_tilde_dbpw2;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was bw*/
+ x->para.dp.calc = filter_tilde_dp_bpw2;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("drbpw2"))
{
- x->dp.calc = filter_tilde_drpw2;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was bw*/
+ x->para.dp.calc = filter_tilde_dp_rpw2;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("dbsw2"))
{
- x->dp.calc = filter_tilde_dbsw2;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was bw*/
+ x->para.dp.calc = filter_tilde_dp_bsw2;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("dhp1"))
{
- x->dp.calc = filter_tilde_dhp1;
- x->dp.filter_function_is_first_order = 1;
+ x->para.dp.calc = filter_tilde_dp_hp1;
+ x->para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dhp2"))
{
- x->dp.calc = filter_tilde_dhp2;
+ x->para.dp.calc = filter_tilde_dp_hp2;
}
else if(filt_typ == gensym("dlp1"))
{
- x->dp.calc = filter_tilde_dlp1;
- x->dp.filter_function_is_first_order = 1;
+ x->para.dp.calc = filter_tilde_dp_lp1;
+ x->para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dlp2"))
{
- x->dp.calc = filter_tilde_dlp2;
+ x->para.dp.calc = filter_tilde_dp_lp2;
}
else if(filt_typ == gensym("dhp1c"))
{
- x->dp.calc = filter_tilde_dhp1;
- x->dp.cur_a = 1.0 / a;
- x->dp.filter_function_is_first_order = 1;
+ x->para.dp.calc = filter_tilde_dp_hp1;
+ x->para.dp.cur_a = 1.0 / a;
+ x->para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dhp2c"))
{
- x->dp.calc = filter_tilde_dhp2;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a / b;
- x->dp.cur_b = 1.0 / b;
- x->dp.filter_function_is_highpass = 1;
+ x->para.dp.calc = filter_tilde_dp_hp2;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a / b;
+ x->para.dp.cur_b = 1.0 / b;
+ x->para.dp.filter_function_is_highpass = 1;
}
else if(filt_typ == gensym("dlp1c"))
{
- x->dp.calc = filter_tilde_dlp1;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was damping*/
- x->dp.filter_function_is_first_order = 1;
+ x->para.dp.calc = filter_tilde_dp_lp1;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was damping*/
+ x->para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dlp2c"))
{
- x->dp.calc = filter_tilde_dlp2;
- x->dp.inlet3_is_Q1_or_damping0 = 0;
- x->dp.cur_a = a; /*"a" was damping*/
+ x->para.dp.calc = filter_tilde_dp_lp2;
+ x->para.dp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.dp.cur_a = a; /*"a" was damping*/
}
else
{
@@ -1436,9 +1454,9 @@ dap1, dap2, dap1c, dap2c, \
dbpq2, drbpq2, dbsq2, \
dbpw2, drbpw2, dbsw2 !");
}
- x->dp.end_f = x->dp.cur_f;
- x->dp.end_a = x->dp.cur_a;
- x->dp.end_b = x->dp.cur_b;
+ x->para.dp.end_f = x->para.dp.cur_f;
+ x->para.dp.end_a = x->para.dp.cur_a;
+ x->para.dp.end_b = x->para.dp.cur_b;
}
}
else
@@ -1452,17 +1470,17 @@ dbpw2, drbpw2, dbsw2 !");
b = (t_float)atom_getfloatarg(3, argc, argv);
interpol = (t_float)atom_getfloatarg(4, argc, argv);
}
- x->fp.cur_f = f;
- f *= x->fp.pi_over_sr;
+ x->para.sp.cur_f = f;
+ f *= x->para.sp.pi_over_sr;
if(f < 1.0e-20f)
- x->fp.cur_l = 1.0e20f;
+ x->para.sp.cur_l = 1.0e20f;
else if(f > 1.57079632f)
- x->fp.cur_l = 0.0f;
+ x->para.sp.cur_l = 0.0f;
else
{
si = sin(f);
co = cos(f);
- x->fp.cur_l = co/si;
+ x->para.sp.cur_l = co/si;
}
if(a <= 0.0f)
a = 0.000001f;
@@ -1471,128 +1489,128 @@ dbpw2, drbpw2, dbsw2 !");
if(interpol <= 0.0f)
interpol = 0.0f;
- x->fp.interpol_time = interpol;
- x->fp.ticks_per_interpol_time = 0.001f * 44100.0f / 64.0f;
- i = (int)((x->fp.ticks_per_interpol_time)*(x->fp.interpol_time)+0.49999f);
+ x->para.sp.interpol_time = interpol;
+ x->para.sp.ticks_per_interpol_time = 0.001f * 44100.0f / 64.0f;
+ i = (int)((x->para.sp.ticks_per_interpol_time)*(x->para.sp.interpol_time)+0.49999f);
if(i <= 0)
{
- x->fp.ticks = 1;
- x->fp.rcp_ticks = 1.0f;
+ x->para.sp.ticks = 1;
+ x->para.sp.rcp_ticks = 1.0f;
}
else
{
- x->fp.ticks = i;
- x->fp.rcp_ticks = 1.0f / (t_float)i;
+ x->para.sp.ticks = i;
+ x->para.sp.rcp_ticks = 1.0f / (t_float)i;
}
- x->fp.cur_b = b;
- x->fp.cur_a = 1.0f/a; /*"a" is default Q*/
- x->fp.inlet3_is_Q1_or_damping0 = 1;
- x->fp.filter_function_is_highpass = 0;
- x->fp.calc = filter_tilde_snafu;
+ x->para.sp.cur_b = b;
+ x->para.sp.cur_a = 1.0f/a; /*"a" is default Q*/
+ x->para.sp.inlet3_is_Q1_or_damping0 = 1;
+ x->para.sp.filter_function_is_highpass = 0;
+ x->para.sp.calc = filter_tilde_sp_dummy;
if(filt_typ->s_name)
{
if(filt_typ == gensym("ap1"))
{
- x->fp.calc = filter_tilde_ap1;
- x->fp.a1 = 1.0f;
- x->fp.filter_function_is_first_order = 1;
+ x->para.sp.calc = filter_tilde_sp_ap1;
+ x->para.sp.a1 = 1.0f;
+ x->para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("ap2"))
{
- x->fp.calc = filter_tilde_ap2;
- x->fp.a2 = 1.0f;
+ x->para.sp.calc = filter_tilde_sp_ap2;
+ x->para.sp.a2 = 1.0f;
}
else if(filt_typ == gensym("ap1c"))
{
- x->fp.calc = filter_tilde_ap1;
- x->fp.a1 = 1.0f;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was damping*/
- x->fp.filter_function_is_first_order = 1;
+ x->para.sp.calc = filter_tilde_sp_ap1;
+ x->para.sp.a1 = 1.0f;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was damping*/
+ x->para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("ap2c"))
{
- x->fp.calc = filter_tilde_ap2;
- x->fp.a2 = 1.0f;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was damping*/
+ x->para.sp.calc = filter_tilde_sp_ap2;
+ x->para.sp.a2 = 1.0f;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was damping*/
}
else if(filt_typ == gensym("bpq2"))
{
- x->fp.calc = filter_tilde_bp2;
+ x->para.sp.calc = filter_tilde_sp_bp2;
}
else if(filt_typ == gensym("rbpq2"))
{
- x->fp.calc = filter_tilde_rp2;
+ x->para.sp.calc = filter_tilde_sp_rp2;
}
else if(filt_typ == gensym("bsq2"))
{
- x->fp.calc = filter_tilde_bs2;
+ x->para.sp.calc = filter_tilde_sp_bs2;
}
else if(filt_typ == gensym("bpw2"))
{
- x->fp.calc = filter_tilde_bpw2;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was bw*/
+ x->para.sp.calc = filter_tilde_sp_bpw2;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("rbpw2"))
{
- x->fp.calc = filter_tilde_rpw2;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was bw*/
+ x->para.sp.calc = filter_tilde_sp_rpw2;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("bsw2"))
{
- x->fp.calc = filter_tilde_bsw2;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was bw*/
+ x->para.sp.calc = filter_tilde_sp_bsw2;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("hp1"))
{
- x->fp.calc = filter_tilde_hp1;
- x->fp.filter_function_is_first_order = 1;
+ x->para.sp.calc = filter_tilde_sp_hp1;
+ x->para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("hp2"))
{
- x->fp.calc = filter_tilde_hp2;
+ x->para.sp.calc = filter_tilde_sp_hp2;
}
else if(filt_typ == gensym("lp1"))
{
- x->fp.calc = filter_tilde_lp1;
- x->fp.filter_function_is_first_order = 1;
+ x->para.sp.calc = filter_tilde_sp_lp1;
+ x->para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("lp2"))
{
- x->fp.calc = filter_tilde_lp2;
+ x->para.sp.calc = filter_tilde_sp_lp2;
}
else if(filt_typ == gensym("hp1c"))
{
- x->fp.calc = filter_tilde_hp1;
- x->fp.cur_a = 1.0f / a;
- x->fp.filter_function_is_first_order = 1;
+ x->para.sp.calc = filter_tilde_sp_hp1;
+ x->para.sp.cur_a = 1.0f / a;
+ x->para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("hp2c"))
{
- x->fp.calc = filter_tilde_hp2;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a / b;
- x->fp.cur_b = 1.0f / b;
- x->fp.filter_function_is_highpass = 1;
+ x->para.sp.calc = filter_tilde_sp_hp2;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a / b;
+ x->para.sp.cur_b = 1.0f / b;
+ x->para.sp.filter_function_is_highpass = 1;
}
else if(filt_typ == gensym("lp1c"))
{
- x->fp.calc = filter_tilde_lp1;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was damping*/
- x->fp.filter_function_is_first_order = 1;
+ x->para.sp.calc = filter_tilde_sp_lp1;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was damping*/
+ x->para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("lp2c"))
{
- x->fp.calc = filter_tilde_lp2;
- x->fp.inlet3_is_Q1_or_damping0 = 0;
- x->fp.cur_a = a; /*"a" was damping*/
+ x->para.sp.calc = filter_tilde_sp_lp2;
+ x->para.sp.inlet3_is_Q1_or_damping0 = 0;
+ x->para.sp.cur_a = a; /*"a" was damping*/
}
else
{
@@ -1608,9 +1626,9 @@ dap1, dap2, dap1c, dap2c, \
dbpq2, drbpq2, dbsq2, \
dbpw2, drbpw2, dbsw2 !");
}
- x->fp.end_f = x->fp.cur_f;
- x->fp.end_a = x->fp.cur_a;
- x->fp.end_b = x->fp.cur_b;
+ x->para.sp.end_f = x->para.sp.cur_f;
+ x->para.sp.end_a = x->para.sp.cur_a;
+ x->para.sp.end_b = x->para.sp.cur_b;
}
}
return (x);