diff options
-rw-r--r-- | exemples/48_pmpd~.pd | 204 | ||||
-rw-r--r-- | exemples/49_string~.pd | 52 | ||||
-rw-r--r-- | src/makefile | 2 | ||||
-rw-r--r-- | src/pmpd~.c | 31 |
4 files changed, 147 insertions, 142 deletions
diff --git a/exemples/48_pmpd~.pd b/exemples/48_pmpd~.pd index 104c1c7..1628928 100644 --- a/exemples/48_pmpd~.pd +++ b/exemples/48_pmpd~.pd @@ -1,142 +1,140 @@ -#N canvas 125 3 842 750 10; -#X text 281 321 Id \, M \, X0; -#X text 312 244 Id \, mass1 \, mass2 \, K \, D; -#X text 243 170 id \, outlet \, mass \, amplitude; -#X msg 221 378 reset; +#N canvas 39 25 842 667 10; #X obj 39 413 t a; -#X msg 202 324 mass 1 10 1; #X obj 134 11 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X obj 52 654 tabwrite~ array99; +#X obj 52 647 tabwrite~ array99; #X obj 424 497 metro 100; #X obj 424 471 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X obj 190 658 tabwrite~ array98; -#N canvas 0 0 454 304 graph1 0; +#X obj 190 647 tabwrite~ array98; +#N canvas 0 0 454 304 (subpatch) 0; #X array array97 100 float 0; #X coords 0 1 100 -1 150 100 1; #X restore 662 269 graph; -#X msg 201 299 mass 1 10 1; #X msg 15 54 \; pd dsp 1 \;; #X obj 15 29 loadbang; #X obj 450 474 loadbang; #X msg 299 402 forceX 2 1; #X obj 197 498 phasor~ 1; -#X obj 77 498 phasor~ 0.3; #X floatatom 77 479 5 0 0 0 - - -; #X floatatom 197 477 5 0 0 0 - - -; #X floatatom 320 478 5 0 0 0 - - -; -#X msg 203 350 mass 1 10 1; -#X msg 161 145 out 1 0 1 1; -#X msg 162 171 out 1 1 2 1; -#X msg 163 197 out 1 2 3 1; -#N canvas 0 0 454 304 graph1 0; +#N canvas 0 0 454 304 (subpatch) 0; #X array array98 100 float 0; #X coords 0 1 100 -1 150 100 1; #X restore 662 165 graph; -#X obj 325 658 tabwrite~ array97; +#X obj 325 647 tabwrite~ array97; #X obj 88 521 tabwrite~ array9; #X obj 208 522 tabwrite~ array8; #X obj 332 523 tabwrite~ array7; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array array9 100 float 0; #X coords 0 1 100 -1 150 100 1; #X restore 507 61 graph; -#N canvas 0 0 454 304 graph1 0; +#N canvas 0 0 454 304 (subpatch) 0; #X array array7 100 float 0; #X coords 0 1 100 -1 150 100 1; #X restore 507 269 graph; -#N canvas 0 0 454 304 graph1 0; +#N canvas 0 0 454 304 (subpatch) 0; #X array array8 100 float 0; #X coords 0 1 100 -1 150 100 1; #X restore 507 165 graph; -#X text 210 89 id \, inlet \, mass \, amplitude; -#X msg 134 116 in 1 2 3 1; -#X obj 37 714 dac~; -#X msg 182 222 link 1 0 1 0.1 0.001; -#X msg 181 244 link 1 0 2 0.5 0.001; -#X msg 182 267 link 1 0 3 0.3 0.001; -#X obj 39 629 hip~ 20; -#X obj 178 634 hip~ 20; -#X obj 312 632 hip~ 20; -#N canvas 0 0 450 300 graph1 0; +#X obj 38 734 dac~; +#N canvas 0 0 450 300 (subpatch) 0; #X array array99 100 float 0; #X coords 0 1 100 -1 150 100 1; #X restore 662 61 graph; -#X obj 39 599 pmpd~ 3 3; #X obj 320 499 phasor~ 1.5; -#X msg 133 68 in 1 0 1 1; -#X msg 133 91 in 1 1 2 1; #X obj 134 37 t b b b b b; -#X obj 405 635 metro 100; -#X obj 405 609 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +#X obj 325 623 metro 100; +#X obj 325 597 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X obj 431 612 loadbang; -#X obj 77 543 /~ 50; -#X obj 38 689 +~ 0; -#X obj 197 544 /~ 20; -#X obj 321 546 /~ 20; +#X obj 351 600 loadbang; #X text 159 10 <- create the network; -#X connect 3 0 4 0; -#X connect 4 0 44 0; -#X connect 5 0 4 0; -#X connect 6 0 48 0; -#X connect 8 0 28 0; -#X connect 8 0 29 0; -#X connect 8 0 30 0; -#X connect 9 0 8 0; -#X connect 12 0 4 0; -#X connect 14 0 13 0; -#X connect 15 0 8 0; -#X connect 16 0 4 0; -#X connect 17 0 29 0; -#X connect 17 0 54 0; -#X connect 18 0 28 0; -#X connect 18 0 52 0; -#X connect 19 0 18 0; -#X connect 20 0 17 0; -#X connect 21 0 45 0; -#X connect 22 0 4 0; -#X connect 23 0 4 0; -#X connect 24 0 4 0; -#X connect 25 0 4 0; -#X connect 35 0 4 0; -#X connect 37 0 4 0; -#X connect 38 0 4 0; -#X connect 39 0 4 0; -#X connect 40 0 7 0; -#X connect 40 0 53 0; -#X connect 41 0 10 0; -#X connect 41 0 53 0; -#X connect 42 0 27 0; -#X connect 42 0 53 0; -#X connect 44 0 40 0; -#X connect 44 1 41 0; -#X connect 44 2 42 0; -#X connect 45 0 30 0; -#X connect 45 0 55 0; -#X connect 46 0 4 0; -#X connect 47 0 4 0; -#X connect 48 0 46 0; -#X connect 48 0 47 0; -#X connect 48 0 35 0; -#X connect 48 1 23 0; -#X connect 48 1 24 0; -#X connect 48 1 25 0; -#X connect 48 2 37 0; -#X connect 48 2 38 0; -#X connect 48 2 39 0; -#X connect 48 3 12 0; -#X connect 48 3 5 0; -#X connect 48 3 22 0; -#X connect 48 4 3 0; -#X connect 49 0 7 0; -#X connect 49 0 10 0; -#X connect 49 0 27 0; -#X connect 50 0 49 0; -#X connect 51 0 49 0; -#X connect 52 0 44 0; -#X connect 53 0 36 0; -#X connect 53 0 36 1; -#X connect 54 0 44 1; -#X connect 55 0 44 2; +#X obj 39 709 *~ 0.5; +#X msg 181 256 link 0 2 0.5 0.001; +#X msg 182 277 link 0 3 0.3 0.001; +#X msg 202 324 mass 10 1; +#X msg 203 350 mass 10 1; +#X text 295 325 M \, X0; +#X text 312 256 mass1 \, mass2 \, K \, D; +#X text 281 168 outlet \, mass \, amplitude; +#X text 248 89 inlet \, mass \, amplitude; +#X msg 201 299 mass 10 1; +#X msg 221 378 reset \, mass 0 0; +#X msg 179 191 outPos 2 3 1; +#X msg 133 91 inForce 1 2 1; +#X obj 40 679 hip~ 20; +#X msg 134 116 inForce 2 3 1; +#X msg 162 171 outPos 1 2 1; +#X msg 133 68 inForce 0 1 1; +#X obj 77 498 phasor~ 1.33333; +#X msg 155 149 outPos 0 1 3; +#X text 212 236 mass1 \, mass2 \, K \, D \, Pow \, L0 \, Lmin \, Lmax +; +#X msg 176 218 NLlink 0 1 0.1 0.001 1.1 0 -10 10; +#X obj 77 543 /~ 250; +#X obj 197 544 /~ 10; +#X obj 319 554 /~ 30; +#X obj 39 583 pmpd~ 3 3; +#X connect 0 0 55 0; +#X connect 1 0 26 0; +#X connect 3 0 17 0; +#X connect 3 0 18 0; +#X connect 3 0 19 0; +#X connect 4 0 3 0; +#X connect 8 0 7 0; +#X connect 9 0 3 0; +#X connect 10 0 0 0; +#X connect 11 0 18 0; +#X connect 11 0 53 0; +#X connect 12 0 48 0; +#X connect 13 0 11 0; +#X connect 14 0 25 0; +#X connect 25 0 19 0; +#X connect 25 0 54 0; +#X connect 26 0 47 0; +#X connect 26 0 43 0; +#X connect 26 0 45 0; +#X connect 26 1 49 0; +#X connect 26 1 46 0; +#X connect 26 1 42 0; +#X connect 26 2 32 0; +#X connect 26 2 33 0; +#X connect 26 2 51 0; +#X connect 26 3 40 0; +#X connect 26 3 34 0; +#X connect 26 3 35 0; +#X connect 26 4 41 0; +#X connect 27 0 2 0; +#X connect 27 0 5 0; +#X connect 27 0 16 0; +#X connect 28 0 27 0; +#X connect 29 0 27 0; +#X connect 31 0 23 0; +#X connect 31 0 23 1; +#X connect 32 0 0 0; +#X connect 33 0 0 0; +#X connect 34 0 0 0; +#X connect 35 0 0 0; +#X connect 40 0 0 0; +#X connect 41 0 0 0; +#X connect 42 0 0 0; +#X connect 43 0 0 0; +#X connect 44 0 31 0; +#X connect 45 0 0 0; +#X connect 46 0 0 0; +#X connect 47 0 0 0; +#X connect 48 0 17 0; +#X connect 48 0 52 0; +#X connect 49 0 0 0; +#X connect 51 0 0 0; +#X connect 52 0 55 0; +#X connect 53 0 55 1; +#X connect 54 0 55 2; +#X connect 55 0 2 0; +#X connect 55 0 44 0; +#X connect 55 1 5 0; +#X connect 55 1 44 0; +#X connect 55 2 16 0; +#X connect 55 2 44 0; diff --git a/exemples/49_string~.pd b/exemples/49_string~.pd index 9bd3f15..804c7bc 100644 --- a/exemples/49_string~.pd +++ b/exemples/49_string~.pd @@ -26,7 +26,7 @@ #X obj 80 -14 loadbang; #X obj 26 221 dac~; #X obj 27 171 hip~ 20; -#N canvas 0 0 450 300 graph1 0; +#N canvas 0 0 450 300 (subpatch) 0; #X array array99 3000 float 0; #X coords 0 1 2999 -1 150 100 1; #X restore 49 257 graph; @@ -38,8 +38,6 @@ #X obj 72 270 pack f f; #X obj 83 200 t f f; #X obj 108 223 + 1; -#X msg 205 360 in 1 0 3 1; -#X msg 206 332 out 1 0 7 1; #X text 254 75 number of masss on the string; #X obj 144 220 + 1; #X obj 104 112 + 1; @@ -77,42 +75,44 @@ #X connect 5 0 3 0; #X connect 5 1 4 1; #X restore 138 156 pd uzi; -#X msg 149 181 mass 1 20 1; -#X msg 69 297 link 1 \$1 \$2 0.1 0.03; #X obj 137 127 20; #X obj 86 136 21; #X obj 109 244 % 21; #X msg 221 78 50; -#X connect 0 0 8 0; -#X connect 0 0 7 0; -#X connect 0 1 17 0; -#X connect 0 2 16 0; +#X msg 149 181 mass 20 1; +#X msg 69 297 link \$1 \$2 0.1 0.03; +#X msg 204 360 inForce 0 3 1; +#X msg 206 332 outPos 0 7 1; +#X connect 0 0 19 0; +#X connect 0 0 18 0; +#X connect 0 1 13 0; +#X connect 0 2 12 0; #X connect 0 3 1 0; #X connect 1 0 3 0; #X connect 2 0 0 0; -#X connect 4 0 15 0; +#X connect 4 0 17 0; #X connect 5 0 4 0; #X connect 5 1 6 0; -#X connect 6 0 18 0; -#X connect 7 0 3 0; -#X connect 8 0 3 0; -#X connect 10 0 18 1; -#X connect 11 0 17 1; -#X connect 12 0 5 0; -#X connect 13 0 14 0; -#X connect 14 0 3 0; -#X connect 15 0 3 0; -#X connect 16 0 13 0; -#X connect 17 0 12 0; -#X connect 18 0 4 1; -#X connect 19 0 10 0; -#X connect 19 0 11 0; -#X connect 19 0 16 1; +#X connect 6 0 14 0; +#X connect 8 0 14 1; +#X connect 9 0 13 1; +#X connect 10 0 5 0; +#X connect 11 0 16 0; +#X connect 12 0 11 0; +#X connect 13 0 10 0; +#X connect 14 0 4 1; +#X connect 15 0 8 0; +#X connect 15 0 9 0; +#X connect 15 0 12 1; +#X connect 16 0 3 0; +#X connect 17 0 3 0; +#X connect 18 0 3 0; +#X connect 19 0 3 0; #X restore 28 96 pd corde; #X obj 28 74 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 89 193 metro 100; -#X obj 89 167 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 +#X obj 89 167 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 ; #X obj 115 170 loadbang; #X obj 28 122 pmpd~ 1 1; diff --git a/src/makefile b/src/makefile index e0043c9..45f07bf 100644 --- a/src/makefile +++ b/src/makefile @@ -63,7 +63,7 @@ pd_linux: pmpd.pd_linux mass.pd_linux link.pd_linux mass2D.pd_linux link2D.pd_li LINUXCFLAGS = -fPIC -DPD -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow -Wstrict-prototypes -Werror \
- -Wno-unused -Wno-parentheses -Wno-switch
+ -Wno-unused -Wno-parentheses -Wno-switch LINUXINCLUDE = -I../../src
diff --git a/src/pmpd~.c b/src/pmpd~.c index 33cfe28..ce8f02d 100644 --- a/src/pmpd~.c +++ b/src/pmpd~.c @@ -268,7 +268,8 @@ void pmpd_tilde_mass(t_pmpd_tilde *x, t_float M, t_float posX) x->mass[x->nb_mass].posX = posX;
x->mass[x->nb_mass].forceX = 0;
- x->nb_mass++ ;
+ x->nb_mass++ ; + if (x->nb_mass == nb_max_mass) error("to many mass");
x->nb_mass = min ( nb_max_mass -1, x->nb_mass );
}
@@ -281,7 +282,8 @@ void pmpd_tilde_link(t_pmpd_tilde *x, t_float mass_1, t_float mass_2, t_float K1 x->link[x->nb_link].K1 = K1;
x->link[x->nb_link].D1 = D1;
- x->nb_link++ ;
+ x->nb_link++ ; + if (x->nb_link == nb_max_link) error("to many link");
x->nb_link = min ( nb_max_link -1, x->nb_link );
} @@ -300,7 +302,8 @@ void pmpd_tilde_NLlink(t_pmpd_tilde *x, t_symbol *s, int argc, t_atom *argv) x->NLlink[x->nb_NLlink].Lmin = atom_getfloatarg(6, argc, argv);
x->NLlink[x->nb_NLlink].Lmax = atom_getfloatarg(7, argc, argv);
- x->nb_NLlink++ ;
+ x->nb_NLlink++ ; + if (x->nb_NLlink == nb_max_link) error("to many NLlink");
x->nb_NLlink = min ( nb_max_link -1, x->nb_NLlink ); } else @@ -315,7 +318,8 @@ void pmpd_tilde_inPos(t_pmpd_tilde *x, t_float nb_inlet, t_float mass_1, t_float x->inPos[x->nb_inPos].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
x->inPos[x->nb_inPos].influence = influence;
- x->nb_inPos++;
+ x->nb_inPos++; + if (x->nb_inPos == nb_max_in) error("to many inPos");
x->nb_inPos = min ( nb_max_in - 1, x->nb_inPos );
} void pmpd_tilde_inForce(t_pmpd_tilde *x, t_float nb_inlet, t_float mass_1, t_float influence)
@@ -326,7 +330,8 @@ void pmpd_tilde_inForce(t_pmpd_tilde *x, t_float nb_inlet, t_float mass_1, t_flo x->inForce[x->nb_inForce].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
x->inForce[x->nb_inForce].influence = influence;
- x->nb_inForce++;
+ x->nb_inForce++; + if (x->nb_inForce == nb_max_in) error("to many inForce");
x->nb_inForce = min ( nb_max_in - 1, x->nb_inForce );
} @@ -338,7 +343,8 @@ void pmpd_tilde_outPos(t_pmpd_tilde *x, t_float nb_outlet, t_float mass_1, t_flo x->outPos[x->nb_outPos].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
x->outPos[x->nb_outPos].influence = influence;
- x->nb_outPos++ ;
+ x->nb_outPos++ ; + if (x->nb_outPos == nb_max_out) error("to many outPos");
x->nb_outPos = min ( nb_max_out - 1, x->nb_outPos );
}
@@ -350,7 +356,8 @@ void pmpd_tilde_outSpeed(t_pmpd_tilde *x, t_float nb_outlet, t_float mass_1, t_f x->outSpeed[x->nb_outSpeed].mass1 = &x->mass[max(0, min ( x->nb_mass, (int)mass_1))];
x->outSpeed[x->nb_outSpeed].influence = influence;
- x->nb_outSpeed++ ;
+ x->nb_outSpeed++ ; + if (x->nb_outSpeed == nb_max_out) error("to many outSpeed");
x->nb_outSpeed = min ( nb_max_out - 1, x->nb_outSpeed );
}
@@ -395,14 +402,14 @@ void pmpd_tilde_setup(void) { CLASS_MAINSIGNALIN(pmpd_tilde_class, t_pmpd_tilde, f);
class_addbang(pmpd_tilde_class, pmpd_tilde_bang);
- class_addfloat(pmpd_tilde_class, (t_method)pmpd_tilde_float);
+ class_addfloat(pmpd_tilde_class, (t_method)pmpd_tilde_float);
class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_mass, gensym("mass"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_link, gensym("link"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_NLlink, gensym("NLlink"), A_GIMME, 0); - class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_inPos, gensym("inPos"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_inForce, gensym("inForce"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_outPos, gensym("outPos"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_outSpeed, gensym("outSpeed"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_inPos, gensym("inPos"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_inForce, gensym("inForce"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_outPos, gensym("outPos"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_outSpeed, gensym("outSpeed"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_posX, gensym("posX"), A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_forceX, gensym("forceX"), A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(pmpd_tilde_class, (t_method)pmpd_tilde_reset, gensym("reset"), 0);
|