From 0f576ee67600ceb2a435fb26b036551ffde8bb74 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sat, 19 Nov 2005 23:15:44 +0000 Subject: *** empty log message *** svn path=/trunk/; revision=3981 --- externals/grill/flext/source/flclass.h | 4 +- externals/grill/flext/source/flout.cpp | 3 +- externals/grill/flext/source/flstdc.h | 2 +- externals/grill/flext/source/flxlet.cpp | 2 + externals/grill/xsample/.DS_Store | Bin 0 -> 6148 bytes externals/grill/xsample/readme.txt | 2 +- externals/grill/xsample/source/groove.cpp | 88 +++++++++++++++++++----------- externals/grill/xsample/source/main.cpp | 20 ++++--- externals/grill/xsample/source/main.h | 12 +++- 9 files changed, 89 insertions(+), 44 deletions(-) create mode 100644 externals/grill/xsample/.DS_Store (limited to 'externals') diff --git a/externals/grill/flext/source/flclass.h b/externals/grill/flext/source/flclass.h index d01fbfc8..1e18cd93 100644 --- a/externals/grill/flext/source/flclass.h +++ b/externals/grill/flext/source/flclass.h @@ -810,8 +810,8 @@ private: //! \brief This represents either an inlet or outlet during construction class FLEXT_SHARE xlet { public: - xlet(): tp(xlet_none),desc(NULL) {} - ~xlet() { if(desc) delete[] desc; } + xlet(); + ~xlet(); xlettype tp; char *desc; diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp index d09b4e55..d4066568 100644 --- a/externals/grill/flext/source/flout.cpp +++ b/externals/grill/flext/source/flout.cpp @@ -101,7 +101,8 @@ bool flext_base::InitInlets() #if PD_MINOR_VERSION >= 37 && defined(PD_DEVEL_VERSION) // set tooltip - if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc)); +// this is on a per-class basis... we cannot really use it here +// if(xi.desc && *xi.desc) class_settip(thisClass(),gensym(xi.desc)); #endif } diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h index 17d28e26..3d699ce1 100644 --- a/externals/grill/flext/source/flstdc.h +++ b/externals/grill/flext/source/flstdc.h @@ -45,7 +45,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define NT #endif -extern "C" { +extern "C" { // Include the relevant PD header files #ifdef FLEXT_DEBUG /* PD header file structure has changed with version 0.37 diff --git a/externals/grill/flext/source/flxlet.cpp b/externals/grill/flext/source/flxlet.cpp index f8f26b3b..6aeea303 100755 --- a/externals/grill/flext/source/flxlet.cpp +++ b/externals/grill/flext/source/flxlet.cpp @@ -21,6 +21,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. flext_base::xlet flext_base::inlist[MAXLETS],flext_base::outlist[MAXLETS]; +flext_base::xlet::xlet(): tp(xlet_none),desc(NULL) {} +flext_base::xlet::~xlet() { if(desc) delete[] desc; } void flext_base::xlet::Desc(const char *c) { diff --git a/externals/grill/xsample/.DS_Store b/externals/grill/xsample/.DS_Store new file mode 100644 index 00000000..55eaa8bc Binary files /dev/null and b/externals/grill/xsample/.DS_Store differ diff --git a/externals/grill/xsample/readme.txt b/externals/grill/xsample/readme.txt index 9383a120..a4553457 100644 --- a/externals/grill/xsample/readme.txt +++ b/externals/grill/xsample/readme.txt @@ -16,7 +16,7 @@ Visit https://www.paypal.com/xclick/business=gr%40grrrr.org&item_name=xsample&no IMPORTANT INFORMATION for all Max/MSP users: 1) -For Mac OSX it is best to put the max-osx/xsample.mxd file into the folder +For Mac OSX it is best to put the max-darwin/xsample.mxd file into the folder /Library/Application Support/Cycling '74/externals and the file maxmsp/xsample-objectmappings.txt into the folder /Library/Application Support/Cycling '74/init . diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp index d76e3776..2a7cbeec 100644 --- a/externals/grill/xsample/source/groove.cpp +++ b/externals/grill/xsample/source/groove.cpp @@ -341,22 +341,44 @@ void xgroove::s_pos_loop(int n,t_sample *const *invecs,t_sample *const *outvecs) if(plen > 0) { 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! + 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; + } - // 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; + } + } - pos[i] = o; - o += spd; - } // normalize and store current playing position setpos(o); @@ -667,13 +689,15 @@ bool xgroove::do_xzone() long lack = CASTINT(ceil((xzone*2.f-(znsmax-znsmin))/2.f)); 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; + 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) { // try to keep loop length @@ -689,16 +713,18 @@ bool xgroove::do_xzone() znsmin = curmin-hzone; 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; - } + 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) { // try to keep loop position and length diff --git a/externals/grill/xsample/source/main.cpp b/externals/grill/xsample/source/main.cpp index df0c1456..c62df461 100644 --- a/externals/grill/xsample/source/main.cpp +++ b/externals/grill/xsample/source/main.cpp @@ -49,7 +49,7 @@ void xsample::setup(t_classid c) } xsample::xsample(): - update(xsc_all), + update(xsc_all),wrap(false), #if FLEXT_SYS == FLEXT_SYS_MAX unitmode(xsu_ms), // Max/MSP defaults to milliseconds #else @@ -168,12 +168,18 @@ void xsample::DoUpdate(unsigned int flags) 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; + + 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; } if(flags&xsc_units) { diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h index 6fb1bd2c..9d9f94b8 100644 --- a/externals/grill/xsample/source/main.h +++ b/externals/grill/xsample/source/main.h @@ -15,7 +15,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. #error You need at least flext version 0.5.0 #endif -#define XSAMPLE_VERSION "0.3.1" +#define XSAMPLE_VERSION "0.3.2pre" extern "C++" { @@ -191,6 +191,12 @@ protected: Refresh(); } + void m_wrap(bool w) + { + wrap = w; + Update(xsc_pos|xsc_range,true); + } + void m_min(float mn); void m_max(float mx); @@ -201,6 +207,7 @@ protected: long sclmin; // in samples float sclmul; float s2u; // sample to unit conversion factor + bool wrap; inline float scale(float smp) const { return (smp-sclmin)*sclmul; } @@ -266,6 +273,9 @@ private: FLEXT_ATTRGET_F(s2u) + FLEXT_CALLSET_B(m_wrap) + FLEXT_ATTRGET_B(wrap) + protected: FLEXT_CALLGET_F(mg_min) FLEXT_CALLGET_F(mg_max) -- cgit v1.2.1