aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iemlib1/src/filter~.c845
-rw-r--r--iemlib1/src/hml_shelf~.c19
-rw-r--r--iemlib1/src/lp1_t~.c16
-rw-r--r--iemlib1/src/para_bp2~.c19
-rw-r--r--iemlib1/src/vcf_filter~.c17
5 files changed, 481 insertions, 435 deletions
diff --git a/iemlib1/src/filter~.c b/iemlib1/src/filter~.c
index 8469d58..9b9cc7b 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 - 2010 */
+iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2011 */
#include "m_pd.h"
@@ -10,7 +10,8 @@ iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2010
/* ---------- filter~ - slow dynamic filter-kernel 1. and 2. order ----------- */
-/* ---------- now with single and double precision option -------------------- */
+/* -------------- now with single and double precision option ---------------- */
+/* ------- sp ..... single precision, ---- dp ..... double precision --------- */
typedef struct _filter_tilde_sp_para t_filter_tilde_sp_para;
@@ -43,7 +44,7 @@ struct _filter_tilde_sp_para
int counter_f;// number of dsp ticks to compute new frequency
int counter_a;// number of dsp ticks to compute new damping
int counter_b;// number of dsp ticks to compute new frequency shift
- int inlet3_is_Q1_or_damping0;// if flag is HIGH, the third inlet (Q) has to be inverted to damping
+ int inlet3_is_Q;// if flag is HIGH, the third inlet (Q) has to be inverted to damping
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
@@ -81,7 +82,7 @@ struct _filter_tilde_dp_para
int counter_f;// number of dsp ticks to compute new frequency
int counter_a;// number of dsp ticks to compute new damping
int counter_b;// number of dsp ticks to compute new frequency shift
- int inlet3_is_Q1_or_damping0;// if flag is HIGH, the third inlet (Q) has to be inverted to damping
+ int inlet3_is_Q;// if flag is HIGH, the third inlet (Q) has to be inverted to damping
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
@@ -97,11 +98,11 @@ typedef union _filt_para
typedef struct _filter_tilde
{
t_object x_obj;
- t_filt_para para;
- int precision_dp1_sp0;
+ t_filt_para x_para;
+ int x_precision_dp1_sp0;
t_outlet *x_debug_outlet;
t_atom x_at[5];
- t_float x_msi;
+ t_float x_float_sig_in;
} t_filter_tilde;
static t_class *filter_tilde_class;
@@ -276,20 +277,6 @@ static void filter_tilde_sp_ap2(t_filter_tilde_sp_para *x)
x->b2 = -x->a0;
}
-/*static void filter_tilde_bp2(t_filter_tilde *x)
-{
-t_float l, al, l2, rcp;
-
- l = x->cur_l;
- l2 = l*l + 1.0;
- al = l*x->cur_a;
- rcp = 1.0f/(al + l2);
- x->a0 = rcp*al;
- x->a2 = -x->a0;
- x->b1 = rcp*2.0f*(2.0f - l2);
- x->b2 = rcp*(l2 - al);
-}*/
-
static void filter_tilde_dp_lp1(t_filter_tilde_dp_para *x)
{
double al;
@@ -644,19 +631,19 @@ static void filter_tilde_dsp_dp_tick(t_filter_tilde_dp_para *x)
static t_int *filter_tilde_sp_perform_2o(t_int *w)
{
- t_float *in = (float *)(w[1]);
- t_float *out = (float *)(w[2]);
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- 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;
+ t_float wn0, wn1=x->x_para.sp.wn1, wn2=x->x_para.sp.wn2;
+ t_float a0=x->x_para.sp.a0, a1=x->x_para.sp.a1, a2=x->x_para.sp.a2;
+ t_float b1=x->x_para.sp.b1, b2=x->x_para.sp.b2;
- filter_tilde_dsp_sp_tick(&x->para.sp);
+ filter_tilde_dsp_sp_tick(&x->x_para.sp);
for(i=0; i<n; i++)
{
- wn0 = *in++ + b1*wn1 + b2*wn2;
- *out++ = a0*wn0 + a1*wn1 + a2*wn2;
+ wn0 = (t_float)(*in++) + b1*wn1 + b2*wn2;
+ *out++ = (t_sample)(a0*wn0 + a1*wn1 + a2*wn2);
wn2 = wn1;
wn1 = wn0;
}
@@ -666,8 +653,8 @@ static t_int *filter_tilde_sp_perform_2o(t_int *w)
if(IEM_DENORMAL(wn1))
wn1 = 0.0f;
- x->para.sp.wn1 = wn1;
- x->para.sp.wn2 = wn2;
+ x->x_para.sp.wn1 = wn1;
+ x->x_para.sp.wn2 = wn2;
return(w+5);
}
/* yn0 = *out;
@@ -683,35 +670,35 @@ y/x = (a0 + a1*z-1 + a2*z-2)/(1 - b1*z-1 - b2*z-2);*/
static t_int *filter_tilde_sp_perf8_2o(t_int *w)
{
- t_float *in = (float *)(w[1]);
- t_float *out = (float *)(w[2]);
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(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->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;
+ t_float a0=x->x_para.sp.a0, a1=x->x_para.sp.a1, a2=x->x_para.sp.a2;
+ t_float b1=x->x_para.sp.b1, b2=x->x_para.sp.b2;
- filter_tilde_dsp_sp_tick(&x->para.sp);
- wn[0] = x->para.sp.wn2;
- wn[1] = x->para.sp.wn1;
+ filter_tilde_dsp_sp_tick(&x->x_para.sp);
+ wn[0] = x->x_para.sp.wn2;
+ wn[1] = x->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];
- out[0] = a0*wn[2] + a1*wn[1] + a2*wn[0];
- wn[3] = in[1] + b1*wn[2] + b2*wn[1];
- out[1] = a0*wn[3] + a1*wn[2] + a2*wn[1];
- wn[4] = in[2] + b1*wn[3] + b2*wn[2];
- out[2] = a0*wn[4] + a1*wn[3] + a2*wn[2];
- wn[5] = in[3] + b1*wn[4] + b2*wn[3];
- out[3] = a0*wn[5] + a1*wn[4] + a2*wn[3];
- wn[6] = in[4] + b1*wn[5] + b2*wn[4];
- out[4] = a0*wn[6] + a1*wn[5] + a2*wn[4];
- wn[7] = in[5] + b1*wn[6] + b2*wn[5];
- out[5] = a0*wn[7] + a1*wn[6] + a2*wn[5];
- wn[8] = in[6] + b1*wn[7] + b2*wn[6];
- out[6] = a0*wn[8] + a1*wn[7] + a2*wn[6];
- wn[9] = in[7] + b1*wn[8] + b2*wn[7];
- out[7] = a0*wn[9] + a1*wn[8] + a2*wn[7];
+ wn[2] = (t_float)(in[0]) + b1*wn[1] + b2*wn[0];
+ out[0] = (t_sample)(a0*wn[2] + a1*wn[1] + a2*wn[0]);
+ wn[3] = (t_float)(in[1]) + b1*wn[2] + b2*wn[1];
+ out[1] = (t_sample)(a0*wn[3] + a1*wn[2] + a2*wn[1]);
+ wn[4] = (t_float)(in[2]) + b1*wn[3] + b2*wn[2];
+ out[2] = (t_sample)(a0*wn[4] + a1*wn[3] + a2*wn[2]);
+ wn[5] = (t_float)(in[3]) + b1*wn[4] + b2*wn[3];
+ out[3] = (t_sample)(a0*wn[5] + a1*wn[4] + a2*wn[3]);
+ wn[6] = (t_float)(in[4]) + b1*wn[5] + b2*wn[4];
+ out[4] = (t_sample)(a0*wn[6] + a1*wn[5] + a2*wn[4]);
+ wn[7] = (t_float)(in[5]) + b1*wn[6] + b2*wn[5];
+ out[5] = (t_sample)(a0*wn[7] + a1*wn[6] + a2*wn[5]);
+ wn[8] = (t_float)(in[6]) + b1*wn[7] + b2*wn[6];
+ out[6] = (t_sample)(a0*wn[8] + a1*wn[7] + a2*wn[6]);
+ wn[9] = (t_float)(in[7]) + b1*wn[8] + b2*wn[7];
+ out[7] = (t_sample)(a0*wn[9] + a1*wn[8] + a2*wn[7]);
wn[0] = wn[8];
wn[1] = wn[9];
}
@@ -721,91 +708,91 @@ static t_int *filter_tilde_sp_perf8_2o(t_int *w)
if(IEM_DENORMAL(wn[1]))
wn[1] = 0.0f;
- x->para.sp.wn1 = wn[1];
- x->para.sp.wn2 = wn[0];
+ x->x_para.sp.wn1 = wn[1];
+ x->x_para.sp.wn2 = wn[0];
return(w+5);
}
static t_int *filter_tilde_sp_perform_1o(t_int *w)
{
- t_float *in = (float *)(w[1]);
- t_float *out = (float *)(w[2]);
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- 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;
+ t_float wn0, wn1=x->x_para.sp.wn1;
+ t_float a0=x->x_para.sp.a0, a1=x->x_para.sp.a1;
+ t_float b1=x->x_para.sp.b1;
- filter_tilde_dsp_sp_tick(&x->para.sp);
+ filter_tilde_dsp_sp_tick(&x->x_para.sp);
for(i=0; i<n; i++)
{
- wn0 = *in++ + b1*wn1;
- *out++ = a0*wn0 + a1*wn1;
+ wn0 = (t_float)(*in++) + b1*wn1;
+ *out++ = (t_sample)(a0*wn0 + a1*wn1);
wn1 = wn0;
}
/* NAN protect */
if(IEM_DENORMAL(wn1))
wn1 = 0.0f;
- x->para.sp.wn1 = wn1;
+ x->x_para.sp.wn1 = wn1;
return(w+5);
}
static t_int *filter_tilde_sp_perf8_1o(t_int *w)
{
- t_float *in = (float *)(w[1]);
- t_float *out = (float *)(w[2]);
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(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->para.sp.a0, a1=x->para.sp.a1;
- t_float b1=x->para.sp.b1;
+ t_float a0=x->x_para.sp.a0, a1=x->x_para.sp.a1;
+ t_float b1=x->x_para.sp.b1;
- filter_tilde_dsp_sp_tick(&x->para.sp);
- wn[0] = x->para.sp.wn1;
+ filter_tilde_dsp_sp_tick(&x->x_para.sp);
+ wn[0] = x->x_para.sp.wn1;
for(i=0; i<n; i+=8, in+=8, out+=8)
{
- wn[1] = in[0] + b1*wn[0];
- out[0] = a0*wn[1] + a1*wn[0];
- wn[2] = in[1] + b1*wn[1];
- out[1] = a0*wn[2] + a1*wn[1];
- wn[3] = in[2] + b1*wn[2];
- out[2] = a0*wn[3] + a1*wn[2];
- wn[4] = in[3] + b1*wn[3];
- out[3] = a0*wn[4] + a1*wn[3];
- wn[5] = in[4] + b1*wn[4];
- out[4] = a0*wn[5] + a1*wn[4];
- wn[6] = in[5] + b1*wn[5];
- out[5] = a0*wn[6] + a1*wn[5];
- wn[7] = in[6] + b1*wn[6];
- out[6] = a0*wn[7] + a1*wn[6];
- wn[8] = in[7] + b1*wn[7];
- out[7] = a0*wn[8] + a1*wn[7];
+ wn[1] = (t_float)(in[0]) + b1*wn[0];
+ out[0] = (t_sample)(a0*wn[1] + a1*wn[0]);
+ wn[2] = (t_float)(in[1]) + b1*wn[1];
+ out[1] = (t_sample)(a0*wn[2] + a1*wn[1]);
+ wn[3] = (t_float)(in[2]) + b1*wn[2];
+ out[2] = (t_sample)(a0*wn[3] + a1*wn[2]);
+ wn[4] = (t_float)(in[3]) + b1*wn[3];
+ out[3] = (t_sample)(a0*wn[4] + a1*wn[3]);
+ wn[5] = (t_float)(in[4]) + b1*wn[4];
+ out[4] = (t_sample)(a0*wn[5] + a1*wn[4]);
+ wn[6] = (t_float)(in[5]) + b1*wn[5];
+ out[5] = (t_sample)(a0*wn[6] + a1*wn[5]);
+ wn[7] = (t_float)(in[6]) + b1*wn[6];
+ out[6] = (t_sample)(a0*wn[7] + a1*wn[6]);
+ wn[8] = (t_float)(in[7]) + b1*wn[7];
+ out[7] = (t_sample)(a0*wn[8] + a1*wn[7]);
wn[0] = wn[8];
}
/* NAN protect */
if(IEM_DENORMAL(wn[0]))
wn[0] = 0.0f;
- x->para.sp.wn1 = wn[0];
+ x->x_para.sp.wn1 = wn[0];
return(w+5);
}
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_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- 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;
+ double wn0, wn1=x->x_para.dp.wn1, wn2=x->x_para.dp.wn2;
+ double a0=x->x_para.dp.a0, a1=x->x_para.dp.a1, a2=x->x_para.dp.a2;
+ double b1=x->x_para.dp.b1, b2=x->x_para.dp.b2;
- filter_tilde_dsp_dp_tick(&x->para.dp);
+ filter_tilde_dsp_dp_tick(&x->x_para.dp);
for(i=0; i<n; i++)
{
wn0 = (double)(*in++) + b1*wn1 + b2*wn2;
- *out++ = (t_float)(a0*wn0 + a1*wn1 + a2*wn2);
+ *out++ = (t_sample)(a0*wn0 + a1*wn1 + a2*wn2);
wn2 = wn1;
wn1 = wn0;
}
@@ -815,8 +802,8 @@ static t_int *filter_tilde_dp_perform_2o(t_int *w)
// if(IEM_DENORMAL(wn1))
// wn1 = 0.0f;
- x->para.dp.wn1 = wn1;
- x->para.dp.wn2 = wn2;
+ x->x_para.dp.wn1 = wn1;
+ x->x_para.dp.wn2 = wn2;
return(w+5);
}
/* yn0 = *out;
@@ -832,35 +819,35 @@ y/x = (a0 + a1*z-1 + a2*z-2)/(1 - b1*z-1 - b2*z-2);*/
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_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
double wn[10];
- 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;
+ double a0=x->x_para.dp.a0, a1=x->x_para.dp.a1, a2=x->x_para.dp.a2;
+ double b1=x->x_para.dp.b1, b2=x->x_para.dp.b2;
- filter_tilde_dsp_dp_tick(&x->para.dp);
- wn[0] = x->para.dp.wn2;
- wn[1] = x->para.dp.wn1;
+ filter_tilde_dsp_dp_tick(&x->x_para.dp);
+ wn[0] = x->x_para.dp.wn2;
+ wn[1] = x->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];
- out[0] = (t_float)(a0*wn[2] + a1*wn[1] + a2*wn[0]);
+ out[0] = (t_sample)(a0*wn[2] + a1*wn[1] + a2*wn[0]);
wn[3] = (double)(in[1]) + b1*wn[2] + b2*wn[1];
- out[1] = (t_float)(a0*wn[3] + a1*wn[2] + a2*wn[1]);
+ out[1] = (t_sample)(a0*wn[3] + a1*wn[2] + a2*wn[1]);
wn[4] = (double)(in[2]) + b1*wn[3] + b2*wn[2];
- out[2] = (t_float)(a0*wn[4] + a1*wn[3] + a2*wn[2]);
+ out[2] = (t_sample)(a0*wn[4] + a1*wn[3] + a2*wn[2]);
wn[5] = (double)(in[3]) + b1*wn[4] + b2*wn[3];
- out[3] = (t_float)(a0*wn[5] + a1*wn[4] + a2*wn[3]);
+ out[3] = (t_sample)(a0*wn[5] + a1*wn[4] + a2*wn[3]);
wn[6] = (double)(in[4]) + b1*wn[5] + b2*wn[4];
- out[4] = (t_float)(a0*wn[6] + a1*wn[5] + a2*wn[4]);
+ out[4] = (t_sample)(a0*wn[6] + a1*wn[5] + a2*wn[4]);
wn[7] = (double)(in[5]) + b1*wn[6] + b2*wn[5];
- out[5] = (t_float)(a0*wn[7] + a1*wn[6] + a2*wn[5]);
+ out[5] = (t_sample)(a0*wn[7] + a1*wn[6] + a2*wn[5]);
wn[8] = (double)(in[6]) + b1*wn[7] + b2*wn[6];
- out[6] = (t_float)(a0*wn[8] + a1*wn[7] + a2*wn[6]);
+ out[6] = (t_sample)(a0*wn[8] + a1*wn[7] + a2*wn[6]);
wn[9] = (double)(in[7]) + b1*wn[8] + b2*wn[7];
- out[7] = (t_float)(a0*wn[9] + a1*wn[8] + a2*wn[7]);
+ out[7] = (t_sample)(a0*wn[9] + a1*wn[8] + a2*wn[7]);
wn[0] = wn[8];
wn[1] = wn[9];
}
@@ -900,211 +887,218 @@ static t_int *filter_tilde_dp_perf8_2o(t_int *w)
*/
- x->para.dp.wn1 = wn[1];
- x->para.dp.wn2 = wn[0];
+ x->x_para.dp.wn1 = wn[1];
+ x->x_para.dp.wn2 = wn[0];
return(w+5);
}
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_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
- double wn0, wn1=x->para.dp.wn1;
- double a0=x->para.dp.a0, a1=x->para.dp.a1;
- double b1=x->para.dp.b1;
+ double wn0, wn1=x->x_para.dp.wn1;
+ double a0=x->x_para.dp.a0, a1=x->x_para.dp.a1;
+ double b1=x->x_para.dp.b1;
- filter_tilde_dsp_dp_tick(&x->para.dp);
+ filter_tilde_dsp_dp_tick(&x->x_para.dp);
for(i=0; i<n; i++)
{
wn0 = (double)(*in++) + b1*wn1;
- *out++ = (t_float)(a0*wn0 + a1*wn1);
+ *out++ = (t_sample)(a0*wn0 + a1*wn1);
wn1 = wn0;
}
/* NAN protect */
// if(IEM_DENORMAL(wn1))
// wn1 = 0.0f;
- x->para.dp.wn1 = wn1;
+ x->x_para.dp.wn1 = wn1;
return(w+5);
}
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_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
t_filter_tilde *x = (t_filter_tilde *)(w[3]);
int i, n = (t_int)(w[4]);
double wn[9];
- double a0=x->para.dp.a0, a1=x->para.dp.a1;
- double b1=x->para.dp.b1;
+ double a0=x->x_para.dp.a0, a1=x->x_para.dp.a1;
+ double b1=x->x_para.dp.b1;
- filter_tilde_dsp_dp_tick(&x->para.dp);
- wn[0] = x->para.dp.wn1;
+ filter_tilde_dsp_dp_tick(&x->x_para.dp);
+ wn[0] = x->x_para.dp.wn1;
for(i=0; i<n; i+=8, in+=8, out+=8)
{
wn[1] = (double)(in[0]) + b1*wn[0];
- out[0] = (t_float)(a0*wn[1] + a1*wn[0]);
+ out[0] = (t_sample)(a0*wn[1] + a1*wn[0]);
wn[2] = (double)(in[1]) + b1*wn[1];
- out[1] = (t_float)(a0*wn[2] + a1*wn[1]);
+ out[1] = (t_sample)(a0*wn[2] + a1*wn[1]);
wn[3] = (double)(in[2]) + b1*wn[2];
- out[2] = (t_float)(a0*wn[3] + a1*wn[2]);
+ out[2] = (t_sample)(a0*wn[3] + a1*wn[2]);
wn[4] = (double)(in[3]) + b1*wn[3];
- out[3] = (t_float)(a0*wn[4] + a1*wn[3]);
+ out[3] = (t_sample)(a0*wn[4] + a1*wn[3]);
wn[5] = (double)(in[4]) + b1*wn[4];
- out[4] = (t_float)(a0*wn[5] + a1*wn[4]);
+ out[4] = (t_sample)(a0*wn[5] + a1*wn[4]);
wn[6] = (double)(in[5]) + b1*wn[5];
- out[5] = (t_float)(a0*wn[6] + a1*wn[5]);
+ out[5] = (t_sample)(a0*wn[6] + a1*wn[5]);
wn[7] = (double)(in[6]) + b1*wn[6];
- out[6] = (t_float)(a0*wn[7] + a1*wn[6]);
+ out[6] = (t_sample)(a0*wn[7] + a1*wn[6]);
wn[8] = (double)(in[7]) + b1*wn[7];
- out[7] = (t_float)(a0*wn[8] + a1*wn[7]);
+ out[7] = (t_sample)(a0*wn[8] + a1*wn[7]);
wn[0] = wn[8];
}
/* NAN protect */
// if(IEM_DENORMAL(wn[0]))
// wn[0] = 0.0f;
- x->para.dp.wn1 = wn[0];
+ x->x_para.dp.wn1 = wn[0];
return(w+5);
}
-static void filter_tilde_ft4(t_filter_tilde *x, t_float t)
+static void filter_tilde_ft4(t_filter_tilde *x, t_floatarg t)
{
- if(x->precision_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
- double dt=(double)t;
- int di = (int)((x->para.dp.ticks_per_interpol_time)*dt+0.49999);
+ double dt = (double)t;
+ int di = (int)((x->x_para.dp.ticks_per_interpol_time)*dt+0.49999);
- x->para.dp.interpol_time = dt;
+ x->x_para.dp.interpol_time = dt;
if(di <= 0)
{
- x->para.dp.ticks = 1;
- x->para.dp.rcp_ticks = 1.0;
+ x->x_para.dp.ticks = 1;
+ x->x_para.dp.rcp_ticks = 1.0;
}
else
{
- x->para.dp.ticks = di;
- x->para.dp.rcp_ticks = 1.0 / (double)di;
+ x->x_para.dp.ticks = di;
+ x->x_para.dp.rcp_ticks = 1.0 / (double)di;
}
}
else
{
- int i = (int)((x->para.sp.ticks_per_interpol_time)*t+0.49999f);
+ t_float st = (t_float)t;
+ int i = (int)((x->x_para.sp.ticks_per_interpol_time)*st+0.49999f);
- x->para.sp.interpol_time = t;
+ x->x_para.sp.interpol_time = st;
if(i <= 0)
{
- x->para.sp.ticks = 1;
- x->para.sp.rcp_ticks = 1.0;
+ x->x_para.sp.ticks = 1;
+ x->x_para.sp.rcp_ticks = 1.0f;
}
else
{
- x->para.sp.ticks = i;
- x->para.sp.rcp_ticks = 1.0 / (t_float)i;
+ x->x_para.sp.ticks = i;
+ x->x_para.sp.rcp_ticks = 1.0f / (t_float)i;
}
}
}
-static void filter_tilde_ft3(t_filter_tilde *x, t_float b)
+static void filter_tilde_ft3(t_filter_tilde *x, t_floatarg b)
{
- if(x->precision_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
- double db=(double)b;
+ double db = (double)b;
if(db <= 0.0)
db = 0.000001;
- if(x->para.dp.filter_function_is_highpass)
+ if(x->x_para.dp.filter_function_is_highpass)
db = 1.0 / db;
- if(db != x->para.dp.cur_b)
+ if(db != x->x_para.dp.cur_b)
{
- 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*/
+ x->x_para.dp.end_b = db;
+ x->x_para.dp.counter_b = x->x_para.dp.ticks;
+ x->x_para.dp.delta_b = exp(log(db/x->x_para.dp.cur_b)*x->x_para.dp.rcp_ticks);
+ x->x_para.dp.event_mask |= 4;/*set event_mask_bit 2 = 1*/
}
}
else
{
- if(b <= 0.0f)
- b = 0.000001f;
- if(x->para.sp.filter_function_is_highpass)
- b = 1.0f / b;
- if(b != x->para.sp.cur_b)
+ t_float sb = (t_float)b;
+
+ if(sb <= 0.0f)
+ sb = 0.000001f;
+ if(x->x_para.sp.filter_function_is_highpass)
+ sb = 1.0f / sb;
+ if(sb != x->x_para.sp.cur_b)
{
- 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*/
+ x->x_para.sp.end_b = sb;
+ x->x_para.sp.counter_b = x->x_para.sp.ticks;
+ x->x_para.sp.delta_b = exp(log(sb/x->x_para.sp.cur_b)*x->x_para.sp.rcp_ticks);
+ x->x_para.sp.event_mask |= 4;/*set event_mask_bit 2 = 1*/
}
}
}
-static void filter_tilde_ft2(t_filter_tilde *x, t_float a)
+static void filter_tilde_ft2(t_filter_tilde *x, t_floatarg a)
{
- if(x->precision_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
- double da=(double)a;
+ double da = (double)a;
if(da <= 0.0)
da = 0.000001;
- if(x->para.dp.inlet3_is_Q1_or_damping0)
+ if(x->x_para.dp.inlet3_is_Q)
da = 1.0 / da;
- if(x->para.dp.filter_function_is_highpass)
- da /= x->para.dp.cur_b;
- if(da != x->para.dp.cur_a)
+ if(x->x_para.dp.filter_function_is_highpass)
+ da /= x->x_para.dp.cur_b;
+ if(da != x->x_para.dp.cur_a)
{
- 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*/
+ x->x_para.dp.end_a = da;
+ x->x_para.dp.counter_a = x->x_para.dp.ticks;
+ x->x_para.dp.delta_a = exp(log(da/x->x_para.dp.cur_a)*x->x_para.dp.rcp_ticks);
+ x->x_para.dp.event_mask |= 2;/*set event_mask_bit 1 = 1*/
}
}
else
{
- if(a <= 0.0f)
- a = 0.000001f;
- if(x->para.sp.inlet3_is_Q1_or_damping0)
- a = 1.0f / a;
- if(x->para.sp.filter_function_is_highpass)
- a /= x->para.sp.cur_b;
- if(a != x->para.sp.cur_a)
+ t_float sa = (t_float)a;
+
+ if(sa <= 0.0f)
+ sa = 0.000001f;
+ if(x->x_para.sp.inlet3_is_Q)
+ sa = 1.0f / sa;
+ if(x->x_para.sp.filter_function_is_highpass)
+ sa /= x->x_para.sp.cur_b;
+ if(sa != x->x_para.sp.cur_a)
{
- 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*/
+ x->x_para.sp.end_a = sa;
+ x->x_para.sp.counter_a = x->x_para.sp.ticks;
+ x->x_para.sp.delta_a = exp(log(sa/x->x_para.sp.cur_a)*x->x_para.sp.rcp_ticks);
+ x->x_para.sp.event_mask |= 2;/*set event_mask_bit 1 = 1*/
}
}
}
-static void filter_tilde_ft1(t_filter_tilde *x, t_float f)
+static void filter_tilde_ft1(t_filter_tilde *x, t_floatarg f)
{
- if(x->precision_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
- double df=(double)f;
+ double df = (double)f;
if(df <= 0.0)
df = 0.000001;
- if(df != x->para.dp.cur_f)
+ if(df != x->x_para.dp.cur_f)
{
- 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*/
+ x->x_para.dp.end_f = df;
+ x->x_para.dp.counter_f = x->x_para.dp.ticks;
+ x->x_para.dp.delta_f = exp(log(df/x->x_para.dp.cur_f)*x->x_para.dp.rcp_ticks);
+ x->x_para.dp.event_mask |= 1;/*set event_mask_bit 0 = 1*/
}
}
else
{
- if(f <= 0.0f)
- f = 0.000001f;
- if(f != x->para.sp.cur_f)
+ t_float sf = (t_float)f;
+
+ if(sf <= 0.0f)
+ sf = 0.000001f;
+ if(sf != x->x_para.sp.cur_f)
{
- 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*/
+ x->x_para.sp.end_f = sf;
+ x->x_para.sp.counter_f = x->x_para.sp.ticks;
+ x->x_para.sp.delta_f = exp(log(sf/x->x_para.sp.cur_f)*x->x_para.sp.rcp_ticks);
+ x->x_para.sp.event_mask |= 1;/*set event_mask_bit 0 = 1*/
}
}
}
@@ -1112,58 +1106,76 @@ 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_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
- 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;
+ x->x_at[0].a_w.w_float = (t_float)x->x_para.dp.b1;
+ x->x_at[1].a_w.w_float = (t_float)x->x_para.dp.b2;
+ x->x_at[2].a_w.w_float = (t_float)x->x_para.dp.a0;
+ x->x_at[3].a_w.w_float = (t_float)x->x_para.dp.a1;
+ x->x_at[4].a_w.w_float = (t_float)x->x_para.dp.a2;
}
else
{
- 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;
+ x->x_at[0].a_w.w_float = x->x_para.sp.b1;
+ x->x_at[1].a_w.w_float = x->x_para.sp.b2;
+ x->x_at[2].a_w.w_float = x->x_para.sp.a0;
+ x->x_at[3].a_w.w_float = x->x_para.sp.a1;
+ x->x_at[4].a_w.w_float = x->x_para.sp.a2;
}
outlet_list(x->x_debug_outlet, &s_list, 5, x->x_at);
}
+static void filter_tilde_set(t_filter_tilde *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 1) && IS_A_FLOAT(argv, 0))
+ {
+ if(x->x_precision_dp1_sp0)
+ x->x_para.dp.wn1 = (double)atom_getfloatarg(0, argc, argv);
+ else
+ x->x_para.sp.wn1 = (t_float)atom_getfloatarg(0, argc, argv);
+ }
+ if((argc >= 2) && IS_A_FLOAT(argv, 1) && (x->x_para.dp.filter_function_is_first_order == 0))
+ {
+ if(x->x_precision_dp1_sp0)
+ x->x_para.dp.wn2 = (double)atom_getfloatarg(1, argc, argv);
+ else
+ x->x_para.sp.wn2 = (t_float)atom_getfloatarg(1, argc, argv);
+ }
+}
+
static void filter_tilde_dsp(t_filter_tilde *x, t_signal **sp)
{
int i, n=(int)sp[0]->s_n;
- if(x->precision_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
double si, co, f;
- 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);
+ x->x_para.dp.pi_over_sr = 3.14159265358979323846 / (double)(sp[0]->s_sr);
+ x->x_para.dp.ticks_per_interpol_time = 0.001 * (double)(sp[0]->s_sr) / (double)n;
+ i = (int)((x->x_para.dp.ticks_per_interpol_time)*(x->x_para.dp.interpol_time)+0.49999);
if(i <= 0)
{
- x->para.dp.ticks = 1;
- x->para.dp.rcp_ticks = 1.0;
+ x->x_para.dp.ticks = 1;
+ x->x_para.dp.rcp_ticks = 1.0;
}
else
{
- x->para.dp.ticks = i;
- x->para.dp.rcp_ticks = 1.0 / (double)i;
+ x->x_para.dp.ticks = i;
+ x->x_para.dp.rcp_ticks = 1.0 / (double)i;
}
- f = x->para.dp.cur_f * x->para.dp.pi_over_sr;
+ f = x->x_para.dp.cur_f * x->x_para.dp.pi_over_sr;
if(f < 1.0e-20)
- x->para.dp.cur_l = 1.0e20;
+ x->x_para.dp.cur_l = 1.0e20;
else if(f > 1.57079632)
- x->para.dp.cur_l = 0.0;
+ x->x_para.dp.cur_l = 0.0;
else
{
si = sin(f);
co = cos(f);
- x->para.dp.cur_l = co/si;
+ x->x_para.dp.cur_l = co/si;
}
- if(x->para.dp.filter_function_is_first_order)
+ if(x->x_para.dp.filter_function_is_first_order)
{
if(n&7)
dsp_add(filter_tilde_dp_perform_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
@@ -1182,31 +1194,31 @@ static void filter_tilde_dsp(t_filter_tilde *x, t_signal **sp)
{
t_float si, co, f;
- 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);
+ x->x_para.sp.pi_over_sr = 3.14159265358979323846f / (t_float)(sp[0]->s_sr);
+ x->x_para.sp.ticks_per_interpol_time = 0.001f * (t_float)(sp[0]->s_sr) / (t_float)n;
+ i = (int)((x->x_para.sp.ticks_per_interpol_time)*(x->x_para.sp.interpol_time)+0.49999f);
if(i <= 0)
{
- x->para.sp.ticks = 1;
- x->para.sp.rcp_ticks = 1.0f;
+ x->x_para.sp.ticks = 1;
+ x->x_para.sp.rcp_ticks = 1.0f;
}
else
{
- x->para.sp.ticks = i;
- x->para.sp.rcp_ticks = 1.0f / (t_float)i;
+ x->x_para.sp.ticks = i;
+ x->x_para.sp.rcp_ticks = 1.0f / (t_float)i;
}
- f = x->para.sp.cur_f * x->para.sp.pi_over_sr;
+ f = x->x_para.sp.cur_f * x->x_para.sp.pi_over_sr;
if(f < 1.0e-20f)
- x->para.sp.cur_l = 1.0e20f;
+ x->x_para.sp.cur_l = 1.0e20f;
else if(f > 1.57079632f)
- x->para.sp.cur_l = 0.0f;
+ x->x_para.sp.cur_l = 0.0f;
else
{
si = sin(f);
co = cos(f);
- x->para.sp.cur_l = co/si;
+ x->x_para.sp.cur_l = co/si;
}
- if(x->para.sp.filter_function_is_first_order)
+ if(x->x_para.sp.filter_function_is_first_order)
{
if(n&7)
dsp_add(filter_tilde_sp_perform_1o, 4, sp[0]->s_vec, sp[1]->s_vec, x, n);
@@ -1235,7 +1247,7 @@ static void *filter_tilde_new(t_symbol *s, int argc, t_atom *argv)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft4"));
outlet_new(&x->x_obj, &s_signal);
x->x_debug_outlet = outlet_new(&x->x_obj, &s_list);
- x->x_msi = 0.0f;
+ x->x_float_sig_in = 0.0f;
x->x_at[0].a_type = A_FLOAT;
x->x_at[1].a_type = A_FLOAT;
@@ -1243,51 +1255,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->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->x_para.dp.delta_f = 0.0;
+ x->x_para.dp.delta_a = 0.0;
+ x->x_para.dp.delta_b = 0.0;
+ x->x_para.dp.interpol_time = 0.0;
+ x->x_para.dp.wn1 = 0.0;
+ x->x_para.dp.wn2 = 0.0;
+ x->x_para.dp.a0 = 0.0;
+ x->x_para.dp.a1 = 0.0;
+ x->x_para.dp.a2 = 0.0;
+ x->x_para.dp.b1 = 0.0;
+ x->x_para.dp.b2 = 0.0;
+ x->x_para.dp.pi_over_sr = 3.14159265358979323846 / 44100.0;
+ x->x_para.dp.event_mask = 1;
+ x->x_para.dp.counter_f = 1;
+ x->x_para.dp.counter_a = 0;
+ x->x_para.dp.counter_b = 0;
+ x->x_para.dp.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;
+ x->x_para.sp.delta_f = 0.0f;
+ x->x_para.sp.delta_a = 0.0f;
+ x->x_para.sp.delta_b = 0.0f;
+ x->x_para.sp.interpol_time = 0.0f;
+ x->x_para.sp.wn1 = 0.0f;
+ x->x_para.sp.wn2 = 0.0f;
+ x->x_para.sp.a0 = 0.0f;
+ x->x_para.sp.a1 = 0.0f;
+ x->x_para.sp.a2 = 0.0f;
+ x->x_para.sp.b1 = 0.0f;
+ x->x_para.sp.b2 = 0.0f;
+ x->x_para.sp.pi_over_sr = 3.14159265358979323846f / 44100.0f;
+ x->x_para.sp.event_mask = 1;
+ x->x_para.sp.counter_f = 1;
+ x->x_para.sp.counter_a = 0;
+ x->x_para.sp.counter_b = 0;
+ x->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_dp1_sp0 = 1;
+ x->x_precision_dp1_sp0 = 1;
else
- x->precision_dp1_sp0 = 0;
+ x->x_precision_dp1_sp0 = 0;
- if(x->precision_dp1_sp0)
+ if(x->x_precision_dp1_sp0)
{
double si, co, f=0.0, a=0.0, b=0.0, interpol=0.0;
@@ -1298,17 +1310,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->para.dp.cur_f = f;
- f *= x->para.dp.pi_over_sr;
+ x->x_para.dp.cur_f = f;
+ f *= x->x_para.dp.pi_over_sr;
if(f < 1.0e-20)
- x->para.dp.cur_l = 1.0e20;
+ x->x_para.dp.cur_l = 1.0e20;
else if(f > 1.57079632)
- x->para.dp.cur_l = 0.0;
+ x->x_para.dp.cur_l = 0.0;
else
{
si = sin(f);
co = cos(f);
- x->para.dp.cur_l = co/si;
+ x->x_para.dp.cur_l = co/si;
}
if(a <= 0.0)
a = 0.000001;
@@ -1317,128 +1329,128 @@ static void *filter_tilde_new(t_symbol *s, int argc, t_atom *argv)
if(interpol <= 0.0)
interpol = 0.0;
- 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);
+ x->x_para.dp.interpol_time = interpol;
+ x->x_para.dp.ticks_per_interpol_time = 0.001 * 44100.0 / 64.0;
+ i = (int)((x->x_para.dp.ticks_per_interpol_time)*(x->x_para.dp.interpol_time)+0.49999);
if(i <= 0)
{
- x->para.dp.ticks = 1;
- x->para.dp.rcp_ticks = 1.0;
+ x->x_para.dp.ticks = 1;
+ x->x_para.dp.rcp_ticks = 1.0;
}
else
{
- x->para.dp.ticks = i;
- x->para.dp.rcp_ticks = 1.0 / (double)i;
+ x->x_para.dp.ticks = i;
+ x->x_para.dp.rcp_ticks = 1.0 / (double)i;
}
- 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;
+ x->x_para.dp.cur_b = b;
+ x->x_para.dp.cur_a = 1.0/a; /*"a" is default Q*/
+ x->x_para.dp.inlet3_is_Q = 1;
+ x->x_para.dp.filter_function_is_highpass = 0;
+ x->x_para.dp.calc = filter_tilde_dp_dummy;
if(filt_typ->s_name)
{
if(filt_typ == gensym("dap1"))
{
- x->para.dp.calc = filter_tilde_dp_ap1;
- x->para.dp.a1 = 1.0;
- x->para.dp.filter_function_is_first_order = 1;
+ x->x_para.dp.calc = filter_tilde_dp_ap1;
+ x->x_para.dp.a1 = 1.0;
+ x->x_para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dap2"))
{
- x->para.dp.calc = filter_tilde_dp_ap2;
- x->para.dp.a2 = 1.0;
+ x->x_para.dp.calc = filter_tilde_dp_ap2;
+ x->x_para.dp.a2 = 1.0;
}
else if(filt_typ == gensym("dap1c"))
{
- 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;
+ x->x_para.dp.calc = filter_tilde_dp_ap1;
+ x->x_para.dp.a1 = 1.0;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was damping*/
+ x->x_para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dap2c"))
{
- 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*/
+ x->x_para.dp.calc = filter_tilde_dp_ap2;
+ x->x_para.dp.a2 = 1.0;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was damping*/
}
else if(filt_typ == gensym("dbpq2"))
{
- x->para.dp.calc = filter_tilde_dp_bp2;
+ x->x_para.dp.calc = filter_tilde_dp_bp2;
}
else if(filt_typ == gensym("drbpq2"))
{
- x->para.dp.calc = filter_tilde_dp_rp2;
+ x->x_para.dp.calc = filter_tilde_dp_rp2;
}
else if(filt_typ == gensym("dbsq2"))
{
- x->para.dp.calc = filter_tilde_dp_bs2;
+ x->x_para.dp.calc = filter_tilde_dp_bs2;
}
else if(filt_typ == gensym("dbpw2"))
{
- 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*/
+ x->x_para.dp.calc = filter_tilde_dp_bpw2;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("drbpw2"))
{
- 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*/
+ x->x_para.dp.calc = filter_tilde_dp_rpw2;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("dbsw2"))
{
- 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*/
+ x->x_para.dp.calc = filter_tilde_dp_bsw2;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("dhp1"))
{
- x->para.dp.calc = filter_tilde_dp_hp1;
- x->para.dp.filter_function_is_first_order = 1;
+ x->x_para.dp.calc = filter_tilde_dp_hp1;
+ x->x_para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dhp2"))
{
- x->para.dp.calc = filter_tilde_dp_hp2;
+ x->x_para.dp.calc = filter_tilde_dp_hp2;
}
else if(filt_typ == gensym("dlp1"))
{
- x->para.dp.calc = filter_tilde_dp_lp1;
- x->para.dp.filter_function_is_first_order = 1;
+ x->x_para.dp.calc = filter_tilde_dp_lp1;
+ x->x_para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dlp2"))
{
- x->para.dp.calc = filter_tilde_dp_lp2;
+ x->x_para.dp.calc = filter_tilde_dp_lp2;
}
else if(filt_typ == gensym("dhp1c"))
{
- 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;
+ x->x_para.dp.calc = filter_tilde_dp_hp1;
+ x->x_para.dp.cur_a = 1.0 / a;
+ x->x_para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dhp2c"))
{
- 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;
+ x->x_para.dp.calc = filter_tilde_dp_hp2;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a / b;
+ x->x_para.dp.cur_b = 1.0 / b;
+ x->x_para.dp.filter_function_is_highpass = 1;
}
else if(filt_typ == gensym("dlp1c"))
{
- 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;
+ x->x_para.dp.calc = filter_tilde_dp_lp1;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was damping*/
+ x->x_para.dp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("dlp2c"))
{
- 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*/
+ x->x_para.dp.calc = filter_tilde_dp_lp2;
+ x->x_para.dp.inlet3_is_Q = 0;
+ x->x_para.dp.cur_a = a; /*"a" was damping*/
}
else
{
@@ -1454,9 +1466,9 @@ dap1, dap2, dap1c, dap2c, \
dbpq2, drbpq2, dbsq2, \
dbpw2, drbpw2, dbsw2 !");
}
- 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;
+ x->x_para.dp.end_f = x->x_para.dp.cur_f;
+ x->x_para.dp.end_a = x->x_para.dp.cur_a;
+ x->x_para.dp.end_b = x->x_para.dp.cur_b;
}
}
else
@@ -1470,17 +1482,17 @@ dbpw2, drbpw2, dbsw2 !");
b = (t_float)atom_getfloatarg(3, argc, argv);
interpol = (t_float)atom_getfloatarg(4, argc, argv);
}
- x->para.sp.cur_f = f;
- f *= x->para.sp.pi_over_sr;
+ x->x_para.sp.cur_f = f;
+ f *= x->x_para.sp.pi_over_sr;
if(f < 1.0e-20f)
- x->para.sp.cur_l = 1.0e20f;
+ x->x_para.sp.cur_l = 1.0e20f;
else if(f > 1.57079632f)
- x->para.sp.cur_l = 0.0f;
+ x->x_para.sp.cur_l = 0.0f;
else
{
si = sin(f);
co = cos(f);
- x->para.sp.cur_l = co/si;
+ x->x_para.sp.cur_l = co/si;
}
if(a <= 0.0f)
a = 0.000001f;
@@ -1489,128 +1501,128 @@ dbpw2, drbpw2, dbsw2 !");
if(interpol <= 0.0f)
interpol = 0.0f;
- 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);
+ x->x_para.sp.interpol_time = interpol;
+ x->x_para.sp.ticks_per_interpol_time = 0.001f * 44100.0f / 64.0f;
+ i = (int)((x->x_para.sp.ticks_per_interpol_time)*(x->x_para.sp.interpol_time)+0.49999f);
if(i <= 0)
{
- x->para.sp.ticks = 1;
- x->para.sp.rcp_ticks = 1.0f;
+ x->x_para.sp.ticks = 1;
+ x->x_para.sp.rcp_ticks = 1.0f;
}
else
{
- x->para.sp.ticks = i;
- x->para.sp.rcp_ticks = 1.0f / (t_float)i;
+ x->x_para.sp.ticks = i;
+ x->x_para.sp.rcp_ticks = 1.0f / (t_float)i;
}
- 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;
+ x->x_para.sp.cur_b = b;
+ x->x_para.sp.cur_a = 1.0f/a; /*"a" is default Q*/
+ x->x_para.sp.inlet3_is_Q = 1;
+ x->x_para.sp.filter_function_is_highpass = 0;
+ x->x_para.sp.calc = filter_tilde_sp_dummy;
if(filt_typ->s_name)
{
if(filt_typ == gensym("ap1"))
{
- x->para.sp.calc = filter_tilde_sp_ap1;
- x->para.sp.a1 = 1.0f;
- x->para.sp.filter_function_is_first_order = 1;
+ x->x_para.sp.calc = filter_tilde_sp_ap1;
+ x->x_para.sp.a1 = 1.0f;
+ x->x_para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("ap2"))
{
- x->para.sp.calc = filter_tilde_sp_ap2;
- x->para.sp.a2 = 1.0f;
+ x->x_para.sp.calc = filter_tilde_sp_ap2;
+ x->x_para.sp.a2 = 1.0f;
}
else if(filt_typ == gensym("ap1c"))
{
- 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;
+ x->x_para.sp.calc = filter_tilde_sp_ap1;
+ x->x_para.sp.a1 = 1.0f;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was damping*/
+ x->x_para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("ap2c"))
{
- 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*/
+ x->x_para.sp.calc = filter_tilde_sp_ap2;
+ x->x_para.sp.a2 = 1.0f;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was damping*/
}
else if(filt_typ == gensym("bpq2"))
{
- x->para.sp.calc = filter_tilde_sp_bp2;
+ x->x_para.sp.calc = filter_tilde_sp_bp2;
}
else if(filt_typ == gensym("rbpq2"))
{
- x->para.sp.calc = filter_tilde_sp_rp2;
+ x->x_para.sp.calc = filter_tilde_sp_rp2;
}
else if(filt_typ == gensym("bsq2"))
{
- x->para.sp.calc = filter_tilde_sp_bs2;
+ x->x_para.sp.calc = filter_tilde_sp_bs2;
}
else if(filt_typ == gensym("bpw2"))
{
- 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*/
+ x->x_para.sp.calc = filter_tilde_sp_bpw2;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("rbpw2"))
{
- 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*/
+ x->x_para.sp.calc = filter_tilde_sp_rpw2;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("bsw2"))
{
- 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*/
+ x->x_para.sp.calc = filter_tilde_sp_bsw2;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was bw*/
}
else if(filt_typ == gensym("hp1"))
{
- x->para.sp.calc = filter_tilde_sp_hp1;
- x->para.sp.filter_function_is_first_order = 1;
+ x->x_para.sp.calc = filter_tilde_sp_hp1;
+ x->x_para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("hp2"))
{
- x->para.sp.calc = filter_tilde_sp_hp2;
+ x->x_para.sp.calc = filter_tilde_sp_hp2;
}
else if(filt_typ == gensym("lp1"))
{
- x->para.sp.calc = filter_tilde_sp_lp1;
- x->para.sp.filter_function_is_first_order = 1;
+ x->x_para.sp.calc = filter_tilde_sp_lp1;
+ x->x_para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("lp2"))
{
- x->para.sp.calc = filter_tilde_sp_lp2;
+ x->x_para.sp.calc = filter_tilde_sp_lp2;
}
else if(filt_typ == gensym("hp1c"))
{
- 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;
+ x->x_para.sp.calc = filter_tilde_sp_hp1;
+ x->x_para.sp.cur_a = 1.0f / a;
+ x->x_para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("hp2c"))
{
- 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;
+ x->x_para.sp.calc = filter_tilde_sp_hp2;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a / b;
+ x->x_para.sp.cur_b = 1.0f / b;
+ x->x_para.sp.filter_function_is_highpass = 1;
}
else if(filt_typ == gensym("lp1c"))
{
- 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;
+ x->x_para.sp.calc = filter_tilde_sp_lp1;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was damping*/
+ x->x_para.sp.filter_function_is_first_order = 1;
}
else if(filt_typ == gensym("lp2c"))
{
- 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*/
+ x->x_para.sp.calc = filter_tilde_sp_lp2;
+ x->x_para.sp.inlet3_is_Q = 0;
+ x->x_para.sp.cur_a = a; /*"a" was damping*/
}
else
{
@@ -1626,9 +1638,9 @@ dap1, dap2, dap1c, dap2c, \
dbpq2, drbpq2, dbsq2, \
dbpw2, drbpw2, dbsw2 !");
}
- 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;
+ x->x_para.sp.end_f = x->x_para.sp.cur_f;
+ x->x_para.sp.end_a = x->x_para.sp.cur_a;
+ x->x_para.sp.end_b = x->x_para.sp.cur_b;
}
}
return (x);
@@ -1638,11 +1650,12 @@ void filter_tilde_setup(void)
{
filter_tilde_class = class_new(gensym("filter~"), (t_newmethod)filter_tilde_new,
0, sizeof(t_filter_tilde), 0, A_GIMME, 0);
- CLASS_MAINSIGNALIN(filter_tilde_class, t_filter_tilde, x_msi);
+ CLASS_MAINSIGNALIN(filter_tilde_class, t_filter_tilde, x_float_sig_in);
class_addmethod(filter_tilde_class, (t_method)filter_tilde_dsp, gensym("dsp"), 0);
class_addmethod(filter_tilde_class, (t_method)filter_tilde_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(filter_tilde_class, (t_method)filter_tilde_ft2, gensym("ft2"), A_FLOAT, 0);
class_addmethod(filter_tilde_class, (t_method)filter_tilde_ft3, gensym("ft3"), A_FLOAT, 0);
class_addmethod(filter_tilde_class, (t_method)filter_tilde_ft4, gensym("ft4"), A_FLOAT, 0);
+ class_addmethod(filter_tilde_class, (t_method)filter_tilde_set, gensym("set"), A_GIMME, 0);
class_addmethod(filter_tilde_class, (t_method)filter_tilde_print, gensym("print"), 0);
}
diff --git a/iemlib1/src/hml_shelf~.c b/iemlib1/src/hml_shelf~.c
index f2ec442..cad58b0 100644
--- a/iemlib1/src/hml_shelf~.c
+++ b/iemlib1/src/hml_shelf~.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 - 2006 */
+iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2011 */
#include "m_pd.h"
#include "iemlib.h"
@@ -47,7 +47,7 @@ typedef struct _hml_shelf_tilde
int event_mask;
void *x_debug_outlet;
t_atom x_at[5];
- t_float x_msi;
+ t_float x_float_sig_in;
} t_hml_shelf_tilde;
static t_class *hml_shelf_tilde_class;
@@ -425,6 +425,15 @@ static void hml_shelf_tilde_ft1(t_hml_shelf_tilde *x, t_floatarg ll)
}
}
+static void hml_shelf_tilde_set(t_hml_shelf_tilde *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 2) && IS_A_FLOAT(argv, 1) && IS_A_FLOAT(argv, 0))
+ {
+ x->wn1 = (t_float)atom_getfloatarg(0, argc, argv);
+ x->wn2 = (t_float)atom_getfloatarg(1, argc, argv);
+ }
+}
+
static void hml_shelf_tilde_print(t_hml_shelf_tilde *x)
{
// post("fb1 = %g, fb2 = %g, ff1 = %g, ff2 = %g, ff3 = %g", x->b1, x->b2, x->a0, x->a1, x->a2);
@@ -467,7 +476,7 @@ static void *hml_shelf_tilde_new(t_symbol *s, int argc, t_atom *argv)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft6"));
outlet_new(&x->x_obj, &s_signal);
x->x_debug_outlet = outlet_new(&x->x_obj, &s_list);
- x->x_msi = 0;
+ x->x_float_sig_in = 0.0f;
x->x_at[0].a_type = A_FLOAT;
x->x_at[1].a_type = A_FLOAT;
@@ -535,7 +544,7 @@ void hml_shelf_tilde_setup(void)
{
hml_shelf_tilde_class = class_new(gensym("hml_shelf~"), (t_newmethod)hml_shelf_tilde_new,
0, sizeof(t_hml_shelf_tilde), 0, A_GIMME, 0);
- CLASS_MAINSIGNALIN(hml_shelf_tilde_class, t_hml_shelf_tilde, x_msi);
+ CLASS_MAINSIGNALIN(hml_shelf_tilde_class, t_hml_shelf_tilde, x_float_sig_in);
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_dsp, gensym("dsp"), 0);
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_ft2, gensym("ft2"), A_FLOAT, 0);
@@ -543,6 +552,6 @@ void hml_shelf_tilde_setup(void)
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_ft4, gensym("ft4"), A_FLOAT, 0);
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_ft5, gensym("ft5"), A_FLOAT, 0);
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_ft6, gensym("ft6"), A_FLOAT, 0);
+ class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_set, gensym("set"), A_GIMME, 0);
class_addmethod(hml_shelf_tilde_class, (t_method)hml_shelf_tilde_print, gensym("print"), 0);
-// class_sethelpsymbol(hml_shelf_tilde_class, gensym("iemhelp/help-hml_shelf~"));
}
diff --git a/iemlib1/src/lp1_t~.c b/iemlib1/src/lp1_t~.c
index 8005b95..251cfe7 100644
--- a/iemlib1/src/lp1_t~.c
+++ b/iemlib1/src/lp1_t~.c
@@ -1,14 +1,14 @@
/* 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 - 2010 */
+iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2011 */
#include "m_pd.h"
#include "iemlib.h"
#include <math.h>
/* -- lp1_t~ - slow dynamic lowpass-filter 1. order controlled by time constant tau input --- */
-/* -- now with double precision -- */
+/* -- now with double precision; for low-frequency filters it is important to calculate the filter in double precision -- */
typedef struct _lp1_t_tilde
{
@@ -25,7 +25,7 @@ typedef struct _lp1_t_tilde
t_float interpol_time;
int ticks;
int counter_t;
- t_float x_msi;
+ t_float x_float_sig_in;
} t_lp1_t_tilde;
static t_class *lp1_t_tilde_class;
@@ -140,6 +140,11 @@ static void lp1_t_tilde_ft1(t_lp1_t_tilde *x, t_floatarg f_time_const)
}
}
+static void lp1_t_tilde_set(t_lp1_t_tilde *x, t_floatarg w1)
+{
+ x->yn1 = (double)w1;
+}
+
static void lp1_t_tilde_dsp(t_lp1_t_tilde *x, t_signal **sp)
{
int i, n=(int)sp[0]->s_n;
@@ -172,7 +177,7 @@ static void *lp1_t_tilde_new(t_symbol *s, int argc, t_atom *argv)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft2"));
outlet_new(&x->x_obj, &s_signal);
- x->x_msi = 0;
+ x->x_float_sig_in = 0.0f;
x->counter_t = 1;
x->delta_t = 0.0;
x->interpol_time = 0.0f;
@@ -207,8 +212,9 @@ void lp1_t_tilde_setup(void)
{
lp1_t_tilde_class = class_new(gensym("lp1_t~"), (t_newmethod)lp1_t_tilde_new,
0, sizeof(t_lp1_t_tilde), 0, A_GIMME, 0);
- CLASS_MAINSIGNALIN(lp1_t_tilde_class, t_lp1_t_tilde, x_msi);
+ CLASS_MAINSIGNALIN(lp1_t_tilde_class, t_lp1_t_tilde, x_float_sig_in);
class_addmethod(lp1_t_tilde_class, (t_method)lp1_t_tilde_dsp, gensym("dsp"), 0);
class_addmethod(lp1_t_tilde_class, (t_method)lp1_t_tilde_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(lp1_t_tilde_class, (t_method)lp1_t_tilde_ft2, gensym("ft2"), A_FLOAT, 0);
+ class_addmethod(lp1_t_tilde_class, (t_method)lp1_t_tilde_set, gensym("set"), A_FLOAT, 0);
}
diff --git a/iemlib1/src/para_bp2~.c b/iemlib1/src/para_bp2~.c
index d946c71..ffeb41d 100644
--- a/iemlib1/src/para_bp2~.c
+++ b/iemlib1/src/para_bp2~.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 - 2006 */
+iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2011 */
#include "m_pd.h"
#include "iemlib.h"
@@ -41,7 +41,7 @@ typedef struct _para_bp2_tilde
int event_mask;
void *x_debug_outlet;
t_atom x_at[5];
- t_float x_msi;
+ t_float x_float_sig_in;
} t_para_bp2_tilde;
static t_class *para_bp2_tilde_class;
@@ -286,6 +286,15 @@ static void para_bp2_tilde_ft1(t_para_bp2_tilde *x, t_floatarg f)
}
}
+static void para_bp2_tilde_set(t_para_bp2_tilde *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 2) && IS_A_FLOAT(argv, 1) && IS_A_FLOAT(argv, 0))
+ {
+ x->wn1 = (t_float)atom_getfloatarg(0, argc, argv);
+ x->wn2 = (t_float)atom_getfloatarg(1, argc, argv);
+ }
+}
+
static void para_bp2_tilde_print(t_para_bp2_tilde *x)
{
// post("fb1 = %g, fb2 = %g, ff1 = %g, ff2 = %g, ff3 = %g", x->b1, x->b2, x->a0, x->a1, x->a2);
@@ -338,7 +347,7 @@ static void *para_bp2_tilde_new(t_symbol *s, int argc, t_atom *argv)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft4"));
outlet_new(&x->x_obj, &s_signal);
x->x_debug_outlet = outlet_new(&x->x_obj, &s_list);
- x->x_msi = 0;
+ x->x_float_sig_in = 0.0f;
x->x_at[0].a_type = A_FLOAT;
x->x_at[1].a_type = A_FLOAT;
@@ -407,12 +416,12 @@ void para_bp2_tilde_setup(void)
{
para_bp2_tilde_class = class_new(gensym("para_bp2~"), (t_newmethod)para_bp2_tilde_new,
0, sizeof(t_para_bp2_tilde), 0, A_GIMME, 0);
- CLASS_MAINSIGNALIN(para_bp2_tilde_class, t_para_bp2_tilde, x_msi);
+ CLASS_MAINSIGNALIN(para_bp2_tilde_class, t_para_bp2_tilde, x_float_sig_in);
class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_dsp, gensym("dsp"), 0);
class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_ft2, gensym("ft2"), A_FLOAT, 0);
class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_ft3, gensym("ft3"), A_FLOAT, 0);
class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_ft4, gensym("ft4"), A_FLOAT, 0);
+ class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_set, gensym("set"), A_GIMME, 0);
class_addmethod(para_bp2_tilde_class, (t_method)para_bp2_tilde_print, gensym("print"), 0);
-// class_sethelpsymbol(para_bp2_tilde_class, gensym("iemhelp/help-para_bp2~"));
}
diff --git a/iemlib1/src/vcf_filter~.c b/iemlib1/src/vcf_filter~.c
index 393559a..7caa68d 100644
--- a/iemlib1/src/vcf_filter~.c
+++ b/iemlib1/src/vcf_filter~.c
@@ -15,7 +15,7 @@ typedef struct _vcf_filter_tilde
t_object x_obj;
t_float x_wn1;
t_float x_wn2;
- t_float x_msi;
+ t_float x_float_sig_in1;
char x_filtname[6];
} t_vcf_filter_tilde;
@@ -300,6 +300,15 @@ static void vcf_filter_tilde_dsp(t_vcf_filter_tilde *x, t_signal **sp)
}
}
+static void vcf_filter_tilde_set(t_vcf_filter_tilde *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if((argc >= 2) && IS_A_FLOAT(argv, 1) && IS_A_FLOAT(argv, 0))
+ {
+ x->x_wn1 = (t_float)atom_getfloatarg(0, argc, argv);
+ x->x_wn2 = (t_float)atom_getfloatarg(1, argc, argv);
+ }
+}
+
static void *vcf_filter_tilde_new(t_symbol *filt_typ)
{
t_vcf_filter_tilde *x = (t_vcf_filter_tilde *)pd_new(vcf_filter_tilde_class);
@@ -308,7 +317,7 @@ static void *vcf_filter_tilde_new(t_symbol *filt_typ)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
outlet_new(&x->x_obj, &s_signal);
- x->x_msi = 0;
+ x->x_float_sig_in1 = 0;
x->x_wn1 = 0.0f;
x->x_wn2 = 0.0f;
c = (char *)filt_typ->s_name;
@@ -321,7 +330,7 @@ void vcf_filter_tilde_setup(void)
{
vcf_filter_tilde_class = class_new(gensym("vcf_filter~"), (t_newmethod)vcf_filter_tilde_new,
0, sizeof(t_vcf_filter_tilde), 0, A_SYMBOL, 0);
- CLASS_MAINSIGNALIN(vcf_filter_tilde_class, t_vcf_filter_tilde, x_msi);
+ CLASS_MAINSIGNALIN(vcf_filter_tilde_class, t_vcf_filter_tilde, x_float_sig_in1);
class_addmethod(vcf_filter_tilde_class, (t_method)vcf_filter_tilde_dsp, gensym("dsp"), 0);
-// class_sethelpsymbol(vcf_filter_tilde_class, gensym("iemhelp/help-vcf_filter~"));
+ class_addmethod(vcf_filter_tilde_class, (t_method)vcf_filter_tilde_set, gensym("set"), A_GIMME, 0);
}