Skip to content

Commit e00301e

Browse files
committed
minor update
second inlet signal check have been corrected.
1 parent 37b2b1d commit e00301e

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

.DS_Store

6 KB
Binary file not shown.

build/mookVCF~.c

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,10 @@ void mookVCF_float(t_mookVCF *x, double f){
100100

101101
if(in==1){
102102
x->s_freq= f < 1. ? 1 : f;
103-
x->s_freq=f;
104103
object_attr_touch((t_object *)x, gensym("cutoff"));
105104
mookVCF_calc(x);
106105
}else if(in==2){
107-
if(f >= 1){
108-
f = 1.f - 1E-20;
109-
x->s_res = f;
110-
}else if(f<0.){
111-
f = 0.f;
112-
x->s_res = f;
113-
}else{
114-
x->s_res = f;
115-
}
116-
106+
x->s_res = f >= 1.0 ? 1 - 1E-20 : f;
117107
object_attr_touch((t_object *)x, gensym("resonance"));
118108
mookVCF_calc(x);
119109
}
@@ -130,17 +120,7 @@ t_max_err mookVCF_attr_setcutoff(t_mookVCF *x, void *attr, long argc, t_atom *ar
130120
t_max_err mookVCF_attr_setresonance(t_mookVCF *x, void *attr, long argc, t_atom *argv){
131121
double reso = atom_getfloat(argv);
132122

133-
if(reso >= 1){
134-
reso = 1.f - 1E-20;
135-
// reso = 0.98;
136-
x->s_res = reso;
137-
}else if(reso<0.){
138-
reso = 0.f;
139-
x->s_res = reso;
140-
}else{
141-
x->s_res = reso;
142-
}
143-
123+
x->s_res = reso >= 1.0 ? 1 - 1E-20 : reso;
144124
mookVCF_calc(x);
145125
return 0;
146126
}
@@ -150,7 +130,7 @@ void mookVCF_perform64(t_mookVCF *x,t_object *dsp64,double **ins,long numins,dou
150130
t_double *in1=ins[0];
151131
t_double *out=outs[0];
152132
t_double freq = x->s_fcon ? *ins[1] : x->s_freq; // vérifier s'il y a du signal dans les entrées 2 et 3
153-
t_double res = x->s_res ? *ins[2] : x->s_res;
133+
t_double res = x->s_rcon ? *ins[2] : x->s_res;
154134

155135
double X;
156136
double y1=x->s_ym1;
@@ -164,10 +144,10 @@ void mookVCF_perform64(t_mookVCF *x,t_object *dsp64,double **ins,long numins,dou
164144
double t2 = x->s_t2;
165145

166146
// scale resonance
167-
if(res >= 1){
168-
res = 1.f - 1E-20;
169-
}else if(res<0.){
170-
res = 0.f;
147+
if(res >= 1.0){
148+
res = 1.0 - 1E-20;
149+
}else if(res < 0.0){
150+
res = 0.0;
171151
}
172152

173153
// do we need to calculate the coefs ?
@@ -255,6 +235,8 @@ void *mookVCF_new(t_symbol *s, long argc, t_atom *argv){
255235
if ((argv + 1)->a_type == A_FLOAT){
256236
object_post((t_object*)x, "arg[%ld] Resonance: %f", 1, atom_getfloat(argv+1));
257237
}
238+
}else{
239+
reso = 0;
258240
}
259241
}
260242

0 commit comments

Comments
 (0)