diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2010-02-10 00:34:05 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2010-02-10 00:34:05 +0000 |
commit | 086e6b358ad45bda0e6a948cfb7ea2d33ab7da5a (patch) | |
tree | b87b0adfbfd8f9b9439d8bf528b63b64f23dce03 /source/vlrange.c | |
parent | 98e3e1214cf71a62b2de938c9c7e07f6bdd0090c (diff) |
re-arranged into libdir and setup with the template Makefile+debian stuff. renabled vv+ and vv- as vvplus and vvminus
svn path=/trunk/externals/smlib/; revision=13158
Diffstat (limited to 'source/vlrange.c')
-rw-r--r-- | source/vlrange.c | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/source/vlrange.c b/source/vlrange.c deleted file mode 100644 index 07b383f..0000000 --- a/source/vlrange.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "defines.h"
-
-/*--------------- vlrange -----------------------*/
-/* leaky range of each element in a list */
-/* arguments: [halfdecay] */
-
-static t_class *vlrange_class;
-
-typedef struct _vlrange
-{
- t_object x_obj;
- float m_c_leak;
- float m_leak;
- float *m_min;
- float *m_max;
- int m_n;
-} t_vlrange;
-
-
-static void vlrange_perform(t_vlrange *x, t_symbol *s, int argc, t_atom *argv)
-{
- int i;
- t_atom *ap,*app;
- float *fmin, *fmax;
- float m_leak;
- float m_c_leak;
- m_leak=x->m_leak;
- m_c_leak=x->m_c_leak;
-
- if (argc!=x->m_n)
- {
- int i;
- if (x->m_min)
- {
- freebytes(x->m_min,x->m_n);
- freebytes(x->m_max,x->m_n);
- }
- x->m_min=(float*)getbytes(argc*sizeof(float));
- x->m_max=(float*)getbytes(argc*sizeof(float));
- for(i=0;i<argc;i++)
- {
- x->m_min[i]=0.0f;
- x->m_max[i]=0.0f;
- }
- x->m_n=argc;
- }
-
- fmin=x->m_min;
- fmax=x->m_max;
- ap = (t_atom *)getbytes(sizeof(t_atom)*argc);
- app=ap;
- for (i = 0; i < argc; i++)
- {
- float f=atom_getfloat(argv++);
- *fmax =(f > *fmax ) ? f : *fmax *m_c_leak + f*m_leak;
- *fmin =(f < *fmin ) ? f : *fmin *m_c_leak + f*m_leak;
- SETFLOAT(app, *fmax-*fmin);
- app++;
- fmax++;
- fmin++;
- }
- outlet_list(x->x_obj.ob_outlet,gensym("list"),argc,ap);
- freebytes(ap,argc);
-}
-
-static void vlrange_setHalfDecay(t_vlrange *x, t_floatarg halfDecayTime)
-{
- x->m_c_leak=(float)powf(.5,(1.0f/halfDecayTime));
- x->m_leak=1.0f-x->m_c_leak;
-}
-
-static void *vlrange_new(t_float halfDecayTime)
-{
- t_vlrange *x=(t_vlrange *)pd_new(vlrange_class);
- outlet_new(&x->x_obj, gensym("list"));
- vlrange_setHalfDecay(x, halfDecayTime);
- x->m_n=0;
- x->m_min=0;
- x->m_max=0;
- return (void *)x;
-}
-
-static void vlrange_free(t_vlrange *x)
-{
- freebytes(x->m_max,x->m_n);
- freebytes(x->m_min,x->m_n);
-}
-
-void vlrange_setup(void)
-{
- vlrange_class = class_new(gensym("vlrange"),
- (t_newmethod)vlrange_new, (t_method)vlrange_free,
- sizeof(t_vlrange),
- CLASS_DEFAULT,
- A_DEFFLOAT, 0);
- class_addmethod(vlrange_class, (t_method)vlrange_setHalfDecay,
- gensym("decay"), A_DEFFLOAT, NULL);
- class_addlist(vlrange_class, (t_method)vlrange_perform);
-}
|