diff options
Diffstat (limited to 'externals/grill')
21 files changed, 293 insertions, 264 deletions
diff --git a/externals/grill/flext/readme.txt b/externals/grill/flext/readme.txt index 8389cac7..bc043c33 100644 --- a/externals/grill/flext/readme.txt +++ b/externals/grill/flext/readme.txt @@ -120,6 +120,7 @@ Version history: - added functions for SIMD support - fixed race condition when using LaunchThread in a setup function (now waiting for thread helper to initialize) - added flext::Forward function to send messages to bound symbols +- added "zero" flag to flext::buffer resize operation 0.4.2: - started port for jMax @@ -331,8 +332,7 @@ TODO list: general: - documentation - add log messages for debugging version -- feed assist function with in/outlet description -- MaxMSP: how to call separate help files for objects in a library? +- MaxMSP: how to call separate help files for objects in a library? -> object mappings (in OSX) - use PD's t_float type for floating point values (and what about t_int?) bugs: diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp index 633f0d45..f7672b75 100644 --- a/externals/grill/flext/source/flbuf.cpp +++ b/externals/grill/flext/source/flbuf.cpp @@ -176,20 +176,21 @@ bool flext::buffer::Update() #endif } -void flext::buffer::Frames(int fr,bool keep) +void flext::buffer::Frames(int fr,bool keep,bool zero) { #if FLEXT_SYS == FLEXT_SYS_PD + // is this function guaranteed to keep memory and set rest to zero? ::garray_resize(arr,(float)fr); Update(); #elif FLEXT_SYS == FLEXT_SYS_MAX t_sample *tmp = NULL; - int sz = frames; + int sz = frames; if(fr < sz) sz = fr; if(keep) { // copy buffer data to tmp storage tmp = new t_sample[sz]; - if(tmp) + if(tmp) CopySamples(data,tmp,sz); else error("flext::buffer - not enough memory for keeping buffer~ contents"); @@ -210,7 +211,10 @@ void flext::buffer::Frames(int fr,bool keep) // copy data back CopySamples(tmp,data,sz); delete[] tmp; + if(zero && sz < fr) ZeroSamples(data+sz,fr-sz); } + else + if(zero) ZeroSamples(data,fr); #else #error #endif diff --git a/externals/grill/flext/source/fldefs.h b/externals/grill/flext/source/fldefs.h index 7ba0f1b2..da6d995c 100644 --- a/externals/grill/flext/source/fldefs.h +++ b/externals/grill/flext/source/fldefs.h @@ -67,6 +67,8 @@ FLEXT_REALHDR_S(NEW_CLASS, PARENT_CLASS, SETUPFUN) // ==================================================================================== /*! \defgroup FLEXT_D_INSTANCE Class instantiation + \note The name of your class is of importance! It must be the same as the external + \note (excluded an eventual ~ (tilde)) */ diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h index b76437cc..c9235d95 100644 --- a/externals/grill/flext/source/flsupport.h +++ b/externals/grill/flext/source/flsupport.h @@ -129,22 +129,34 @@ public: //! Get frame count int Frames() const { return frames; } //! Set frame count - void Frames(int fr,bool keep = false); + void Frames(int fr,bool keep = false,bool zero = true); //! Graphic auto refresh interval void SetRefrIntv(float intv); protected: + //! buffer name const t_symbol *sym; + //! array holding audio data t_sample *data; - int chns,frames; + //! number of audio channels + int chns; + //! number of frames (multiplied by chns for the number of samples) + int frames; #if FLEXT_SYS == FLEXT_SYS_PD + //! pointer to the PD array structure t_garray *arr; + //! update interval float interval; - bool isdirty,ticking; + //! flag signaling that the data has been changed + bool isdirty; + //! flag showing that the update clock is active + bool ticking; + //! update clock t_clock *tick; private: + //! update clock callback static void cb_tick(buffer *b); #endif }; diff --git a/externals/grill/vasp/changes.txt b/externals/grill/vasp/changes.txt index 23e0f917..3838fa63 100644 --- a/externals/grill/vasp/changes.txt +++ b/externals/grill/vasp/changes.txt @@ -5,6 +5,7 @@ Version history: - FIX: bug for binary operations of complex vasps - ADD: implemented (factor-4) loop unrolling for vector calculation loops - CHANGE: completely restructured vector optimization and introduced multi-dimensional multi-layered functionality +- ADD: attribute "zero" of vasp.size variants (default: true) - whether new samples shall be zeroed 0.1.2: - FIX: bug in vasp.frames* ... wrong argument diff --git a/externals/grill/vasp/max/vasp.cconv b/externals/grill/vasp/max/vasp.cconv Binary files differnew file mode 100755 index 00000000..5b5c2c39 --- /dev/null +++ b/externals/grill/vasp/max/vasp.cconv diff --git a/externals/grill/vasp/max/vasp.conv b/externals/grill/vasp/max/vasp.conv index 0d101377..f7ecd744 100755 --- a/externals/grill/vasp/max/vasp.conv +++ b/externals/grill/vasp/max/vasp.conv @@ -1,30 +1,16 @@ max v2; #N vpatcher 30 70 430 370; -#P newex 53 224 52 196617 vasp.c!fft; -#P newex 134 130 62 196617 vasp.sync 2; -#P newex 150 103 45 196617 vasp.= 0; -#P newex 151 79 43 196617 vasp.im; -#P newex 133 157 49 196617 vasp.cfft; -#P newex 54 198 44 196617 vasp.c*; -#P newex 54 131 62 196617 vasp.sync 2; -#P newex 70 104 45 196617 vasp.= 0; -#P newex 71 80 43 196617 vasp.im; -#P newex 53 158 49 196617 vasp.cfft; +#P newex 53 224 53 196617 vasp.r!fft; +#P newex 133 157 50 196617 vasp.rfft; +#P newex 54 198 40 196617 vasp.*; +#P newex 55 159 50 196617 vasp.rfft; #P outlet 52 252 15 0; #P inlet 140 51 15 0; #P inlet 54 51 15 0; -#P connect 12 0 2 0; -#P connect 6 0 3 0; -#P connect 7 0 12 0; -#P connect 0 0 6 0; -#P connect 3 0 7 0; -#P connect 4 0 5 0; -#P connect 0 0 4 0; -#P connect 8 0 7 1; -#P connect 5 0 6 1; -#P connect 11 0 8 0; -#P connect 1 0 11 0; -#P connect 9 0 10 0; -#P connect 1 0 9 0; -#P connect 10 0 11 1; +#P connect 6 0 2 0; +#P connect 4 0 6 0; +#P connect 3 0 4 0; +#P connect 0 0 3 0; +#P connect 5 0 4 1; +#P connect 1 0 5 0; #P pop; diff --git a/externals/grill/vasp/pd-ex/convolve.pd b/externals/grill/vasp/pd-ex/convolve.pd new file mode 100644 index 00000000..1194e33d --- /dev/null +++ b/externals/grill/vasp/pd-ex/convolve.pd @@ -0,0 +1,136 @@ +#N canvas 292 80 638 415 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.;
+#X obj 179 125 nbx 8 16 0 1e+008 0 0 len_src empty empty 0 -8 128 12
+-225271 -1 -1 4e+006 256;
+#X text 275 137 (defines the size of the result);
+#X obj 177 179 nbx 8 16 0 1e+008 0 0 len_arg empty empty 0 -8 128 12
+-225271 -1 -1 89000 256;
+#X obj 32 122 wedit buf_src;
+#X obj 30 176 wedit buf_arg;
+#X obj 33 350 wedit buf_res;
+#X text 122 255 start convolution;
+#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 4e+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;
+#X text 203 10 fft-based convolution \, (C)2003 Thomas Grill;
+#X text 203 25 needs vasp and wedit;
+#X text 32 329 result buffer;
+#X text 31 102 source buffer;
+#X text 29 157 argument buffer;
+#X text 278 124 length of source (samples);
+#X text 276 178 length of argument (samples);
+#N canvas 0 0 464 314 do 0;
+#X obj 29 215 vasp.u;
+#N canvas 406 75 430 580 convolve 0;
+#X obj 29 195 vasp.!;
+#X obj 107 280 vasp.conv;
+#X obj 107 311 t a a;
+#X obj 185 344 vasp.f?;
+#X obj 188 372 t b f;
+#X obj 108 482 vasp.->;
+#X obj 195 140 vasp.!;
+#X obj 102 170 vasp.f?;
+#X obj 29 131 t a b a;
+#X obj 194 111 vasp;
+#X obj 28 106 vasp;
+#N canvas 0 0 458 308 sf 0;
+#X obj 39 178 outlet;
+#X obj 38 43 inlet;
+#X obj 41 79 vasp.s;
+#X obj 120 43 inlet;
+#X obj 39 118 vasp.f;
+#X connect 1 0 2 0;
+#X connect 2 0 4 0;
+#X connect 3 0 2 1;
+#X connect 3 0 4 1;
+#X connect 4 0 0 0;
+#X restore 194 211 pd sf;
+#N canvas 0 0 452 302 sf 0;
+#X obj 39 178 outlet;
+#X obj 38 43 inlet;
+#X obj 41 79 vasp.s;
+#X obj 120 43 inlet;
+#X obj 39 118 vasp.f;
+#X connect 1 0 2 0;
+#X connect 2 0 4 0;
+#X connect 3 0 2 1;
+#X connect 3 0 4 1;
+#X connect 4 0 0 0;
+#X restore 187 437 pd sf;
+#X obj 107 406 vasp.opt;
+#X obj 210 405 vasp;
+#X obj 26 46 inlet;
+#X obj 132 51 inlet;
+#X obj 221 50 inlet;
+#X obj 313 50 inlet;
+#X obj 107 538 outlet;
+#X text 26 15 bang;
+#X text 126 21 src1;
+#X text 218 20 src2;
+#X text 313 22 dst;
+#X text 10 217 copy to temp;
+#X text 192 158 copy to temp;
+#X text 164 537 dst;
+#X connect 0 0 1 0;
+#X connect 1 0 2 0;
+#X connect 2 0 13 0;
+#X connect 2 1 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 14 0;
+#X connect 4 1 12 1;
+#X connect 5 1 19 0;
+#X connect 6 0 11 0;
+#X connect 7 0 11 1;
+#X connect 8 0 0 0;
+#X connect 8 1 9 0;
+#X connect 8 2 7 0;
+#X connect 9 0 6 0;
+#X connect 10 0 8 0;
+#X connect 11 0 1 1;
+#X connect 12 0 5 1;
+#X connect 13 0 5 0;
+#X connect 14 0 12 0;
+#X connect 15 0 10 0;
+#X connect 16 0 10 1;
+#X connect 17 0 9 1;
+#X connect 18 0 14 1;
+#X restore 28 186 pd convolve;
+#X obj 26 52 t b b;
+#X obj 43 127 vasp.f;
+#X msg 43 94 vasp buf_src;
+#X msg 154 93 vasp buf_arg;
+#X msg 267 92 vasp buf_res;
+#X obj 306 220 table buf_src 10;
+#X obj 307 242 table buf_arg 10;
+#X obj 307 264 table buf_res 10;
+#X obj 26 23 r start_bang;
+#X obj 143 21 r len_src;
+#X obj 229 24 r len_arg;
+#X obj 153 126 vasp.f;
+#X obj 27 278 outlet;
+#X obj 29 251 vasp.f?;
+#X text 85 215 update buffer;
+#X connect 0 0 15 0;
+#X connect 1 0 0 0;
+#X connect 2 0 1 0;
+#X connect 2 1 4 0;
+#X connect 2 1 5 0;
+#X connect 2 1 6 0;
+#X connect 3 0 1 1;
+#X connect 4 0 3 0;
+#X connect 5 0 13 0;
+#X connect 6 0 1 3;
+#X connect 10 0 2 0;
+#X connect 11 0 3 1;
+#X connect 12 0 13 1;
+#X connect 13 0 1 2;
+#X connect 15 0 14 0;
+#X restore 177 324 pd do;
+#X connect 20 0 9 0;
+#X connect 20 0 10 0;
diff --git a/externals/grill/vasp/pd/vasp.cconv.pd b/externals/grill/vasp/pd/vasp.cconv.pd new file mode 100644 index 00000000..62cbb795 --- /dev/null +++ b/externals/grill/vasp/pd/vasp.cconv.pd @@ -0,0 +1,28 @@ +#N canvas 30 70 408 308 12;
+#X obj 53 224 vasp.c!fft;
+#X obj 162 131 vasp.sync 2;
+#X obj 178 104 vasp.= 0;
+#X obj 179 80 vasp.im;
+#X obj 161 158 vasp.cfft;
+#X obj 54 198 vasp.c*;
+#X obj 54 131 vasp.sync 2;
+#X obj 70 104 vasp.= 0;
+#X obj 71 80 vasp.im;
+#X obj 53 158 vasp.cfft;
+#X obj 54 51 inlet;
+#X obj 168 52 inlet;
+#X obj 52 252 outlet;
+#X connect 0 0 12 0;
+#X connect 1 0 4 0;
+#X connect 2 0 1 1;
+#X connect 3 0 2 0;
+#X connect 4 0 5 1;
+#X connect 5 0 0 0;
+#X connect 6 0 9 0;
+#X connect 7 0 6 1;
+#X connect 8 0 7 0;
+#X connect 9 0 5 0;
+#X connect 10 0 6 0;
+#X connect 10 0 8 0;
+#X connect 11 0 1 0;
+#X connect 11 0 3 0;
diff --git a/externals/grill/vasp/pd/vasp.conv.pd b/externals/grill/vasp/pd/vasp.conv.pd index 93390159..24d3c35e 100644 --- a/externals/grill/vasp/pd/vasp.conv.pd +++ b/externals/grill/vasp/pd/vasp.conv.pd @@ -1,28 +1,14 @@ -#N canvas 30 70 406 306 12; -#X obj 53 224 vasp.c!fft; -#X obj 162 131 vasp.sync 2; -#X obj 178 104 vasp.= 0; -#X obj 179 80 vasp.im; -#X obj 161 158 vasp.cfft; -#X obj 54 198 vasp.c*; -#X obj 54 131 vasp.sync 2; -#X obj 70 104 vasp.= 0; -#X obj 71 80 vasp.im; -#X obj 53 158 vasp.cfft; -#X obj 54 51 inlet; -#X obj 168 52 inlet; -#X obj 52 252 outlet; -#X connect 0 0 12 0; -#X connect 1 0 4 0; -#X connect 2 0 1 1; -#X connect 3 0 2 0; -#X connect 4 0 5 1; -#X connect 5 0 0 0; -#X connect 6 0 9 0; -#X connect 7 0 6 1; -#X connect 8 0 7 0; -#X connect 9 0 5 0; -#X connect 10 0 6 0; -#X connect 10 0 8 0; -#X connect 11 0 1 0; -#X connect 11 0 3 0; +#N canvas 30 70 408 308 12;
+#X obj 54 51 inlet;
+#X obj 165 52 inlet;
+#X obj 50 193 outlet;
+#X obj 51 99 vasp.rfft;
+#X obj 159 99 vasp.rfft;
+#X obj 52 139 vasp.*;
+#X obj 51 165 vasp.r!fft;
+#X connect 0 0 3 0;
+#X connect 1 0 4 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 6 0;
+#X connect 6 0 2 0;
diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp index 3b92d1e9..d4a6338e 100644 --- a/externals/grill/vasp/source/buflib.cpp +++ b/externals/grill/vasp/source/buflib.cpp @@ -297,6 +297,6 @@ VSymbol ImmBuf::Symbol() const { return entry->sym; } I ImmBuf::Frames() const { return entry->len; } -V ImmBuf::Frames(I fr,BL keep) { entry = BufLib::Resize(entry,fr,keep); } +V ImmBuf::Frames(I fr,BL keep,BL zero) { entry = BufLib::Resize(entry,fr,keep,zero); } S *ImmBuf::Data() { return entry->data; } diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp index 5f63895a..f1cbee10 100644 --- a/externals/grill/vasp/source/main.cpp +++ b/externals/grill/vasp/source/main.cpp @@ -12,7 +12,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "classes.h" -const C *VASP_VERSION = "0.1.3pre1"; +const C *VASP_VERSION = "0.1.3pre3"; #include "opfuns.h" diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp index d8245471..6c2eba4b 100644 --- a/externals/grill/vasp/source/obj_size.cpp +++ b/externals/grill/vasp/source/obj_size.cpp @@ -34,7 +34,7 @@ class vasp_size: public: vasp_size(I argc,t_atom *argv,BL abs = true): - size(0),sets(false),keep(true) + size(0),sets(false),keep(true),zero(true) { if(argc >= 1 && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0])); @@ -52,6 +52,7 @@ public: { FLEXT_CADDMETHOD(c,1,m_arg); FLEXT_CADDATTR_VAR1(c,"keep",keep); + FLEXT_CADDATTR_VAR1(c,"zero",zero); } virtual V m_arg(F s) @@ -63,20 +64,21 @@ public: virtual Vasp *x_work() { Vasp *ret = new Vasp(ref); - if(sets) ret->Size(size,keep); + if(sets) ret->Size(size,keep,zero); return ret; } virtual V m_help() { post("%s - Set the size of the vector buffers",thisName()); } protected: I size; - BL sets,keep; + BL sets,keep,zero; private: FLEXT_CALLBACK_F(m_arg); FLEXT_CALLSET_I(m_arg); FLEXT_ATTRGET_I(size); FLEXT_ATTRVAR_B(keep); + FLEXT_ATTRVAR_B(zero); }; FLEXT_LIB_V("vasp, vasp.size vasp.s",vasp_size) diff --git a/externals/grill/vasp/source/opdefs.h b/externals/grill/vasp/source/opdefs.h index 8d7d522c..71774db6 100644 --- a/externals/grill/vasp/source/opdefs.h +++ b/externals/grill/vasp/source/opdefs.h @@ -313,13 +313,6 @@ template<class T,class ARG,class OP> BL V__cop(ARG p,register const S *sr,regist return true; } -template<class T,class CL> inline BL _D__run(OpParam &p) { return V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames); } -template<class T,class CL> inline BL _D__cun(OpParam &p) { return V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); } -template<class T,class CL> inline BL _D__rbin(OpParam &p) { return _F__rbin<T,CL>(p); } -template<class T,class CL> inline BL _D__cbin(OpParam &p) { return _F__cbin<T,CL>(p); } -template<class T,class CL> inline BL _D__rop(OpParam &p) { return V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames); } -template<class T,class CL> inline BL _D__cop(OpParam &p) { return V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); } - template<class T> BL _d__run(V fun(T &v,T a),OpParam &p) { @@ -423,21 +416,54 @@ template<class T> BL _d__cop(V fun(T &rv,T &iv,T ra,T ia,OpParam &p),OpParam &p) } +/* +template<class T,class CL> inline BL _D__run(OpParam &p) { return V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames); } +template<class T,class CL> inline BL _D__cun(OpParam &p) { return V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); } +template<class T,class CL> inline BL _D__rbin(OpParam &p) { return _F__rbin<T,CL>(p); } +template<class T,class CL> inline BL _D__cbin(OpParam &p) { return _F__cbin<T,CL>(p); } +template<class T,class CL> inline BL _D__rop(OpParam &p) { return V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames); } +template<class T,class CL> inline BL _D__cop(OpParam &p) { return V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); } #ifdef VASP_COMPACT - template<class T,class CL> inline BL D__run(OpParam &p) { return _d__run<T>(CL::run,p); } - template<class T,class CL> inline BL D__cun(OpParam &p) { return _d__cun<T>(CL::cun,p); } - template<class T,class CL> inline BL D__rbin(OpParam &p) { return _d__rbin<T>(CL::rbin,p); } - template<class T,class CL> inline BL D__cbin(OpParam &p) { return _d__cbin<T>(CL::cbin,p); } - template<class T,class CL> inline BL D__rop(OpParam &p) { return _d__rop<T>(CL::rop,p); } - template<class T,class CL> inline BL D__cop(OpParam &p) { return _d__cop<T>(CL::cop,p); } + template<class T,class CL> BL D__run(OpParam &p) { return _d__run<T>(CL::run,p); } + template<class T,class CL> BL D__cun(OpParam &p) { return _d__cun<T>(CL::cun,p); } + template<class T,class CL> BL D__rbin(OpParam &p) { return _d__rbin<T>(CL::rbin,p); } + template<class T,class CL> BL D__cbin(OpParam &p) { return _d__cbin<T>(CL::cbin,p); } + template<class T,class CL> BL D__rop(OpParam &p) { return _d__rop<T>(CL::rop,p); } + template<class T,class CL> BL D__cop(OpParam &p) { return _d__cop<T>(CL::cop,p); } +#else + template<class T,class CL> BL D__run(OpParam &p) { return CL::run_opt()?_D__run<T,CL>(p):_d__run<T>(CL::run,p); } + template<class T,class CL> BL D__cun(OpParam &p) { return CL::cun_opt()?_D__cun<T,CL>(p):_d__cun<T>(CL::cun,p); } + template<class T,class CL> BL D__rbin(OpParam &p) { return CL::rbin_opt()?_D__rbin<T,CL>(p):_d__rbin<T>(CL::rbin,p); } + template<class T,class CL> BL D__cbin(OpParam &p) { return CL::cbin_opt()?_D__cbin<T,CL>(p):_d__cbin<T>(CL::cbin,p); } + template<class T,class CL> BL D__rop(OpParam &p) { return CL::rop_opt()?_D__rop<T,CL>(p):_d__rop<T>(CL::rop,p); } + template<class T,class CL> BL D__cop(OpParam &p) { return CL::cop_opt()?_D__cop<T,CL>(p):_d__cop<T>(CL::cop,p); } +#endif +*/ + +// MSVC 6 can't handle optimization here!! (silently produces wrong code!!!) + +#define _D__run(T,CL,p) V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames) +#define _D__cun(T,CL,p) V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames) +#define _D__rbin(T,CL,p) _F__rbin<T,CL>(p) +#define _D__cbin(T,CL,p) _F__cbin<T,CL>(p) +#define _D__rop(T,CL,p) V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames) +#define _D__cop(T,CL,p) V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames) + +#if defined(VASP_COMPACT) || (defined(_MSC_VER) && _MSC_VER <= 1200) + #define D__run(T,CL,p) _d__run<T>(CL::run,p) + #define D__cun(T,CL,p) _d__cun<T>(CL::cun,p) + #define D__rbin(T,CL,p) _d__rbin<T>(CL::rbin,p) + #define D__cbin(T,CL,p) _d__cbin<T>(CL::cbin,p) + #define D__rop(T,CL,p) _d__rop<T>(CL::rop,p) + #define D__cop(T,CL,p) _d__cop<T>(CL::cop,p) #else - template<class T,class CL> inline BL D__run(OpParam &p) { return CL::run_opt()?_D__run<T,CL>(p):_d__run<T>(CL::run,p); } - template<class T,class CL> inline BL D__cun(OpParam &p) { return CL::cun_opt()?_D__cun<T,CL>(p):_d__cun<T>(CL::cun,p); } - template<class T,class CL> inline BL D__rbin(OpParam &p) { return CL::rbin_opt()?_D__rbin<T,CL>(p):_d__rbin<T>(CL::rbin,p); } - template<class T,class CL> inline BL D__cbin(OpParam &p) { return CL::cbin_opt()?_D__cbin<T,CL>(p):_d__cbin<T>(CL::cbin,p); } - template<class T,class CL> inline BL D__rop(OpParam &p) { return CL::rop_opt()?_D__rop<T,CL>(p):_d__rop<T>(CL::rop,p); } - template<class T,class CL> inline BL D__cop(OpParam &p) { return CL::cop_opt()?_D__cop<T,CL>(p):_d__cop<T>(CL::cop,p); } + #define D__run(T,CL,p) ( CL::run_opt()?_D__run(T,CL,p):_d__run<T>(CL::run,p) ) + #define D__cun(T,CL,p) ( CL::cun_opt()?_D__cun(T,CL,p):_d__cun<T>(CL::cun,p) ) + #define D__rbin(T,CL,p) ( CL::rbin_opt()?_D__rbin(T,CL,p):_d__rbin<T>(CL::rbin,p) ) + #define D__cbin(T,CL,p) ( CL::cbin_opt()?_D__cbin(T,CL,p):_d__cbin<T>(CL::cbin,p) ) + #define D__rop(T,CL,p) ( CL::rop_opt()?_D__rop(T,CL,p):_d__rop<T>(CL::rop,p) ) + #define D__cop(T,CL,p) ( CL::cop_opt()?_D__cop(T,CL,p):_d__cop<T>(CL::cop,p) ) #endif diff --git a/externals/grill/vasp/source/opfuns.h b/externals/grill/vasp/source/opfuns.h index 2228641d..3a14eb95 100644 --- a/externals/grill/vasp/source/opfuns.h +++ b/externals/grill/vasp/source/opfuns.h @@ -121,7 +121,7 @@ namespace VecOp { template<class T> class f_sqr { public: static I run_opt() { return 3; } - static V run(T &v,T a) { v = a*a; } + static V run(T &v,T a) { v = a*a; post("sq"); } static I cun_opt() { return 1; } static V cun(T &rv,T &iv,T ra,T ia) { rv = ra*ra-ia*ia; iv = ra*ia*2; } }; @@ -449,8 +449,9 @@ namespace VecOp { } + #define DEFOP(T,FUN,OP,KIND) \ -namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND<T,f_##OP<T> >(p); } } +namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND(T,f_##OP<T>,p); } } #define DEFVEC_R(T,OP) \ diff --git a/externals/grill/vasp/source/oploop.h b/externals/grill/vasp/source/oploop.h index 603cd7ce..9518edf1 100755 --- a/externals/grill/vasp/source/oploop.h +++ b/externals/grill/vasp/source/oploop.h @@ -67,11 +67,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define _DE_LOOP(VAR,LEN,BODY) { \ for(VAR = 0; VAR < LEN; flext_base::ThrYield()) { \ register const I __m__ = _D_MIN(LEN,VAR+_D_BLOCK); \ - for(; VAR <= __m__-4; VAR += 4) { \ - BODY; \ - BODY; \ - BODY; \ - BODY; \ + for(; VAR <= __m__-4; ) { \ + BODY; ++VAR; \ + BODY; ++VAR; \ + BODY; ++VAR; \ + BODY; ++VAR; \ } \ for(; VAR < __m__; ++VAR) { \ BODY; \ @@ -82,11 +82,11 @@ WARRANTIES, see the file, "license.txt," in this distribution. #else #define _DE_LOOP(VAR,LEN,BODY) { \ - for(VAR = 0; VAR <= LEN-4; VAR += 4) { \ - BODY; \ - BODY; \ - BODY; \ - BODY; \ + for(VAR = 0; VAR <= LEN-4; ) { \ + BODY; ++VAR; \ + BODY; ++VAR; \ + BODY; ++VAR; \ + BODY; ++VAR; \ } \ for(; VAR < LEN; ++VAR) { \ BODY; \ diff --git a/externals/grill/vasp/source/vasp.cpp b/externals/grill/vasp/source/vasp.cpp index 66bffccb..09ecb8ff 100644 --- a/externals/grill/vasp/source/vasp.cpp +++ b/externals/grill/vasp/source/vasp.cpp @@ -281,37 +281,37 @@ V Vasp::Channel(I c) } -V Vasp::Size(I s,BL keep) +V Vasp::Size(I s,BL keep,BL zero) { for(I i = 0; i < Vectors(); ++i) { VBuffer *buf = Buffer(i); if(buf) { - buf->Frames(s,keep); + buf->Frames(s,keep,zero); delete buf; } } } -V Vasp::SizeD(I sd,BL keep) +V Vasp::SizeD(I sd,BL keep,BL zero) { for(I i = 0; i < Vectors(); ++i) { VBuffer *buf = Buffer(i); if(buf) { I s = buf->Frames()+sd; - buf->Frames(s >= 0?s:0,keep); + buf->Frames(s >= 0?s:0,keep,zero); delete buf; } } } -V Vasp::SizeM(R f,BL keep) +V Vasp::SizeM(R f,BL keep,BL zero) { for(I i = 0; i < Vectors(); ++i) { VBuffer *buf = Buffer(i); if(buf) { I s = (I)(buf->Frames()*f); - buf->Frames(s >= 0?s:0,keep); + buf->Frames(s >= 0?s:0,keep,zero); delete buf; } } diff --git a/externals/grill/vasp/source/vasp.h b/externals/grill/vasp/source/vasp.h index 3f76b5bd..ed63846f 100644 --- a/externals/grill/vasp/source/vasp.h +++ b/externals/grill/vasp/source/vasp.h @@ -78,13 +78,13 @@ public: V FramesR(R f) { if(f) FramesM(1./f); else Frames(0); } // set buffer sizes - V Size(I fr,BL keep = true); + V Size(I fr,BL keep = true,BL zero = true); // set frame count differentially - V SizeD(I frd,BL keep = true); + V SizeD(I frd,BL keep = true,BL zero = true); // set frame count - V SizeM(R f,BL keep = true); + V SizeM(R f,BL keep = true,BL zero = true); // set frame count - V SizeR(R f,BL keep = true) { if(f) SizeM(1./f,keep); else Size(0,false); } + V SizeR(R f,BL keep = true,BL zero = true) { if(f) SizeM(1./f,keep,zero); else Size(0,false); } // actual length of the vasp (in frames) I ChkFrames() const; diff --git a/externals/grill/vasp/source/vbuffer.h b/externals/grill/vasp/source/vbuffer.h index 01a57af0..e616ad1c 100644 --- a/externals/grill/vasp/source/vbuffer.h +++ b/externals/grill/vasp/source/vbuffer.h @@ -47,7 +47,7 @@ public: virtual BL Ok() const = 0; virtual I Frames() const = 0; - virtual V Frames(I fr,BL keep) = 0; + virtual V Frames(I fr,BL keep,BL zero) = 0; virtual I Channels() const = 0; virtual S *Data() = 0; @@ -91,7 +91,7 @@ public: SysBuf &Set(const VSymbol &s,I chn = 0,I len = -1,I offs = 0); virtual I Frames() const { return buf.Frames(); } - virtual V Frames(I fr,BL keep) { buf.Frames(fr,keep); } + virtual V Frames(I fr,BL keep,BL zero) { buf.Frames(fr,keep,zero); } virtual I Channels() const { return buf.Channels(); } virtual S *Data() { return buf.Data(); } @@ -115,7 +115,7 @@ public: virtual VSymbol Symbol() const; virtual I Frames() const; - virtual V Frames(I fr,BL keep); + virtual V Frames(I fr,BL keep,BL zero); virtual I Channels() const { return 1; } virtual S *Data(); diff --git a/externals/grill/vasp/vasp.cw b/externals/grill/vasp/vasp.cw Binary files differindex 1601dbcb..0463eb2d 100644 --- a/externals/grill/vasp/vasp.cw +++ b/externals/grill/vasp/vasp.cw diff --git a/externals/grill/xsample/readme.txt b/externals/grill/xsample/readme.txt index 26f9b54b..f884c80e 100644 --- a/externals/grill/xsample/readme.txt +++ b/externals/grill/xsample/readme.txt @@ -1,310 +1,155 @@ 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. - - Donations for further development of the package are highly appreciated. - - ---------------------------------------------------------------------------- - - IMPORTANT INFORMATION for all MaxMSP users: - - 1) For OSX it is best to put the xsample file somewhere in your Max/MSP search path and drop the file - xsample-objectmappings.txt into the folder /Library/Application Support/Cycling '74/init . - - 2) Otherwise (or for OS9) it is advisable to put the xsample shared library file into the "max-startup" folder. - Hence it will be loaded at Max startup. - - 3) If you want to load the xsample library on demand, create a [xsample] object in Max/MSP. - - ---------------------------------------------------------------------------- - - You will need the flext C++ layer for PD and Max/MSP externals to compile this. - see http://www.parasitaere-kapazitaeten.net/ext - - - Package files: - - readme.txt: this one - - gpl.txt,license.txt: GPL license stuff - - main.h,main.cpp,inter.cpp,inter.ci: base class definition for all the other objects - - record.cpp: xrecord~ - - play.cpp: xplay~ - - groove.cpp: xgroove~ - - ---------------------------------------------------------------------------- - - The package should at least compile (and is tested) with the following compilers: - - pd - Windows: - ------------- - o Microsoft Visual C++ 6: edit "xsample.dsp" project file - > due to a compiler bug the optimization using templates is not functional - - pd - linux: - ----------- - 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 - - 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: 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 - - - ---------------------------------------------------------------------------- - - Goals/features of the package: - - - portable and effective sample recording/playing objects for pd and Max/MSP - - MSP-like groove~ object for PD - - message- or signal-triggered recording object with mix-in capability - - avoid the various bugs of the original MSP2 objects - - multi-channel capability - - live update of respective buffer/array content - - switchable 4-point or linear interpolation for xplay~/xgroove~ object - - cross-fading loop zone (inside or outside to loop) for xgroove~ - - ---------------------------------------------------------------------------- - - Version history: - - 0.3.0: - - added resources to MaxMSP build - - xgroove~, xrecord~: introduced a loop/end bang outlet - - added MaxMSP buffer resize recognition - - xgroove~: introduced a crossfading loop zone - - adapted source for flext 0.4.1 - most methods within class scope - - introduced attributes - - restructured make procedures - - corrected names of PD makefile, set help names - - fixed scale mode bug with xgroove~ - - added validity check for buffers - - Max/MSP OSX: new file xsample-objectmappings.txt fixes load of library on finding correct helpfiles! - - 0.2.4: - - according to flext 0.2.3 changed sample type to t_sample (S) - - xrecord~: fixed mix mode bug - - fixed argument buffer problem - - 0.2.3: - - using flext 0.2.2 - xsample is now a library under MaxMSP - - cleaner gcc makefile - - xgroove~, xrecord~: added "all" message to select entire buffer length - - xgroove~, xplay~: revisited dsp methods, restructured the code, fixed small interpolation bugs - - xgroove~, xplay~: added linear interpolation (message "interp 2") - - enabled 0 output channels -> xgroove~: position output only - - xgroove~: added bidirectional looping (message "loop 2") - - 0.2.2: - - using flext 0.2.0 - - xrecord~ for PD: new flext brings better graphics update behavior - - xrecord~: recording position doesn't jump to start when recording length is reached - - fixed bug with refresh message (min/max reset) - - xgroove~: position (by pos message) isn't sample rounded anymore - - reset/refresh messages readjust dsp routines to current buffer format (e.g. channel count) - - corrected Max/MSP assist method for multi-channel - - fixed xplay~ help method - - changed syntax to x*~ [channels=1] [buffer] for future enhancements (MaxMSP only, warning for old syntax) - - fixed small bug concerning startup position in xgroove~ and xrecord~ - - fixed deadly bug in xplay~ dsp code (only active with template optimization) - - 0.2.1: - - no leftmost float inlet for position setting - use pos method - - changed dsp handling for flext 0.1.1 conformance - - workarounds for buggy/incomplete compilers - - prevent buffer warning message at patcher load (wait for loadbang) - - fixed bug: current pos is reset when changing min or max points - - 0.2.0: - - first version for flext - - --------------------------------------------------------------------------- - - - TODO list: - - general: - - - do a smooth (line~) mixin in xrecord~ help patch - - features: - - multi-buffer handling (aka multi-channel for pd) - - vasp handling - - performance comparison to respective PD/Max objects - - anti-alias filter? (possible?) - - - delay min/max changes when cur pos in cross-fade zone - - tests: - - reconsider startup sequence of set buffer,set units,set sclmode,set pos/min/max - - bugs: - - PD: problems with timed buffer redrawing (takes a lot of cpu time) - flext bug? - - Apple MPW doesn't correctly compile template optimization - - Max help files aren't correctly opened due to xsample objects residing in a library (FIXED for OSX!!!) - |