diff options
author | Guenter Geiger <ggeiger@users.sourceforge.net> | 2003-08-11 21:39:41 +0000 |
---|---|---|
committer | Guenter Geiger <ggeiger@users.sourceforge.net> | 2003-08-11 21:39:41 +0000 |
commit | 1e0554e849a5d638f96761bdcc79e2685e85d1e9 (patch) | |
tree | 82ce76981f8265ee9c9b1828abfe3ff9875c4967 | |
parent | 18f4d4e6f7029eb607dd5e4fdbadc562c2ea6bc4 (diff) |
blah
svn path=/trunk/externals/ggee/; revision=842
-rwxr-xr-x | gui/envgen.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gui/envgen.c b/gui/envgen.c index 7192cca..ceaf65f 100755 --- a/gui/envgen.c +++ b/gui/envgen.c @@ -141,16 +141,22 @@ void envgen_setresize(t_envgen *x, t_floatarg f) void envgen_float(t_envgen *x, t_floatarg f)
{
int state = 0;
+ float val;
+
while (x->duration[state] < f && state < x->last_state) state++;
if (state == 0 || f >= x->duration[x->last_state]) {
- outlet_float(x->x_obj.ob_outlet,x->finalvalues[state]);
+ outlet_float(x->x_obj.ob_outlet,x->finalvalues[state]*(x->max-x->min));
return;
}
- outlet_float(x->x_obj.ob_outlet,x->finalvalues[state-1] +
+
+ val = x->finalvalues[state-1] +
(f - x->duration[state-1])*
(x->finalvalues[state] - x->finalvalues[state-1])/
- (x->duration[state] - x->duration[state-1]));
+ (x->duration[state] - x->duration[state-1]);
+
+ val *= val*(x->max - x->min);
+ outlet_float(x->x_obj.ob_outlet,val);
}
@@ -169,7 +175,7 @@ void envgen_bang(t_envgen *x) x->x_state = ATTACK;
x->x_val = x->finalvalues[NONE];
- SETFLOAT(a,x->finalvalues[x->x_state]);
+ SETFLOAT(a,x->finalvalues[x->x_state]*(x->max-x->min));
SETFLOAT(a+1,x->duration[x->x_state]);
outlet_list(x->x_obj.ob_outlet,&s_list,2,(t_atom*)&a);
|