aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/xsample/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2002-10-22 23:16:30 +0000
committerThomas Grill <xovo@users.sourceforge.net>2002-10-22 23:16:30 +0000
commitc2645dc4003b1391aba9b387a79a66cff1e63d3e (patch)
tree1ea6dccb8011a8ff64efb7c2ecf9a22caad860b3 /externals/grill/xsample/source
parentd62e56f4df9594f72ce501f5e19c974fd18e7295 (diff)
This commit was generated by cvs2svn to compensate for changes in r189,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/; revision=190
Diffstat (limited to 'externals/grill/xsample/source')
-rw-r--r--externals/grill/xsample/source/groove.cpp709
-rw-r--r--externals/grill/xsample/source/inter.ci355
-rw-r--r--externals/grill/xsample/source/inter.cpp95
-rw-r--r--externals/grill/xsample/source/main.cpp203
-rw-r--r--externals/grill/xsample/source/main.h277
-rw-r--r--externals/grill/xsample/source/makefile.bcc74
-rw-r--r--externals/grill/xsample/source/makefile.pd-cygwin89
-rw-r--r--externals/grill/xsample/source/makefile.pd-linux89
-rw-r--r--externals/grill/xsample/source/play.cpp160
-rw-r--r--externals/grill/xsample/source/record.cpp506
-rw-r--r--externals/grill/xsample/source/xsample.cwbin0 -> 105160 bytes
-rw-r--r--externals/grill/xsample/source/xsample.dsp127
-rw-r--r--externals/grill/xsample/source/xsample.mpw129
13 files changed, 2813 insertions, 0 deletions
diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp
new file mode 100644
index 00000000..5c2b056f
--- /dev/null
+++ b/externals/grill/xsample/source/groove.cpp
@@ -0,0 +1,709 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 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.
+
+*/
+
+#include "main.h"
+#include <math.h>
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+
+#define XZONE_TABLE 512
+
+
+class xgroove:
+ public xinter
+{
+// FLEXT_HEADER_S(xgroove,xinter,setup)
+ FLEXT_HEADER(xgroove,xinter)
+
+public:
+ xgroove(I argc,t_atom *argv);
+ ~xgroove();
+
+ virtual BL Init();
+
+#ifdef MAXMSP
+ virtual V m_assist(L msg,L arg,C *s);
+#endif
+
+ virtual V m_help();
+ virtual V m_print();
+
+ virtual V m_units(xs_unit mode = xsu__);
+
+ virtual BL m_reset();
+
+ virtual V m_pos(F pos);
+ virtual V m_all();
+ virtual V m_min(F mn);
+ virtual V m_max(F mx);
+
+ V m_xzone(F xz);
+ V m_xsymm(F xz);
+ V m_xshape(I argc = 0,t_atom *argv = NULL);
+ V m_xkeep(BL k);
+
+ enum xs_loop {
+ xsl__ = -1, // don't change
+ xsl_once = 0,xsl_loop,xsl_bidir
+ };
+
+ V m_loop(xs_loop lp = xsl__);
+
+protected:
+
+ xs_loop loopmode;
+ D curpos; // in samples
+ I bidir;
+
+ F _xzone,xzone,xsymm;
+ F znmin,znmax;
+ I xkeep;
+ S **znbuf;
+ S *znpos,*znmul,*znidx;
+ I pblksz;
+
+ outlet *outmin,*outmax; // float outlets
+
+ V outputmin() { ToOutFloat(outmin,curmin*s2u); }
+ V outputmax() { ToOutFloat(outmax,curmax*s2u); }
+
+ inline V setpos(F pos)
+ {
+ if(pos < curmin) pos = curmin;
+ else if(pos > curmax) pos = curmax;
+ curpos = pos;
+ }
+
+private:
+// static V setup(t_class *c);
+
+ virtual V s_dsp();
+
+ DEFSIGFUN(s_pos_off);
+ DEFSIGFUN(s_pos_once);
+ DEFSIGFUN(s_pos_loop);
+ DEFSIGFUN(s_pos_loopzn);
+ DEFSIGFUN(s_pos_bidir);
+
+ DEFSIGCALL(posfun);
+
+ DEFSTCALL(zonefun);
+
+ V do_xzone();
+
+ virtual V m_signal(I n,S *const *in,S *const *out)
+ {
+ bufchk();
+ posfun(n,in,out);
+ }
+
+ FLEXT_CALLBACK_F(m_pos)
+ FLEXT_CALLBACK(m_all)
+ FLEXT_CALLBACK_F(m_min)
+ FLEXT_CALLBACK_F(m_max)
+
+ FLEXT_CALLBACK_F(m_xzone)
+ FLEXT_CALLBACK_F(m_xsymm)
+ FLEXT_CALLBACK_V(m_xshape)
+ FLEXT_CALLBACK_B(m_xkeep)
+
+ FLEXT_CALLBACK_1(m_loop,xs_loop)
+};
+
+
+FLEXT_LIB_DSP_V("xgroove~",xgroove)
+
+/*
+V xgroove::setup(t_class *)
+{
+#ifndef PD
+ post("loaded xgroove~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
+#endif
+}
+*/
+
+xgroove::xgroove(I argc,t_atom *argv):
+ loopmode(xsl_loop),curpos(0),
+ _xzone(0),xzone(0),xsymm(0.5),xkeep(0),pblksz(0),
+ znbuf(NULL),znmul(NULL),znidx(NULL),znpos(NULL),
+ bidir(1)
+{
+ I argi = 0;
+#ifdef MAXMSP
+ if(argc > argi && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ }
+#endif
+
+ if(argc > argi && IsSymbol(argv[argi])) {
+ buf = new buffer(GetSymbol(argv[argi]),true);
+ argi++;
+
+#ifdef MAXMSP
+ // oldstyle command line?
+ if(argi == 1 && argc == 2 && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ post("%s: old style command line detected - please change to '%s [channels] [buffer]'",thisName(),thisName());
+ }
+#endif
+ }
+ else
+ buf = new buffer(NULL,true);
+
+ AddInSignal(); // speed signal
+ AddInFloat(2); // min & max play pos
+ AddOutSignal(outchns); // output
+ AddOutSignal(); // position
+ AddOutFloat(2); // play min & max
+ AddOutBang(); // loop bang
+
+ FLEXT_ADDMETHOD(1,m_min);
+ FLEXT_ADDMETHOD(2,m_max);
+ FLEXT_ADDMETHOD_F(0,"min",m_min);
+ FLEXT_ADDMETHOD_F(0,"max",m_max);
+ FLEXT_ADDMETHOD_F(0,"pos",m_pos);
+ FLEXT_ADDMETHOD_(0,"all",m_all);
+ FLEXT_ADDMETHOD_B(0,"loop",m_loop);
+
+ FLEXT_ADDMETHOD_F(0,"xzone",m_xzone);
+ FLEXT_ADDMETHOD_F(0,"xsymm",m_xsymm);
+ FLEXT_ADDMETHOD_(0,"xshape",m_xshape);
+ FLEXT_ADDMETHOD_B(0,"xkeep",m_xkeep);
+
+ znbuf = new S *[outchns];
+ for(I i = 0; i < outchns; ++i) znbuf[i] = new S[0];
+ znpos = new S[0];
+ znidx = new S[0];
+ m_xshape();
+}
+
+xgroove::~xgroove()
+{
+ if(znbuf) {
+ for(I i = 0; i < outchns; ++i) delete[] znbuf[i];
+ delete[] znbuf;
+ }
+
+ if(znmul) delete[] znmul;
+ if(znpos) delete[] znpos;
+ if(znidx) delete[] znidx;
+}
+
+BL xgroove::Init()
+{
+ if(xinter::Init()) {
+ outmin = GetOut(outchns+1);
+ outmax = GetOut(outchns+2);
+
+ m_reset();
+ return true;
+ }
+ else
+ return false;
+}
+
+V xgroove::m_units(xs_unit mode)
+{
+ xsample::m_units(mode);
+
+ m_sclmode();
+ outputmin();
+ outputmax();
+}
+
+V xgroove::m_min(F mn)
+{
+ xsample::m_min(mn);
+ m_pos(curpos*s2u);
+ do_xzone();
+ outputmin();
+}
+
+V xgroove::m_max(F mx)
+{
+ xsample::m_max(mx);
+ m_pos(curpos*s2u);
+ do_xzone();
+ outputmax();
+}
+
+V xgroove::m_pos(F pos)
+{
+ setpos(pos?pos/s2u:0);
+}
+
+V xgroove::m_all()
+{
+ xsample::m_all();
+ do_xzone();
+ outputmin();
+ outputmax();
+}
+
+BL xgroove::m_reset()
+{
+ curpos = 0;
+ bidir = 1;
+ return xsample::m_reset();
+}
+
+V xgroove::m_xzone(F xz)
+{
+ bufchk();
+ _xzone = xz < 0?0:xz/s2u;
+ do_xzone();
+ s_dsp();
+}
+
+V xgroove::m_xsymm(F xs)
+{
+ if(xs < 0)
+ xsymm = -1;
+ else if(xs <= 1)
+ xsymm = xs;
+ else {
+ post("%s - xsymm value out of range - set to center (0.5)",thisName());
+ xsymm = 0.5;
+ }
+ do_xzone();
+}
+
+V xgroove::m_xshape(I argc,t_atom *argv)
+{
+ const F pi = 3.14159265358979f;
+ I i,sh = 0;
+ F param = 1;
+ if(argc >= 1 && CanbeInt(argv[0])) sh = GetAInt(argv[0]);
+ if(argc >= 2 && CanbeFloat(argv[1])) {
+ param = GetAFloat(argv[1]);
+ // clip to 0..1
+ if(param < 0) param = 0;
+ else if(param > 1) param = 1;
+ }
+
+ if(znmul) delete[] znmul;
+ znmul = new S[XZONE_TABLE+1];
+
+ switch(sh) {
+ case 1:
+ for(i = 0; i <= XZONE_TABLE; ++i)
+ znmul[i] = sin(i*(pi/2./XZONE_TABLE))*param+i*(1./XZONE_TABLE)*(1-param);
+ break;
+ case 0:
+ default:
+ for(i = 0; i <= XZONE_TABLE; ++i)
+ znmul[i] = i*(1./XZONE_TABLE);
+ }
+}
+
+V xgroove::m_xkeep(BL k)
+{
+ xkeep = k;
+ do_xzone();
+}
+
+V xgroove::do_xzone()
+{
+ xzone = _xzone;
+ I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ if(xsymm < 0) {
+ // crossfade zone is inside the loop (-> loop is shorter than nominal!)
+ if(xzone >= plen) xzone = plen-1;
+ znmin = smin+xzone,znmax = smax-xzone;
+ }
+ else {
+ // desired crossfade points
+ znmin = smin+xzone*xsymm,znmax = smax+xzone*(xsymm-1);
+ // extra space at beginning and end
+ F o1 = znmin-xzone,o2 = buf->Frames()-(znmax+xzone);
+
+ if(o1 < 0 || o2 < 0) { // or (o1*o2 < 0)
+ if(o1+o2 < 0) {
+ // must reduce crossfade/loop length
+ if(!xkeep) {
+ // prefer preservation of cross-fade length
+ if(xzone >= plen) // have to reduce cross-fade length
+ xzone = plen-1;
+ znmin = smin+xzone,znmax = smax-xzone;
+ }
+ else {
+ // prefer preservation of loop length
+ znmin += o1,znmax -= o2;
+ xzone = (buf->Frames()-znmax+znmin)/2;
+ }
+ smin = 0,plen = smax = buf->Frames();
+ }
+ else if(o1 < 0) {
+ // min point is out of bounds (but enough space for mere shift)
+ I i1 = (I)o1;
+ smin -= i1,smax -= i1;
+ znmin = smin+xzone*xsymm,znmax = smax+xzone*(xsymm-1);
+ }
+ else /* o2 < 0 */ {
+ // max point is out of bounds (but enough space for mere shift)
+ I i2 = (I)o2;
+ smin += i2,smax += i2;
+ znmin = smin+xzone*xsymm,znmax = smax+xzone*(xsymm-1);
+ }
+ }
+ }
+}
+
+V xgroove::m_loop(xs_loop lp)
+{
+ loopmode = lp;
+ bidir = 1;
+ s_dsp();
+}
+
+
+V xgroove::s_pos_off(I n,S *const *invecs,S *const *outvecs)
+{
+ S *pos = outvecs[outchns];
+
+ const F oscl = scale(curpos);
+ for(I si = 0; si < n; ++si) pos[si] = oscl;
+
+ playfun(n,&pos,outvecs);
+}
+
+V xgroove::s_pos_once(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+
+ if(buf && plen > 0) {
+ register D o = curpos;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ if(o >= smax) { o = smax; lpbang = true; }
+ else if(o < smin) { o = smin; lpbang = true; }
+
+ pos[i] = scale(o);
+ o += spd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ playfun(n,&pos,outvecs);
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+V xgroove::s_pos_loop(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+
+ if(buf && plen > 0) {
+ register D o = curpos;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ // normalize offset
+ if(o >= smax) {
+ o = fmod(o-smin,plen)+smin;
+ lpbang = true;
+ }
+ else if(o < smin) {
+ o = fmod(o-smin,plen)+smax;
+ lpbang = true;
+ }
+
+ pos[i] = scale(o);
+ o += spd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ playfun(n,&pos,outvecs);
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+V xgroove::s_pos_loopzn(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ const F xz = xzone,lmin = znmin,lmax = znmax;
+ const F xf = (F)XZONE_TABLE/xz;
+
+ if(buf && plen > 0) {
+ BL inzn = false;
+ register D o = curpos;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ // normalize offset
+ if(o >= smax) {
+ o = fmod(o-smin,plen)+smin;
+ lpbang = true;
+ }
+ else if(o < smin) {
+ o = fmod(o-smin,plen)+smax;
+ lpbang = true;
+ }
+
+ if(o >= lmax) // in late cross-fade zone
+ o -= lmax-smin;
+
+ if(o < lmin) {
+ // in early cross-fade zone
+ register F inp = o-smin;
+ znidx[i] = inp*xf;
+ znpos[i] = scale(lmax+inp);
+ inzn = true;
+ }
+ else
+ znidx[i] = XZONE_TABLE,znpos[i] = 0;
+
+ pos[i] = scale(o);
+ o += spd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ playfun(n,&pos,outvecs);
+
+ 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);
+
+ for(I o = 0; o < outchns; ++o) {
+ F *ov = outvecs[o],*ob = znbuf[o];
+ for(I i = 0; i < n; ++i,ov++,ob++)
+ *ov = (*ov)*znidx[i]+(*ob)*znpos[i];
+ }
+ }
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+V xgroove::s_pos_bidir(I n,S *const *invecs,S *const *outvecs)
+{
+ const S *speed = invecs[0];
+ S *pos = outvecs[outchns];
+ BL lpbang = false;
+
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+
+ if(buf && plen > 0) {
+ register D o = curpos;
+ register F bd = bidir;
+
+ for(I i = 0; i < n; ++i) {
+ const S spd = speed[i]; // must be first because the vector is reused for output!
+
+ // normalize offset
+ if(o >= smax) {
+ o = smax-fmod(o-smin,plen); // mirror the position at smax
+ bd = -bd;
+ lpbang = true;
+ }
+ else if(o < smin) {
+ o = smin-fmod(o-smin,plen); // mirror the position at smin
+ bd = -bd;
+ lpbang = true;
+ }
+
+ pos[i] = scale(o);
+ o += spd*bd;
+ }
+ // normalize and store current playing position
+ setpos(o);
+
+ bidir = (I)bd;
+ playfun(n,&pos,outvecs);
+ }
+ else
+ s_pos_off(n,invecs,outvecs);
+
+ if(lpbang) ToOutBang(outchns+3);
+}
+
+
+V xgroove::s_dsp()
+{
+ if(doplay) {
+ switch(loopmode) {
+ case xsl_once: SETSIGFUN(posfun,SIGFUN(s_pos_once)); break;
+ case xsl_loop:
+ if(xzone > 0) {
+ const I blksz = Blocksize();
+
+ if(pblksz != blksz) {
+ for(I o = 0; o < outchns; ++o) {
+ delete[] znbuf[o];
+ znbuf[o] = new S[blksz];
+ }
+
+ delete[] znpos; znpos = new S[blksz];
+ delete[] znidx; znidx = new S[blksz];
+
+ pblksz = blksz;
+ }
+
+ SETSIGFUN(posfun,SIGFUN(s_pos_loopzn));
+
+ if(interp == xsi_4p)
+ switch(outchns) {
+ case 1: SETSTFUN(zonefun,TMPLSTF(st_play4,1,1)); break;
+ case 2: SETSTFUN(zonefun,TMPLSTF(st_play4,1,2)); break;
+ case 4: SETSTFUN(zonefun,TMPLSTF(st_play4,1,4)); break;
+ 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;
+ case 2: SETSTFUN(zonefun,TMPLSTF(st_play1,1,2)); break;
+ 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));
+ break;
+ case xsl_bidir: SETSIGFUN(posfun,SIGFUN(s_pos_bidir)); break;
+ }
+ }
+ else
+ SETSIGFUN(posfun,SIGFUN(s_pos_off));
+ xinter::s_dsp();
+}
+
+
+
+V xgroove::m_help()
+{
+ post("%s - part of xsample objects, version " XSAMPLE_VERSION,thisName());
+#ifdef _DEBUG
+ post("compiled on " __DATE__ " " __TIME__);
+#endif
+ post("(C) Thomas Grill, 2001-2002");
+#ifdef MAXMSP
+ post("Arguments: %s [channels=1] [buffer]",thisName());
+#else
+ post("Arguments: %s [buffer]",thisName());
+#endif
+ post("Inlets: 1:Messages/Speed signal, 2:Min position, 3:Max position");
+ post("Outlets: 1:Audio signal, 2:Position signal, 3:Min position (rounded), 4:Max position (rounded)");
+ post("Methods:");
+ post("\thelp: shows this help");
+ post("\tset [name]: set buffer or reinit");
+ post("\tenable 0/1: turn dsp calculation off/on");
+ post("\treset: reset min/max playing points and playing offset");
+ post("\tprint: print current settings");
+ post("\tloop 0/1/2: sets looping to off/forward/bidirectional");
+ post("\tinterp 0/1/2: set interpolation to off/4-point/linear");
+ post("\tmin {unit}: set minimum playing point");
+ post("\tmax {unit}: set maximum playing point");
+ post("\tall: select entire buffer length");
+ post("\tpos {unit}: set playing position (obeying the current scale mode)");
+ post("\tbang/start: start playing");
+ post("\tstop: stop playing");
+ post("\trefresh: checks buffer and refreshes outlets");
+ post("\tunits 0/1/2/3: set units to frames/buffer size/ms/s");
+ post("\tsclmode 0/1/2/3: set range of position to units/units in loop/buffer/loop");
+ post("\txzone {unit}: length of loop crossfade zone");
+ post("\txsymm -1,0...1: symmetry of crossfade zone inside/outside point");
+ post("\txshape 0/1 [param 0...1]: shape of crossfading (linear/trig)");
+ post("");
+}
+
+V xgroove::m_print()
+{
+ static const C *sclmode_txt[] = {"units","units in loop","buffer","loop"};
+ static const C *interp_txt[] = {"off","4-point","linear"};
+ static const C *loop_txt[] = {"once","looping","bidir"};
+
+ // print all current settings
+ post("%s - current settings:",thisName());
+ post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels());
+ post("out channels = %i, frames/unit = %.3f, scale mode = %s",outchns,(F)(1./s2u),sclmode_txt[sclmode]);
+ post("loop = %s, interpolation = %s",loop_txt[(I)loopmode],interp_txt[interp >= xsi_none && interp <= xsi_lin?interp:xsi_none]);
+ post("loop crossfade zone = %.3f",(F)(xzone*s2u));
+ post("");
+}
+
+#ifdef MAXMSP
+V xgroove::m_assist(long msg, long arg, char *s)
+{
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ switch(arg) {
+ case 0:
+ sprintf(s,"Signal of playing speed"); break;
+ case 1:
+ sprintf(s,"Starting point"); break;
+ case 2:
+ sprintf(s,"Ending point"); break;
+ }
+ break;
+ case 2: //ASSIST_OUTLET:
+ if(arg < outchns)
+ sprintf(s,"Audio signal channel %li",arg+1);
+ else
+ switch(arg-outchns) {
+ case 0:
+ sprintf(s,"Position currently played"); break;
+ case 1:
+ sprintf(s,"Starting point (rounded to frame)"); break;
+ case 2:
+ sprintf(s,"Ending point (rounded to frame)"); break;
+ case 3:
+ sprintf(s,"Bang on loop end/rollover"); break;
+ }
+ break;
+ }
+}
+#endif
+
+
+
+
+
diff --git a/externals/grill/xsample/source/inter.ci b/externals/grill/xsample/source/inter.ci
new file mode 100644
index 00000000..2902c386
--- /dev/null
+++ b/externals/grill/xsample/source/inter.ci
@@ -0,0 +1,355 @@
+#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++)/s2u);
+ 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++)/s2u;
+ 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++)/s2u;
+ 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;
+}
+
+#if 0
+
+TMPLDEF V xinter::s_play0(I n,S *const *invecs,S *const *outvecs)
+{
+ // stopped
+ SIGCHNS(BCHNS,buf->Channels(),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::s_play4(I n,S *const *invecs,S *const *outvecs)
+{
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ if(plen < 4) {
+ if(plen < 2) s_play1 TMPLCALL (n,invecs,outvecs);
+ else s_play2 TMPLCALL (n,invecs,outvecs);
+ return;
+ }
+
+ SIGCHNS(BCHNS,buf->Channels(),OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+ const S *bdt = buf->Data();
+
+ // 4-point interpolation
+ // ---------------------
+ const I maxo = smax-1; // last sample in play region
+
+ for(I i = 0; i < n; ++i,++si) {
+ F o = *(pos++)/s2u;
+ 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_play2(I n,S *const *invecs,S *const *outvecs)
+{
+ const I smin = curmin,smax = curmax,plen = smax-smin; //curlen;
+ if(plen < 2) {
+ s_play1 TMPLCALL (n,invecs,outvecs);
+ return;
+ }
+
+ SIGCHNS(BCHNS,buf->Channels(),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
+ const S *bdt = buf->Data();
+
+ for(I i = 0; i < n; ++i,++si) {
+ const F o = *(pos++)/s2u;
+ 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::s_play1(I n,S *const *invecs,S *const *outvecs)
+{
+ SIGCHNS(BCHNS,buf->Channels(),OCHNS,outchns);
+
+ const S *pos = invecs[0];
+ S *const *sig = outvecs;
+ register I si = 0;
+ const I smin = curmin,smax = curmax;
+ const S *bdt = buf->Data();
+
+ // no interpolation
+ // ----------------
+
+ for(I i = 0; i < n; ++i,++si) {
+ register const I oint = (I)(*(pos++)/s2u);
+ 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;
+}
+
+#else
+
+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
+
+
+#endif
diff --git a/externals/grill/xsample/source/inter.cpp b/externals/grill/xsample/source/inter.cpp
new file mode 100644
index 00000000..095fba6f
--- /dev/null
+++ b/externals/grill/xsample/source/inter.cpp
@@ -0,0 +1,95 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 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.
+
+*/
+
+#include "main.h"
+#include <math.h>
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+#ifndef TMPLOPT
+#include "inter.ci"
+#endif
+
+
+xinter::xinter():
+ doplay(false),outchns(1),
+ interp(xsi_4p)
+{
+ FLEXT_ADDMETHOD_E(0,"interp",m_interp);
+}
+
+I xinter::m_set(I argc,t_atom *argv)
+{
+ I r = xsample::m_set(argc,argv);
+ if(r < 0) m_reset(); // resets pos/min/max
+ if(r != 0) m_units();
+ return r;
+}
+
+V xinter::m_start()
+{
+ m_refresh();
+ doplay = true;
+ s_dsp();
+}
+
+V xinter::m_stop()
+{
+ doplay = false;
+ s_dsp();
+}
+
+V xinter::s_dsp()
+{
+ if(doplay) {
+ if(interp == xsi_4p)
+ switch(buf->Channels()*1000+outchns) {
+ case 1001: SETSIGFUN(playfun,TMPLFUN(s_play4,1,1)); break;
+ case 1002: SETSIGFUN(playfun,TMPLFUN(s_play4,1,2)); break;
+ case 2001: SETSIGFUN(playfun,TMPLFUN(s_play4,2,1)); break;
+ case 2002: SETSIGFUN(playfun,TMPLFUN(s_play4,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(playfun,TMPLFUN(s_play4,4,-1)); break;
+ case 4004: SETSIGFUN(playfun,TMPLFUN(s_play4,4,4)); break;
+ default: SETSIGFUN(playfun,TMPLFUN(s_play4,-1,-1));
+ }
+ else if(interp == xsi_lin)
+ switch(buf->Channels()*1000+outchns) {
+ case 1001: SETSIGFUN(playfun,TMPLFUN(s_play2,1,1)); break;
+ case 1002: SETSIGFUN(playfun,TMPLFUN(s_play2,1,2)); break;
+ case 2001: SETSIGFUN(playfun,TMPLFUN(s_play2,2,1)); break;
+ case 2002: SETSIGFUN(playfun,TMPLFUN(s_play2,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(playfun,TMPLFUN(s_play2,4,-1)); break;
+ case 4004: SETSIGFUN(playfun,TMPLFUN(s_play2,4,4)); break;
+ default: SETSIGFUN(playfun,TMPLFUN(s_play2,-1,-1));
+ }
+ else
+ switch(buf->Channels()*1000+outchns) {
+ case 1001: SETSIGFUN(playfun,TMPLFUN(s_play1,1,1)); break;
+ case 1002: SETSIGFUN(playfun,TMPLFUN(s_play1,1,2)); break;
+ case 2001: SETSIGFUN(playfun,TMPLFUN(s_play1,2,1)); break;
+ case 2002: SETSIGFUN(playfun,TMPLFUN(s_play1,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(playfun,TMPLFUN(s_play1,4,-1)); break;
+ case 4004: SETSIGFUN(playfun,TMPLFUN(s_play1,4,4)); break;
+ default: SETSIGFUN(playfun,TMPLFUN(s_play1,-1,-1));
+ }
+ }
+ else
+ SETSIGFUN(playfun,TMPLFUN(s_play0,-1,-1));
+}
+
+
diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp
new file mode 100644
index 00000000..410746ff
--- /dev/null
+++ b/externals/grill/xsample/source/main.cpp
@@ -0,0 +1,203 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 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.
+
+*/
+
+#include "main.h"
+
+
+// Initialization function for xsample library
+V lib_setup()
+{
+ post("xsample objects, version " XSAMPLE_VERSION ", (C)2001,2002 Thomas Grill");
+ post("xsample: xrecord~, xplay~, xgroove~ - send objects a 'help' message to get assistance");
+ post("");
+
+ // call the objects' setup routines
+ FLEXT_DSP_SETUP(xrecord);
+ FLEXT_DSP_SETUP(xplay);
+ FLEXT_DSP_SETUP(xgroove);
+
+#ifdef MAXMSP
+ // That's not the right place..... (doesn't work)
+ finder_addclass((char *)"MSP Sampling",(char *)"xgroove~");
+ finder_addclass((char *)"MSP Sampling",(char *)"xplay~");
+ finder_addclass((char *)"MSP Sampling",(char *)"xrecord~");
+#endif
+
+}
+
+// setup the library
+FLEXT_LIB_SETUP(xsample,lib_setup)
+
+// ------------------------------
+
+xsample::xsample():
+ buf(NULL),
+#ifdef PD
+ unitmode(xsu_sample), // PD defaults to samples
+#else
+ unitmode(xsu_ms), // Max/MSP defaults to milliseconds
+#endif
+ sclmode(xss_unitsinbuf),
+ curmin(0),curmax(1<<30)
+{
+ FLEXT_ADDBANG(0,m_start);
+ FLEXT_ADDMETHOD_(0,"start",m_start);
+ FLEXT_ADDMETHOD_(0,"stop",m_stop);
+
+ FLEXT_ADDMETHOD_(0,"set",m_set);
+ FLEXT_ADDMETHOD_(0,"print",m_print);
+ FLEXT_ADDMETHOD_(0,"refresh",m_refresh);
+ FLEXT_ADDMETHOD_(0,"reset",m_reset);
+
+ FLEXT_ADDMETHOD_E(0,"units",m_units);
+ FLEXT_ADDMETHOD_E(0,"sclmode",m_sclmode);
+}
+
+xsample::~xsample()
+{
+// m_enable(false); // switch off DSP
+
+ if(buf) delete buf;
+}
+
+
+
+I xsample::m_set(I argc, t_atom *argv)
+{
+ return buf->Set(argc >= 1?GetASymbol(argv[0]):NULL);
+}
+
+BL xsample::m_refresh()
+{
+// bufchk();
+
+ BL ret;
+ if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
+ else ret = false;
+
+ m_min((F)curmin*s2u); // also checks pos
+ m_max((F)curmax*s2u); // also checks pos
+
+ return ret;
+}
+
+BL xsample::m_reset()
+{
+// bufchk();
+
+ BL ret;
+ if(buf->Set()) { s_dsp(); ret = true; } // channel count may have changed
+ else ret = false;
+
+ m_units();
+ m_sclmode();
+ m_min(0);
+ m_max(buf->Frames()*s2u);
+
+ return ret;
+}
+
+V xsample::m_loadbang()
+{
+ m_reset();
+}
+
+V xsample::m_units(xs_unit mode)
+{
+ bufchk();
+
+ if(mode != xsu__) unitmode = mode;
+ switch(unitmode) {
+ case xsu_sample: // samples
+ s2u = 1;
+ break;
+ case xsu_buffer: // buffer size
+ s2u = 1.f/buf->Frames();
+ break;
+ case xsu_ms: // ms
+ s2u = 1000.f/Samplerate();
+ break;
+ case xsu_s: // s
+ s2u = 1.f/Samplerate();
+ break;
+ default:
+ post("%s: Unknown unit mode",thisName());
+ }
+}
+
+V xsample::m_sclmode(xs_sclmd mode)
+{
+ bufchk();
+
+ if(mode != xss__) sclmode = mode;
+ switch(sclmode) {
+ case 0: // samples/units
+ sclmin = 0; sclmul = s2u;
+ break;
+ case 1: // samples/units from recmin to recmax
+ sclmin = curmin; sclmul = s2u;
+ break;
+ case 2: // unity between 0 and buffer size
+ sclmin = 0; sclmul = buf->Frames()?1.f/buf->Frames():0;
+ break;
+ case 3: // unity between recmin and recmax
+// sclmin = curmin; sclmul = curlen?1.f/curlen:0;
+ sclmin = curmin; sclmul = curmin != curmax?1.f/(curmax-curmin):0;
+ break;
+ default:
+ post("%s: Unknown scale mode",thisName());
+ }
+}
+
+V xsample::m_min(F mn)
+{
+ bufchk();
+
+ mn /= s2u; // conversion to samples
+ if(mn < 0) mn = 0;
+ else if(mn > curmax) mn = (F)curmax;
+ curmin = (I)(mn+.5);
+// curlen = curmax-curmin;
+
+ m_sclmode();
+}
+
+V xsample::m_max(F mx)
+{
+ bufchk();
+
+ mx /= s2u; // conversion to samples
+ if(mx > buf->Frames()) mx = (F)buf->Frames();
+ else if(mx < curmin) mx = (F)curmin;
+ curmax = (I)(mx+.5);
+// curlen = curmax-curmin;
+
+ m_sclmode();
+}
+
+V xsample::m_all()
+{
+ bufchk();
+
+// curlen = (curmax = buf->Frames())-(curmin = 0);
+ curmin = 0; curmax = buf->Frames();
+ m_sclmode();
+}
+
+V xsample::m_dsp(I /*n*/,S *const * /*insigs*/,S *const * /*outsigs*/)
+{
+ // this is hopefully called at change of sample rate ?!
+
+ if(!m_refresh()) s_dsp();
+}
+
+
+
+
diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h
new file mode 100644
index 00000000..db78a630
--- /dev/null
+++ b/externals/grill/xsample/source/main.h
@@ -0,0 +1,277 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 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 __XSAMPLE_H
+#define __XSAMPLE_H
+
+#define XSAMPLE_VERSION "0.2.5pre1"
+
+
+#include <flext.h>
+
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 400)
+#error You need at least flext version 0.4.0
+#endif
+
+
+// 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 <int,int> templates?! -> no optimization
+// #define TMPLOPT
+#elif defined(__BORLANDC__)
+// handles all optimizations
+ #define TMPLOPT
+#elif defined(__GNUC__)
+// GNUC 2.95.2 dies at compile with <int,int> templates
+#if __GNUC__ >= 3
+ #define TMPLOPT // only workable with gcc >= 3.0
+#endif
+#elif defined(__MWERKS__)
+// CodeWarrior can't take address of a template member function
+ #define TMPLOPT
+ #define SIGSTATIC
+#elif defined(__MRC__)
+// Apple MPW - MrCpp
+// #define TMPLOPT // template optimation for more speed
+#else
+// another compiler
+// #define TMPLOPT // template optimation for more speed (about 10%)
+ //#define SIGSTATIC // another redirection to avoid addresses of class member functions
+#endif
+
+
+// lazy me
+#define F float
+#define D double
+#define I int
+#define L long
+#define C char
+#define V void
+#define BL bool
+#define S t_sample
+
+
+class xsample:
+ public flext_dsp
+{
+ FLEXT_HEADER(xsample,flext_dsp)
+
+public:
+ xsample();
+ ~xsample();
+
+ enum xs_unit {
+ xsu__ = -1, // don't change
+ xsu_sample = 0,xsu_buffer,xsu_ms,xsu_s
+ };
+
+ enum xs_intp {
+ xsi__ = -1, // don't change
+ xsi_none = 0,xsi_4p,xsi_lin
+ };
+
+ enum xs_sclmd {
+ xss__ = -1, // don't change
+ xss_unitsinbuf = 0,xss_unitsinloop,xss_buffer,xss_loop
+ };
+
+protected:
+ buffer *buf;
+
+ virtual V m_start() = 0;
+ virtual V m_stop() = 0;
+ virtual BL m_reset();
+
+ virtual I m_set(I argc,t_atom *argv);
+ virtual V m_print() = 0;
+ virtual BL m_refresh();
+ virtual V m_loadbang();
+
+ virtual V m_units(xs_unit u = xsu__);
+ virtual V m_sclmode(xs_sclmd u = xss__);
+
+ virtual V m_all();
+ virtual V m_min(F mn);
+ virtual V m_max(F mx);
+
+ virtual V m_dsp(I n,F *const *insigs,F *const *outsigs);
+ virtual V s_dsp() = 0;
+
+ xs_unit unitmode; //iunitmode,ounitmode;
+ xs_sclmd sclmode; //isclmode,osclmode;
+
+ I curmin,curmax; //,curlen; // in samples
+ I sclmin; // in samples
+ F sclmul;
+ F s2u; // sample to unit conversion factor
+
+ inline F scale(F smp) const { return (smp-sclmin)*sclmul; }
+
+ BL bufchk() { if(buf->Update()) { m_refresh(); return true; } return false; }
+
+private:
+
+ FLEXT_CALLBACK(m_start)
+ FLEXT_CALLBACK(m_stop)
+
+ FLEXT_CALLBACK_V(m_set)
+ FLEXT_CALLBACK(m_print)
+ FLEXT_CALLBACK(m_refresh)
+ FLEXT_CALLBACK(m_reset)
+
+ FLEXT_CALLBACK_1(m_units,xs_unit)
+ FLEXT_CALLBACK_1(m_sclmode,xs_sclmd)
+};
+
+
+// defines which are used in the derived classes
+#ifdef SIGSTATIC
+ #ifdef TMPLOPT
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::st_##FUN<BCHNS,IOCHNS>
+ #define TMPLSTF(FUN,BCHNS,IOCHNS) &thisType::FUN<BCHNS,IOCHNS>
+ #define SIGFUN(FUN) &thisType::st_##FUN
+ #define TMPLDEF template <int _BCHNS_,int _IOCHNS_>
+ #define TMPLCALL <_BCHNS_,_IOCHNS_>
+ #else
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::st_##FUN
+ #define TMPLSTF(FUN,BCHNS,IOCHNS) &thisType::FUN
+ #define SIGFUN(FUN) &thisType::st_##FUN
+ #define TMPLDEF
+ #define TMPLCALL
+ #endif
+
+ #define DEFSIGFUN(NAME) \
+ static V st_##NAME(thisType *obj,I n,S *const *in,S *const *out) { obj->NAME (n,in,out); } \
+ V NAME(I n,S *const *in,S *const *out)
+
+ #define TMPLSIGFUN(NAME) \
+ 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 SETSIGFUN(VAR,FUN) v_##VAR = FUN
+
+ #define SETSTFUN(VAR,FUN) VAR = FUN
+
+ #define DEFSIGCALL(NAME) \
+ inline V NAME(I n,S *const *in,S *const *out) { (*v_##NAME)(this,n,in,out); } \
+ 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)
+
+#else
+ #ifdef TMPLOPT
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::FUN<BCHNS,IOCHNS>
+ #define SIGFUN(FUN) &thisType::FUN
+ #define TMPLDEF template <int _BCHNS_,int _IOCHNS_>
+ #define TMPLCALL <_BCHNS_,_IOCHNS_>
+ #else
+ #define TMPLFUN(FUN,BCHNS,IOCHNS) &thisType::FUN
+ #define SIGFUN(FUN) &thisType::FUN
+ #define TMPLDEF
+ #define TMPLCALL
+ #endif
+
+ #define TMPLSTF(FUN,BCHNS,IOCHNS) TMPLFUN(FUN,BCHNS,IOCHNS)
+
+ #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 SETSIGFUN(VAR,FUN) v_##VAR = FUN
+
+ #define DEFSIGCALL(NAME) \
+ inline V NAME(I n,S *const *in,S *const *out) { (this->*v_##NAME)(n,in,out); } \
+ V (thisType::*v_##NAME)(I n,S *const *invecs,S *const *outvecs)
+
+ #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)
+#endif
+
+
+
+
+
+#ifndef MIN
+#define MIN(x,y) ((x) < (y)?(x):(y))
+#endif
+
+// in the signal functions
+#ifdef TMPLOPT
+ // optimization by using constants for channel numbers
+ #define SIGCHNS(BCHNS,bchns,IOCHNS,iochns) \
+ const I BCHNS = _BCHNS_ < 0?(bchns):_BCHNS_; \
+ const I IOCHNS = _IOCHNS_ < 0?MIN(iochns,BCHNS):MIN(_IOCHNS_,BCHNS)
+#else
+ // no template optimization
+ #ifdef PD // only mono buffers
+ #define SIGCHNS(BCHNS,bchns,IOCHNS,iochns) \
+ const I BCHNS = 1; \
+ const I IOCHNS = MIN(iochns,BCHNS)
+ #else // MAXMSP
+ #define SIGCHNS(BCHNS,bchns,IOCHNS,iochns) \
+ const I BCHNS = bchns; \
+ const I IOCHNS = MIN(iochns,BCHNS)
+ #endif
+#endif
+
+
+class xinter:
+ public xsample
+{
+ FLEXT_HEADER(xinter,xsample)
+
+public:
+ xinter();
+
+protected:
+ virtual I m_set(I argc,t_atom *argv);
+
+ virtual V m_start();
+ virtual V m_stop();
+
+ V m_interp(xs_intp mode = xsi__) { interp = mode; s_dsp(); }
+
+ I outchns;
+ BL doplay;
+ xs_intp interp;
+
+ TMPLSIGFUN(s_play0);
+ TMPLSIGFUN(s_play1);
+ TMPLSIGFUN(s_play2);
+ TMPLSIGFUN(s_play4);
+
+ TMPLSTFUN(st_play0);
+ TMPLSTFUN(st_play1);
+ TMPLSTFUN(st_play2);
+ TMPLSTFUN(st_play4);
+
+ DEFSIGCALL(playfun);
+
+ virtual V s_dsp();
+
+private:
+
+ FLEXT_CALLBACK_1(m_interp,xs_intp)
+};
+
+#ifdef TMPLOPT
+#include "inter.ci"
+#endif
+
+#endif
+
+
diff --git a/externals/grill/xsample/source/makefile.bcc b/externals/grill/xsample/source/makefile.bcc
new file mode 100644
index 00000000..e9e624b2
--- /dev/null
+++ b/externals/grill/xsample/source/makefile.bcc
@@ -0,0 +1,74 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for BorlandC++
+#
+# usage: make -f makefile.bcc
+#
+# ---------------------------------------------
+
+NAME=xsample
+SETUPFUNCTION=$(NAME)_setup
+
+# where to put the build
+OUTPATH=..\bcc
+
+# flext stuff
+FLEXTPATH=..\..\flext ### EDIT! ##
+TARGET=pdwin
+
+# paths
+BCCPATH=c:\programme\prog\bcc55 ### EDIT! ##
+PDPATH=c:\programme\audio\pd ### EDIT! ##
+
+# includes, libs
+INCPATH=-I$(BCCPATH)\include -I$(PDPATH)\src -I$(FLEXTPATH)\source
+LIBPATH=-L$(BCCPATH)\lib -L$(PDPATH)\lib
+LIBS=cw32.lib import32.lib C0D32.OBJ
+
+# compiler definitions and flags
+DEFS=-DPD -DNT
+CFLAGS=-6 -O2 -OS -ff -tWD
+
+
+# the rest can stay untouched
+# ----------------------------------------------
+
+# all the source files from the package
+SRCS= main.cpp inter.cpp record.cpp play.cpp groove.cpp
+HDRS= main.h inter.ci
+
+OBJS= $(SRCS:.cpp=.obj)
+
+# default target
+all: $(OUTPATH)\$(NAME).dll
+
+# remove build
+clean:
+ -del /s /q $(OUTPATH) > nul
+ rmdir $(OUTPATH)
+
+# ----------------------------------------------
+
+$(SRCS): $(HDRS)
+ -touch $<
+
+.PATH.OBJ=$(OUTPATH)
+
+.cpp.obj:
+ bcc32 -c $(CFLAGS) $(DEFS) $(INCPATH) -n$(OUTPATH) $<
+
+$(OUTPATH):
+ -@if not exist $< mkdir $<
+
+$(OUTPATH)\pd.lib: $(PDPATH)\bin\pd.dll
+ implib -a $@ $**
+
+$(OUTPATH)\$(NAME).def:
+ @echo EXPORTS $(SETUPFUNCTION) = _$(SETUPFUNCTION) > $<
+
+$(OUTPATH)\$(NAME).dll :: $(OUTPATH) $(OUTPATH)\$(NAME).def $(OUTPATH)\pd.lib
+
+$(OUTPATH)\$(NAME).dll :: $(OBJS)
+ ilink32 -C -Tpd $(LIBPATH) $** ,$<,,$(LIBS) $(OUTPATH)\pd.lib $(FLEXTPATH)\pd-bcc\flext-$(TARGET).lib,$(OUTPATH)\$(NAME).def
+
diff --git a/externals/grill/xsample/source/makefile.pd-cygwin b/externals/grill/xsample/source/makefile.pd-cygwin
new file mode 100644
index 00000000..18c53431
--- /dev/null
+++ b/externals/grill/xsample/source/makefile.pd-cygwin
@@ -0,0 +1,89 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for gcc @ linux
+#
+# usage:
+# to build run "make -f makefile.pd-cygwin"
+# to install (as root), do "make -f makefile.pd-cygwin install"
+#
+
+## EDIT ZONE ##################################
+
+# flext path
+FLEXTPATH=../../flext
+
+# pd path
+PDPATH=c:/programme/audio/pd
+
+# where to install
+INSTDIR=c:/programme/audio/pd/extra
+
+###############################################
+
+FLEXTLIB=$(FLEXTPATH)/pd-cygwin/flext.lib
+
+# where to build (temporary)
+TARGDIR=../pd-cygwin
+
+# compiler stuff
+INCLUDES=$(PDPATH)/src
+LIBPATH=$(PDPATH)/bin
+FLAGS=-DPD
+CFLAGS=-O6 -mcpu=pentiumpro -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions
+LIBS=m pd
+
+# ----------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=xsample
+
+# all the source files from the package
+SRCS=main.cpp inter.cpp play.cpp record.cpp groove.cpp
+HDRS=main.h
+
+MAKEFILE=makefile.pd-cygwin
+TARGET=$(TARGDIR)/$(NAME).dll
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(SRCS): $(HDRS) $(MAKEFILE)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : %.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $(patsubst %,-L%,$(LIBPATH)) $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+$(INSTDIR):
+ mkdir $(INSTDIR)
+
+install:: $(INSTDIR)
+
+install:: $(TARGET)
+ cp $^ $(INSTDIR)
+ chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+
+.PHONY: clean
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/xsample/source/makefile.pd-linux b/externals/grill/xsample/source/makefile.pd-linux
new file mode 100644
index 00000000..863a0068
--- /dev/null
+++ b/externals/grill/xsample/source/makefile.pd-linux
@@ -0,0 +1,89 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for gcc @ linux
+#
+# usage:
+# to build run "make -f makefile.pd-linux"
+# to install (as root), do "make -f makefile.pd-linux install"
+#
+
+## EDIT ZONE ##################################
+
+# flext path
+FLEXTPATH=/usr/local/lib/pd/flext
+
+# pd path
+#PDPATH=/usr/local/lib/pd/include
+
+# where to install
+INSTDIR=/usr/local/lib/pd/extra
+
+###############################################
+
+FLEXTLIB=$(FLEXTPATH)/flext.a
+
+# where to build (temporary)
+TARGDIR=../pd-linux
+
+# compiler stuff
+CXX=g++-3.2
+INCLUDES=$(PDPATH)
+FLAGS=-DPD
+CFLAGS=-O6 -mcpu=pentiumpro -funroll-loops -fmove-all-movables -frerun-loop-opt -finline-functions
+LIBS=m
+
+# ----------------------------------------------
+# the rest can stay untouched
+# ----------------------------------------------
+
+NAME=xsample
+
+# all the source files from the package
+SRCS=main.cpp inter.cpp play.cpp record.cpp groove.cpp
+HDRS=main.h
+
+MAKEFILE=makefile.pd-linux
+TARGET=$(TARGDIR)/$(NAME).pd_linux
+
+# default target
+all: $(TARGDIR) $(TARGET)
+
+$(SRCS): $(HDRS) $(MAKEFILE)
+ touch $@
+
+$(TARGDIR):
+ mkdir $(TARGDIR)
+
+$(TARGDIR)/%.o : %.cpp
+ $(CXX) -c $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(FLEXTPATH)) $< -o $@
+
+$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) $(FLEXTLIB)
+ $(CXX) $(LDFLAGS) -shared $^ $(patsubst %,-l%,$(LIBS)) -o $@
+ strip --strip-unneeded $@
+ chmod 755 $@
+
+$(INSTDIR):
+ mkdir $(INSTDIR)
+
+install:: $(INSTDIR)
+
+install:: $(TARGET)
+ cp $^ $(INSTDIR)
+ chown root.root $(patsubst %,$(INSTDIR)/%,$(notdir $^))
+
+.PHONY: clean
+clean:
+ rm -f $(TARGDIR)/*.o $(TARGET)
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/externals/grill/xsample/source/play.cpp b/externals/grill/xsample/source/play.cpp
new file mode 100644
index 00000000..827d88de
--- /dev/null
+++ b/externals/grill/xsample/source/play.cpp
@@ -0,0 +1,160 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 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.
+
+*/
+
+#include "main.h"
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+
+class xplay:
+ public xinter
+{
+// FLEXT_HEADER_S(xplay,xinter,setup)
+ FLEXT_HEADER(xplay,xinter)
+
+public:
+ xplay(I argc, t_atom *argv);
+
+ virtual BL Init();
+
+#ifdef MAXMSP
+ virtual V m_assist(L msg,L arg,C *s);
+#endif
+
+ virtual V m_help();
+ virtual V m_print();
+
+private:
+// static V setup(t_class *c);
+
+ virtual V m_signal(I n,S *const *in,S *const *out)
+ {
+ bufchk();
+ playfun(n,in,out);
+ }
+};
+
+FLEXT_LIB_DSP_V("xplay~",xplay)
+
+/*
+V xplay::setup(t_class *)
+{
+#ifndef PD
+ post("loaded xplay~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
+#endif
+}
+*/
+
+xplay::xplay(I argc, t_atom *argv)
+{
+ I argi = 0;
+#ifdef MAXMSP
+ if(argc > argi && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ }
+#endif
+
+ if(argc > argi && IsSymbol(argv[argi])) {
+ buf = new buffer(GetSymbol(argv[argi]),true);
+ argi++;
+
+#ifdef MAXMSP
+ // oldstyle command line?
+ if(argi == 1 && argc == 2 && CanbeInt(argv[argi])) {
+ outchns = GetAInt(argv[argi]);
+ argi++;
+ post("%s: old style command line detected - please change to '%s [channels] [buffer]'",thisName(),thisName());
+ }
+#endif
+ }
+ else
+ buf = new buffer(NULL,true);
+
+ AddInSignal(); // pos signal
+ AddOutSignal(outchns);
+
+ m_reset();
+}
+
+BL xplay::Init()
+{
+ if(xinter::Init()) {
+ m_reset();
+ return true;
+ }
+ else
+ return false;
+}
+
+
+
+V xplay::m_help()
+{
+ post("%s - part of xsample objects, version " XSAMPLE_VERSION,thisName());
+#ifdef _DEBUG
+ post("compiled on " __DATE__ " " __TIME__);
+#endif
+ post("(C) Thomas Grill, 2001-2002");
+#ifdef MAXMSP
+ post("Arguments: %s [channels=1] [buffer]",thisName());
+#else
+ post("Arguments: %s [buffer]",thisName());
+#endif
+ post("Inlets: 1:Messages/Position signal");
+ post("Outlets: 1:Audio signal");
+ post("Methods:");
+ post("\thelp: shows this help");
+ post("\tset name: set buffer");
+ post("\tenable 0/1: turn dsp calculation off/on");
+ post("\tprint: print current settings");
+ post("\tbang/start: begin playing");
+ 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("");
+}
+
+V xplay::m_print()
+{
+ const C *interp_txt[] = {"off","4-point","linear"};
+ // print all current settings
+ post("%s - current settings:",thisName());
+ post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels());
+ post("out channels = %i, samples/unit = %.3f, interpolation = %s",outchns,(F)(1./s2u),interp_txt[interp >= xsi_none && interp <= xsi_lin?interp:xsi_none]);
+ post("");
+}
+
+
+#ifdef MAXMSP
+V xplay::m_assist(L msg,L arg,C *s)
+{
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ switch(arg) {
+ case 0:
+ sprintf(s,"Messages and Signal of playing position"); break;
+ }
+ break;
+ case 2: //ASSIST_OUTLET:
+ if(arg < outchns)
+ sprintf(s,"Audio signal channel %li",arg+1);
+ break;
+ }
+}
+#endif
+
+
+
+
diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp
new file mode 100644
index 00000000..cc3543a3
--- /dev/null
+++ b/externals/grill/xsample/source/record.cpp
@@ -0,0 +1,506 @@
+/*
+
+xsample - extended sample objects for Max/MSP and pd (pure data)
+
+Copyright (c) 2001,2002 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.
+
+*/
+
+#include "main.h"
+
+#ifdef _MSC_VER
+#pragma warning (disable:4244)
+#endif
+
+
+class xrecord:
+ public xsample
+{
+// FLEXT_HEADER_S(xrecord,xsample,setup)
+ FLEXT_HEADER(xrecord,xsample)
+
+public:
+ xrecord(I argc,t_atom *argv);
+
+ virtual BL Init();
+
+#ifdef MAXMSP
+ virtual V m_assist(L msg,L arg,C *s);
+#endif
+
+ virtual V m_help();
+ virtual V m_print();
+
+ virtual I m_set(I argc,t_atom *argv);
+
+ virtual V m_pos(F pos);
+ virtual V m_all();
+ virtual V m_start();
+ virtual V m_stop();
+
+ virtual BL m_reset();
+
+ virtual V m_units(xs_unit md = xsu__);
+ virtual V m_min(F mn);
+ virtual V m_max(F mx);
+
+ virtual V m_mixmode(BL mx) { mixmode = mx; }
+ virtual V m_sigmode(BL mode) { /*dorec =*/ sigmode = mode; }
+ virtual V m_loop(BL lp) { doloop = lp; }
+ virtual V m_append(BL app) { if(!(appmode = app)) m_pos(0); }
+
+ virtual V m_draw(I argc,t_atom *argv);
+
+protected:
+ I inchns;
+ BL sigmode,appmode;
+ F drintv;
+
+ BL dorec,doloop,mixmode;
+ L curpos; // in samples
+
+ outlet *outmin,*outmax; // float outlets
+
+ V outputmin() { ToOutFloat(outmin,curmin*s2u); }
+ V outputmax() { ToOutFloat(outmax,curmax*s2u); }
+
+private:
+// static V setup(t_class *c);
+
+ virtual V s_dsp();
+
+ TMPLSIGFUN(s_rec);
+
+ DEFSIGCALL(recfun);
+ virtual V m_signal(I n,S *const *in,S *const *out)
+ {
+ bufchk();
+ recfun(n,in,out);
+ }
+
+ FLEXT_CALLBACK_F(m_pos)
+ FLEXT_CALLBACK(m_all)
+ FLEXT_CALLBACK_F(m_min)
+ FLEXT_CALLBACK_F(m_max)
+
+ FLEXT_CALLBACK_B(m_loop)
+ FLEXT_CALLBACK_B(m_mixmode)
+ FLEXT_CALLBACK_B(m_sigmode)
+ FLEXT_CALLBACK_B(m_append)
+
+ FLEXT_CALLBACK_V(m_draw)
+};
+
+
+FLEXT_LIB_DSP_V("xrecord~",xrecord)
+
+/*
+V xrecord::setup(t_class *)
+{
+#ifndef PD
+ post("loaded xrecord~ - part of xsample objects, version " XSAMPLE_VERSION " - (C) Thomas Grill, 2001-2002");
+#endif
+}
+*/
+
+xrecord::xrecord(I argc,t_atom *argv):
+ dorec(false),
+ sigmode(false),mixmode(false),
+ appmode(true),doloop(false),
+ drintv(0),
+ inchns(1)
+{
+ I argi = 0;
+#ifdef MAXMSP
+ if(argc > argi && CanbeInt(argv[argi])) {
+ inchns = GetAInt(argv[argi]);
+ argi++;
+ }
+#endif
+
+ if(argc > argi && IsSymbol(argv[argi])) {
+ buf = new buffer(GetSymbol(argv[argi]),true);
+ argi++;
+
+#ifdef MAXMSP
+ // oldstyle command line?
+ if(argi == 1 && argc == 2 && CanbeInt(argv[argi])) {
+ inchns = GetAInt(argv[argi]);
+ argi++;
+ post("%s: old style command line detected - please change to '%s [channels] [buffer]'",thisName(),thisName());
+ }
+#endif
+ }
+ else
+ buf = new buffer(NULL,true);
+
+ AddInSignal(inchns); // audio signals
+ AddInSignal(); // on/off signal
+ AddInFloat(2); // min & max
+ AddOutSignal(); // pos signal
+ AddOutFloat(2); // min & max
+ AddOutBang(); // loop bang
+
+ FLEXT_ADDMETHOD_F(0,"pos",m_pos);
+ FLEXT_ADDMETHOD(inchns+1,m_min);
+ FLEXT_ADDMETHOD(inchns+2,m_max);
+ FLEXT_ADDMETHOD_F(0,"min",m_min);
+ FLEXT_ADDMETHOD_F(0,"max",m_max);
+ FLEXT_ADDMETHOD_(0,"all",m_all);
+
+ FLEXT_ADDMETHOD_B(0,"loop",m_loop);
+ FLEXT_ADDMETHOD_B(0,"mixmode",m_mixmode);
+ FLEXT_ADDMETHOD_B(0,"sigmode",m_sigmode);
+ FLEXT_ADDMETHOD_B(0,"append",m_append);
+
+ FLEXT_ADDMETHOD_(0,"draw",m_draw);
+}
+
+
+BL xrecord::Init()
+{
+ if(xsample::Init()) {
+ outmin = GetOut(1);
+ outmax = GetOut(2);
+
+ m_reset();
+ return true;
+ }
+ else
+ return false;
+}
+
+V xrecord::m_units(xs_unit mode)
+{
+ xsample::m_units(mode);
+
+ m_sclmode();
+ outputmin();
+ outputmax();
+}
+
+V xrecord::m_min(F mn)
+{
+ xsample::m_min(mn);
+ m_pos(curpos*s2u);
+ outputmin();
+}
+
+V xrecord::m_max(F mx)
+{
+ xsample::m_max(mx);
+ m_pos(curpos*s2u);
+ outputmax();
+}
+
+V xrecord::m_all()
+{
+ xsample::m_all();
+ outputmin();
+ outputmax();
+}
+
+V xrecord::m_pos(F pos)
+{
+ curpos = pos?(L)(pos/s2u+.5):0;
+
+ if(curpos < curmin) curpos = curmin;
+ else if(curpos > curmax) curpos = curmax;
+}
+
+
+I xrecord::m_set(I argc,t_atom *argv)
+{
+ I r = xsample::m_set(argc,argv);
+ if(r < 0) m_reset(); // resets pos/min/max
+ if(r != 0) m_units();
+ return r;
+}
+
+V xrecord::m_start()
+{
+ if(!sigmode && !appmode) m_pos(0);
+ m_refresh();
+ dorec = true;
+ buf->SetRefrIntv(drintv);
+ s_dsp();
+}
+
+V xrecord::m_stop()
+{
+ dorec = false;
+ buf->Dirty(true);
+ buf->SetRefrIntv(0);
+ s_dsp();
+}
+
+BL xrecord::m_reset()
+{
+ curpos = 0;
+ return xsample::m_reset();
+}
+
+V xrecord::m_draw(I argc,t_atom *argv)
+{
+ if(argc >= 1) {
+ drintv = GetInt(argv[0]);
+ if(dorec) buf->SetRefrIntv(drintv);
+ }
+ else
+ buf->Dirty(true);
+}
+
+
+TMPLDEF V xrecord::s_rec(I n,S *const *invecs,S *const *outvecs)
+{
+ SIGCHNS(BCHNS,buf->Channels(),ICHNS,inchns);
+
+ const S *const *sig = invecs;
+ register I si = 0;
+ const S *on = invecs[inchns];
+ S *pos = outvecs[0];
+
+ BL lpbang = false;
+ register const F pf = sclmul;
+ register L o = curpos;
+
+ if(o < curmin) o = curmin;
+
+// if(buf && dorec && curlen > 0) {
+ if(buf && dorec && curmax > curmin) {
+ while(n) {
+ L ncur = curmax-o; // at max to buffer or recording end
+
+ if(ncur <= 0) { // end of buffer
+ if(doloop) {
+ o = curmin;
+// ncur = curlen;
+ ncur = curmax-o;
+ }
+ else
+ m_stop(); // loop expired;
+
+ lpbang = true;
+ }
+
+ if(!dorec) break;
+
+ if(ncur > n) ncur = n;
+
+ register I i;
+ register S *bf = buf->Data()+o*BCHNS;
+ register F p = scale(o);
+
+ if(sigmode) {
+ if(appmode) {
+ // append to current position
+
+ if(!mixmode) {
+ for(i = 0; i < ncur; ++i,++si) {
+ if(*(on++) >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = sig[ci][si];
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else
+ *(pos++) = p;
+ }
+ }
+ else {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S g = *(on++);
+ if(g >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-g)+sig[ci][si]*g;
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else
+ *(pos++) = p;
+ }
+ }
+ }
+ else {
+ // don't append
+ if(!mixmode) {
+ for(i = 0; i < ncur; ++i,++si) {
+ if(*(on++) >= 0)
+ {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = sig[ci][si];
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else {
+ *(pos++) = p = scale(o = 0);
+ bf = buf->Data();
+ }
+ }
+ }
+ else {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S g = *(on++);
+ if(g >= 0) {
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-g)+sig[ci][si]*g;
+ bf += BCHNS;
+ *(pos++) = p,p += pf,++o;
+ }
+ else {
+ *(pos++) = p = scale(o = 0);
+ bf = buf->Data();
+ }
+ }
+ }
+ }
+ }
+ else {
+ // message mode
+
+ // Altivec optimization for that!
+ if(!mixmode) {
+ for(int ci = 0; ci < ICHNS; ++ci) {
+ register S *b = bf+ci;
+ register const F *s = sig[ci];
+ for(i = 0; i < ncur; ++i,b += BCHNS,++s) *b = *s;
+ }
+ si += ncur;
+ }
+ else {
+ for(i = 0; i < ncur; ++i,++si) {
+ register const S w = *(on++);
+ for(int ci = 0; ci < ICHNS; ++ci)
+ bf[ci] = bf[ci]*(1.-w)+sig[ci][si]*w;
+ bf += BCHNS;
+ }
+ }
+ for(i = 0; i < ncur; ++i) {
+ *(pos++) = p,p += pf,++o;
+ }
+ }
+
+ n -= ncur;
+ }
+ curpos = o;
+
+ buf->Dirty();
+ }
+
+ if(n) {
+ register F p = scale(o);
+ while(n--) *(pos++) = p;
+ }
+
+ if(lpbang) ToOutBang(3);
+}
+
+V xrecord::s_dsp()
+{
+ switch(buf->Channels()*1000+inchns) {
+ case 1001: SETSIGFUN(recfun,TMPLFUN(s_rec,1,1)); break;
+ case 1002: SETSIGFUN(recfun,TMPLFUN(s_rec,1,2)); break;
+ case 2001: SETSIGFUN(recfun,TMPLFUN(s_rec,2,1)); break;
+ case 2002: SETSIGFUN(recfun,TMPLFUN(s_rec,2,2)); break;
+ case 4001:
+ case 4002:
+ case 4003: SETSIGFUN(recfun,TMPLFUN(s_rec,4,-1)); break;
+ case 4004: SETSIGFUN(recfun,TMPLFUN(s_rec,4,4)); break;
+ default: SETSIGFUN(recfun,TMPLFUN(s_rec,-1,-1)); break;
+ }
+}
+
+
+
+
+V xrecord::m_help()
+{
+ post("%s - part of xsample objects, version " XSAMPLE_VERSION,thisName());
+#ifdef _DEBUG
+ post("compiled on " __DATE__ " " __TIME__);
+#endif
+ post("(C) Thomas Grill, 2001-2002");
+#ifdef MAXMSP
+ post("Arguments: %s [channels=1] [buffer]",thisName());
+#else
+ post("Arguments: %s [buffer]",thisName());
+#endif
+ post("Inlets: 1:Messages/Audio signal, 2:Trigger signal, 3:Min point, 4: Max point");
+ post("Outlets: 1:Position signal, 2:Min point, 3:Max point");
+ post("Methods:");
+ post("\thelp: shows this help");
+ post("\tset [name]: set buffer or reinit");
+ post("\tenable 0/1: turn dsp calculation off/on");
+ post("\treset: reset min/max recording points and recording offset");
+ post("\tprint: print current settings");
+ post("\tsigmode 0/1: specify message or signal triggered recording");
+ post("\tappend 0/1: reset recording position or append to current position");
+ post("\tloop 0/1: switches looping off/on");
+ post("\tmixmode 0/1: specify if audio signal should be mixed in");
+ post("\tmin {unit}: set minimum recording point");
+ post("\tmax {unit}: set maximum recording point");
+ post("\tall: select entire buffer length");
+ post("\tpos {unit}: set recording position (obeying the current scale mode)");
+ post("\tbang/start: start recording");
+ post("\tstop: stop recording");
+ post("\trefresh: checks buffer and refreshes outlets");
+ post("\tunits 0/1/2/3: set units to frames/buffer size/ms/s");
+ post("\tsclmode 0/1/2/3: set range of position to units/units in loop/buffer/loop");
+ post("\tdraw [{float}]: redraw buffer immediately (arg omitted) or periodic (in ms)");
+ post("");
+}
+
+V xrecord::m_print()
+{
+ static const C sclmode_txt[][20] = {"units","units in loop","buffer","loop"};
+
+ // print all current settings
+ post("%s - current settings:",thisName());
+ post("bufname = '%s', length = %.3f, channels = %i",buf->Name(),(F)(buf->Frames()*s2u),buf->Channels());
+ post("in channels = %i, frames/unit = %.3f, scale mode = %s",inchns,(F)(1./s2u),sclmode_txt[sclmode]);
+ post("sigmode = %s, append = %s, loop = %s, mixmode = %s",sigmode?"yes":"no",appmode?"yes":"no",doloop?"yes":"no",mixmode?"yes":"no");
+ post("");
+}
+
+
+#ifdef MAXMSP
+V xrecord::m_assist(L msg,L arg,C *s)
+{
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ if(arg < inchns) {
+ if(arg)
+ sprintf(s,"Messages and Audio channel 1");
+ else
+ sprintf(s,"Audio channel %li",arg+1);
+ }
+ else
+ switch(arg-inchns) {
+ case 0:
+ sprintf(s,"On/Off/Fade/Mix signal (0..1)"); break;
+ case 1:
+ sprintf(s,"Starting point of recording"); break;
+ case 2:
+ sprintf(s,"Ending point of recording"); break;
+ }
+ break;
+ case 2: //ASSIST_OUTLET:
+ switch(arg) {
+ case 0:
+ sprintf(s,"Current position of recording"); break;
+ case 1:
+ sprintf(s,"Starting point (rounded to frame)"); break;
+ case 2:
+ sprintf(s,"Ending point (rounded to frame)"); break;
+ case 3:
+ sprintf(s,"Bang on loop end/rollover"); break;
+ }
+ break;
+ }
+}
+#endif
+
+
+
diff --git a/externals/grill/xsample/source/xsample.cw b/externals/grill/xsample/source/xsample.cw
new file mode 100644
index 00000000..c9e91616
--- /dev/null
+++ b/externals/grill/xsample/source/xsample.cw
Binary files differ
diff --git a/externals/grill/xsample/source/xsample.dsp b/externals/grill/xsample/source/xsample.dsp
new file mode 100644
index 00000000..6c97b49e
--- /dev/null
+++ b/externals/grill/xsample/source/xsample.dsp
@@ -0,0 +1,127 @@
+# Microsoft Developer Studio Project File - Name="xsample" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xsample - Win32 Debug
+!MESSAGE Dies ist kein gόltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und fόhren Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "xsample.mak".
+!MESSAGE
+!MESSAGE Sie kφnnen beim Ausfόhren von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "xsample.mak" CFG="xsample - Win32 Debug"
+!MESSAGE
+!MESSAGE Fόr die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "xsample - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xsample - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName "xsample"
+# PROP Scc_LocalPath ".."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xsample - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\msvc"
+# PROP Intermediate_Dir "..\msvc"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSAMPLE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /G6 /W3 /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "NDEBUG"
+# ADD RSC /l 0xc07 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /libpath:"c:\programme\audio\pd\bin" /libpath:"..\..\flext\pd-msvc\\"
+
+!ELSEIF "$(CFG)" == "xsample - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\msvc-debug"
+# PROP Intermediate_Dir "..\msvc-debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XSAMPLE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /W3 /Gm /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NT" /D "PD" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0xc07 /d "_DEBUG"
+# ADD RSC /l 0xc07 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"c:\programme\audio\pd\bin\\" /libpath:"..\..\flext\pd-msvc\\"
+
+!ENDIF
+
+# Begin Target
+
+# Name "xsample - Win32 Release"
+# Name "xsample - Win32 Debug"
+# Begin Group "doc"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\readme.txt
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\groove.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\inter.ci
+# End Source File
+# Begin Source File
+
+SOURCE=.\inter.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\play.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\record.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/externals/grill/xsample/source/xsample.mpw b/externals/grill/xsample/source/xsample.mpw
new file mode 100644
index 00000000..9e6b625e
--- /dev/null
+++ b/externals/grill/xsample/source/xsample.mpw
@@ -0,0 +1,129 @@
+# xsample - extended sample objects for Max/MSP and pd (pure data)
+# Copyright (c) 2001,2002 Thomas Grill (xovo@gmx.net)
+#
+# Makefile for Apple MPW-PR
+#
+# usage: make -f xsample.mpw
+#
+# ---------------------------------------------
+
+MAKEFILE = xsample.mpw
+€MondoBuild€ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified
+
+ObjDir = ::MPW:
+MaxSDK = HD Daten:Prog Stuff:Max/MSP SDK:SDK Examples
+flext = :::flext:
+Includes = -i :,"{flext}","{MaxSDK}:Max Includes","{MaxSDK}:MSP Includes"
+Defines = -d MAXMSP
+
+Sym-PPC = -sym off
+Flags = -bool on -enum int -includes unix -opt speed,unroll,unswitch
+WarnOff = -w 35
+
+PPCCPlusOptions = {Includes} {Sym-PPC} {Defines} {Flags} {WarnOff}
+
+
+### Source Files ###
+
+SrcFiles = main.cpp inter.cpp groove.cpp play.cpp record.cpp
+Headers = main.h
+
+### Object Files ###
+
+Obj-groove = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}groove.cpp.x"
+
+Obj-play = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}play.cpp.x"
+
+Obj-record = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}record.cpp.x"
+
+Obj = 
+ "{ObjDir}main.cpp.x" 
+ "{ObjDir}record.cpp.x" 
+ "{ObjDir}play.cpp.x" 
+ "{ObjDir}inter.cpp.x" 
+ "{ObjDir}groove.cpp.x"
+
+
+### Libraries ###
+
+LibFiles-Ext = 
+ "{flext}MPW:flext.o" 
+ "{MaxSDK}:Max Includes:MaxLib" 
+ "{MaxSDK}:MSP Includes:MaxAudioLib"
+
+LibFiles-PPC = 
+ "{SharedLibraries}StdCLib" 
+ "{SharedLibraries}MathLib" 
+ "{PPCLibraries}StdCRuntime.o" 
+ "{PPCLibraries}PPCCRuntime.o" 
+ "{PPCLibraries}MrCPlusLib.o" 
+
+
+### Default Rules ###
+
+{ObjDir} Ÿ :
+
+.cpp.x Ÿ .cpp {€MondoBuild€} {Headers}
+ {PPCCPlus} {depDir}{default}.cpp -o {targDir}{default}.cpp.x {PPCCPlusOptions}
+
+
+### Build Rules ###
+
+all Ÿ Folder {ObjDir}xsample
+single Ÿ Folder {ObjDir}xgroove~ {ObjDir}xplay~ {ObjDir}xrecord~
+
+Folder Ÿ
+ if !`Exists {ObjDir}` ; NewFolder {ObjDir} ; end
+
+{ObjDir}xgroove~ ŸŸ {Obj-groove} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main
+
+{ObjDir}xplay~ ŸŸ {Obj-play} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main
+
+{ObjDir}xrecord~ ŸŸ {Obj-record} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main
+
+{ObjDir}xsample ŸŸ {Obj} {LibFiles-Ext}
+ PPCLink 
+ -o {Targ} 
+ {deps} 
+ {LibFiles-PPC} 
+ {Sym-PPC} 
+ -mf -d 
+ -t 'iLaF' -c 'max2' 
+ -xm s 
+ -export main -main main