diff options
Diffstat (limited to 'pmpd3d_set.c')
-rw-r--r-- | pmpd3d_set.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pmpd3d_set.c b/pmpd3d_set.c index 3577613..1e5dddc 100644 --- a/pmpd3d_set.c +++ b/pmpd3d_set.c @@ -677,3 +677,27 @@ void pmpd3d_posZ(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) } } + +void pmpd3d_overdamp(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv) +{ +// set the overdamped factor to a mass + t_int tmp, i; + + if ( (argc == 2) && ( argv[0].a_type == A_FLOAT ) && ( argv[1].a_type == A_FLOAT ) ) + { + tmp = atom_getfloatarg(0, argc, argv); + tmp = max(0, min( x->nb_mass-1, tmp)); + x->mass[tmp].overdamp = atom_getfloatarg(1, argc, argv); + } + if ( (argc == 2) && ( argv[0].a_type == A_SYMBOL ) && ( argv[1].a_type == A_FLOAT ) ) + { + for (i=0; i< x->nb_mass; i++) + { + if ( atom_getsymbolarg(0,argc,argv) == x->mass[i].Id) + { + x->mass[i].overdamp = atom_getfloatarg(1, argc, argv); + } + } + } +} + |