diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-10 04:37:50 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2003-01-10 04:37:50 +0000 |
commit | e2d190402557ed3e57679fdbfdcb8643bda84d42 (patch) | |
tree | 05b80ec21df6065da22289bf90a53cca2cf977fc /externals/grill/xsample | |
parent | feeb907835c33ec49308a32449dc0b6d07285e2a (diff) |
""
svn path=/trunk/; revision=334
Diffstat (limited to 'externals/grill/xsample')
-rw-r--r-- | externals/grill/xsample/license.txt | 33 | ||||
-rw-r--r-- | externals/grill/xsample/maxmsp/xgroove~.help | bin | 8270 -> 7207 bytes | |||
-rw-r--r-- | externals/grill/xsample/maxmsp/xplay~.help | bin | 6092 -> 4649 bytes | |||
-rw-r--r-- | externals/grill/xsample/maxmsp/xrecord~.help | bin | 9523 -> 8210 bytes | |||
-rwxr-xr-x | externals/grill/xsample/maxmsp/xsample.help | bin | 1072 -> 1147 bytes | |||
-rw-r--r-- | externals/grill/xsample/source/groove.cpp | 65 | ||||
-rw-r--r-- | externals/grill/xsample/source/inter.cpp | 5 | ||||
-rw-r--r-- | externals/grill/xsample/source/main.h | 21 | ||||
-rw-r--r-- | externals/grill/xsample/source/play.cpp | 4 | ||||
-rw-r--r-- | externals/grill/xsample/source/record.cpp | 27 | ||||
-rwxr-xr-x | externals/grill/xsample/xsample.cw | bin | 106655 -> 106655 bytes |
11 files changed, 76 insertions, 79 deletions
diff --git a/externals/grill/xsample/license.txt b/externals/grill/xsample/license.txt index 01baf51a..d59706ef 100644 --- a/externals/grill/xsample/license.txt +++ b/externals/grill/xsample/license.txt @@ -49,36 +49,3 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In the official flext distribution, the GNU General Public License is in the file gpl.txt - ---- pd (pure data) -------------------------------------- -This software is copyrighted by Miller Puckette and others. The following -terms apply to all files associated with the software unless explicitly -disclaimed in individual files. - -The authors hereby grant permission to use, copy, modify, distribute, -and license this software and its documentation for any purpose, provided -that existing copyright notices are retained in all copies and that this -notice is included verbatim in any distributions. No written agreement, -license, or royalty fee is required for any of the authorized uses. -Modifications to this software may be copyrighted by their authors -and need not follow the licensing terms described here, provided that -the new terms are clearly indicated on the first page of each file where -they apply. - -IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY -FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY -DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE -IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE -NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR -MODIFICATIONS. - -RESTRICTED RIGHTS: Use, duplication or disclosure by the government -is subject to the restrictions as set forth in subparagraph (c) (1) (ii) -of the Rights in Technical Data and Computer Software Clause as DFARS -252.227-7013 and FAR 52.227-19. diff --git a/externals/grill/xsample/maxmsp/xgroove~.help b/externals/grill/xsample/maxmsp/xgroove~.help Binary files differindex da4820ba..ee8a244e 100644 --- a/externals/grill/xsample/maxmsp/xgroove~.help +++ b/externals/grill/xsample/maxmsp/xgroove~.help diff --git a/externals/grill/xsample/maxmsp/xplay~.help b/externals/grill/xsample/maxmsp/xplay~.help Binary files differindex 5f15beca..5a210f74 100644 --- a/externals/grill/xsample/maxmsp/xplay~.help +++ b/externals/grill/xsample/maxmsp/xplay~.help diff --git a/externals/grill/xsample/maxmsp/xrecord~.help b/externals/grill/xsample/maxmsp/xrecord~.help Binary files differindex d0e6da5c..b4a55d78 100644 --- a/externals/grill/xsample/maxmsp/xrecord~.help +++ b/externals/grill/xsample/maxmsp/xrecord~.help diff --git a/externals/grill/xsample/maxmsp/xsample.help b/externals/grill/xsample/maxmsp/xsample.help Binary files differindex 1c2ceb22..6af68c77 100755 --- a/externals/grill/xsample/maxmsp/xsample.help +++ b/externals/grill/xsample/maxmsp/xsample.help diff --git a/externals/grill/xsample/source/groove.cpp b/externals/grill/xsample/source/groove.cpp index b3779a04..241146c6 100644 --- a/externals/grill/xsample/source/groove.cpp +++ b/externals/grill/xsample/source/groove.cpp @@ -46,6 +46,8 @@ public: V m_xzone(F xz); V m_xsymm(F xz); V m_xshape(I argc = 0,const t_atom *argv = NULL); + inline V ms_xshape(const AtomList &ret) { m_xshape(ret.Count(),ret.Atoms()); } + V mg_xshape(AtomList &ret) const; V m_xkeep(BL k); enum xs_loop { @@ -62,6 +64,8 @@ protected: I bidir; F _xzone,xzone,xsymm; + I xshape; + F xshparam; F znmin,znmax; I xkeep; S **znbuf; @@ -70,8 +74,8 @@ protected: outlet *outmin,*outmax; // float outlets - V outputmin() { ToOutFloat(outmin,curmin*s2u); } - V outputmax() { ToOutFloat(outmax,curmax*s2u); } + inline V outputmin() { ToOutFloat(outmin,curmin*s2u); } + inline V outputmax() { ToOutFloat(outmax,curmax*s2u); } inline V setpos(F pos) { @@ -80,7 +84,7 @@ protected: curpos = pos; } - V mg_pos(F &v) const { v = curpos*s2u; } + inline V mg_pos(F &v) const { v = curpos*s2u; } private: static V setup(t_classid c); @@ -110,10 +114,13 @@ private: FLEXT_CALLBACK_F(m_max) FLEXT_CALLBACK(m_all) - FLEXT_CALLBACK_F(m_xzone) - FLEXT_CALLBACK_F(m_xsymm) - FLEXT_CALLBACK_V(m_xshape) - FLEXT_CALLBACK_B(m_xkeep) + FLEXT_CALLSET_F(m_xzone) + FLEXT_ATTRGET_F(_xzone) + FLEXT_CALLSET_F(m_xsymm) + FLEXT_ATTRGET_F(xsymm) + FLEXT_CALLVAR_V(mg_xshape,ms_xshape) + FLEXT_CALLSET_B(m_xkeep) + FLEXT_ATTRGET_B(xkeep) FLEXT_CALLVAR_F(mg_pos,m_pos) FLEXT_CALLSET_F(m_min) @@ -128,7 +135,7 @@ FLEXT_LIB_DSP_V("xgroove~",xgroove) V xgroove::setup(t_classid c) { -// DefineHelp(c,"xgroove~"); + DefineHelp(c,"xgroove~"); FLEXT_CADDMETHOD_(c,0,"all",m_all); FLEXT_CADDMETHOD(c,1,m_min); @@ -140,15 +147,16 @@ V xgroove::setup(t_classid c) FLEXT_CADDATTR_VAR_E(c,"loop",loopmode,m_loop); - FLEXT_CADDMETHOD_F(c,0,"xzone",m_xzone); - FLEXT_CADDMETHOD_F(c,0,"xsymm",m_xsymm); - FLEXT_CADDMETHOD_(c,0,"xshape",m_xshape); - FLEXT_CADDMETHOD_B(c,0,"xkeep",m_xkeep); + FLEXT_CADDATTR_VAR(c,"xzone",_xzone,m_xzone); + FLEXT_CADDATTR_VAR(c,"xsymm",xsymm,m_xsymm); + FLEXT_CADDATTR_VAR(c,"xshape",mg_xshape,ms_xshape); + FLEXT_CADDATTR_VAR(c,"xkeep",xkeep,m_xkeep); } xgroove::xgroove(I argc,const t_atom *argv): loopmode(xsl_loop),curpos(0), _xzone(0),xzone(0),xsymm(0.5),xkeep(0),pblksz(0), + xshape(0),xshparam(1), znbuf(NULL),znmul(NULL),znidx(NULL),znpos(NULL), bidir(1) { @@ -181,7 +189,7 @@ xgroove::xgroove(I argc,const t_atom *argv): AddInFloat("Ending point"); // max play pos for(I ci = 0; ci < outchns; ++ci) { C tmp[30]; - sprintf(tmp,"Audio signal channel %i",ci+1); + STD::sprintf(tmp,"Audio signal channel %i",ci+1); AddOutSignal(tmp); // output } AddOutSignal("Position currently played"); // position @@ -270,7 +278,7 @@ BL xgroove::m_reset() V xgroove::m_xzone(F xz) { bufchk(); - _xzone = xz < 0?0:xz/s2u; + _xzone = xz < 0?0:xz; do_xzone(); s_dsp(); } @@ -291,23 +299,24 @@ V xgroove::m_xsymm(F xs) V xgroove::m_xshape(I argc,const 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]); + xshape = 0; + xshparam = 1; + if(argc >= 1 && CanbeInt(argv[0])) xshape = GetAInt(argv[0]); if(argc >= 2 && CanbeFloat(argv[1])) { - param = GetAFloat(argv[1]); + xshparam = GetAFloat(argv[1]); // clip to 0..1 - if(param < 0) param = 0; - else if(param > 1) param = 1; + if(xshparam < 0) xshparam = 0; + else if(xshparam > 1) xshparam = 1; } if(znmul) delete[] znmul; znmul = new S[XZONE_TABLE+1]; - switch(sh) { + I i; + switch(xshape) { case 1: for(i = 0; i <= XZONE_TABLE; ++i) - znmul[i] = sin(i*(pi/2./XZONE_TABLE))*param+i*(1./XZONE_TABLE)*(1-param); + znmul[i] = sin(i*(pi/2./XZONE_TABLE))*xshparam+i*(1./XZONE_TABLE)*(1-xshparam); break; case 0: default: @@ -316,6 +325,14 @@ V xgroove::m_xshape(I argc,const t_atom *argv) } } +V xgroove::mg_xshape(AtomList &ret) const +{ + ret(2); + SetInt(ret[0],xshape); + SetFloat(ret[1],xshparam); +} + + V xgroove::m_xkeep(BL k) { xkeep = k; @@ -324,7 +341,7 @@ V xgroove::m_xkeep(BL k) V xgroove::do_xzone() { - xzone = _xzone; + xzone = _xzone/s2u; I smin = curmin,smax = curmax,plen = smax-smin; //curlen; if(xsymm < 0) { // crossfade zone is inside the loop (-> loop is shorter than nominal!) @@ -632,7 +649,7 @@ V xgroove::m_help() #ifdef FLEXT_DEBUG post("compiled on " __DATE__ " " __TIME__); #endif - post("(C) Thomas Grill, 2001-2002"); + post("(C) Thomas Grill, 2001-2003"); #if FLEXT_SYS == FLEXT_SYS_MAX post("Arguments: %s [channels=1] [buffer]",thisName()); #else diff --git a/externals/grill/xsample/source/inter.cpp b/externals/grill/xsample/source/inter.cpp index aeee7e9d..42221e1c 100644 --- a/externals/grill/xsample/source/inter.cpp +++ b/externals/grill/xsample/source/inter.cpp @@ -19,12 +19,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "inter.ci" #endif +void xinter::setup(t_classid c) +{ + FLEXT_CADDATTR_VAR_E(c,"interp",interp,m_interp); +} xinter::xinter(): doplay(false),outchns(1), interp(xsi_4p) { - FLEXT_ADDMETHOD_E(0,"interp",m_interp); } I xinter::m_set(I argc,const t_atom *argv) diff --git a/externals/grill/xsample/source/main.h b/externals/grill/xsample/source/main.h index 77d02772..8f9d15dc 100644 --- a/externals/grill/xsample/source/main.h +++ b/externals/grill/xsample/source/main.h @@ -61,6 +61,13 @@ WARRANTIES, see the file, "license.txt," in this distribution. #define S t_sample +#ifdef __MWERKS__ + #define STD std +#else + #define STD +#endif + + class xsample: public flext_dsp { @@ -120,10 +127,10 @@ protected: BL bufchk() { if(buf->Update()) { m_refresh(); return true; } return false; } V mg_buffer(AtomList &l) { if(buf) { l(1); SetSymbol(l[0],buf->Symbol()); } else l(); } - V ms_buffer(const AtomList &l) { m_set(l.Count(),l.Atoms()); } + inline V ms_buffer(const AtomList &l) { m_set(l.Count(),l.Atoms()); } - V mg_min(F &v) const { v = curmin*s2u; } - V mg_max(F &v) const { v = curmax*s2u; } + inline V mg_min(F &v) const { v = curmin*s2u; } + inline V mg_max(F &v) const { v = curmax*s2u; } private: static V setup(t_classid c); @@ -250,7 +257,7 @@ protected: class xinter: public xsample { - FLEXT_HEADER(xinter,xsample) + FLEXT_HEADER_S(xinter,xsample,setup) public: xinter(); @@ -261,7 +268,7 @@ protected: virtual V m_start(); virtual V m_stop(); - V m_interp(xs_intp mode = xsi__) { interp = mode; s_dsp(); } + inline V m_interp(xs_intp mode = xsi__) { interp = mode; s_dsp(); } I outchns; BL doplay; @@ -282,8 +289,10 @@ protected: virtual V s_dsp(); private: + static V setup(t_classid c); - FLEXT_CALLBACK_1(m_interp,xs_intp) + FLEXT_CALLSET_E(m_interp,xs_intp) + FLEXT_ATTRGET_E(interp,xs_intp) }; #ifdef TMPLOPT diff --git a/externals/grill/xsample/source/play.cpp b/externals/grill/xsample/source/play.cpp index f558e95d..50f32e75 100644 --- a/externals/grill/xsample/source/play.cpp +++ b/externals/grill/xsample/source/play.cpp @@ -75,7 +75,7 @@ xplay::xplay(I argc,const t_atom *argv) AddInSignal("Messages and Signal of playing position"); // pos signal for(I ci = 0; ci < outchns; ++ci) { C tmp[30]; - sprintf(tmp,"Audio signal channel %i",ci+1); + STD::sprintf(tmp,"Audio signal channel %i",ci+1); AddOutSignal(tmp); } @@ -100,7 +100,7 @@ V xplay::m_help() #ifdef FLEXT_DEBUG post("compiled on " __DATE__ " " __TIME__); #endif - post("(C) Thomas Grill, 2001-2002"); + post("(C) Thomas Grill, 2001-2003"); #if FLEXT_SYS == FLEXT_SYS_MAX post("Arguments: %s [channels=1] [buffer]",thisName()); #else diff --git a/externals/grill/xsample/source/record.cpp b/externals/grill/xsample/source/record.cpp index d138d4e5..c9faef65 100644 --- a/externals/grill/xsample/source/record.cpp +++ b/externals/grill/xsample/source/record.cpp @@ -42,10 +42,7 @@ public: virtual V m_min(F mn); virtual V m_max(F mx); -// V m_mixmode(BL mx) { mixmode = mx; } -// V m_sigmode(BL mode) { sigmode = mode; } -// V m_loop(BL lp) { doloop = lp; } - V m_append(BL app) { if(!(appmode = app)) m_pos(0); } + inline V m_append(BL app) { if(!(appmode = app)) m_pos(0); } virtual V m_draw(I argc,const t_atom *argv); @@ -59,8 +56,10 @@ protected: outlet *outmin,*outmax; // float outlets - V outputmin() { ToOutFloat(outmin,curmin*s2u); } - V outputmax() { ToOutFloat(outmax,curmax*s2u); } + inline V outputmin() { ToOutFloat(outmin,curmin*s2u); } + inline V outputmax() { ToOutFloat(outmax,curmax*s2u); } + + inline V mg_pos(F &v) const { v = curpos*s2u; } private: static V setup(t_classid c); @@ -76,8 +75,10 @@ private: recfun(n,in,out); } - FLEXT_CALLBACK_F(m_pos) + FLEXT_CALLVAR_F(mg_pos,m_pos) FLEXT_CALLBACK(m_all) + FLEXT_CALLSET_F(m_min) + FLEXT_CALLSET_F(m_max) FLEXT_CALLBACK_F(m_min) FLEXT_CALLBACK_F(m_max) @@ -98,9 +99,9 @@ V xrecord::setup(t_classid c) { DefineHelp(c,"xrecord~"); - FLEXT_CADDMETHOD_F(c,0,"pos",m_pos); - FLEXT_CADDMETHOD_F(c,0,"min",m_min); - FLEXT_CADDMETHOD_F(c,0,"max",m_max); + FLEXT_CADDATTR_VAR(c,"pos",mg_pos,m_pos); + FLEXT_CADDATTR_VAR(c,"min",mg_min,m_min); + FLEXT_CADDATTR_VAR(c,"max",mg_max,m_max); FLEXT_CADDMETHOD_(c,0,"all",m_all); FLEXT_CADDMETHOD_(c,0,"draw",m_draw); @@ -143,8 +144,8 @@ xrecord::xrecord(I argc,const t_atom *argv): buf = new buffer(NULL,true); for(I ci = 0; ci < inchns; ++ci) { - C tmp[30]; - sprintf(tmp,"Audio channel %i",ci+1); + C tmp[40]; + STD::sprintf(tmp,ci == 0?"Messages/audio channel %i":"Audio channel %i",ci+1); AddInSignal(tmp); // audio signals } AddInSignal("On/Off/Fade/Mix signal (0..1)"); // on/off signal @@ -422,7 +423,7 @@ V xrecord::m_help() #ifdef FLEXT_DEBUG post("compiled on " __DATE__ " " __TIME__); #endif - post("(C) Thomas Grill, 2001-2002"); + post("(C) Thomas Grill, 2001-2003"); #if FLEXT_SYS == FLEXT_SYS_MAX post("Arguments: %s [channels=1] [buffer]",thisName()); #else diff --git a/externals/grill/xsample/xsample.cw b/externals/grill/xsample/xsample.cw Binary files differindex 83938005..d6db1838 100755 --- a/externals/grill/xsample/xsample.cw +++ b/externals/grill/xsample/xsample.cw |