From 9815096db22c73cacdbb65512d1b61d633db7fa8 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 2 Dec 2002 19:21:08 +0000 Subject: "version 0.1.1" svn path=/trunk/; revision=267 --- externals/grill/vasp/source/env.h | 73 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 externals/grill/vasp/source/env.h (limited to 'externals/grill/vasp/source/env.h') diff --git a/externals/grill/vasp/source/env.h b/externals/grill/vasp/source/env.h new file mode 100644 index 00000000..e9f8dae7 --- /dev/null +++ b/externals/grill/vasp/source/env.h @@ -0,0 +1,73 @@ +/* + +VASP modular - vector assembling signal processor / objects for Max/MSP and PD + +Copyright (c) 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. + +*/ + +#ifndef __VASP_ENV_H +#define __VASP_ENV_H + +#include "vasp.h" + +class Env +{ +public: + Env(): cnt(0),pos(NULL),val(NULL) {} + Env(I argc,const t_atom *argv); +// Env(const Env &p); + ~Env(); + + static BL ChkArgs(I argc,const t_atom *argv); + + V Clear(); + + BL Ok() const { return cnt && pos != NULL && val != NULL; } + +// friend class Iter; + + class Iter + { + public: + Iter(const Env &e); + V Init(R p); + + R ValFwd(R p) + { + if(p > npt) UpdateFwd(p); + return pvl+k*(p-ppt); + } + + R ValBwd(R p) + { + if(p < ppt) UpdateBwd(p); + return pvl+k*(p-ppt); + } + + protected: + V UpdateFwd(R p); + V UpdateBwd(R p); + + const Env &bp; + I ix; + R ppt,npt; + R pvl,nvl; + R k; + }; + + I Count() const { return cnt; } + const R *Pos() const { return pos; } + const R *Val() const { return val; } + R Pos(I ix) const { return pos[ix]; } + R Val(I ix) const { return val[ix]; } + +protected: + I cnt; + R *pos,*val; +}; + +#endif + -- cgit v1.2.1