Update of /cvsroot/pure-data/externals/grill/xsample/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25406/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.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** groove.cpp 22 Oct 2005 23:55:21 -0000 1.35 --- groove.cpp 19 Nov 2005 23:15:44 -0000 1.36 *************** *** 342,361 **** register double o = curpos;
! for(int i = 0; i < n; ++i) { ! const t_sample spd = speed[i]; // must be first because the vector is reused for output!
! // normalize offset ! if(!(o < smax)) { // faster than o >= smax ! o = fmod(o-smin,plen)+smin; ! lpbang = true; ! } ! else if(o < smin) { ! o = fmod(o-smin,plen)+smax; ! lpbang = true; ! }
- pos[i] = o; - o += spd; - } // normalize and store current playing position setpos(o); --- 342,383 ---- register double o = curpos;
! if(wrap && smin < 0 && smax >= buf.Frames()) { ! for(int i = 0; i < n; ++i) { ! const t_sample spd = speed[i]; // must be first because the vector is reused for output!
! // normalize offset ! if(!(o < smax)) { // faster than o >= smax ! o = fmod(o-smin,plen)+smin; ! lpbang = true; ! } ! else if(o < smin) { ! o = fmod(o-smin,plen)+smax; ! lpbang = true; ! } ! ! // TODO normalize to 0...buf.Frames() ! pos[i] = o; ! o += spd; ! } ! } ! else { ! for(int i = 0; i < n; ++i) { ! const t_sample spd = speed[i]; // must be first because the vector is reused for output! ! ! // normalize offset ! if(!(o < smax)) { // faster than o >= smax ! o = fmod(o-smin,plen)+smin; ! lpbang = true; ! } ! else if(o < smin) { ! o = fmod(o-smin,plen)+smax; ! lpbang = true; ! } ! ! pos[i] = o; ! o += spd; ! } ! }
// normalize and store current playing position setpos(o); *************** *** 668,678 **** if(lack > 0) znsmin -= lack,znsmax += lack;
! // check buffer limits and shift bounds if necessary ! if(znsmin < 0) { ! znsmax -= znsmin; ! znsmin = 0; ! } ! if(znsmax > frames) ! znsmax = frames; } else if(xfade == xsf_keeplooplen) { --- 690,702 ---- if(lack > 0) znsmin -= lack,znsmax += lack;
! if(!wrap) { ! // check buffer limits and shift bounds if necessary ! if(znsmin < 0) { ! znsmax -= znsmin; ! znsmin = 0; ! } ! if(znsmax > frames) ! znsmax = frames; ! } } else if(xfade == xsf_keeplooplen) { *************** *** 690,703 **** znsmax = curmax+hzone;
! // check buffer limits and shift bounds if necessary ! // both cases can't happen because of xzone having been limited above ! if(znsmin < 0) { ! znsmax -= znsmin; ! znsmin = 0; ! } ! else if(znsmax > frames) { ! znsmin -= znsmax-frames; ! znsmax = frames; ! } } else if(xfade == xsf_keeplooppos) { --- 714,729 ---- znsmax = curmax+hzone;
! if(!wrap) { ! // check buffer limits and shift bounds if necessary ! // both cases can't happen because of xzone having been limited above ! if(znsmin < 0) { ! znsmax -= znsmin; ! znsmin = 0; ! } ! else if(znsmax > frames) { ! znsmin -= znsmax-frames; ! znsmax = frames; ! } ! } } else if(xfade == xsf_keeplooppos) {
Index: main.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/xsample/source/main.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** main.cpp 11 Oct 2005 10:09:47 -0000 1.22 --- main.cpp 19 Nov 2005 23:15:44 -0000 1.23 *************** *** 50,54 ****
xsample::xsample(): ! update(xsc_all), #if FLEXT_SYS == FLEXT_SYS_MAX unitmode(xsu_ms), // Max/MSP defaults to milliseconds --- 50,54 ----
xsample::xsample(): ! update(xsc_all),wrap(false), #if FLEXT_SYS == FLEXT_SYS_MAX unitmode(xsu_ms), // Max/MSP defaults to milliseconds *************** *** 169,178 **** if(flags&xsc_range && buf.Ok()) { const int f = buf.Frames(); ! ! if(curmin < 0) curmin = 0; ! else if(curmin > f) curmin = f; ! ! if(curmax > f) curmax = f; ! else if(curmax < curmin) curmax = curmin; }
--- 169,184 ---- if(flags&xsc_range && buf.Ok()) { const int f = buf.Frames(); ! ! if(!wrap) { ! // normalize bounds ! if(curmin < 0) curmin = 0; ! else if(curmin > f) curmin = f; ! ! if(curmax > f) curmax = f; ! else if(curmax < curmin) curmax = curmin; ! } ! else ! // don't normalize ! if(curmax < curmin) curmax = curmin; }
Index: main.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/xsample/source/main.h,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** main.h 22 Oct 2005 23:55:21 -0000 1.40 --- main.h 19 Nov 2005 23:15:44 -0000 1.41 *************** *** 16,20 **** #endif
! #define XSAMPLE_VERSION "0.3.1"
extern "C++" { --- 16,20 ---- #endif
! #define XSAMPLE_VERSION "0.3.2pre"
extern "C++" { *************** *** 192,195 **** --- 192,201 ---- }
+ void m_wrap(bool w) + { + wrap = w; + Update(xsc_pos|xsc_range,true); + } + void m_min(float mn); void m_max(float mx); *************** *** 202,205 **** --- 208,212 ---- float sclmul; float s2u; // sample to unit conversion factor + bool wrap;
inline float scale(float smp) const { return (smp-sclmin)*sclmul; } *************** *** 267,270 **** --- 274,280 ---- FLEXT_ATTRGET_F(s2u)
+ FLEXT_CALLSET_B(m_wrap) + FLEXT_ATTRGET_B(wrap) + protected: FLEXT_CALLGET_F(mg_min)