aboutsummaryrefslogtreecommitdiff
path: root/pmpd.c
diff options
context:
space:
mode:
authorCyrille Henry <nusmuk@users.sourceforge.net>2011-02-20 14:25:05 +0000
committerCyrille Henry <nusmuk@users.sourceforge.net>2011-02-20 14:25:05 +0000
commitbd44c30d91f8f13cba813b96fb5122c3f4118ecb (patch)
treea4484cddfa152d38c5a7eddceb9f1d0c6edd85b9 /pmpd.c
parentc10b148c202a50ea546997fec0e9b1432774d4e0 (diff)
specific optimisation
svn path=/trunk/externals/pmpd/; revision=14931
Diffstat (limited to 'pmpd.c')
-rw-r--r--pmpd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/pmpd.c b/pmpd.c
index 47a366d..14232b6 100644
--- a/pmpd.c
+++ b/pmpd.c
@@ -149,7 +149,7 @@ void pmpd_bang(t_pmpd *x)
t_int i;
// post("bang");
- for (i=1; i<x->nb_mass; i++)
+ for (i=0; i<x->nb_mass; i++)
// compute new masses position
if (x->mass[i].mobile > 0) // only if mobile
{
@@ -286,7 +286,8 @@ void pmpd_link(t_pmpd *x, t_symbol *s, int argc, t_atom *argv)
{
if ( (atom_getsymbolarg(1,argc,argv) == x->mass[i].Id)&(atom_getsymbolarg(2,argc,argv) == x->mass[j].Id))
{
- pmpd_create_link(x, Id, i, j, K, D, Pow, Lmin, Lmax, 0);
+ if (!( (x->mass[i].Id == x->mass[j].Id) && (i>j) )) // si lien entre 2 serie de masses identique entres elle, alors on ne creer qu'un lien sur 2, pour evider les redondances
+ pmpd_create_link(x, Id, i, j, K, D, Pow, Lmin, Lmax, 0);
}
}
}
@@ -346,9 +347,12 @@ void pmpd_tabLink(t_pmpd *x, t_symbol *s, int argc, t_atom *argv)
{
if ( (atom_getsymbolarg(1,argc,argv) == x->mass[i].Id)&(atom_getsymbolarg(2,argc,argv) == x->mass[j].Id))
{
- pmpd_create_link(x, Id, i, j, K, D, 1, -1000000, 1000000, 2);
- x->link[x->nb_link-1].arrayK = arrayK;
- x->link[x->nb_link-1].arrayD = arrayD;
+ if (!( (x->mass[i].Id == x->mass[j].Id) && (i>j) )) // si lien entre 2 serie de masses identique entres elle, alors on ne creer qu'un lien sur 2, pour evider les redondances
+ {
+ pmpd_create_link(x, Id, i, j, K, D, 1, -1000000, 1000000, 2);
+ x->link[x->nb_link-1].arrayK = arrayK;
+ x->link[x->nb_link-1].arrayD = arrayD;
+ }
}
}
}
@@ -1202,6 +1206,7 @@ void pmpd_setup(void)
class_addbang(pmpd_class, pmpd_bang);
class_addmethod(pmpd_class, (t_method)pmpd_reset, gensym("reset"), 0);
class_addmethod(pmpd_class, (t_method)pmpd_infosL, gensym("infosL"), 0);
+ class_addmethod(pmpd_class, (t_method)pmpd_infosL, gensym("infos"), 0);
class_addmethod(pmpd_class, (t_method)pmpd_mass, gensym("mass"), A_DEFSYMBOL, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd_class, (t_method)pmpd_link, gensym("link"), A_GIMME, 0);
class_addmethod(pmpd_class, (t_method)pmpd_link, gensym("tabLink"), A_GIMME, 0);