Update of /cvsroot/pure-data/externals/grill/xsample/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25925/source
Modified Files: groove.cpp main.cpp main.h Log Message: ""
Index: groove.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/xsample/source/groove.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** groove.cpp 8 Apr 2004 04:01:44 -0000 1.26 --- groove.cpp 21 Jun 2004 14:02:12 -0000 1.27 *************** *** 18,22 ****
! #define XZONE_TABLE 64
--- 18,22 ----
! #define XZONE_TABLE 512
*************** *** 301,305 **** V xgroove::m_pos(F pos) { ! setpos(pos?pos/s2u:0); }
--- 301,305 ---- V xgroove::m_pos(F pos) { ! setpos(pos && s2u?pos/s2u:0); }
*************** *** 330,334 **** { bufchk(); ! _xzone = xz < 0?0:xz/s2u; // do_xzone(); s_dsp(); --- 330,334 ---- { bufchk(); ! _xzone = xz < 0 || !s2u?0:xz/s2u; // do_xzone(); s_dsp(); *************** *** 643,646 **** --- 643,651 ---- const L smin = znsmin,smax = znsmax,plen = smax-smin;
+ // temporary storage + const L cmin = curmin,cmax = curmax; + // hack -> set curmin/curmax to loop extremes so that sampling functions (playfun) don't get confused + curmin = smin,curmax = smax; + if(buf && plen > 0) { BL inzn = false; *************** *** 662,676 **** }
if(o < lmin) { register F inp; if(o < lmin2) { o += lsh; - lpbang = true; // now lmax <= o <= lmax2
inp = xz-(F)(o-lmax); // 0 <= inp < xz znpos[i] = lmin-inp; } ! else { // in early cross-fade zone inp = xz+(F)(o-lmin); // 0 <= inp < xz znpos[i] = lmax+inp; --- 667,688 ---- }
+ #if 1 if(o < lmin) { register F inp; if(o < lmin2) { + // in first half of early cross-fade zone + // this happens only once, then the offset is normalized to the end + // of the loop (before mid of late crossfade) + o += lsh; // now lmax <= o <= lmax2 + lpbang = true;
inp = xz-(F)(o-lmax); // 0 <= inp < xz znpos[i] = lmin-inp; } ! else { ! // in second half of early cross-fade zone ! inp = xz+(F)(o-lmin); // 0 <= inp < xz znpos[i] = lmax+inp; *************** *** 682,693 **** register F inp; if(!(o < lmax2)) { o -= lsh; - lpbang = true; // now lmin2 <= o <= lmin
inp = xz+(F)(o-lmin); // 0 <= inp < xz znpos[i] = lmax+inp; } ! else { // in late cross-fade zone inp = xz-(F)(o-lmax); // 0 <= inp < xz znpos[i] = lmin-inp; --- 694,709 ---- register F inp; if(!(o < lmax2)) { + // in second half of late cross-fade zone + // this happens only once, then the offset is normalized to the beginning + // of the loop (after mid of early crossfade) o -= lsh; // now lmin2 <= o <= lmin + lpbang = true;
inp = xz+(F)(o-lmin); // 0 <= inp < xz znpos[i] = lmax+inp; } ! else { ! // in first half of late cross-fade zone inp = xz-(F)(o-lmax); // 0 <= inp < xz znpos[i] = lmin-inp; *************** *** 702,705 **** --- 718,742 ---- pos[i] = o; o += spd; + #else + if(o >= lmax) { + o -= lsh; + lpbang = true; + } + + if(o < lmin) { + register F inp = (F)(o-smin); // 0 <= inp < xz + znpos[i] = lmax+inp; + znidx[i] = inp*xf; + inzn = true; + } + else { + znpos[i] = 0; + znidx[i] = XZONE_TABLE; + } + + const S spd = speed[i]; // must be first because the vector is reused for output! + pos[i] = o; + o += spd; + #endif }
*************** *** 737,740 **** --- 774,779 ---- s_pos_off(n,invecs,outvecs); + curmin = cmin,curmax = cmax; + if(lpbang) ToOutBang(outchns+3); } *************** *** 788,797 **** { if(doplay) { switch(loopmode) { ! case xsl_once: SETSIGFUN(posfun,SIGFUN(s_pos_once)); break; case xsl_loop: - // xzone might not be set yet (is done in do_xzone() ) - do_xzone(); // recalculate (s2u may have been 0 before) - if(xzone > 0) { const I blksz = Blocksize(); --- 827,838 ---- { if(doplay) { + // xzone might not be set yet (is done in do_xzone() ) + do_xzone(); // recalculate (s2u may have been 0 before) + switch(loopmode) { ! case xsl_once: ! SETSIGFUN(posfun,SIGFUN(s_pos_once)); ! break; case xsl_loop: if(xzone > 0) { const I blksz = Blocksize(); *************** *** 824,828 **** SETSIGFUN(posfun,SIGFUN(s_pos_loop)); break; ! case xsl_bidir: SETSIGFUN(posfun,SIGFUN(s_pos_bidir)); break; } } --- 865,871 ---- SETSIGFUN(posfun,SIGFUN(s_pos_loop)); break; ! case xsl_bidir: ! SETSIGFUN(posfun,SIGFUN(s_pos_bidir)); ! break; } }
Index: main.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/xsample/source/main.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** main.cpp 24 Apr 2004 13:59:42 -0000 1.17 --- main.cpp 21 Jun 2004 14:02:12 -0000 1.18 *************** *** 61,65 **** #endif sclmode(xss_unitsinbuf), ! curmin(0),curmax(1<<30) {} --- 61,65 ---- #endif sclmode(xss_unitsinbuf), ! curmin(0),curmax(1<<31) {} *************** *** 99,102 **** --- 99,104 ---- else ret = false; + m_units(); + m_sclmode(); // realize positions... 2 times bufchk()!! m_min((F)curmin*s2u); // also checks pos *************** *** 130,150 **** if(mode != xsu__) unitmode = mode;
! if(bufchk()) ! 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()); ! } }
--- 132,151 ---- if(mode != xsu__) unitmode = mode;
! switch(unitmode) { ! case xsu_sample: // samples ! s2u = 1; ! break; ! case xsu_buffer: // buffer size ! s2u = bufchk()?1.f/buf->Frames():0; ! 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()); ! } }
*************** *** 153,197 **** if(mode != xss__) sclmode = mode;
! if(bufchk()) ! 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 = curmin != curmax?1.f/(curmax-curmin):0; ! break; ! default: ! post("%s: Unknown scale mode",thisName()); ! } }
V xsample::m_min(F mn) { ! if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
! mn /= s2u; // conversion to samples ! if(mn < 0) mn = 0; ! else if(mn > curmax) mn = (F)curmax; ! curmin = (I)(mn+.5);
! m_sclmode(); }
V xsample::m_max(F mx) { ! if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
! mx /= s2u; // conversion to samples ! if(mx > buf->Frames()) mx = (F)buf->Frames(); ! else if(mx < curmin) mx = (F)curmin; ! curmax = (I)(mx+.5);
! m_sclmode(); }
--- 154,201 ---- 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 = (bufchk() && buf->Frames())?1.f/buf->Frames():0; ! break; ! case 3: // unity between recmin and recmax ! sclmin = curmin; sclmul = curmin != curmax?1.f/(curmax-curmin):0; ! break; ! default: ! post("%s: Unknown scale mode",thisName()); ! } }
V xsample::m_min(F mn) { ! // if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
! if(s2u) { ! mn /= s2u; // conversion to samples ! if(mn < 0) mn = 0; ! else if(mn > curmax) mn = (F)curmax; ! curmin = (I)(mn+.5);
! m_sclmode(); ! } }
V xsample::m_max(F mx) { ! // if(!bufchk()) return; // if invalid do nothing (actually, it should be delayed)
! if(s2u) { ! mx /= s2u; // conversion to samples ! if(mx > buf->Frames()) mx = (F)buf->Frames(); ! else if(mx < curmin) mx = (F)curmin; ! curmax = (I)(mx+.5);
! m_sclmode(); ! } }
Index: main.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/xsample/source/main.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** main.h 24 Apr 2004 13:59:42 -0000 1.30 --- main.h 21 Jun 2004 14:02:12 -0000 1.31 *************** *** 13,17 ****
! #define XSAMPLE_VERSION "0.3.0"
--- 13,17 ----
! #define XSAMPLE_VERSION "0.3.1pre3"