From 97926eb08cf74f277e522ffb8c7f985457822de3 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 11 Feb 2003 04:37:35 +0000 Subject: "" svn path=/trunk/; revision=388 --- externals/grill/xsample/config-pd-darwin.txt | 5 + externals/grill/xsample/config-pd-linux.txt | 6 + externals/grill/xsample/make-files.txt | 2 +- externals/grill/xsample/makefile.pd-darwin | 2 +- externals/grill/xsample/makefile.pd-linux | 3 +- externals/grill/xsample/maxmsp/xgroove~.help | Bin 7207 -> 7301 bytes externals/grill/xsample/maxmsp/xplay~.help | Bin 4649 -> 4788 bytes externals/grill/xsample/pd/xgroove~.pd | 348 +++++++++++++-------------- externals/grill/xsample/readme.txt | 28 ++- externals/grill/xsample/source/groove.cpp | 39 +-- externals/grill/xsample/source/inter.ci | 196 --------------- externals/grill/xsample/source/inter.cpp | 9 +- externals/grill/xsample/source/inter.h | 190 +++++++++++++++ externals/grill/xsample/source/main.cpp | 61 ++++- externals/grill/xsample/source/main.h | 28 ++- externals/grill/xsample/source/play.cpp | 25 +- externals/grill/xsample/source/record.cpp | 3 +- externals/grill/xsample/xsample.cw | Bin 154591 -> 155147 bytes externals/grill/xsample/xsample.dsp | 4 + 19 files changed, 519 insertions(+), 430 deletions(-) delete mode 100644 externals/grill/xsample/source/inter.ci create mode 100755 externals/grill/xsample/source/inter.h (limited to 'externals/grill/xsample') diff --git a/externals/grill/xsample/config-pd-darwin.txt b/externals/grill/xsample/config-pd-darwin.txt index 7fa15a68..0d4ef217 100755 --- a/externals/grill/xsample/config-pd-darwin.txt +++ b/externals/grill/xsample/config-pd-darwin.txt @@ -29,3 +29,8 @@ INSTDIR=${PD}/extra # where should the xsample help be installed? # (leave blank to omit installation) HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit your system!) +UFLAGS=-malign-power -maltivec + diff --git a/externals/grill/xsample/config-pd-linux.txt b/externals/grill/xsample/config-pd-linux.txt index 26e62e49..a58077ec 100755 --- a/externals/grill/xsample/config-pd-linux.txt +++ b/externals/grill/xsample/config-pd-linux.txt @@ -26,3 +26,9 @@ INSTDIR=${PD}/extra # where should the xsample help be installed? # (leave blank to omit installation) HELPDIR=${PD}/doc/5.reference + +# additional compiler flags +# (check whether they fit to your system!) +UFLAGS=-mcpu=pentiumpro # gcc 2.95 +# UFLAGS=-mcpu=pentium3 -msse -mfpmath=sse # gcc 3.2 + diff --git a/externals/grill/xsample/make-files.txt b/externals/grill/xsample/make-files.txt index d96d8485..1607b051 100755 --- a/externals/grill/xsample/make-files.txt +++ b/externals/grill/xsample/make-files.txt @@ -3,5 +3,5 @@ SRCS= \ main.cpp play.cpp groove.cpp record.cpp inter.cpp HDRS= \ - main.h inter.ci + main.h inter.h diff --git a/externals/grill/xsample/makefile.pd-darwin b/externals/grill/xsample/makefile.pd-darwin index 0dbb0611..f51f550f 100755 --- a/externals/grill/xsample/makefile.pd-darwin +++ b/externals/grill/xsample/makefile.pd-darwin @@ -18,7 +18,7 @@ FLEXTLIB=$(FLEXTPATH)/flext.a # compiler stuff INCLUDES=$(PDINC) FLAGS=-DFLEXT_SYS=2 -CFLAGS=-O6 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes # -maltivec +CFLAGS=${UFLAGS} -O6 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes -funroll-loops -fmove-all-movables -frerun-loop-opt -fno-rtti -fno-exceptions LIBS=m LDFLAGS=-bundle -bundle_loader $(PDBIN) diff --git a/externals/grill/xsample/makefile.pd-linux b/externals/grill/xsample/makefile.pd-linux index 9e6dabaf..c8742ea0 100644 --- a/externals/grill/xsample/makefile.pd-linux +++ b/externals/grill/xsample/makefile.pd-linux @@ -17,8 +17,7 @@ FLEXTLIB=$(FLEXTPATH)/flext.a # compiler stuff INCLUDES=$(PDINC) FLAGS=-DFLEXT_SYS=2 -CFLAGS=-O6 -mcpu=pentiumpro -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -#CFLAGS=-O6 -mcpu=pentium3 -msse -mfpmath=sse -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions +CFLAGS=${UFLAGS} -O6 -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions -fno-rtti -fno-exceptions LIBS=m # ---------------------------------------------- diff --git a/externals/grill/xsample/maxmsp/xgroove~.help b/externals/grill/xsample/maxmsp/xgroove~.help index ee8a244e..e00533b1 100644 Binary files a/externals/grill/xsample/maxmsp/xgroove~.help and b/externals/grill/xsample/maxmsp/xgroove~.help differ diff --git a/externals/grill/xsample/maxmsp/xplay~.help b/externals/grill/xsample/maxmsp/xplay~.help index 5a210f74..1dbe02d1 100644 Binary files a/externals/grill/xsample/maxmsp/xplay~.help and b/externals/grill/xsample/maxmsp/xplay~.help differ diff --git a/externals/grill/xsample/pd/xgroove~.pd b/externals/grill/xsample/pd/xgroove~.pd index da24d9ec..f856025d 100644 --- a/externals/grill/xsample/pd/xgroove~.pd +++ b/externals/grill/xsample/pd/xgroove~.pd @@ -1,174 +1,174 @@ -#N canvas 92 110 839 558 12; -#X obj 258 240 hsl 128 15 0.001 3 1 1 empty empty empty 20 8 0 8 -225271 --1 -1 0 1; -#X floatatom 255 261 8 0 0; -#X floatatom 275 312 8 0 0; -#X floatatom 350 312 8 0 0; -#X floatatom 273 372 8 0 0; -#X floatatom 348 372 8 0 0; -#X obj 275 419 loadbang; -#X obj 274 445 metro 30; -#X obj 250 470 snapshot~; -#X floatatom 250 494 8 0 0; -#X msg 258 82 loop \$1; -#X obj 159 27 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1 --1; -#X msg 158 47 stop; -#N canvas 0 0 450 300 graph7 0; -#X array buf 300 float 1; -#A 0 0.841115 0.9094 0.95923 0.989636 0.999991 0.990063 0.960094 0.910649 -0.842757 0.757796 0.65746 0.543816 0.419143 0.285978 0.147021 0.00508036 --0.136962 -0.276228 -0.409895 -0.535265 -0.649771 -0.751121 -0.83725 --0.906401 -0.957205 -0.988587 -0.999947 -0.991051 -0.962051 -0.913577 --0.846573 -0.762418 -0.662823 -0.549777 -0.425604 -0.292801 -0.154064 --0.0122066 0.129898 0.269372 0.403387 0.529223 0.644347 0.746395 0.833328 -0.903378 0.955105 0.987498 0.99986 0.991967 0.963983 0.91644 0.850346 -0.767009 0.668129 0.555721 0.432034 0.299602 0.161097 0.0193266 -0.122836 --0.262506 -0.396859 -0.523173 -0.638875 -0.741645 -0.82937 -0.900294 --0.952984 -0.986339 -0.999729 -0.992844 -0.965842 -0.919283 -0.854067 --0.771564 -0.673418 -0.561622 -0.438457 -0.306392 -0.168126 -0.0264512 -0.115759 0.255627 0.390308 0.517083 0.633384 0.736837 0.825374 0.89717 -0.95079 0.985156 0.999531 0.993672 0.967666 0.922048 0.857765 0.776069 -0.678665 0.567504 0.444838 0.313167 0.175141 0.0335691 -0.108684 -0.248732 --0.383745 -0.510974 -0.627851 -0.732014 -0.821324 -0.894008 -0.948562 --0.983895 -0.999309 -0.994439 -0.96944 -0.924788 -0.861391 -0.780556 --0.683878 -0.573355 -0.451214 -0.319922 -0.182154 -0.0406903 0.101596 -0.241826 0.37715 0.504839 0.62229 0.727131 0.81725 0.890784 0.946286 -0.982602 0.999003 0.99518 0.971156 0.927473 0.864993 0.784974 0.689065 -0.579174 0.457555 0.326665 0.189149 0.047805 -0.0945095 -0.234908 -0.370551 --0.498674 -0.616703 -0.722227 -0.813114 -0.887541 -0.943952 -0.981256 --0.998669 -0.995836 -0.972845 -0.93011 -0.868543 -0.789377 -0.694202 --0.584975 -0.463879 -0.333389 -0.196144 -0.0549212 0.0874133 0.227976 -0.363918 0.492493 0.611072 0.717282 0.80895 0.88422 0.941593 0.979852 -0.998275 0.996467 0.974453 0.932714 0.872048 0.793723 0.699318 0.590728 -0.47018 0.340094 0.20312 0.0620311 -0.0803164 -0.221037 -0.357277 -0.486275 --0.605431 -0.712297 -0.804743 -0.880878 -0.939154 -0.97842 -0.99783 --0.997035 -0.976038 -0.935246 -0.875523 -0.798037 -0.704388 -0.596471 --0.476452 -0.346789 -0.210093 -0.0691412 0.0732124 0.21408 0.350613 -0.480039 0.599733 0.707289 0.800488 0.87748 0.936691 0.976908 0.997349 -0.997554 0.977556 0.937754 0.87893 0.802314 0.709426 0.602164 0.482708 -0.353456 0.217051 0.0762439 -0.0661074 -0.207122 -0.343933 -0.473779 --0.594024 -0.702224 -0.796211 -0.87404 -0.934169 -0.975372 -0.996792 --0.998035 -0.979032 -0.940196 -0.882319 -0.806539 -0.714434 -0.60784 --0.48893 -0.36012 -0.224 -0.0833475 0.0589955 0.200142 0.337238 0.467489 -0.588274 0.69714 0.791867 0.870566 0.931602 0.973768 0.996211 0.998443 -0.980464 0.9426 0.885637 0.810741 0.719392 0.613481 0.495132 0.366748 -0.230939 0.0904412 -0.0518851 -0.193161 -0.33052 -0.461188 -0.582499 --0.692013 -0.787507 -0.867028 -0.928998 -0.972125 -0.995556 -0.998827 --0.98183 -0.944959 -0.888927 -0.81488 -0.724336 -0.619089 -0.501311 --0.373371; -#X coords 0 1 299 -1 300 200 1; -#X restore 521 23 graph; -#X obj 144 486 dac~; -#X msg 157 86 reset; -#X text 290 292 min/max points; -#X text 289 390 min/max points; -#X text 323 494 position; -#X text 181 24 start; -#X text 198 45 stop; -#X msg 156 113 help; -#X text 416 234 speed; -#X text 337 254 (float or signal); -#X obj 656 365 table buf2; -#X floatatom 519 380 8 0 0; -#X obj 519 353 soundfiler; -#X msg 158 172 set buf2; -#X msg 157 144 set buf; -#X msg 372 82 interp \$1; -#X msg 240 312 all; -#X obj 198 341 xgroove~ buf; -#X text 255 10 looping mode; -#X text 370 9 interpolation; -#X msg 20 170 pos 100; -#X msg 35 199 pos 200; -#X obj 152 447 *~; -#X obj 22 242 ramp 10; -#X msg 10 105 xzone \$1; -#X obj 13 62 hsl 128 15 0 300 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X floatatom 10 83 5 0 0; -#X obj 258 32 vdl 15 0 0 3 empty empty empty 0 -6 0 8 -262144 -1 -1 -0; -#X text 277 29 once; -#X text 277 45 forward; -#X text 277 61 bidir; -#X obj 372 31 vdl 15 0 0 3 empty empty empty 0 -6 0 8 -262144 -1 -1 -0; -#X text 391 28 none; -#X text 391 44 linear; -#X text 391 60 4-point; -#X obj 520 299 openpanel; -#X msg 521 326 read -resize \$1 buf2; -#X obj 521 275 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 --1; -#X obj 256 134 vdl 15 0 0 4 empty empty empty 0 -6 0 8 -262144 -1 -1 -0; -#X text 255 113 units; -#X msg 256 199 units \$1; -#X obj 364 134 vdl 15 0 0 4 empty empty empty 0 -6 0 8 -262144 -1 -1 -0; -#X text 363 113 scale mode; -#X msg 364 199 sclmode \$1; -#X text 275 131 frames; -#X text 275 147 buffer sz; -#X text 275 163 ms; -#X text 275 178 s; -#X text 383 147 units in loop; -#X text 383 163 buffer; -#X text 383 178 loop; -#X text 383 131 units in buffer; -#X obj 524 440 osc~ 1000; -#X obj 524 498 tabwrite~ buf; -#X obj 536 467 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 --1; -#X msg 557 468 stop; -#X obj 319 343 print A; -#X msg 131 213 getattributes; -#X msg 177 248 getmax; -#X msg 120 248 getmin; -#X connect 0 0 1 0; -#X connect 1 0 31 0; -#X connect 2 0 31 1; -#X connect 3 0 31 2; -#X connect 6 0 7 0; -#X connect 7 0 8 0; -#X connect 8 0 9 0; -#X connect 10 0 31 0; -#X connect 11 0 31 0; -#X connect 12 0 31 0; -#X connect 15 0 31 0; -#X connect 21 0 31 0; -#X connect 26 0 25 0; -#X connect 27 0 31 0; -#X connect 28 0 31 0; -#X connect 29 0 31 0; -#X connect 30 0 31 0; -#X connect 31 0 36 1; -#X connect 31 1 8 0; -#X connect 31 2 4 0; -#X connect 31 3 5 0; -#X connect 31 5 70 0; -#X connect 34 0 37 0; -#X connect 35 0 37 0; -#X connect 36 0 14 0; -#X connect 36 0 14 1; -#X connect 37 0 36 0; -#X connect 37 1 31 0; -#X connect 38 0 31 0; -#X connect 39 0 40 0; -#X connect 40 0 38 0; -#X connect 41 0 10 0; -#X connect 45 0 29 0; -#X connect 49 0 50 0; -#X connect 50 0 26 0; -#X connect 51 0 49 0; -#X connect 52 0 54 0; -#X connect 54 0 31 0; -#X connect 55 0 57 0; -#X connect 57 0 31 0; -#X connect 66 0 67 0; -#X connect 68 0 67 0; -#X connect 69 0 67 0; -#X connect 71 0 31 0; -#X connect 72 0 31 0; -#X connect 73 0 31 0; +#N canvas 92 110 841 560 12; +#X obj 258 240 hsl 128 15 0.001 3 1 1 empty empty empty 20 8 0 8 -225271 +-1 -1 3600 1; +#X floatatom 255 261 8 0 0 0 - - -; +#X floatatom 275 312 8 0 0 0 - - -; +#X floatatom 350 312 8 0 0 0 - - -; +#X floatatom 273 372 8 0 0 0 - - -; +#X floatatom 348 372 8 0 0 0 - - -; +#X obj 275 419 loadbang; +#X obj 274 445 metro 30; +#X obj 250 470 snapshot~; +#X floatatom 250 494 8 0 0 0 - - -; +#X msg 258 82 loop \$1; +#X obj 159 27 bng 15 250 50 0 empty empty empty 20 8 0 8 -258699 -1 +-1; +#X msg 158 47 stop; +#N canvas 0 0 450 300 graph7 0; +#X array buf 300 float 1; +#A 0 0.841115 0.9094 0.95923 0.989636 0.999991 0.990063 0.960094 0.910649 +0.842757 0.757796 0.65746 0.543816 0.419143 0.285978 0.147021 0.00508036 +-0.136962 -0.276228 -0.409895 -0.535265 -0.649771 -0.751121 -0.83725 +-0.906401 -0.957205 -0.988587 -0.999947 -0.991051 -0.962051 -0.913577 +-0.846573 -0.762418 -0.662823 -0.549777 -0.425604 -0.292801 -0.154064 +-0.0122066 0.129898 0.269372 0.403387 0.529223 0.644347 0.746395 0.833328 +0.903378 0.955105 0.987498 0.99986 0.991967 0.963983 0.91644 0.850346 +0.767009 0.668129 0.555721 0.432034 0.299602 0.161097 0.0193266 -0.122836 +-0.262506 -0.396859 -0.523173 -0.638875 -0.741645 -0.82937 -0.900294 +-0.952984 -0.986339 -0.999729 -0.992844 -0.965842 -0.919283 -0.854067 +-0.771564 -0.673418 -0.561622 -0.438457 -0.306392 -0.168126 -0.0264512 +0.115759 0.255627 0.390308 0.517083 0.633384 0.736837 0.825374 0.89717 +0.95079 0.985156 0.999531 0.993672 0.967666 0.922048 0.857765 0.776069 +0.678665 0.567504 0.444838 0.313167 0.175141 0.0335691 -0.108684 -0.248732 +-0.383745 -0.510974 -0.627851 -0.732014 -0.821324 -0.894008 -0.948562 +-0.983895 -0.999309 -0.994439 -0.96944 -0.924788 -0.861391 -0.780556 +-0.683878 -0.573355 -0.451214 -0.319922 -0.182154 -0.0406903 0.101596 +0.241826 0.37715 0.504839 0.62229 0.727131 0.81725 0.890784 0.946286 +0.982602 0.999003 0.99518 0.971156 0.927473 0.864993 0.784974 0.689065 +0.579174 0.457555 0.326665 0.189149 0.047805 -0.0945095 -0.234908 -0.370551 +-0.498674 -0.616703 -0.722227 -0.813114 -0.887541 -0.943952 -0.981256 +-0.998669 -0.995836 -0.972845 -0.93011 -0.868543 -0.789377 -0.694202 +-0.584975 -0.463879 -0.333389 -0.196144 -0.0549212 0.0874133 0.227976 +0.363918 0.492493 0.611072 0.717282 0.80895 0.88422 0.941593 0.979852 +0.998275 0.996467 0.974453 0.932714 0.872048 0.793723 0.699318 0.590728 +0.47018 0.340094 0.20312 0.0620311 -0.0803164 -0.221037 -0.357277 -0.486275 +-0.605431 -0.712297 -0.804743 -0.880878 -0.939154 -0.97842 -0.99783 +-0.997035 -0.976038 -0.935246 -0.875523 -0.798037 -0.704388 -0.596471 +-0.476452 -0.346789 -0.210093 -0.0691412 0.0732124 0.21408 0.350613 +0.480039 0.599733 0.707289 0.800488 0.87748 0.936691 0.976908 0.997349 +0.997554 0.977556 0.937754 0.87893 0.802314 0.709426 0.602164 0.482708 +0.353456 0.217051 0.0762439 -0.0661074 -0.207122 -0.343933 -0.473779 +-0.594024 -0.702224 -0.796211 -0.87404 -0.934169 -0.975372 -0.996792 +-0.998035 -0.979032 -0.940196 -0.882319 -0.806539 -0.714434 -0.60784 +-0.48893 -0.36012 -0.224 -0.0833475 0.0589955 0.200142 0.337238 0.467489 +0.588274 0.69714 0.791867 0.870566 0.931602 0.973768 0.996211 0.998443 +0.980464 0.9426 0.885637 0.810741 0.719392 0.613481 0.495132 0.366748 +0.230939 0.0904412 -0.0518851 -0.193161 -0.33052 -0.461188 -0.582499 +-0.692013 -0.787507 -0.867028 -0.928998 -0.972125 -0.995556 -0.998827 +-0.98183 -0.944959 -0.888927 -0.81488 -0.724336 -0.619089 -0.501311 +-0.373371; +#X coords 0 1 299 -1 300 200 1; +#X restore 521 23 graph; +#X obj 144 486 dac~; +#X msg 157 86 reset; +#X text 290 292 min/max points; +#X text 289 390 min/max points; +#X text 323 494 position; +#X text 181 24 start; +#X text 198 45 stop; +#X msg 156 113 help; +#X text 416 234 speed; +#X text 337 254 (float or signal); +#X obj 656 365 table buf2; +#X floatatom 519 380 8 0 0 0 - - -; +#X obj 519 353 soundfiler; +#X msg 158 172 set buf2; +#X msg 157 144 set buf; +#X msg 372 82 interp \$1; +#X msg 240 312 all; +#X obj 198 341 xgroove~ buf; +#X text 255 10 looping mode; +#X text 370 9 interpolation; +#X msg 20 170 pos 100; +#X msg 35 199 pos 200; +#X obj 152 447 *~; +#X obj 22 242 ramp 10; +#X msg 10 105 xzone \$1; +#X obj 13 62 hsl 128 15 0 300 0 0 empty empty empty -2 -6 0 8 -262144 +-1 -1 800 1; +#X floatatom 10 83 5 0 0 0 - - -; +#X obj 258 32 vdl 15 0 0 3 empty empty empty 0 -6 0 8 -262144 -1 -1 +0; +#X text 277 29 once; +#X text 277 45 forward; +#X text 277 61 bidir; +#X obj 372 31 vdl 15 0 0 3 empty empty empty 0 -6 0 8 -262144 -1 -1 +0; +#X text 391 28 none; +#X text 391 44 linear; +#X text 391 60 4-point; +#X obj 520 299 openpanel; +#X msg 521 326 read -resize \$1 buf2; +#X obj 521 275 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X obj 256 134 vdl 15 0 0 4 empty empty empty 0 -6 0 8 -262144 -1 -1 +0; +#X text 255 113 units; +#X msg 256 199 units \$1; +#X obj 364 134 vdl 15 0 0 4 empty empty empty 0 -6 0 8 -262144 -1 -1 +0; +#X text 363 113 scale mode; +#X msg 364 199 sclmode \$1; +#X text 275 131 frames; +#X text 275 147 buffer sz; +#X text 275 163 ms; +#X text 275 178 s; +#X text 383 147 units in loop; +#X text 383 163 buffer; +#X text 383 178 loop; +#X text 383 131 units in buffer; +#X obj 524 440 osc~ 1000; +#X obj 524 498 tabwrite~ buf; +#X obj 536 467 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +-1; +#X msg 557 468 stop; +#X obj 319 343 print A; +#X msg 131 213 getattributes; +#X msg 177 248 getmax; +#X msg 120 248 getmin; +#X connect 0 0 1 0; +#X connect 1 0 31 0; +#X connect 2 0 31 1; +#X connect 3 0 31 2; +#X connect 6 0 7 0; +#X connect 7 0 8 0; +#X connect 8 0 9 0; +#X connect 10 0 31 0; +#X connect 11 0 31 0; +#X connect 12 0 31 0; +#X connect 15 0 31 0; +#X connect 21 0 31 0; +#X connect 26 0 25 0; +#X connect 27 0 31 0; +#X connect 28 0 31 0; +#X connect 29 0 31 0; +#X connect 30 0 31 0; +#X connect 31 0 36 1; +#X connect 31 1 8 0; +#X connect 31 2 4 0; +#X connect 31 3 5 0; +#X connect 31 5 70 0; +#X connect 34 0 37 0; +#X connect 35 0 37 0; +#X connect 36 0 14 0; +#X connect 36 0 14 1; +#X connect 37 0 36 0; +#X connect 37 1 31 0; +#X connect 38 0 31 0; +#X connect 39 0 40 0; +#X connect 40 0 38 0; +#X connect 41 0 10 0; +#X connect 45 0 29 0; +#X connect 49 0 50 0; +#X connect 50 0 26 0; +#X connect 51 0 49 0; +#X connect 52 0 54 0; +#X connect 54 0 31 0; +#X connect 55 0 57 0; +#X connect 57 0 31 0; +#X connect 66 0 67 0; +#X connect 68 0 67 0; +#X connect 69 0 67 0; +#X connect 71 0 31 0; +#X connect 72 0 31 0; +#X connect 73 0 31 0; diff --git a/externals/grill/xsample/readme.txt b/externals/grill/xsample/readme.txt index 8f88cd2d..07aa5a6a 100644 --- a/externals/grill/xsample/readme.txt +++ b/externals/grill/xsample/readme.txt @@ -10,13 +10,10 @@ Donations for further development of the package are highly appreciated. IMPORTANT INFORMATION for all MaxMSP users: -It is advisable to put the xsample shared library file into the "startup" folder. Hence it will be +It is advisable to put the xsample shared library file into the "max-startup" folder. Hence it will be loaded at Max startup. -If you want to load the xsample library on demand, please run MakeAliases inside the MPW folder. -This will create aliases to the several xsample objects contained in the library. -Move these into the "externals" folder. -(This latter procedure is only tested for OS 9.2, you may experience problems with other MacOS versions) +If you want to load the xsample library on demand, create a [xsample] object in Max/MSP. ---------------------------------------------------------------------------- @@ -44,15 +41,24 @@ o Microsoft Visual C++ 6: edit "xsample.dsp" project file pd - linux: ----------- -o GCC for linux: run "make -f makefile.pd-linux" and as root "make -f makefile.pd-linux install" +o GCC: edit "config-pd-linux.txt" and run "sh ./build-pd-linux.sh" > various versions of GCC die during compile with template optimization turned on -Max/MSP - MacOS: +pd - OSX: +----------- +o GCC: edit "config-pd-darwin.txt" and run "sh ./build-pd-darwin.sh" +> various versions of GCC die during compile with template optimization turned on + +Max/MSP - MacOS9: ---------------- -o Metrowerks CodeWarrior V6: edit "xsample.cw" project file functions +o Metrowerks CodeWarrior: edit "xsample.cw" project file functions o Apple MPW-PR: edit & use the "flext.mpw" makefile +Max/MSP - MacOSX: +---------------- +o Metrowerks CodeWarrior: edit "xsample.cw" project file functions + ---------------------------------------------------------------------------- @@ -71,7 +77,7 @@ Goals/features of the package: Version history: -0.2.5: +0.3.0: - added resources to MaxMSP build - xgroove~, xrecord~: introduced a loop/end bang outlet - added MaxMSP buffer resize recognition @@ -80,7 +86,8 @@ Version history: - introduced attributes - restructured make procedures - corrected names of PD makefile, set help names -- fixed scale mode bug +- fixed scale mode bug with xgroove~ +- added validity check for buffers 0.2.4: - according to flext 0.2.3 changed sample type to t_sample (S) @@ -125,7 +132,6 @@ Version history: TODO list: general: -- Documentation and better example patches - do a smooth (line~) mixin in xrecord~ help patch diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp index 62f0c291..60bf617b 100644 --- a/externals/grill/xsample/source/groove.cpp +++ b/externals/grill/xsample/source/groove.cpp @@ -103,8 +103,10 @@ private: virtual V m_signal(I n,S *const *in,S *const *out) { - bufchk(); - posfun(n,in,out); + if(bufchk()) + posfun(n,in,out); + else + zerofun(n,in,out); } FLEXT_CALLBACK_F(m_pos) @@ -195,11 +197,11 @@ xgroove::xgroove(I argc,const t_atom *argv): AddOutFloat("Ending point (rounded to frame)"); // play max AddOutBang("Bang on loop end/rollover"); // loop bang - znbuf = new S *[outchns]; for(I i = 0; i < outchns; ++i) znbuf[i] = new S[0]; - znpos = new S[0]; + znpos = new S[0]; // don't know vector size yet -> m_dsp znidx = new S[0]; + znmul = new S[XZONE_TABLE+1]; m_xshape(); } @@ -304,9 +306,6 @@ V xgroove::m_xshape(I argc,const t_atom *argv) else if(xshparam > 1) xshparam = 1; } - if(znmul) delete[] znmul; - znmul = new S[XZONE_TABLE+1]; - I i; switch(xshape) { case 1: @@ -393,13 +392,11 @@ V xgroove::s_pos_off(I n,S *const *invecs,S *const *outvecs) { S *pos = outvecs[outchns]; - I si; - for(si = 0; si < n; ++si) pos[si] = curpos; + SetSamples(pos,n,curpos); playfun(n,&pos,outvecs); - const F oscl = scale(curpos); - for(si = 0; si < n; ++si) pos[si] = oscl; + SetSamples(pos,n,scale(curpos)); } V xgroove::s_pos_once(I n,S *const *invecs,S *const *outvecs) @@ -427,7 +424,7 @@ V xgroove::s_pos_once(I n,S *const *invecs,S *const *outvecs) playfun(n,&pos,outvecs); - for(I i = 0; i < n; ++i) pos[i] = scale(pos[i]); + arrscale(n,pos,pos); } else s_pos_off(n,invecs,outvecs); @@ -467,7 +464,7 @@ V xgroove::s_pos_loop(I n,S *const *invecs,S *const *outvecs) playfun(n,&pos,outvecs); - for(I i = 0; i < n; ++i) pos[i] = scale(pos[i]); + arrscale(n,pos,pos); } else s_pos_off(n,invecs,outvecs); @@ -523,15 +520,16 @@ V xgroove::s_pos_loopzn(I n,S *const *invecs,S *const *outvecs) playfun(n,&pos,outvecs); - for(I i = 0; i < n; ++i) pos[i] = scale(pos[i]); + arrscale(n,pos,pos); if(inzn) { // only if we were in cross-fade zone playfun(n,&znpos,znbuf); - for(I i = 0; i < n; ++i) znpos[i] = XZONE_TABLE-znidx[i]; - zonefun(znmul,0,XZONE_TABLE+1,1,n,1,1,&znidx,&znidx); - zonefun(znmul,0,XZONE_TABLE+1,1,n,1,1,&znpos,&znpos); + arrscale(n,znidx,znpos,-XZONE_TABLE,-1); + + zonefun(znmul,0,XZONE_TABLE+1,n,1,1,&znidx,&znidx); + zonefun(znmul,0,XZONE_TABLE+1,n,1,1,&znpos,&znpos); for(I o = 0; o < outchns; ++o) { F *ov = outvecs[o],*ob = znbuf[o]; @@ -582,7 +580,7 @@ V xgroove::s_pos_bidir(I n,S *const *invecs,S *const *outvecs) bidir = (I)bd; playfun(n,&pos,outvecs); - for(I i = 0; i < n; ++i) pos[i] = scale(pos[i]); + arrscale(n,pos,pos); } else s_pos_off(n,invecs,outvecs); @@ -614,6 +612,8 @@ V xgroove::s_dsp() SETSIGFUN(posfun,SIGFUN(s_pos_loopzn)); + // linear interpolation should be just ok for fade zone, no? +/* if(interp == xsi_4p) switch(outchns) { case 1: SETSTFUN(zonefun,TMPLSTF(st_play4,1,1)); break; @@ -622,12 +622,14 @@ V xgroove::s_dsp() default: SETSTFUN(zonefun,TMPLSTF(st_play4,1,-1)); } else if(interp == xsi_lin) +*/ switch(outchns) { case 1: SETSTFUN(zonefun,TMPLSTF(st_play2,1,1)); break; case 2: SETSTFUN(zonefun,TMPLSTF(st_play2,1,2)); break; case 4: SETSTFUN(zonefun,TMPLSTF(st_play2,1,4)); break; default: SETSTFUN(zonefun,TMPLSTF(st_play2,1,-1)); } +/* else switch(outchns) { case 1: SETSTFUN(zonefun,TMPLSTF(st_play1,1,1)); break; @@ -635,6 +637,7 @@ V xgroove::s_dsp() case 4: SETSTFUN(zonefun,TMPLSTF(st_play1,1,4)); break; default: SETSTFUN(zonefun,TMPLSTF(st_play1,1,-1)); } +*/ } else SETSIGFUN(posfun,SIGFUN(s_pos_loop)); diff --git a/externals/grill/xsample/source/inter.ci b/externals/grill/xsample/source/inter.ci deleted file mode 100644 index 1ce98f61..00000000 --- a/externals/grill/xsample/source/inter.ci +++ /dev/null @@ -1,196 +0,0 @@ -/* - -xsample - extended sample objects for Max/MSP and pd (pure data) - -Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) -For information on usage and redistribution, and for a DISCLAIMER OF ALL -WARRANTIES, see the file, "license.txt," in this distribution. - -*/ - -#ifndef __INTER_H -#define __INTER_H - -TMPLDEF V xinter::st_play0(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) -{ - // stopped - SIGCHNS(BCHNS,inchns,OCHNS,outchns); - -// const S *pos = invecs[0]; - S *const *sig = outvecs; - - for(I ci = 0; ci < outchns; ++ci) - for(I si = 0; si < n; ++si) sig[ci][si] = 0; -} - -TMPLDEF V xinter::st_play1(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) -{ - SIGCHNS(BCHNS,inchns,OCHNS,outchns); - - const S *pos = invecs[0]; - S *const *sig = outvecs; - register I si = 0; - - // no interpolation - // ---------------- - - for(I i = 0; i < n; ++i,++si) { - register const I oint = (I)(*(pos++)); - register const S *fp; - if(oint < smin) { - // position < 0 ... take only 0th sample - fp = bdt+smin*BCHNS; - } - else if(oint >= smax) { - // position > last sample ... take only last sample - fp = bdt+(smax-1)*BCHNS; - } - else { - // normal - fp = bdt+oint*BCHNS; - } - - for(I ci = 0; ci < OCHNS; ++ci) - sig[ci][si] = fp[ci]; - } - - // clear rest of output channels (if buffer has less channels) - for(I ci = OCHNS; ci < outchns; ++ci) - for(si = 0; si < n; ++si) sig[ci][si] = 0; -} - -TMPLDEF V xinter::st_play2(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) -{ - const I plen = smax-smin; //curlen; - if(plen < 2) { - st_play1 TMPLCALL (bdt,smin,smax,s2u,n,inchns,outchns,invecs,outvecs); - return; - } - - SIGCHNS(BCHNS,inchns,OCHNS,outchns); - - const S *pos = invecs[0]; - S *const *sig = outvecs; - register I si = 0; - - // linear interpolation - // -------------------- - - const I maxo = smax-1; // last sample in buffer - - for(I i = 0; i < n; ++i,++si) { - const F o = *(pos++); - register const I oint = (I)o; - - if(oint < smin) { - // position is before first sample -> take the first sample - register const S *const fp = bdt+smin*BCHNS; - for(I ci = 0; ci < OCHNS; ++ci) - sig[ci][si] = fp[ci]; - } - else if(oint >= maxo) { - // position is past last sample -> take the last sample - register const S *const fp = bdt+maxo*BCHNS; - for(I ci = 0; ci < OCHNS; ++ci) - sig[ci][si] = fp[ci]; - } - else { - // normal interpolation - register const F frac = o-oint; - register const S *const fp0 = bdt+oint*BCHNS; - register const S *const fp1 = fp0+BCHNS; - for(I ci = 0; ci < OCHNS; ++ci) - sig[ci][si] = fp0[ci]+frac*(fp1[ci]-fp0[ci]); - } - } - - // clear rest of output channels (if buffer has less channels) - for(I ci = OCHNS; ci < outchns; ++ci) - for(si = 0; si < n; ++si) sig[ci][si] = 0; -} - -TMPLDEF V xinter::st_play4(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) -{ - const I plen = smax-smin; //curlen; - if(plen < 4) { - if(plen < 2) st_play1 TMPLCALL (bdt,smin,smax,s2u,n,inchns,outchns,invecs,outvecs); - else st_play2 TMPLCALL (bdt,smin,smax,s2u,n,inchns,outchns,invecs,outvecs); - return; - } - - SIGCHNS(BCHNS,inchns,OCHNS,outchns); - - const S *pos = invecs[0]; - S *const *sig = outvecs; - register I si = 0; - - // 4-point interpolation - // --------------------- - const I maxo = smax-1; // last sample in play region - - for(I i = 0; i < n; ++i,++si) { - F o = *(pos++); - register I oint = (I)o,ointm,oint1,oint2; - - if(oint <= smin) { - if(oint < smin) oint = smin,o = smin; - // position is first simple - ointm = smin; // first sample - oint1 = oint+1; - oint2 = oint1+1; - } - else if(oint >= maxo-2) { - if(oint > maxo) oint = maxo,o = smax; - ointm = oint-1; - oint1 = oint >= maxo?maxo:oint+1; - oint2 = oint1 >= maxo?maxo:oint1+1; - } - else { - ointm = oint-1; - oint1 = oint+1; - oint2 = oint1+1; - } - - register F frac = o-oint; - - register const S *fa = bdt+ointm*BCHNS; - register const S *fb = bdt+oint*BCHNS; - register const S *fc = bdt+oint1*BCHNS; - register const S *fd = bdt+oint2*BCHNS; - - for(I ci = 0; ci < OCHNS; ++ci) { - const F cmb = fc[ci]-fb[ci]; - sig[ci][si] = fb[ci] + frac*( - cmb - 0.5f*(frac-1.) * ((fa[ci]-fd[ci]+3.0f*cmb)*frac + (fb[ci]-fa[ci]-cmb)) - ); - } - } - - // clear rest of output channels (if buffer has less channels) - for(I ci = OCHNS; ci < outchns; ++ci) - for(si = 0; si < n; ++si) sig[ci][si] = 0; -} - - -TMPLDEF V xinter::s_play0(I n,S *const *invecs,S *const *outvecs) -{ - st_play0 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs); -} - -TMPLDEF V xinter::s_play1(I n,S *const *invecs,S *const *outvecs) -{ - st_play1 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs); -} - -TMPLDEF V xinter::s_play2(I n,S *const *invecs,S *const *outvecs) -{ - st_play2 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs); -} - -TMPLDEF V xinter::s_play4(I n,S *const *invecs,S *const *outvecs) -{ - st_play4 TMPLCALL (buf->Data(),curmin,curmax,s2u,n,buf->Channels(),outchns,invecs,outvecs); -} - - -#endif diff --git a/externals/grill/xsample/source/inter.cpp b/externals/grill/xsample/source/inter.cpp index 42221e1c..f3fba86c 100644 --- a/externals/grill/xsample/source/inter.cpp +++ b/externals/grill/xsample/source/inter.cpp @@ -16,7 +16,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #endif #ifndef TMPLOPT -#include "inter.ci" +#include "inter.h" #endif void xinter::setup(t_classid c) @@ -53,6 +53,13 @@ V xinter::m_stop() V xinter::s_dsp() { + switch(outchns) { + case 1: SETSIGFUN(zerofun,TMPLFUN(s_play0,-1,1)); break; + case 2: SETSIGFUN(zerofun,TMPLFUN(s_play0,-1,2)); break; + case 4: SETSIGFUN(zerofun,TMPLFUN(s_play0,-1,4)); break; + default: SETSIGFUN(zerofun,TMPLFUN(s_play0,-1,-1)); + } + if(doplay) { if(interp == xsi_4p) switch(buf->Channels()*1000+outchns) { diff --git a/externals/grill/xsample/source/inter.h b/externals/grill/xsample/source/inter.h new file mode 100755 index 00000000..697c66df --- /dev/null +++ b/externals/grill/xsample/source/inter.h @@ -0,0 +1,190 @@ +/* + +xsample - extended sample objects for Max/MSP and pd (pure data) + +Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see the file, "license.txt," in this distribution. + +*/ + +#ifndef __INTER_H +#define __INTER_H + +TMPLDEF V xinter::st_play0(const S *,const I ,const I ,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) +{ + // stopped/invalid buffer -> output zero + for(I ci = 0; ci < outchns; ++ci) ZeroSamples(outvecs[ci],n); +} + +TMPLDEF V xinter::st_play1(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) +{ + SIGCHNS(BCHNS,inchns,OCHNS,outchns); + + // position info are frame units + const S *pos = invecs[0]; + S *const *sig = outvecs; + register I si = 0; + + // no interpolation + // ---------------- + + for(I i = 0; i < n; ++i,++si) { + register const I oint = (I)(*(pos++)); + register const S *fp; + if(oint < smin) { + // position < 0 ... take only 0th sample + fp = bdt+smin*BCHNS; + } + else if(oint >= smax) { + // position > last sample ... take only last sample + fp = bdt+(smax-1)*BCHNS; + } + else { + // normal + fp = bdt+oint*BCHNS; + } + + for(I ci = 0; ci < OCHNS; ++ci) + sig[ci][si] = fp[ci]; + } + + // clear rest of output channels (if buffer has less channels) + for(I ci = OCHNS; ci < outchns; ++ci) ZeroSamples(sig[ci],n); +} + +TMPLDEF V xinter::st_play2(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) +{ + const I plen = smax-smin; //curlen; + if(plen < 2) { + st_play1 TMPLCALL (bdt,smin,smax,n,inchns,outchns,invecs,outvecs); + return; + } + + SIGCHNS(BCHNS,inchns,OCHNS,outchns); + + // position info are frame units + const S *pos = invecs[0]; + S *const *sig = outvecs; + register I si = 0; + + // linear interpolation + // -------------------- + + const I maxo = smax-1; // last sample in buffer + + for(I i = 0; i < n; ++i,++si) { + const F o = *(pos++); + register const I oint = (I)o; + + if(oint < smin) { + // position is before first sample -> take the first sample + register const S *const fp = bdt+smin*BCHNS; + for(I ci = 0; ci < OCHNS; ++ci) + sig[ci][si] = fp[ci]; + } + else if(oint >= maxo) { + // position is past last sample -> take the last sample + register const S *const fp = bdt+maxo*BCHNS; + for(I ci = 0; ci < OCHNS; ++ci) + sig[ci][si] = fp[ci]; + } + else { + // normal interpolation + register const F frac = o-oint; + register const S *const fp0 = bdt+oint*BCHNS; + register const S *const fp1 = fp0+BCHNS; + for(I ci = 0; ci < OCHNS; ++ci) + sig[ci][si] = fp0[ci]+frac*(fp1[ci]-fp0[ci]); + } + } + + // clear rest of output channels (if buffer has less channels) + for(I ci = OCHNS; ci < outchns; ++ci) ZeroSamples(sig[ci],n); +} + +TMPLDEF V xinter::st_play4(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) +{ + const I plen = smax-smin; //curlen; + if(plen < 4) { + if(plen < 2) st_play1 TMPLCALL (bdt,smin,smax,n,inchns,outchns,invecs,outvecs); + else st_play2 TMPLCALL (bdt,smin,smax,n,inchns,outchns,invecs,outvecs); + return; + } + + SIGCHNS(BCHNS,inchns,OCHNS,outchns); + + // position info are frame units + const S *pos = invecs[0]; + S *const *sig = outvecs; + register I si = 0; + + // 4-point interpolation + // --------------------- + const I maxo = smax-1; // last sample in play region + + for(I i = 0; i < n; ++i,++si) { + F o = *(pos++); + register I oint = (I)o,ointm,oint1,oint2; + + if(oint <= smin) { + if(oint < smin) oint = smin,o = smin; + // position is first simple + ointm = smin; // first sample + oint1 = oint+1; + oint2 = oint1+1; + } + else if(oint >= maxo-2) { + if(oint > maxo) oint = maxo,o = smax; + ointm = oint-1; + oint1 = oint >= maxo?maxo:oint+1; + oint2 = oint1 >= maxo?maxo:oint1+1; + } + else { + ointm = oint-1; + oint1 = oint+1; + oint2 = oint1+1; + } + + register F frac = o-oint; + + register const S *fa = bdt+ointm*BCHNS; + register const S *fb = bdt+oint*BCHNS; + register const S *fc = bdt+oint1*BCHNS; + register const S *fd = bdt+oint2*BCHNS; + + for(I ci = 0; ci < OCHNS; ++ci) { + const F cmb = fc[ci]-fb[ci]; + sig[ci][si] = fb[ci] + frac*( + cmb - 0.5f*(frac-1.) * ((fa[ci]-fd[ci]+3.0f*cmb)*frac + (fb[ci]-fa[ci]-cmb)) + ); + } + } + + // clear rest of output channels (if buffer has less channels) + for(I ci = OCHNS; ci < outchns; ++ci) ZeroSamples(sig[ci],n); +} + + +TMPLDEF inline V xinter::s_play0(I n,S *const *invecs,S *const *outvecs) +{ + st_play0 TMPLCALL (buf->Data(),curmin,curmax,n,buf->Channels(),outchns,invecs,outvecs); +} + +TMPLDEF inline V xinter::s_play1(I n,S *const *invecs,S *const *outvecs) +{ + st_play1 TMPLCALL (buf->Data(),curmin,curmax,n,buf->Channels(),outchns,invecs,outvecs); +} + +TMPLDEF inline V xinter::s_play2(I n,S *const *invecs,S *const *outvecs) +{ + st_play2 TMPLCALL (buf->Data(),curmin,curmax,n,buf->Channels(),outchns,invecs,outvecs); +} + +TMPLDEF inline V xinter::s_play4(I n,S *const *invecs,S *const *outvecs) +{ + st_play4 TMPLCALL (buf->Data(),curmin,curmax,n,buf->Channels(),outchns,invecs,outvecs); +} + + +#endif diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp index 2a39950d..2392bdb1 100644 --- a/externals/grill/xsample/source/main.cpp +++ b/externals/grill/xsample/source/main.cpp @@ -72,6 +72,18 @@ xsample::~xsample() } +BL xsample::bufchk() +{ + if(buf->Valid()) { + if(buf->Update()) { +// post("%s - buffer updated",thisName()); + m_refresh(); + } + return true; + } + else + return false; +} I xsample::m_set(I argc,const t_atom *argv) { @@ -115,7 +127,7 @@ V xsample::m_loadbang() V xsample::m_units(xs_unit mode) { - bufchk(); + if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed) if(mode != xsu__) unitmode = mode; switch(unitmode) { @@ -138,7 +150,7 @@ V xsample::m_units(xs_unit mode) V xsample::m_sclmode(xs_sclmd mode) { - bufchk(); + if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed) if(mode != xss__) sclmode = mode; switch(sclmode) { @@ -162,7 +174,7 @@ V xsample::m_sclmode(xs_sclmd mode) V xsample::m_min(F mn) { - bufchk(); + if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed) mn /= s2u; // conversion to samples if(mn < 0) mn = 0; @@ -175,7 +187,7 @@ V xsample::m_min(F mn) V xsample::m_max(F mx) { - bufchk(); + if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed) mx /= s2u; // conversion to samples if(mx > buf->Frames()) mx = (F)buf->Frames(); @@ -188,7 +200,7 @@ V xsample::m_max(F mx) V xsample::m_all() { - bufchk(); + if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed) // curlen = (curmax = buf->Frames())-(curmin = 0); curmin = 0; curmax = buf->Frames(); @@ -203,5 +215,44 @@ V xsample::m_dsp(I /*n*/,S *const * /*insigs*/,S *const * /*outsigs*/) } +V xsample::arrscale(I n,const S *src,S *dst,S add,S mul) +{ + int n8 = n>>3; + n -= n8<<3; + while(n8--) { + dst[0] = (src[0]+add)*mul; + dst[1] = (src[1]+add)*mul; + dst[2] = (src[2]+add)*mul; + dst[3] = (src[3]+add)*mul; + dst[4] = (src[4]+add)*mul; + dst[5] = (src[5]+add)*mul; + dst[6] = (src[6]+add)*mul; + dst[7] = (src[7]+add)*mul; + src += 8,dst += 8; + } + + while(n--) *(dst++) = (*(src++)+add)*mul; +} + +V xsample::arrmul(I n,const S *src,S *dst,S mul) +{ + int n8 = n>>3; + n -= n8<<3; + while(n8--) { + dst[0] = src[0]*mul; + dst[1] = src[1]*mul; + dst[2] = src[2]*mul; + dst[3] = src[3]*mul; + dst[4] = src[4]*mul; + dst[5] = src[5]*mul; + dst[6] = src[6]*mul; + dst[7] = src[7]*mul; + src += 8,dst += 8; + } + + while(n--) *(dst++) = *(src++)*mul; +} + + diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h index 94f8885f..03d5d261 100644 --- a/externals/grill/xsample/source/main.h +++ b/externals/grill/xsample/source/main.h @@ -11,19 +11,18 @@ WARRANTIES, see the file, "license.txt," in this distribution. #ifndef __XSAMPLE_H #define __XSAMPLE_H -#define XSAMPLE_VERSION "0.2.5pre3" +#define XSAMPLE_VERSION "0.3.0pre4" #define FLEXT_ATTRIBUTES 1 #include -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401) -#error You need at least flext version 0.4.1 +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 402) +#error You need at least flext version 0.4.2 #endif -// most compilers are somehow broken..... -// in other words: can't handle all C++ features +// most compilers are somehow broken - in other words - can't handle all C++ features #if defined(_MSC_VER) // MS VC 6.0 can't handle templates?! -> no optimization @@ -123,8 +122,14 @@ protected: F s2u; // sample to unit conversion factor inline F scale(F smp) const { return (smp-sclmin)*sclmul; } + + static V arrscale(I n,const S *in,S *out,S add,S mul); + inline V arrscale(I n,const S *in,S *out) const { arrscale(n,in,out,(S)-sclmin,sclmul); } + + static V arrmul(I n,const S *in,S *out,S mul); + inline V arrmul(I n,const S *in,S *out) const { arrmul(n,in,out,(S)(1./s2u)); } - BL bufchk() { if(buf->Update()) { m_refresh(); return true; } return false; } + BL bufchk(); V mg_buffer(AtomList &l) { if(buf) { l(1); SetSymbol(l[0],buf->Symbol()); } else l(); } inline V ms_buffer(const AtomList &l) { m_set(l.Count(),l.Atoms()); } @@ -182,7 +187,7 @@ protected: TMPLDEF static V st_##NAME(thisType *obj,I n,S *const *in,S *const *out) { obj->NAME TMPLCALL (n,in,out); } \ TMPLDEF V NAME(I n,S *const *in,S *const *out) - #define TMPLSTFUN(NAME) TMPLDEF static V NAME(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) + #define TMPLSTFUN(NAME) TMPLDEF static V NAME(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) #define SETSIGFUN(VAR,FUN) v_##VAR = FUN @@ -193,7 +198,7 @@ protected: V (*v_##NAME)(thisType *obj,I n,S *const *in,S *const *out) #define DEFSTCALL(NAME) \ - V (*NAME)(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) + V (*NAME)(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) #else #ifdef TMPLOPT @@ -212,7 +217,7 @@ protected: #define DEFSIGFUN(NAME) V NAME(I n,S *const *in,S *const *out) #define TMPLSIGFUN(NAME) TMPLDEF V NAME(I n,S *const *in,S *const *out) - #define TMPLSTFUN(NAME) TMPLDEF static V NAME(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) + #define TMPLSTFUN(NAME) TMPLDEF static V NAME(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) #define SETSIGFUN(VAR,FUN) v_##VAR = FUN @@ -223,7 +228,7 @@ protected: #define SETSTFUN(VAR,FUN) VAR = FUN #define DEFSTCALL(NAME) \ - V (*NAME)(const S *bdt,const I smin,const I smax,const F s2u,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) + V (*NAME)(const S *bdt,const I smin,const I smax,const I n,const I inchns,const I outchns,S *const *invecs,S *const *outvecs) #endif @@ -285,6 +290,7 @@ protected: TMPLSTFUN(st_play4); DEFSIGCALL(playfun); + DEFSIGCALL(zerofun); virtual V s_dsp(); @@ -296,7 +302,7 @@ private: }; #ifdef TMPLOPT -#include "inter.ci" +#include "inter.h" #endif #endif diff --git a/externals/grill/xsample/source/play.cpp b/externals/grill/xsample/source/play.cpp index 50f32e75..037bc1bb 100644 --- a/externals/grill/xsample/source/play.cpp +++ b/externals/grill/xsample/source/play.cpp @@ -32,11 +32,7 @@ public: private: static V setup(t_classid c); - virtual V m_signal(I n,S *const *in,S *const *out) - { - bufchk(); - playfun(n,in,out); - } + virtual V m_signal(I n,S *const *in,S *const *out); }; FLEXT_LIB_DSP_V("xplay~",xplay) @@ -91,7 +87,20 @@ BL xplay::Init() else return false; } - + +V xplay::m_signal(I n,S *const *in,S *const *out) +{ + // check whether buffer is invalid or changed + if(bufchk()) { + // convert position units to frames + arrmul(n,in[0],out[0]); + // call resample routine + playfun(n,out,out); + } + else + zerofun(n,out,out); +} + V xplay::m_help() @@ -117,8 +126,8 @@ V xplay::m_help() post("\tstop: stop playing"); post("\treset: checks buffer"); post("\trefresh: checks buffer and refreshes outlets"); - post("\tunits 0/1/2/3: set units to samples/buffer size/ms/s"); - post("\tinterp 0/1/2: set interpolation to off/4-point/linear"); + post("\t@units 0/1/2/3: set units to samples/buffer size/ms/s"); + post("\t@interp 0/1/2: set interpolation to off/4-point/linear"); post(""); } diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp index ce169e9a..d6b9e70e 100644 --- a/externals/grill/xsample/source/record.cpp +++ b/externals/grill/xsample/source/record.cpp @@ -69,8 +69,7 @@ private: DEFSIGCALL(recfun); virtual V m_signal(I n,S *const *in,S *const *out) { - bufchk(); - recfun(n,in,out); + if(bufchk()) recfun(n,in,out); } FLEXT_CALLVAR_F(mg_pos,m_pos) diff --git a/externals/grill/xsample/xsample.cw b/externals/grill/xsample/xsample.cw index d893d3ef..70783c4d 100755 Binary files a/externals/grill/xsample/xsample.cw and b/externals/grill/xsample/xsample.cw differ diff --git a/externals/grill/xsample/xsample.dsp b/externals/grill/xsample/xsample.dsp index ec5bffb5..18119476 100644 --- a/externals/grill/xsample/xsample.dsp +++ b/externals/grill/xsample/xsample.dsp @@ -109,6 +109,10 @@ SOURCE=.\source\inter.cpp # End Source File # Begin Source File +SOURCE=.\source\inter.h +# End Source File +# Begin Source File + SOURCE=.\source\main.cpp # End Source File # Begin Source File -- cgit v1.2.1