From 2f012f2baaae9cf9a53afd2398d326a6cdf56fec Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 30 Mar 2003 02:48:59 +0000 Subject: "" svn path=/trunk/; revision=511 --- externals/grill/vasp/changes.txt | 3 ++ externals/grill/vasp/max-ex/convolve | 2 +- externals/grill/vasp/pd-ex/convolve.pd | 8 ++--- externals/grill/vasp/pd/vasp.qmean.pd | 19 +++++----- externals/grill/vasp/pd/vasp.rms.pd | 21 +++++------ externals/grill/vasp/source/buflib.cpp | 60 +++++++++++++++++++++----------- externals/grill/vasp/source/main.cpp | 6 ++-- externals/grill/vasp/source/obj_imm.cpp | 25 +++++++++---- externals/grill/vasp/source/vbuffer.h | 2 +- externals/grill/vasp/vasp.cw | Bin 301192 -> 301192 bytes externals/grill/xsample/source/main.cpp | 4 +-- 11 files changed, 94 insertions(+), 56 deletions(-) (limited to 'externals/grill') diff --git a/externals/grill/vasp/changes.txt b/externals/grill/vasp/changes.txt index 3d9cbcf7..50d4df8a 100644 --- a/externals/grill/vasp/changes.txt +++ b/externals/grill/vasp/changes.txt @@ -10,6 +10,9 @@ Version history: - ADD: all objects: attribute "defer" to queue outgoing vasps - to avoid stack faults for message loops - CHANGE: enable attributes "detach" and "prior" also for non-threaded builds to ensure patch compatibility - FIX: vasp.size - flext bug for @keep=1 +- FIX: vasp.imm - bug with memory reservation length +- ADD: vasp.imm - attribute "zero" (default: true) - whether array should be cleared +- FIX: Max/MSP - freeing immediate buffers with overdrive is bogus -> using queued flext timer 0.1.2: - FIX: bug in vasp.frames* ... wrong argument diff --git a/externals/grill/vasp/max-ex/convolve b/externals/grill/vasp/max-ex/convolve index 2641521a..481d020a 100755 --- a/externals/grill/vasp/max-ex/convolve +++ b/externals/grill/vasp/max-ex/convolve @@ -1 +1 @@ -max v2; #N vpatcher 3 47 870 744; #P newex 53 423 35 196617 vasp.f; #P newex 324 415 45 196617 loadbang; #P message 56 315 53 196617 vasp buf3; #N vpatcher 284 239 684 539; #P newex 36 128 43 196617 * 1000; #P newex 36 102 27 196617 int; #P newex 36 76 42 196617 / 1000; #P outlet 36 217 15 0; #P inlet 36 48 15 0; #P connect 0 0 2 0; #P connect 2 0 3 0; #P connect 3 0 4 0; #P connect 4 0 1 0; #P pop; #P newobj 105 268 38 196617 p rnd; #P message 794 105 52 196617 0 -1 0 -1; #P message 798 253 52 196617 0 -1 0 -1; #P message 541 47 34 196617 write; #N vpatcher 385 272 785 572; #P outlet 29 147 15 0; #P inlet 90 40 15 0; #P inlet 29 42 15 0; #P newex 28 108 35 196617 vasp.f; #P newex 28 71 38 196617 vasp.s; #P connect 2 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P connect 3 0 1 1; #P connect 3 0 0 1; #P pop; #P newobj 70 369 25 196617 p sf; #N vpatcher 385 272 785 572; #P outlet 29 147 15 0; #P inlet 90 40 15 0; #P inlet 29 42 15 0; #P newex 28 108 35 196617 vasp.f; #P newex 28 71 38 196617 vasp.s; #P connect 2 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P connect 3 0 1 1; #P connect 3 0 0 1; #P pop; #P newobj 149 316 25 196617 p sf; #P newex 149 226 30 196617 vasp; #P flonum 600 411 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 495 411 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P button 166 95 15 0; #P flonum 600 251 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 495 251 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 88 214 27 196617 t b i; #P newex 88 189 43 196617 vasp.f?; #P button 51 101 15 0; #N vpatcher 658 452 1058 752; #P origin 0 167; #P newex 26 46 20 196617 t b; #P outlet 34 240 15 0; #P inlet 147 33 15 0; #P inlet 85 29 15 0; #P inlet 24 27 15 0; #P message 45 176 35 196617 set \$1; #P newex 45 211 76 196617 pack 0. 0.; #P newex 126 77 40 196617 * 44.099998; #P newex 45 89 40 196617 * 44.099998; #P newex 45 67 29 196617 !- 0.; #P connect 5 0 9 0; #P connect 3 0 8 0; #P connect 6 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P connect 4 0 3 0; #P fasten 9 0 3 0 31 202 50 202; #P connect 7 0 0 1; #P connect 2 0 3 1; #P connect 6 0 2 0; #P pop; #P newobj 37 147 41 196617 p sel; #N vpatcher 658 452 1058 752; #P origin 0 167; #P newex 26 46 20 196617 t b; #P outlet 34 183 15 0; #P inlet 147 33 15 0; #P inlet 85 29 15 0; #P inlet 24 27 15 0; #P message 45 114 35 196617 set \$1; #P newex 45 142 76 196617 pack 0. 0.; #P newex 133 93 40 196617 * 44.099998; #P newex 45 89 40 196617 * 44.099998; #P newex 45 67 29 196617 !- 0.; #P connect 5 0 9 0; #P connect 3 0 8 0; #P connect 6 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P fasten 9 0 3 0 31 133 50 133; #P connect 4 0 3 0; #P connect 7 0 0 1; #P connect 2 0 3 1; #P connect 6 0 2 0; #P pop; #P newobj 149 125 41 196617 p sel; #P user umenu 138 545 100 196647 1 64 561 1; #X add buf1; #X add buf2; #X add buf3; #P newex 138 564 60 196617 prepend set; #P user waveform~ 276 546 569 107 3 9; #W mode select; #W mouseoutput continuous; #W unit ms; #W grid 1000.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P newex 149 171 35 196617 vasp.n; #P newex 37 206 35 196617 vasp.n; #P toggle 130 57 15 0; #P newex 56 338 38 196617 vasp.n; #P newex 53 467 45 196617 vasp.opt; #P newex 53 445 54 196617 vasp.conv; #P newex 53 511 31 196617 print; #P newex 53 490 38 196617 vasp.u; #P user waveform~ 276 436 569 107 3 9; #W mode select; #W mouseoutput continuous; #W unit ms; #W grid 1000.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P message 276 417 45 196617 set buf3; #P message 492 47 42 196617 replace; #P newex 490 68 81 196617 buffer~ buf3 10; #P newex 37 393 43 196617 vasp.->; #P message 149 150 82 196617 vasp \$1 buf2 \$2; #P button 38 36 42 0; #P message 37 169 83 196617 vasp \$1 buf1 \$2; #P message 30 590 27 196617 stop; #P message 375 48 42 196617 replace; #P newex 373 69 65 196617 buffer~ buf2; #P user waveform~ 277 272 572 133 3 9; #W mode select; #W mouseoutput continuous; #W unit samples; #W grid 44100.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P message 277 253 45 196617 set buf2; #P message 31 572 60 196617 reset \, start; #P newex 94 573 35 196617 sig~ 1; #P user ezdac~ 70 642 114 675 0; #P newex 80 619 84 196617 xgroove~ 1 buf3; #P user waveform~ 277 123 570 121 3 9; #W mode select; #W mouseoutput continuous; #W unit ms; #W grid 1000.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P message 277 104 45 196617 set buf1; #P message 278 48 42 196617 replace; #P newex 276 69 65 196617 buffer~ buf1; #P comment 147 57 100 196617 channel sel 0/1; #P newex 168 202 35 196617 vasp.!; #P connect 16 0 35 0; #P connect 36 0 35 0; #P connect 35 0 15 0; #P connect 15 0 29 0; #P connect 29 0 18 0; #P hidden connect 5 2 35 1; #P connect 18 1 53 0; #P connect 53 0 25 0; #P connect 25 0 26 0; #P connect 26 0 23 0; #P connect 23 0 24 0; #P fasten 38 0 51 0 93 258 61 258; #P connect 51 0 27 0; #P hidden connect 28 0 29 1; #P hidden connect 5 3 35 2; #P connect 27 0 46 0; #P connect 46 0 18 1; #P connect 6 0 7 0; #P fasten 50 0 53 1 110 409 83 409; #P connect 32 0 6 0; #P connect 9 0 6 0; #P connect 8 0 6 0; #P connect 14 0 6 0; #P hidden fasten 28 0 27 1 135 332 89 332; #P fasten 50 0 46 1 110 359 90 359; #P connect 15 0 37 0; #P connect 37 0 38 0; #P fasten 45 0 25 1 154 423 102 423; #P connect 38 1 50 0; #P connect 33 1 32 0; #P connect 41 0 34 0; #P connect 16 0 34 0; #P connect 34 0 17 0; #P connect 17 0 30 0; #P fasten 38 0 44 0 93 258 126 258 126 219 154 219; #P connect 44 0 45 0; #P hidden connect 11 2 34 1; #P fasten 50 0 45 1 110 300 169 300; #P connect 30 0 0 0; #P connect 0 0 44 1; #P hidden connect 28 0 30 1; #P hidden connect 11 3 34 2; #P connect 3 0 2 0; #P hidden connect 19 1 21 0; #P hidden connect 52 0 21 0; #P connect 21 0 22 0; #P hidden connect 2 1 4 0; #P connect 4 0 5 0; #P hidden connect 12 1 10 0; #P connect 10 0 11 0; #P connect 13 0 12 0; #P connect 47 0 19 0; #P connect 20 0 19 0; #P connect 5 2 39 0; #P connect 11 2 42 0; #P connect 5 3 40 0; #P connect 11 3 43 0; #P hidden connect 31 5 22 4; #P hidden connect 22 5 31 4; #P connect 49 0 5 4; #P pop; \ No newline at end of file +max v2; #N vpatcher 3 47 844 744; #P newex 151 447 59 196617 vasp.cconv; #P newex 53 423 35 196617 vasp.f; #P newex 632 52 45 196617 loadbang; #P message 56 315 53 196617 vasp buf3; #N vpatcher 284 239 684 539; #P newex 36 128 43 196617 * 1000; #P newex 36 102 27 196617 int; #P newex 36 76 42 196617 / 1000; #P outlet 36 217 15 0; #P inlet 36 48 15 0; #P connect 0 0 2 0; #P connect 2 0 3 0; #P connect 3 0 4 0; #P connect 4 0 1 0; #P pop; #P newobj 105 268 38 196617 p rnd; #P message 770 110 52 196617 0 -1 0 -1; #P message 774 258 52 196617 0 -1 0 -1; #P message 518 51 34 196617 write; #N vpatcher 385 272 785 572; #P outlet 29 147 15 0; #P inlet 90 40 15 0; #P inlet 29 42 15 0; #P newex 28 108 35 196617 vasp.f; #P newex 28 71 38 196617 vasp.s; #P connect 2 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P connect 3 0 1 1; #P connect 3 0 0 1; #P pop; #P newobj 70 369 25 196617 p sf; #N vpatcher 385 272 785 572; #P outlet 29 147 15 0; #P inlet 90 40 15 0; #P inlet 29 42 15 0; #P newex 28 108 35 196617 vasp.f; #P newex 28 71 38 196617 vasp.s; #P connect 2 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P connect 3 0 1 1; #P connect 3 0 0 1; #P pop; #P newobj 149 316 25 196617 p sf; #P newex 149 226 30 196617 vasp; #P flonum 577 415 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 472 415 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P button 166 95 15 0; #P flonum 577 255 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P flonum 472 255 73 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0; #P newex 88 214 27 196617 t b i; #P newex 88 189 43 196617 vasp.f?; #P button 51 101 15 0; #N vpatcher 658 452 1058 752; #P origin 0 167; #P newex 26 46 20 196617 t b; #P outlet 34 240 15 0; #P inlet 147 33 15 0; #P inlet 85 29 15 0; #P inlet 24 27 15 0; #P message 45 176 35 196617 set \$1; #P newex 45 211 76 196617 pack 0. 0.; #P newex 126 77 40 196617 * 44.099998; #P newex 45 89 40 196617 * 44.099998; #P newex 45 67 29 196617 !- 0.; #P connect 5 0 9 0; #P connect 3 0 8 0; #P connect 6 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P connect 4 0 3 0; #P fasten 9 0 3 0 31 202 50 202; #P connect 7 0 0 1; #P connect 2 0 3 1; #P connect 6 0 2 0; #P pop; #P newobj 37 147 41 196617 p sel; #N vpatcher 658 452 1058 752; #P origin 0 167; #P newex 26 46 20 196617 t b; #P outlet 34 183 15 0; #P inlet 147 33 15 0; #P inlet 85 29 15 0; #P inlet 24 27 15 0; #P message 45 114 35 196617 set \$1; #P newex 45 142 76 196617 pack 0. 0.; #P newex 133 93 40 196617 * 44.099998; #P newex 45 89 40 196617 * 44.099998; #P newex 45 67 29 196617 !- 0.; #P connect 5 0 9 0; #P connect 3 0 8 0; #P connect 6 0 0 0; #P connect 0 0 1 0; #P connect 1 0 4 0; #P fasten 9 0 3 0 31 133 50 133; #P connect 4 0 3 0; #P connect 7 0 0 1; #P connect 2 0 3 1; #P connect 6 0 2 0; #P pop; #P newobj 149 125 41 196617 p sel; #P user umenu 138 545 100 196647 1 64 561 1; #X add buf1; #X add buf2; #X add buf3; #P newex 138 564 60 196617 prepend set; #P newex 149 171 35 196617 vasp.n; #P newex 37 206 35 196617 vasp.n; #P toggle 130 57 15 0; #P newex 56 338 38 196617 vasp.n; #P newex 53 467 45 196617 vasp.opt; #P newex 53 447 54 196617 vasp.conv; #P newex 53 511 31 196617 print; #P newex 53 490 38 196617 vasp.u; #P user waveform~ 253 440 569 107 3 9; #W mode select; #W mouseoutput continuous; #W unit samples; #W grid 44100.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P message 253 421 45 196617 set buf3; #P message 469 51 42 196617 replace; #P newex 467 72 81 196617 buffer~ buf3 10; #P newex 37 393 43 196617 vasp.->; #P message 149 150 82 196617 vasp \$1 buf2 \$2; #P button 38 36 42 0; #P message 37 169 83 196617 vasp \$1 buf1 \$2; #P message 30 590 27 196617 stop; #P message 352 52 42 196617 replace; #P newex 350 73 81 196617 buffer~ buf2 10; #P user waveform~ 254 276 572 133 3 9; #W mode select; #W mouseoutput continuous; #W unit samples; #W grid 44100.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P message 254 257 45 196617 set buf2; #P message 31 572 60 196617 reset \, start; #P newex 94 573 35 196617 sig~ 1; #P user ezdac~ 70 642 114 675 0; #P newex 80 619 84 196617 xgroove~ 1 buf3; #P user waveform~ 254 127 570 121 3 9; #W mode select; #W mouseoutput continuous; #W unit samples; #W grid 44100.; #W ticks 8.; #W labels 1; #W vlabels 0; #W vticks 1; #W vzoom 1.; #W voffset 0.; #W bpm 120. 4.; #W frgb 33 0 0; #W brgb 60 178 173; #W rgb2 0 95 255; #W rgb3 0 0 0; #W rgb4 0 0 0; #W rgb5 190 137 255; #W rgb6 100 100 100; #W rgb7 100 100 100; #P message 254 108 45 196617 set buf1; #P message 255 52 42 196617 replace; #P newex 253 73 81 196617 buffer~ buf1 10; #P comment 147 57 100 196617 channel sel 0/1; #P newex 168 197 35 196617 vasp.!; #P connect 16 0 34 0; #P connect 35 0 34 0; #P connect 34 0 15 0; #P connect 15 0 29 0; #P connect 29 0 18 0; #P hidden connect 5 2 34 1; #P connect 18 1 52 0; #P connect 52 0 25 0; #P connect 25 0 26 0; #P connect 26 0 23 0; #P connect 23 0 24 0; #P fasten 37 0 50 0 93 258 61 258; #P connect 50 0 27 0; #P hidden connect 28 0 29 1; #P hidden connect 5 3 34 2; #P connect 27 0 45 0; #P connect 45 0 18 1; #P connect 6 0 7 0; #P fasten 49 0 52 1 110 409 83 409; #P connect 31 0 6 0; #P connect 9 0 6 0; #P connect 8 0 6 0; #P connect 14 0 6 0; #P hidden fasten 28 0 27 1 135 332 89 332; #P fasten 49 0 45 1 110 359 90 359; #P connect 15 0 36 0; #P connect 36 0 37 0; #P fasten 44 0 25 1 154 423 102 423; #P connect 37 1 49 0; #P connect 32 1 31 0; #P connect 40 0 33 0; #P connect 16 0 33 0; #P connect 33 0 17 0; #P connect 17 0 30 0; #P fasten 37 0 43 0 93 258 126 258 126 219 154 219; #P connect 43 0 44 0; #P hidden connect 11 2 33 1; #P fasten 49 0 44 1 110 300 169 300; #P connect 30 0 0 0; #P connect 0 0 43 1; #P hidden connect 28 0 30 1; #P hidden connect 11 3 33 2; #P connect 3 0 2 0; #P hidden connect 51 0 21 0; #P hidden connect 19 1 21 0; #P connect 21 0 22 0; #P hidden connect 51 0 4 0; #P hidden connect 2 1 4 0; #P connect 4 0 5 0; #P hidden connect 12 1 10 0; #P hidden connect 51 0 10 0; #P connect 10 0 11 0; #P connect 13 0 12 0; #P connect 46 0 19 0; #P connect 20 0 19 0; #P connect 5 2 38 0; #P connect 11 2 41 0; #P connect 5 3 39 0; #P connect 11 3 42 0; #P connect 48 0 5 4; #P connect 47 0 11 4; #P pop; \ No newline at end of file diff --git a/externals/grill/vasp/pd-ex/convolve.pd b/externals/grill/vasp/pd-ex/convolve.pd index 954a5512..9a8a4088 100644 --- a/externals/grill/vasp/pd-ex/convolve.pd +++ b/externals/grill/vasp/pd-ex/convolve.pd @@ -1,4 +1,4 @@ -#N canvas 292 80 642 419 12; +#N canvas 63 57 644 421 12; #X obj 60 241 bng 50 250 50 0 start_bang empty start 0 -6 128 8 -24198 -1 -1; #X text 15 77 load/save/play etc.; @@ -14,7 +14,7 @@ #X obj 177 356 bng 15 250 50 0 empty empty empty 0 -6 0 8 -258699 -1 -1; #X obj 201 357 nbx 8 16 0 1e+008 0 0 len_arg empty empty 0 -8 128 12 --261689 -1 -1 3.21297e+006 256; +-261689 -1 -1 1.50469e+006 256; #X obj 11 10 cnv 15 600 50 empty empty convolve 10 22 0 24 -260818 -1 0; #X text 202 41 http://www.parasitaere-kapazitaeten.net; @@ -23,9 +23,9 @@ #X text 32 329 result buffer; #X text 140 121 source buffer; #X text 137 175 argument buffer; -#N canvas 0 0 470 320 do 0; +#N canvas 0 0 472 322 do 0; #X obj 29 215 vasp.u; -#N canvas 406 75 399 494 convolve 0; +#N canvas 406 75 401 496 convolve 0; #X obj 57 343 vasp.conv; #X obj 199 183 vasp.!; #X obj 108 191 vasp.f?; diff --git a/externals/grill/vasp/pd/vasp.qmean.pd b/externals/grill/vasp/pd/vasp.qmean.pd index 31f5b483..2e33a605 100644 --- a/externals/grill/vasp/pd/vasp.qmean.pd +++ b/externals/grill/vasp/pd/vasp.qmean.pd @@ -1,12 +1,13 @@ -#N canvas 0 0 454 304 12; -#X obj 51 22 inlet; -#X obj 118 265 outlet; -#X obj 87 135 vasp.sum?; -#X obj 51 55 vasp.radio; -#X obj 186 135 vasp.f?; -#X obj 167 208 /; -#X obj 117 168 route 0; -#X obj 87 87 vasp.m; +#N canvas 0 0 456 349 12; +#X obj 31 52 inlet; +#X obj 98 295 outlet; +#X obj 67 165 vasp.sum?; +#X obj 31 85 vasp.radio; +#X obj 166 165 vasp.f?; +#X obj 147 238 /; +#X obj 97 198 route 0; +#X obj 67 117 vasp.m; +#X text 27 8 calculate mean value of the values in a vasp; #X connect 0 0 3 0; #X connect 2 1 6 0; #X connect 3 0 2 0; diff --git a/externals/grill/vasp/pd/vasp.rms.pd b/externals/grill/vasp/pd/vasp.rms.pd index 19ba197d..9cad83b2 100644 --- a/externals/grill/vasp/pd/vasp.rms.pd +++ b/externals/grill/vasp/pd/vasp.rms.pd @@ -1,13 +1,14 @@ -#N canvas 270 238 445 419 12; -#X obj 42 81 vasp.!; -#X obj 42 126 vasp.sqr; -#X obj 43 215 sqrt; -#X obj 42 26 inlet; -#X obj 42 293 outlet; -#X text 105 82 make temporary buffer; -#X text 99 295 RMS; -#X obj 42 164 vasp.qmean; -#X text 132 166 mean value; +#N canvas 270 238 447 421 12; +#X obj 35 118 vasp.!; +#X obj 35 163 vasp.sqr; +#X obj 36 252 sqrt; +#X obj 35 63 inlet; +#X obj 35 330 outlet; +#X text 98 119 make temporary buffer; +#X text 92 332 RMS; +#X obj 35 201 vasp.qmean; +#X text 125 203 mean value; +#X text 32 12 calculate RMS value of a vasp; #X connect 0 0 1 0; #X connect 1 0 7 0; #X connect 2 0 4 0; diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp index d4a6338e..b3595158 100644 --- a/externals/grill/vasp/source/buflib.cpp +++ b/externals/grill/vasp/source/buflib.cpp @@ -12,13 +12,18 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "buflib.h" #include -#define LIBTICK 100 // tick time in ms -#define LIBTOL 2 // how many ticks till release +#define LIBTICK 0.1 // tick time in s +#define LIBTOL 3 // how many ticks till release #define REUSE_MAXLOSEREL 0.1 // max. fraction of lost buffer size #define REUSE_MAXLOSEABS 10000 // max. lost buffer size -#define LIBMAGIC 12349876L // magic number for s_thing data check + +#ifdef __MWERKS__ +#define STD std +#else +#define STD +#endif class FreeEntry @@ -39,7 +44,6 @@ public: V IncRef(); V DecRef(); -// UL magic; const t_symbol *sym; I refcnt,tick; BufEntry *nxt; @@ -63,13 +67,11 @@ static V FreeLibSym(const t_symbol *s); BufEntry::BufEntry(const t_symbol *s,I fr,BL zero): - sym(s), //magic(LIBMAGIC), + sym(s), alloc(fr),len(fr),data(new S[fr]), refcnt(0),nxt(NULL) { if(zero) flext::ZeroMem(data,len*sizeof(*data)); -// FLEXT_ASSERT(!flext_base::GetThing(sym)); -// flext_base::SetThing(sym,this); } BufEntry::~BufEntry() @@ -88,6 +90,18 @@ static BufEntry *FindInLib(const t_symbol *s) return e?e:NULL; } +#ifdef FLEXT_DEBUG +static V DumpLib() +{ + post("Dump {"); + BufEntry *e; + for(e = libhead; e; e = e->nxt) { + post("\t%s -> refs:%i, alloc:%i, len:%i -> %p",flext::GetString(e->sym),e->refcnt,e->alloc,e->len,e->data); + } + post("}"); +} +#endif + VBuffer *BufLib::Get(const VSymbol &s,I chn,I len,I offs) { BufEntry *e = FindInLib(s.Symbol()); @@ -165,7 +179,8 @@ static V LibThr(flext::thr_params *) } #endif -static t_clock *libclk = NULL; +static flext::Timer *libclk = NULL; + static V LibTick(V *) { #ifdef FLEXT_THREADS @@ -175,8 +190,6 @@ static V LibTick(V *) #endif ++libtick; - clock_delay(libclk,LIBTICK); - } static const t_symbol *GetLibSym() @@ -193,19 +206,21 @@ static const t_symbol *GetLibSym() else { // allocate new symbol char tmp[20]; - #ifdef __MWERKS__ - std:: - #endif - sprintf(tmp,"vasp!%04i",libcnt); //! \todo what if libcnt has > 4 digits? + if(libcnt > 0xffff) + STD::sprintf(tmp,"vasp!%08x",libcnt); + else // better hash lookup for 4 digits + STD::sprintf(tmp,"vasp!%04x",libcnt); libcnt++; return gensym(tmp); } - - clock_delay(libclk,LIBTICK); } static V FreeLibSym(const t_symbol *sym) { +#ifdef FLEXT_DEBUG +// post("free %s",flext::GetString(sym)); +#endif + FreeEntry *f = new FreeEntry(sym); if(!freehead) freehead = f; else freetail->nxt = f; @@ -227,8 +242,9 @@ BufEntry *BufLib::NewImm(I fr,BL zero) } #endif if(!libclk) { - libclk = (t_clock *)clock_new(NULL,(t_method)LibTick); - clock_delay(libclk,LIBTICK); + libclk = new flext::Timer(true); + libclk->SetCallback(LibTick); + libclk->Periodic(LIBTICK); } const t_symbol *s = GetLibSym(); @@ -242,6 +258,10 @@ BufEntry *BufLib::NewImm(I fr,BL zero) else libhead = entry; libtail = entry; +#ifdef FLEXT_DEBUG +// DumpLib(); +#endif + #ifdef FLEXT_THREADS libmtx.Unlock(); #endif @@ -278,9 +298,9 @@ BufEntry *BufLib::Resize(BufEntry *e,I fr,BL keep,BL zero) -ImmBuf::ImmBuf(I len): +ImmBuf::ImmBuf(I len,BL zero): VBuffer(0,len), - entry(BufLib::NewImm(len)) + entry(BufLib::NewImm(len,zero)) {} ImmBuf::ImmBuf(BufEntry *e,I len,I offs): diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp index 4efd6e36..6a1e01cf 100644 --- a/externals/grill/vasp/source/main.cpp +++ b/externals/grill/vasp/source/main.cpp @@ -12,11 +12,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "classes.h" -const C *VASP_VERSION = "0.1.3pre5"; +const C *VASP_VERSION = "0.1.3pre6"; #include "opfuns.h" -V lib_setup() +static V vasp_main() { post(""); post("-----------------------------------------"); @@ -207,7 +207,7 @@ V lib_setup() VASP__SETUP(cifft) } -FLEXT_LIB_SETUP(vasp,lib_setup) +FLEXT_LIB_SETUP(vasp,vasp_main) diff --git a/externals/grill/vasp/source/obj_imm.cpp b/externals/grill/vasp/source/obj_imm.cpp index 3e26677f..ce11d74c 100644 --- a/externals/grill/vasp/source/obj_imm.cpp +++ b/externals/grill/vasp/source/obj_imm.cpp @@ -38,7 +38,7 @@ class vasp_imm: public: vasp_imm(I argc,t_atom *argv): - frms(0) + frms(0),zero(true) { if(argc >= 1 && CanbeInt(argv[0])) m_frames(GetAInt(argv[0])); @@ -54,6 +54,7 @@ public: { FLEXT_CADDMETHOD(c,1,m_frames); FLEXT_CADDATTR_VAR(c,"frames",frms,m_frames); + FLEXT_CADDATTR_VAR1(c,"zero",zero); } V m_frames(I n) { frms = n; } @@ -67,7 +68,7 @@ public: else */ { - ImmBuf ibuf(frms); + ImmBuf ibuf(frms,zero); Vasp ret(frms,Vasp::Ref(ibuf)); ToOutVasp(0,ret); } @@ -76,17 +77,27 @@ public: post("%s - More than one vector in vasp!",thisName()); else { VBuffer *buf = ref.Buffer(0); - I len = buf->Length(),chns = buf->Channels(); - if(frms > len) len = frms; + const I len = buf->Length(),chns = buf->Channels(); + + // size of memory reservation (at least frms samples) + const I rlen = frms > len?frms:len; - ImmBuf imm(len); + ImmBuf imm(rlen,false); S *dst = imm.Pointer(); const S *src = buf->Pointer(); + +// post("!copy: src: %p,%i,%i -> dst: %p,%i",src,len,chns,dst,rlen); + register int i; _DE_LOOP(i,len, ( dst[i] = *src,src += chns ) ) + if(zero && rlen > len) ZeroSamples(dst+len,rlen-len); + + Vasp::Ref vr(imm); + +// post("!vr: %s,%i",vr.Ok()?vr.Symbol().Name():"***",vr.Offset()); - Vasp ret(len,Vasp::Ref(imm)); + Vasp ret(len,vr); ToOutVasp(0,ret); } } @@ -96,11 +107,13 @@ public: protected: I frms; + BL zero; private: FLEXT_CALLBACK_I(m_frames) FLEXT_CALLSET_I(m_frames); FLEXT_ATTRGET_I(frms); + FLEXT_ATTRVAR_B(zero); }; FLEXT_LIB_V("vasp, vasp.imm vasp.!",vasp_imm) diff --git a/externals/grill/vasp/source/vbuffer.h b/externals/grill/vasp/source/vbuffer.h index e616ad1c..a87685c9 100644 --- a/externals/grill/vasp/source/vbuffer.h +++ b/externals/grill/vasp/source/vbuffer.h @@ -107,7 +107,7 @@ class ImmBuf: public VBuffer { public: - ImmBuf(I len); + ImmBuf(I len,BL zero = true); ImmBuf(BufEntry *e,I len = -1,I offs = 0); virtual BL Ok() const { return entry != NULL; } diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw index 09a8875f..817ecfc5 100644 Binary files a/externals/grill/vasp/vasp.cw and b/externals/grill/vasp/vasp.cw differ diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp index 2392bdb1..aa1f731e 100644 --- a/externals/grill/xsample/source/main.cpp +++ b/externals/grill/xsample/source/main.cpp @@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. // Initialization function for xsample library -V lib_setup() +static V xsample_main() { post("xsample objects, version " XSAMPLE_VERSION ", (C)2001-2003 Thomas Grill"); post("xsample: xrecord~, xplay~, xgroove~ - send objects a 'help' message to get assistance"); @@ -32,7 +32,7 @@ V lib_setup() } // setup the library -FLEXT_LIB_SETUP(xsample,lib_setup) +FLEXT_LIB_SETUP(xsample,xsample_main) // ------------------------------ -- cgit v1.2.1