aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/xsample/source/inter.cpp
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/inter.cpp
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/inter.cpp')
-rw-r--r--externals/grill/xsample/source/inter.cpp95
1 files changed, 95 insertions, 0 deletions
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));
+}
+
+