aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/vasp/source')
-rw-r--r--externals/grill/vasp/source/arg.cpp277
-rw-r--r--externals/grill/vasp/source/arg.h111
-rw-r--r--externals/grill/vasp/source/buflib.cpp343
-rw-r--r--externals/grill/vasp/source/buflib.h37
-rw-r--r--externals/grill/vasp/source/classes.cpp416
-rw-r--r--externals/grill/vasp/source/classes.h320
-rw-r--r--externals/grill/vasp/source/env.cpp153
-rw-r--r--externals/grill/vasp/source/env.h76
-rw-r--r--externals/grill/vasp/source/main.cpp216
-rw-r--r--externals/grill/vasp/source/main.h94
-rw-r--r--externals/grill/vasp/source/mixfft.cpp588
-rw-r--r--externals/grill/vasp/source/obj_chns.cpp160
-rw-r--r--externals/grill/vasp/source/obj_frames.cpp241
-rw-r--r--externals/grill/vasp/source/obj_imm.cpp123
-rw-r--r--externals/grill/vasp/source/obj_offs.cpp179
-rw-r--r--externals/grill/vasp/source/obj_part.cpp115
-rw-r--r--externals/grill/vasp/source/obj_peaks.cpp119
-rw-r--r--externals/grill/vasp/source/obj_q.cpp124
-rw-r--r--externals/grill/vasp/source/obj_radio.cpp59
-rw-r--r--externals/grill/vasp/source/obj_size.cpp265
-rw-r--r--externals/grill/vasp/source/obj_split.cpp290
-rw-r--r--externals/grill/vasp/source/obj_sync.cpp130
-rw-r--r--externals/grill/vasp/source/obj_vasp.cpp205
-rw-r--r--externals/grill/vasp/source/obj_vecs.cpp111
-rw-r--r--externals/grill/vasp/source/opbase.cpp85
-rw-r--r--externals/grill/vasp/source/opbase.h47
-rw-r--r--externals/grill/vasp/source/opdefs.h495
-rw-r--r--externals/grill/vasp/source/opfuns.h529
-rw-r--r--externals/grill/vasp/source/oploop.h95
-rw-r--r--externals/grill/vasp/source/opparam.cpp255
-rw-r--r--externals/grill/vasp/source/opparam.h128
-rw-r--r--externals/grill/vasp/source/oppermute.h121
-rw-r--r--externals/grill/vasp/source/ops.h27
-rw-r--r--externals/grill/vasp/source/ops_arith.cpp79
-rw-r--r--externals/grill/vasp/source/ops_arith.h54
-rw-r--r--externals/grill/vasp/source/ops_assign.cpp95
-rw-r--r--externals/grill/vasp/source/ops_assign.h33
-rw-r--r--externals/grill/vasp/source/ops_carith.cpp82
-rw-r--r--externals/grill/vasp/source/ops_carith.h48
-rw-r--r--externals/grill/vasp/source/ops_cmp.cpp49
-rw-r--r--externals/grill/vasp/source/ops_cmp.h83
-rw-r--r--externals/grill/vasp/source/ops_cplx.cpp56
-rw-r--r--externals/grill/vasp/source/ops_cplx.h40
-rw-r--r--externals/grill/vasp/source/ops_dft.cpp652
-rw-r--r--externals/grill/vasp/source/ops_dft.h25
-rw-r--r--externals/grill/vasp/source/ops_feature.cpp226
-rw-r--r--externals/grill/vasp/source/ops_feature.h29
-rw-r--r--externals/grill/vasp/source/ops_flt.cpp205
-rw-r--r--externals/grill/vasp/source/ops_flt.h41
-rw-r--r--externals/grill/vasp/source/ops_gate.cpp63
-rw-r--r--externals/grill/vasp/source/ops_gen.cpp266
-rw-r--r--externals/grill/vasp/source/ops_gen.h40
-rw-r--r--externals/grill/vasp/source/ops_qminmax.cpp267
-rw-r--r--externals/grill/vasp/source/ops_rearr.cpp248
-rw-r--r--externals/grill/vasp/source/ops_rearr.h34
-rw-r--r--externals/grill/vasp/source/ops_resmp.cpp275
-rw-r--r--externals/grill/vasp/source/ops_resmp.h28
-rw-r--r--externals/grill/vasp/source/ops_search.cpp213
-rw-r--r--externals/grill/vasp/source/ops_search.h29
-rw-r--r--externals/grill/vasp/source/ops_trnsc.cpp52
-rw-r--r--externals/grill/vasp/source/ops_trnsc.h43
-rw-r--r--externals/grill/vasp/source/ops_wnd.cpp192
-rw-r--r--externals/grill/vasp/source/ops_wnd.h41
-rw-r--r--externals/grill/vasp/source/opvecs.cpp631
-rw-r--r--externals/grill/vasp/source/rdx2fft.cpp82
-rw-r--r--externals/grill/vasp/source/rvfft.cpp357
-rw-r--r--externals/grill/vasp/source/util.cpp24
-rw-r--r--externals/grill/vasp/source/util.h58
-rw-r--r--externals/grill/vasp/source/vasp.cpp384
-rw-r--r--externals/grill/vasp/source/vasp.h161
-rwxr-xr-xexternals/grill/vasp/source/vasp.rsrc13
-rw-r--r--externals/grill/vasp/source/vbuffer.cpp51
-rw-r--r--externals/grill/vasp/source/vbuffer.h128
-rw-r--r--externals/grill/vasp/source/vecblk.cpp60
-rw-r--r--externals/grill/vasp/source/vecblk.h106
75 files changed, 0 insertions, 12177 deletions
diff --git a/externals/grill/vasp/source/arg.cpp b/externals/grill/vasp/source/arg.cpp
deleted file mode 100644
index 696558cf..00000000
--- a/externals/grill/vasp/source/arg.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "arg.h"
-//#include <math.h>
-#include "classes.h"
-
-Argument::Argument(): tp(tp_none),nxt(NULL) {}
-Argument::~Argument() { ClearAll(); }
-
-Argument &Argument::Parse(I argc,const t_atom *argv)
-{
- if(argc == 0)
- Clear();
- else // real?
- if(argc == 1 && flext::CanbeFloat(argv[0]))
- SetR(flext::GetAFloat(argv[0]));
- else // complex?
- if(argc == 2 && flext::CanbeFloat(argv[0]) && flext::CanbeFloat(argv[1]))
- SetCX(flext::GetAFloat(argv[1]),flext::GetAFloat(argv[2]));
- else // double?
- if(argc >= 2 && flext::GetASymbol(argv[0]) == vasp_base::sym_double &&
- flext::CanbeFloat(argv[1]) && (argc == 2 || flext::CanbeFloat(argv[2]))
- )
- SetR((D)flext::GetAFloat(argv[1])+(D)flext::GetAFloat(argv[2]));
- else // envelope?
- if(Env::ChkArgs(argc,argv)) {
- Env *e = new Env(argc,argv);
- if(e && e->Ok()) SetEnv(e);
- else {
- Clear();
- post("vasp - env argument is invalid");
- delete e;
- }
- }
- else // vasp?
- if(Vasp::ChkArgs(argc,argv)) {
- Vasp *v = new Vasp(argc,argv);
- if(v && v->Ok()) SetVasp(v);
- else {
- Clear();
- post("vasp - vasp argument is invalid");
- delete v;
- }
- }
- else {
- Clear();
- post("vasp - invalid arguments");
- }
- return *this;
-}
-
-V Argument::MakeList(flext::AtomList &ret)
-{
- switch(tp) {
- case tp_none:
- ret();
- break;
- case tp_list:
- ret = *dt.atoms;
- break;
- case tp_vasp:
- dt.v->MakeList(ret);
- break;
- case tp_env:
- dt.env->MakeList(ret);
- break;
- case tp_vx: {
- I d = dt.vx->Dim();
- ret(d+1);
- flext::SetSymbol(ret[0],vasp_base::sym_vector);
- for(I i = 0; i < d; ++i)
- flext::SetFloat(ret[i+1],(*dt.vx)[i]);
- break;
- }
- case tp_cx:
- ret(3);
- flext::SetSymbol(ret[0],vasp_base::sym_complex);
- flext::SetFloat(ret[1],dt.cx->real);
- flext::SetFloat(ret[2],dt.cx->imag);
- break;
- case tp_int:
- ret(1);
- flext::SetInt(ret[0],dt.i);
- break;
- case tp_float:
- ret(1);
- flext::SetFloat(ret[0],dt.f);
- break;
- case tp_double: {
- F f = (F)dt.d;
- ret(3);
- flext::SetSymbol(ret[0],vasp_base::sym_double);
- flext::SetFloat(ret[1],f);
- flext::SetFloat(ret[2],dt.d-f);
- break;
- }
- default:
- ERRINTERNAL();
- }
-}
-
-
-Argument &Argument::Clear()
-{
- switch(tp) {
- case tp_none:
- break;
- case tp_list:
- if(dt.atoms) { delete dt.atoms; dt.atoms = NULL; }
- break;
- case tp_vasp:
- if(dt.v) { delete dt.v; dt.v = NULL; }
- break;
- case tp_env:
- if(dt.env) { delete dt.env; dt.env = NULL; }
- break;
- case tp_vx:
- if(dt.vx) { delete dt.vx; dt.vx = NULL; }
- break;
- case tp_cx:
- if(dt.cx) { delete dt.cx; dt.cx = NULL; }
- break;
- case tp_int:
- case tp_float:
- case tp_double:
- break;
- default:
- ERRINTERNAL();
- }
- tp = tp_none;
- return *this;
-}
-
-Argument &Argument::ClearAll()
-{
- Clear();
- if(nxt) { delete nxt; nxt = NULL; }
- return *this;
-}
-
-Argument &Argument::SetVasp(Vasp *v)
-{
- if(tp != tp_none) Clear();
- dt.v = v; tp = tp_vasp;
- return *this;
-}
-
-Argument &Argument::SetEnv(Env *e)
-{
- if(tp != tp_none) Clear();
- dt.env = e; tp = tp_env;
- return *this;
-}
-
-Argument &Argument::SetList(I argc,const t_atom *argv)
-{
- if(tp != tp_none) Clear();
- dt.atoms = new flext::AtomList(argc,argv); tp = tp_list;
- return *this;
-}
-
-Argument &Argument::SetR(F f)
-{
- if(tp != tp_none) Clear();
- dt.f = f; tp = tp_float;
- return *this;
-}
-
-Argument &Argument::SetR(D f)
-{
- if(tp != tp_none) Clear();
- dt.d = f; tp = tp_double;
- return *this;
-}
-
-Argument &Argument::SetI(I i)
-{
- if(tp != tp_none) Clear();
- dt.i = i; tp = tp_int;
- return *this;
-}
-
-Argument &Argument::SetCX(F re,F im)
-{
- if(tp != tp_none) Clear();
- dt.cx = new CX(re,im); tp = tp_cx;
- return *this;
-}
-
-Argument &Argument::SetVX(VX *vec)
-{
- if(tp != tp_none) Clear();
- dt.vx = vec; tp = tp_vx;
- return *this;
-}
-
-I Argument::GetAInt() const { return (I)GetADouble(); }
-
-F Argument::GetAFloat() const { return GetADouble(); }
-
-D Argument::GetADouble() const
-{
- if(IsInt()) return GetInt();
- else if(IsFloat()) return GetFloat();
- else if(IsDouble()) return GetDouble();
- else return 0;
-}
-
-CX Argument::GetAComplex() const
-{
- if(IsInt()) return (F)GetInt();
- else if(IsFloat()) return GetFloat();
- else if(IsDouble()) return GetDouble();
- else if(IsComplex()) return GetComplex();
- else return 0;
-}
-
-Vasp Argument::GetAVasp() const
-{
- if(IsVasp()) return GetVasp();
- else if(IsList()) return Vasp(dt.atoms->Count(),dt.atoms->Atoms());
- else return Vasp();
-}
-
-Env Argument::GetAEnv() const
-{
- if(IsEnv()) return GetEnv();
- else if(IsList()) return Env(dt.atoms->Count(),dt.atoms->Atoms());
- else return Env();
-}
-
-
-Argument &Argument::Add(Argument *n)
-{
- if(nxt) nxt->Add(n);
- else nxt = n;
- return *n;
-}
-
-Argument &Argument::Next(I i)
-{
- if(i <= 0) return *this;
- else {
- Argument *n = Next();
- if(n) return n->Next(i-1);
- else {
- error("Argument: index not found!");
- return *this;
- }
- }
-}
-
-Argument &Argument::AddVasp(Vasp *v) { Argument *a = new Argument; a->SetVasp(v); return Add(a); }
-
-Argument &Argument::AddEnv(Env *e) { Argument *a = new Argument; a->SetEnv(e); return Add(a); }
-
-Argument &Argument::AddList(I argc,const t_atom *argv) { Argument *a = new Argument; a->SetList(argc,argv); return Add(a); }
-
-Argument &Argument::AddI(I i) { Argument *a = new Argument; a->SetI(i); return Add(a); }
-
-Argument &Argument::AddR(F f) { Argument *a = new Argument; a->SetR(f); return Add(a); }
-
-Argument &Argument::AddCX(F re,F im) { Argument *a = new Argument; a->SetCX(re,im); return Add(a); }
-
-Argument &Argument::AddVX(VX *vec) { Argument *a = new Argument; a->SetVX(vec); return Add(a); }
-
-
-
diff --git a/externals/grill/vasp/source/arg.h b/externals/grill/vasp/source/arg.h
deleted file mode 100644
index cd0f70a1..00000000
--- a/externals/grill/vasp/source/arg.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-
-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_ARG_H
-#define __VASP_ARG_H
-
-#include "vasp.h"
-#include "env.h"
-
-#define VASP_ARG() Argument()
-#define VASP_ARG_I(VAL) Argument().SetR(VAL)
-#define VASP_ARG_R(VAL) Argument().SetR(VAL)
-#define VASP_ARG_CX(RV,IV) Argument().SetCX(RV,IV)
-
-class Argument:
- public flext
-{
-public:
- Argument();
- ~Argument();
-
- Argument &Parse(I argc,const t_atom *argv);
- Argument &Clear();
- Argument &ClearAll();
-
- Argument &SetVasp(Vasp *v);
- Argument &SetEnv(Env *e);
- Argument &SetList(I argc,const t_atom *argv);
- Argument &SetI(I i);
- Argument &SetR(F f);
- Argument &SetR(D d);
- Argument &SetR(I i) { return SetR((F)i); }
- Argument &SetCX(F re,F im);
- Argument &SetVX(VX *vec);
-
- Argument *Next() { return nxt; }
- Argument &Next(I i);
- Argument &Add(Argument *a);
-
- Argument &AddVasp(Vasp *v);
- Argument &AddEnv(Env *e);
- Argument &AddList(I argc,const t_atom *argv);
- Argument &AddI(I i);
- Argument &AddR(F f);
- Argument &AddR(D d);
- Argument &AddR(I i) { return AddR((F)i); }
- Argument &AddCX(F re,F im);
- Argument &AddVX(VX *vec);
-
- BL IsNone() const { return tp == tp_none; }
- BL IsList() const { return tp == tp_list; }
- BL IsVasp() const { return tp == tp_vasp; }
- BL CanbeVasp() const { return tp == tp_vasp || (tp == tp_list && Vasp::ChkArgs(dt.atoms->Count(),dt.atoms->Atoms())); }
- BL IsEnv() const { return tp == tp_env; }
- BL CanbeEnv() const { return tp == tp_env || (tp == tp_env && Env::ChkArgs(dt.atoms->Count(),dt.atoms->Atoms())); }
- BL IsInt() const { return tp == tp_int; }
- BL CanbeInt() const { return tp == tp_int || tp == tp_float || tp_double; }
- BL IsFloat() const { return tp == tp_float; }
- BL CanbeFloat() const { return tp == tp_float || tp == tp_double || tp == tp_int; }
- BL IsDouble() const { return tp == tp_double; }
- BL CanbeDouble() const { return tp == tp_double || tp == tp_float || tp == tp_int; }
- BL IsComplex() const { return tp == tp_cx; }
- BL CanbeComplex() const { return tp == tp_cx || CanbeFloat(); }
- BL IsVector() const { return tp == tp_vx; }
- BL CanbeVector() const { return tp == tp_vx || CanbeComplex(); }
-
- const flext::AtomList &GetList() const { return *dt.atoms; }
- const Vasp &GetVasp() const { return *dt.v; }
- Vasp GetAVasp() const;
- const Env &GetEnv() const { return *dt.env; }
- Env GetAEnv() const;
- I GetInt() const { return dt.i; }
- I GetAInt() const;
- F GetFloat() const { return dt.f; }
- F GetAFloat() const;
- D GetDouble() const { return dt.d; }
- D GetADouble() const;
- const CX &GetComplex() const { return *dt.cx; }
- CX GetAComplex() const;
- const VX &GetVector() const { return *dt.vx; }
- VX GetAVector() const;
-
- V MakeList(flext::AtomList &ret);
-
-protected:
- enum {
- tp_none,tp_vasp,tp_env,tp_list,tp_int,tp_float,tp_double,tp_cx,tp_vx
- } tp;
-
- union {
- Vasp *v;
- Env *env;
- flext::AtomList *atoms;
- F f;
- D d;
- I i;
- CX *cx;
- VX *vx;
- } dt;
-
- Argument *nxt;
-};
-
-#endif
diff --git a/externals/grill/vasp/source/buflib.cpp b/externals/grill/vasp/source/buflib.cpp
deleted file mode 100644
index a6b3d082..00000000
--- a/externals/grill/vasp/source/buflib.cpp
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "buflib.h"
-#include <stdio.h>
-
-#define LIBTICK 0.1 // tick time in s
-#define LIBTOL 3 // how many ticks till release
-
-#define REUSE_MAXLOSEREL 0.1 // max. fraction of lost buffer size
-#define REUSE_MAXLOSEABS 10000 // max. lost buffer size
-
-
-#ifdef __MWERKS__
-#define STD std
-#else
-#define STD
-#endif
-
-
-class FreeEntry:
- public flext
-{
-public:
- FreeEntry(const t_symbol *s): sym(s),nxt(NULL) {}
-
- const t_symbol *sym;
- FreeEntry *nxt;
-};
-
-class BufEntry:
- public flext
-{
-public:
- BufEntry(const t_symbol *s,I fr,BL zero = true);
- ~BufEntry();
-
- V IncRef();
- V DecRef();
-
- const t_symbol *sym;
- I refcnt,tick;
- BufEntry *nxt;
-
- I alloc,len;
- S *data;
-};
-
-
-static BufEntry *libhead = NULL,*libtail = NULL;
-static FreeEntry *freehead = NULL,*freetail = NULL;
-static I libcnt = 0,libtick = 0;
-
-#ifdef FLEXT_THREADS
-static flext::ThrMutex libmtx,freemtx;
-#endif
-
-static V FreeLibSym(const t_symbol *s);
-
-
-
-
-BufEntry::BufEntry(const t_symbol *s,I fr,BL zero):
- sym(s),
- alloc(fr),len(fr),
- refcnt(0),nxt(NULL)
-{
- data = (S *)NewAligned(len*sizeof(*data));
- if(zero) flext::ZeroMem(data,len*sizeof(*data));
-}
-
-BufEntry::~BufEntry()
-{
- if(sym) FreeLibSym(sym);
- if(data) FreeAligned(data);
-}
-
-V BufEntry::IncRef() { ++refcnt; }
-V BufEntry::DecRef() { --refcnt; tick = libtick; }
-
-static BufEntry *FindInLib(const t_symbol *s)
-{
- BufEntry *e;
- for(e = libhead; e && e->sym != s; e = e->nxt) (void)0;
- return e?e:NULL;
-}
-
-#ifdef FLEXT_DEBUG
-static V DumpLib()
-{
- post("Dump {");
- BufEntry *e;
- for(e = libhead; e; e = e->nxt) {
- post("\t%s -> refs:%i, alloc:%i, len:%i -> %p",flext::GetString(e->sym),e->refcnt,e->alloc,e->len,e->data);
- }
- post("}");
-}
-#endif
-
-VBuffer *BufLib::Get(const VSymbol &s,I chn,I len,I offs)
-{
- BufEntry *e = FindInLib(s.Symbol());
- if(e)
- return new ImmBuf(e,len,offs);
- else
- return new SysBuf(s,chn,len,offs);
-}
-
-V BufLib::IncRef(const t_symbol *s)
-{
- if(s) {
- BufEntry *e = FindInLib(s);
- if(e) e->IncRef();
- }
-}
-
-V BufLib::DecRef(const t_symbol *s)
-{
- if(s) {
- BufEntry *e = FindInLib(s);
- if(e) e->DecRef();
- }
-}
-
-static V Collect()
-{
-#ifdef FLEXT_THREADS
- libmtx.Lock();
-#endif
-
- // collect garbage
- BufEntry *e,*p;
- for(p = NULL,e = libhead; e; ) {
- if(e->refcnt <= 0 && e->tick+LIBTOL < libtick) {
- FLEXT_ASSERT(e->refcnt == 0);
-
- BufEntry *n = e->nxt;
-
- if(p) p->nxt = n;
- else libhead = n;
-
- if(!n) libtail = p;
- else e->nxt = NULL;
-
- delete e;
-
- e = n;
- }
- else
- p = e,e = e->nxt;
- }
-
-#ifdef FLEXT_THREADS
- libmtx.Unlock();
-#endif
-}
-
-
-#ifdef FLEXT_THREADS
-static bool libthractive = false;
-//static flext::thrid_t libthrid;
-static bool libthrexit = false; // currently not used
-static flext::ThrCond *libthrcond = NULL;
-
-static V LibThr(flext::thr_params *)
-{
- flext::RelPriority(-2);
-
- while(!libthrexit) {
- libthrcond->TimedWait(1); // don't go below 1 here as TimedWait might not support fractions of seconds!!!
- // TODO - should process return value of TimedWait
- Collect();
- }
-}
-#endif
-
-static flext::Timer *libclk = NULL;
-
-static V LibTick(V *)
-{
-#ifdef FLEXT_THREADS
- libthrcond->Signal();
-#else
- Collect();
-#endif
-
- ++libtick;
-}
-
-static const t_symbol *GetLibSym()
-{
-#ifdef FLEXT_THREADS
- freemtx.Lock();
-#endif
- const t_symbol *ret;
-
- if(freehead) {
- // reuse from free-list
- FreeEntry *r = freehead;
- freehead = r->nxt;
- if(!freehead) freetail = NULL;
- const t_symbol *s = r->sym;
- delete r;
- ret = s;
- }
- else {
- // allocate new symbol
- char tmp[20];
- if(libcnt > 0xffff)
- STD::sprintf(tmp,"vasp!%08x",libcnt);
- else // better hash lookup for 4 digits
- STD::sprintf(tmp,"vasp!%04x",libcnt);
- libcnt++;
- ret = gensym(tmp);
- }
-
-#ifdef FLEXT_THREADS
- freemtx.Unlock();
-#endif
- return ret;
-}
-
-static V FreeLibSym(const t_symbol *sym)
-{
-#ifdef FLEXT_DEBUG
-// post("free %s",flext::GetString(sym));
-#endif
-
-#ifdef FLEXT_THREADS
- freemtx.Lock();
-#endif
-
- FreeEntry *f = new FreeEntry(sym);
- if(!freehead) freehead = f;
- else freetail->nxt = f;
- freetail = f;
-
-#ifdef FLEXT_THREADS
- freemtx.Unlock();
-#endif
-}
-
-
-BufEntry *BufLib::NewImm(I fr,BL zero)
-{
-#ifdef FLEXT_THREADS
- if(!libthractive) {
- bool ret = flext::LaunchThread(LibThr,NULL);
- if(!ret)
- error("vasp - Could not launch helper thread");
- else {
- libthrcond = new flext::ThrCond;
- libthractive = true;
- }
- }
-#endif
- if(!libclk) {
- libclk = new flext::Timer(true);
- libclk->SetCallback(LibTick);
- libclk->Periodic(LIBTICK);
- }
-
- const t_symbol *s = GetLibSym();
- BufEntry *entry = new BufEntry(s,fr,zero);
-
-#ifdef FLEXT_THREADS
- libmtx.Lock();
-#endif
-
- if(libtail) libtail->nxt = entry;
- else libhead = entry;
- libtail = entry;
-
-#ifdef FLEXT_DEBUG
-// DumpLib();
-#endif
-
-#ifdef FLEXT_THREADS
- libmtx.Unlock();
-#endif
-
- return entry;
-}
-
-static F reuse_maxloserel = (F)REUSE_MAXLOSEREL;
-static I reuse_maxloseabs = REUSE_MAXLOSEABS;
-
-BufEntry *BufLib::Resize(BufEntry *e,I fr,BL keep,BL zero)
-{
- if(e->alloc >= fr && fr >= e->alloc*(1-reuse_maxloserel) && fr >= (e->alloc-reuse_maxloseabs)) {
- // reuse buffer
- e->len = fr;
- }
- else {
- S *nd = new S[fr];
- if(keep) {
- I l = fr;
- if(e->len < l) {
- l = e->len;
- if(zero) flext::ZeroMem(nd+l,(fr-l)*sizeof(*nd));
- }
- flext::CopyMem(nd,e->data,l*sizeof(*nd));
- }
-
- delete[] e->data;
- e->data = nd;
- e->len = e->alloc = fr;
- }
- return e;
-}
-
-
-
-ImmBuf::ImmBuf(I len,BL zero):
- VBuffer(0,len),
- entry(BufLib::NewImm(len,zero))
-{}
-
-ImmBuf::ImmBuf(BufEntry *e,I len,I offs):
- VBuffer(0,len,offs),
- entry(e)
-{
- if(Length() > e->alloc) {
- Length(e->alloc);
- post("vasp - buffer %s: Length (%i) is out of range, corrected to %i",GetString(e->sym),len,e->alloc);
- }
-}
-
-VSymbol ImmBuf::Symbol() const { return entry->sym; }
-
-I ImmBuf::Frames() const { return entry->len; }
-
-V ImmBuf::Frames(I fr,BL keep,BL zero) { entry = BufLib::Resize(entry,fr,keep,zero); }
-
-S *ImmBuf::Data() { return entry->data; }
diff --git a/externals/grill/vasp/source/buflib.h b/externals/grill/vasp/source/buflib.h
deleted file mode 100644
index 545e8103..00000000
--- a/externals/grill/vasp/source/buflib.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file buflib.h
- \brief Routines for buffer management
-*/
-
-#ifndef __VASP_BUFLIB_H
-#define __VASP_BUFLIB_H
-
-#include "classes.h"
-#include "vbuffer.h"
-
-class BufEntry;
-
-namespace BufLib
-{
- VBuffer *Get(const VSymbol &s,I chn = 0,I len = -1,I offs = 0);
-
- BufEntry *NewImm(I fr,BL zero = true);
-
- V IncRef(const t_symbol *s);
- V DecRef(const t_symbol *s);
-
- BufEntry *Resize(BufEntry *e,I fr,BL keep = false,BL zero = true);
-}
-
-
-
-#endif
diff --git a/externals/grill/vasp/source/classes.cpp b/externals/grill/vasp/source/classes.cpp
deleted file mode 100644
index 195e9e25..00000000
--- a/externals/grill/vasp/source/classes.cpp
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-//#include <stdarg.h>
-
-
-///////////////////////////////////////////////////////////////////////////
-// vasp_base class
-///////////////////////////////////////////////////////////////////////////
-
-const t_symbol *vasp_base::sym_radio;
-const t_symbol *vasp_base::sym_vasp;
-const t_symbol *vasp_base::sym_env;
-const t_symbol *vasp_base::sym_double;
-const t_symbol *vasp_base::sym_complex;
-const t_symbol *vasp_base::sym_vector;
-
-V vasp_base::Setup(t_classid c)
-{
- sym_radio = MakeSymbol("radio");
- sym_vasp = MakeSymbol("vasp");
- sym_env = MakeSymbol("env");
- sym_double = MakeSymbol("double");
- sym_complex = MakeSymbol("complex");
- sym_vector = MakeSymbol("vector");
-
- FLEXT_CADDMETHOD_(c,0,"radio",m_radio);
- FLEXT_CADDMETHOD_(c,0,"help",m_help);
-
- FLEXT_CADDATTR_VAR1(c,"defer",deferred);
-
-// LATER!
-/*
- FLEXT_CADDATTR_VAR1(c,"argchk",argchk);
- FLEXT_CADDATTR_VAR1(c,"loglvl",loglvl);
- FLEXT_CADDATTR_VAR1_E(c,"unit",unit);
-*/
-}
-
-vasp_base::vasp_base():
- refresh(false),argchk(false),deferred(false),
- unit(xsu_sample),loglvl(0)
-{}
-
-vasp_base::~vasp_base() {}
-
-
-V vasp_base::m_radio(I argc,const t_atom *argv)
-{
- if(argc > 0 && IsSymbol(argv[0])) {
- // send command to self!
- ToSelfAnything(0,GetSymbol(argv[0]),argc-1,argv+1);
-
- // send command to the next objects in line
- ToOutAnything(0,sym_radio,argc,argv);
- }
- else
- post("%s - radio message invalid",thisName());
-}
-
-/*
-V vasp_base::m_unit(xs_unit u) { unit = u; }
-V vasp_base::m_argchk(BL chk) { argchk = chk; }
-V vasp_base::m_loglvl(I lvl) { loglvl = lvl; }
-*/
-
-BL vasp_base::ToOutVasp(I oix,Vasp &v)
-{
- AtomList *lst = v.MakeList(false);
- if(lst) {
- if(deferred)
- ToQueueAnything(oix,sym_vasp,lst->Count(),lst->Atoms());
- else
- ToOutAnything(oix,sym_vasp,lst->Count(),lst->Atoms());
- delete lst;
- return true;
- }
- else return false;
-}
-
-///////////////////////////////////////////////////////////////////////////
-// vasp_op class
-///////////////////////////////////////////////////////////////////////////
-
-vasp_op::vasp_op(BL op)
- :detach(false),prior(-2)
-#ifdef FLEXT_THREADS
-// ,thrid(0)
-#endif
-{
- if(op) FLEXT_ADDATTR_VAR("to",m_getto,m_setto);
-}
-
-V vasp_op::Setup(t_classid c)
-{
- FLEXT_CADDBANG(c,0,m_dobang);
- FLEXT_CADDMETHOD_(c,0,"vasp",m_vasp);
- FLEXT_CADDMETHOD_(c,0,"set",m_set);
-
- FLEXT_CADDATTR_VAR(c,"ref",m_getref,m_setref);
-
- FLEXT_CADDMETHOD_(c,0,"stop",m_stop);
-
- FLEXT_CADDATTR_VAR(c,"update",m_getupd,m_setupd);
-
- FLEXT_CADDATTR_VAR1(c,"detach",detach);
- FLEXT_CADDATTR_VAR1(c,"prior",prior);
-}
-
-V vasp_op::m_dobang()
-{
-#ifdef FLEXT_THREADS
- if(detach)
- FLEXT_CALLMETHOD(m_bang);
- else
-#endif
- m_bang();
-}
-
-I vasp_op::m_set(I argc,const t_atom *argv)
-{
- Vasp arg(argc,argv);
-
- if(argc && !arg.Ok()) {
- ref.Clear();
- post("%s - invalid vasp detected and ignored",thisName());
- }
- else {
- if(arg.Check())
- ref = arg;
- else {
- ref.Clear();
- post("%s - vasp reference is invalid",thisName());
- }
- }
-
- return 0;
-}
-
-V vasp_op::m_vasp(I argc,const t_atom *argv)
-{
- m_set(argc,argv);
- m_dobang();
-}
-
-
-V vasp_op::m_to(I argc,const t_atom *argv)
-{
- Vasp to(argc,argv);
-
- if(argc && !to.Ok()) {
- // empty vasp
- dst.Clear();
- }
- else
- dst = to;
-}
-
-V vasp_op::m_update(I argc,const t_atom *argv)
-{
- if(argc == 0)
- ref.Refresh();
- else {
- if(CanbeInt(argv[0]))
- refresh = GetAInt(argv[0]) != 0;
- else
- post("%s(update) - argument should be omitted or integer",thisName());
- }
-}
-
-V vasp_op::m_stop() {}
-
-///////////////////////////////////////////////////////////////////////////
-// vasp_tx class
-///////////////////////////////////////////////////////////////////////////
-
-vasp_tx::vasp_tx(BL to): vasp_op(to) {}
-
-V vasp_tx::m_bang()
-{
- // Thread has to wait until previous is finished
- Lock();
-
-#ifdef FLEXT_THREADS
- if(!IsSystemThread()) RelPriority(prior);
-#endif
-
- if(ref.Check())
- {
- Vasp *ret = x_work();
- if(ret) {
- if(!ToOutVasp(0,*ret))
- post("%s - empty list",thisName());
- if(refresh) ret->Refresh();
- delete ret;
- }
- else {
-#ifdef FLEXT_DEBUG
- post("%s - no valid return",thisName());
-#endif
- }
- }
- else {
- post("%s - no valid vasp to work with",thisName());
- }
-
-#ifdef FLEXT_THREADS
-// thrid = 0;
-#endif
-
- Unlock();
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-// vasp_unop class
-///////////////////////////////////////////////////////////////////////////
-
-vasp_unop::vasp_unop(BL op,UL outcode):
- vasp_tx(op)
-{
- AddInAnything();
- AddOutAnything(1);
- AddOutlets(outcode);
-}
-
-Vasp *vasp_unop::x_work() { return tx_work(); }
-
-Vasp *vasp_unop::tx_work()
-{
- error("%s - no work method implemented",thisName());
- return NULL;
-}
-
-///////////////////////////////////////////////////////////////////////////
-// vasp_binop class
-///////////////////////////////////////////////////////////////////////////
-
-
-vasp_binop::vasp_binop(I argc,const t_atom *argv,const Argument &def,BL op,UL outcode):
- vasp_tx(op)
-{
- a_list(argc,argv);
- if(arg.IsNone() && !def.IsNone()) arg = def;
-
- AddInAnything(2);
- AddOutAnything(1);
- AddOutlets(outcode);
-}
-
-V vasp_binop::Setup(t_classid c)
-{
- FLEXT_CADDMETHOD(c,1,a_list);
- FLEXT_CADDMETHOD_(c,1,"vasp",a_vasp);
- FLEXT_CADDMETHOD_(c,1,"env",a_env);
- FLEXT_CADDMETHOD_(c,1,"float",a_float);
- FLEXT_CADDMETHOD_(c,1,"double",a_double);
- FLEXT_CADDMETHOD_(c,1,"int",a_int);
- FLEXT_CADDMETHOD_(c,1,"complex",a_complex);
- FLEXT_CADDMETHOD_(c,1,"vector",a_vector);
- FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
-
- FLEXT_CADDATTR_VAR(c,"arg",m_getarg,m_setarg);
-}
-
-V vasp_binop::a_list(I argc,const t_atom *argv)
-{
- if(argc) {
- arg.Parse(argc,argv);
- if(arg.IsNone())
- post("%s - list argument could not be evaluated (ignored)",thisName());
- else if(argchk) {
- // check argument feasibility
- }
- }
- else {
-// post("%s - Empty list argument (ignored)",thisName());
- }
-}
-
-V vasp_binop::a_vasp(I argc,const t_atom *argv)
-{
- Vasp *v = new Vasp(argc,argv);
- if(v->Ok()) {
- arg.SetVasp(v);
- if(argchk) {
- // check argument feasibility
- }
- }
- else {
- post("%s - invalid vasp argument (ignored)",thisName());
- delete v;
- }
-}
-
-V vasp_binop::a_env(I argc,const t_atom *argv)
-{
- Env *bp = new Env(argc,argv);
- if(bp->Ok()) {
- arg.SetEnv(bp);
- if(argchk) {
- // check argument feasibility
- }
- }
- else {
- post("%s - invalid env argument (ignored)",thisName());
- delete bp;
- }
-}
-
-V vasp_binop::a_float(F v) { arg.SetR(v); }
-
-V vasp_binop::a_double(I argc,const t_atom *argv)
-{
- if(
- (argc == 1 && CanbeFloat(argv[0])) ||
- (argc == 2 && CanbeFloat(argv[0]) && CanbeFloat(argv[1]))
- ) {
- arg.SetR((D)GetAFloat(argv[0])+(D)GetAFloat(argv[1]));
- if(argchk) {
- // check argument feasibility
- }
- }
- else
- post("%s - invalid double argument (ignored)",thisName());
-}
-
-V vasp_binop::a_int(I v) { arg.SetI(v); }
-
-V vasp_binop::a_complex(I argc,const t_atom *argv)
-{
- if(
- (argc == 1 && CanbeFloat(argv[0])) ||
- (argc == 2 && CanbeFloat(argv[0]) && CanbeFloat(argv[1]))
- ) {
- arg.SetCX(GetAFloat(argv[0]),GetAFloat(argv[1]));
- if(argchk) {
- // check argument feasibility
- }
- }
- else
- post("%s - invalid complex argument (ignored)",thisName());
-}
-
-V vasp_binop::a_vector(I argc,const t_atom *argv)
-{
- error("%s - vector type not implemented",thisName());
-}
-
-
-Vasp *vasp_binop::x_work() { return tx_work(arg); }
-
-Vasp *vasp_binop::tx_work(const Argument &arg)
-{
- error("%s - no work method implemented",thisName());
- return NULL;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-// vasp_anyop class
-///////////////////////////////////////////////////////////////////////////
-
-
-vasp_anyop::vasp_anyop(I argc,const t_atom *argv,const Argument &def,BL op,UL outcode):
- vasp_tx(op)
-{
- a_list(argc,argv);
- if(arg.IsNone() && !def.IsNone()) arg = def;
-
- AddInAnything(2);
- AddOutAnything(1);
- AddOutlets(outcode);
-}
-
-V vasp_anyop::Setup(t_classid c)
-{
- FLEXT_CADDMETHOD(c,1,a_list);
- FLEXT_CADDMETHOD_(c,1,"vasp",a_list);
- FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
-
- FLEXT_CADDATTR_VAR(c,"arg",m_getarg,m_setarg);
-}
-
-V vasp_anyop::a_list(I argc,const t_atom *argv)
-{
- if(argc) {
- arg.SetList(argc,argv);
- if(arg.IsNone())
- post("%s - argument could not be evaluated (ignored)",thisName());
- else if(argchk) {
- // check argument feasibility
- }
- }
- else {
-// post("%s - Empty list argument (ignored)",thisName());
- }
-}
-
-Vasp *vasp_anyop::x_work() { return tx_work(arg); }
-
-Vasp *vasp_anyop::tx_work(const Argument &arg)
-{
- error("%s - no work method implemented",thisName());
- return NULL;
-}
-
diff --git a/externals/grill/vasp/source/classes.h b/externals/grill/vasp/source/classes.h
deleted file mode 100644
index 9096b3f8..00000000
--- a/externals/grill/vasp/source/classes.h
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
-
-VASP modular - vector assembling signal processor / objects for Max/MSP and PD
-
-Copyright (c) 2002-2007 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#ifndef __VASP_CLASSES_H
-#define __VASP_CLASSES_H
-
-#include "vasp.h"
-#include "arg.h"
-
-
-class vasp_base:
- public flext_base
-{
- FLEXT_HEADER_S(vasp_base,flext_base,Setup)
-
-public:
- enum xs_unit {
- xsu__ = -1, // don't change
- xsu_sample = 0,xsu_buffer,xsu_ms,xsu_s
- };
-
- static const t_symbol *sym_vasp;
- static const t_symbol *sym_env;
- static const t_symbol *sym_double;
- static const t_symbol *sym_complex;
- static const t_symbol *sym_vector;
- static const t_symbol *sym_radio;
-
-protected:
- vasp_base();
- virtual ~vasp_base();
-
- virtual V m_radio(I argc,const t_atom *argv); // commands for all
-
- virtual V m_help() = 0;
-
-/*
- V m_argchk(BL chk); // precheck argument on arrival
- V m_loglvl(I lvl); // noise level of log messages
- V m_unit(xs_unit u); // unit command
-*/
- BL refresh; // immediate graphics refresh?
- BL argchk; // pre-operation argument feasibility check
- BL deferred; // queue outgoing vasp messages
- xs_unit unit; // time units
- I loglvl; // noise level for log messages
-
- friend class Vasp;
-
- BL ToOutVasp(I outlet,Vasp &v);
-
-private:
- static V Setup(t_classid);
-
- FLEXT_CALLBACK_V(m_radio)
- FLEXT_CALLBACK(m_help)
-
- FLEXT_ATTRVAR_B(argchk)
- FLEXT_ATTRVAR_B(deferred)
- FLEXT_ATTRVAR_I(loglvl)
- FLEXT_ATTRVAR_E(unit,xs_unit)
-};
-
-
-class vasp_op:
- public vasp_base
-{
- FLEXT_HEADER_S(vasp_op,vasp_base,Setup)
-
-protected:
- vasp_op(BL withto = false);
-
- virtual V m_dobang(); // bang method
-
- virtual V m_vasp(I argc,const t_atom *argv); // trigger
- virtual I m_set(I argc,const t_atom *argv); // non trigger
- virtual V m_to(I argc,const t_atom *argv); // set destination
-// V m_detach(BL thr); // detached thread
-// virtual V m_prior(I dp); // thread priority +-
- virtual V m_stop(); // stop working
-
- virtual V m_update(I argc = 0,const t_atom *argv = NULL); // graphics update
-
- V m_setupd(const AtomList &l) { m_update(l.Count(),l.Atoms()); }
- V m_getupd(AtomList &l) { l(1); SetBool(l[0],refresh); }
-
- // destination vasp
- Vasp ref,dst;
-
- V m_setref(const AtomList &l) { m_set(l.Count(),l.Atoms()); }
- V m_getref(AtomList &l) { ref.MakeList(l); }
- V m_setto(const AtomList &l) { m_to(l.Count(),l.Atoms()); }
- V m_getto(AtomList &l) { dst.MakeList(l); }
-
- FLEXT_CALLBACK_V(m_to)
-
- FLEXT_CALLBACK(m_dobang)
-#ifdef FLEXT_THREADS
- FLEXT_THREAD(m_bang)
-
- ThrMutex runmtx;
- V Lock() { runmtx.Lock(); }
- V Unlock() { runmtx.Unlock(); }
-
-// thrid_t thrid;
-#else
- FLEXT_CALLBACK(m_bang)
-
- V Lock() {}
- V Unlock() {}
-#endif
- BL detach; // detached operation?
- I prior; // thread priority
-
- FLEXT_CALLBACK_V(m_vasp)
- FLEXT_CALLBACK_V(m_set)
-
- FLEXT_CALLVAR_V(m_getref,m_setref)
- FLEXT_CALLVAR_V(m_getto,m_setto)
-
- FLEXT_CALLBACK(m_stop)
-
- FLEXT_CALLVAR_V(m_getupd,m_setupd)
- FLEXT_ATTRVAR_B(detach)
- FLEXT_ATTRVAR_I(prior)
-
-private:
- static V Setup(t_classid);
-
- virtual V m_bang() = 0; // do! and output current Vasp
-};
-
-
-
-class vasp_tx:
- public vasp_op
-{
- FLEXT_HEADER(vasp_tx,vasp_op)
-
-protected:
- vasp_tx(BL withto = false);
-
- virtual V m_bang(); // do! and output current Vasp
-
- virtual Vasp *x_work() = 0;
-};
-
-
-
-
-#define VASP_SETUP(op) FLEXT_SETUP(vasp_##op);
-
-
-
-// base class for unary operations
-
-class vasp_unop:
- public vasp_tx
-{
- FLEXT_HEADER(vasp_unop,vasp_tx)
-
-protected:
- vasp_unop(BL withto = false,UL outcode = 0);
-
- virtual Vasp *x_work();
- virtual Vasp *tx_work();
-};
-
-
-// base class for binary operations
-
-class vasp_binop:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_binop,vasp_tx,Setup)
-
-protected:
- vasp_binop(I argc,const t_atom *argv,const Argument &def = Argument(),BL withto = false,UL outcode = 0);
-
- // assignment functions
- virtual V a_list(I argc,const t_atom *argv);
- /*virtual*/ V a_vasp(I argc,const t_atom *argv);
- /*virtual*/ V a_env(I argc,const t_atom *argv);
- /*virtual*/ V a_float(F f);
- /*virtual*/ V a_int(I f);
- /*virtual*/ V a_double(I argc,const t_atom *argv);
- /*virtual*/ V a_complex(I argc,const t_atom *argv);
- /*virtual*/ V a_vector(I argc,const t_atom *argv);
-
- V a_radio(I,const t_atom *) {}
-
- virtual Vasp *x_work();
- virtual Vasp *tx_work(const Argument &arg);
-
- Argument arg;
-
- V m_setarg(const AtomList &l) { a_list(l.Count(),l.Atoms()); }
- V m_getarg(AtomList &l) { arg.MakeList(l); }
-
-private:
- static V Setup(t_classid);
-
- FLEXT_CALLBACK_V(a_list)
- FLEXT_CALLBACK_V(a_vasp)
- FLEXT_CALLBACK_V(a_env)
- FLEXT_CALLBACK_1(a_float,F)
- FLEXT_CALLBACK_1(a_int,I)
- FLEXT_CALLBACK_V(a_double)
- FLEXT_CALLBACK_V(a_complex)
- FLEXT_CALLBACK_V(a_vector)
- FLEXT_CALLBACK_V(a_radio)
-
- FLEXT_CALLVAR_V(m_getarg,m_setarg)
-};
-
-
-// base class for non-parsed (list) arguments
-
-class vasp_anyop:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_anyop,vasp_tx,Setup)
-
-protected:
- vasp_anyop(I argc,const t_atom *argv,const Argument &def = Argument(),BL withto = false,UL outcode = 0);
-
- // assignment functions
- virtual V a_list(I argc,const t_atom *argv);
-
- V a_radio(I,const t_atom *) {}
-
- virtual Vasp *x_work();
- virtual Vasp *tx_work(const Argument &arg);
-
- Argument arg;
-
- V m_setarg(const AtomList &l) { a_list(l.Count(),l.Atoms()); }
- V m_getarg(AtomList &l) { arg.MakeList(l); }
-
-private:
- static V Setup(t_classid);
-
- FLEXT_CALLBACK_V(a_list)
- FLEXT_CALLBACK_V(a_radio)
-
- FLEXT_CALLVAR_V(m_getarg,m_setarg)
-};
-
-
-
-#define VASP_UNARY(name,op,to,help) \
-class vasp_##op: \
- public vasp_unop \
-{ \
- FLEXT_HEADER(vasp_##op,vasp_unop) \
-public: \
- vasp_##op(): vasp_unop(to) {} \
-protected: \
- virtual Vasp *tx_work() \
- { \
- OpParam p(thisName(),0); \
- CVasp cdst(dst),cref(ref); \
- return VaspOp::m_##op(p,cref,&cdst); \
- } \
- virtual V m_help() { post("%s - " help,thisName()); } \
-}; \
- FLEXT_LIB(name ", vasp_" #op,vasp_##op)
-
-
-#define VASP_BINARY(name,op,to,def,help) \
-class vasp_##op: \
- public vasp_binop \
-{ \
- FLEXT_HEADER(vasp_##op,vasp_binop) \
-public: \
- vasp_##op(I argc,const t_atom *argv): vasp_binop(argc,argv,def,to) {} \
-protected: \
- virtual Vasp *tx_work(const Argument &arg) \
- { \
- OpParam p(thisName(),1); \
- CVasp cdst(dst),cref(ref); \
- return VaspOp::m_##op(p,cref,arg,&cdst); \
- } \
- virtual V m_help() { post("%s - " help,thisName()); } \
-}; \
-FLEXT_LIB_V(name ", vasp_" #op,vasp_##op)
-
-
-#define VASP_ANYOP(name,op,args,to,def,help) \
-class vasp_##op: \
- public vasp_anyop \
-{ \
- FLEXT_HEADER(vasp_##op,vasp_anyop) \
-public: \
- vasp_##op(I argc,const t_atom *argv): vasp_anyop(argc,argv,def,to) {} \
-protected: \
- virtual Vasp *tx_work(const Argument &arg) \
- { \
- OpParam p(thisName(),args); \
- CVasp cdst(dst),cref(ref); \
- return VaspOp::m_##op(p,cref,arg,&cdst); \
- } \
- virtual V m_help() { post("%s - " help,thisName()); } \
-}; \
-FLEXT_LIB_V(name ", vasp_" #op,vasp_##op)
-
-#define VASP_LIB(name,cl) FLEXT_LIB(name ", " #cl,cl);
-#define VASP_LIB_V(name,cl) FLEXT_LIB_V(name ", " #cl,cl);
-
-
-#define VASP__SETUP(op) FLEXT_SETUP(vasp_##op);
-
-#endif
diff --git a/externals/grill/vasp/source/env.cpp b/externals/grill/vasp/source/env.cpp
deleted file mode 100644
index 2f0fb58b..00000000
--- a/externals/grill/vasp/source/env.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "env.h"
-#include "classes.h"
-#include "util.h"
-
-Env::Env(I argc,const t_atom *argv)
-{
- I ix = 0;
- t_symbol *v = ix < argc?flext::GetASymbol(argv[ix]):NULL;
- if(v && v == vasp_base::sym_env) ix++; // if it is "env" ignore it
-
- cnt = (argc-ix)/2;
- pos = new R[cnt];
- val = new R[cnt];
-
- R prev = -BIG;
- BL ok = true;
- for(I i = 0; i < cnt; ++i) {
- val[i] = flext::GetAFloat(argv[ix++]);
- pos[i] = flext::GetAFloat(argv[ix++]);
- if(pos[i] < prev) ok = false;
- prev = pos[i];
- }
-
- if(ix < argc) {
- post("vasp - env pos/value pairs incomplete, omitted dangling value");
- }
-
- if(!ok) Clear();
-}
-
-/*
-Env::Env(const Env &s):
- cnt(s.cnt),pos(new R[s.cnt]),val(new R[s.cnt])
-{
- for(I i = 0; i < cnt; ++i) pos[i] = s.pos[i],val[i] = s.val[i];
-}
-*/
-
-Env::~Env() { Clear(); }
-
-
-BL Env::ChkArgs(I argc,const t_atom *argv)
-{
- I ix = 0;
-
- // vasp keyword
- t_symbol *v = ix < argc?flext::GetASymbol(argv[ix]):NULL;
- if(v && v == vasp_base::sym_env) ix++; // if it is "env" ignore it
-
- while(argc > ix) {
- // check for value
- if(flext::CanbeFloat(argv[ix])) ix++;
- else
- return false;
-
- // check for position
- if(argc > ix)
- if(flext::CanbeFloat(argv[ix])) ix++;
- else
- return false;
- }
-
- return true;
-}
-
-V Env::MakeList(flext::AtomList &ret) const
-{
- ret(cnt*2+1);
- flext::SetSymbol(ret[0],vasp_base::sym_env);
- for(I i = 0; i < cnt; ++i) {
- flext::SetFloat(ret[i*2+1],val[i]);
- flext::SetFloat(ret[i*2+2],pos[i]);
- }
-}
-
-V Env::Clear()
-{
- cnt = 0;
- if(pos) delete[] pos; pos = NULL;
- if(val) delete[] val; val = NULL;
-}
-
-
-Env::Iter::Iter(const Env &bpl): bp(bpl),ppt(-BIG),npt(BIG),pvl(0),k(0) {}
-
-V Env::Iter::Init(R p)
-{
- I cnt = bp.Count();
- FLEXT_ASSERT(cnt > 0);
-
- if(p < bp.Pos(0)) {
- // position is before the head
- ix = -1;
- ppt = -BIG; pvl = bp.Val(0);
- }
- else if(p > bp.Pos(cnt-1)) {
- // position is after the tail
- ix = cnt-1;
- ppt = bp.Pos(ix); pvl = bp.Val(ix);
- }
- else {
- // somewhere in the list
- for(ix = 0; ix < cnt; ++ix)
- if(p >= bp.Pos(ix)) break;
- ppt = bp.Pos(ix); pvl = bp.Val(ix);
-
- FLEXT_ASSERT(ix < cnt);
- }
-
- if(ix >= cnt) {
- npt = BIG; nvl = pvl;
- k = 0;
- }
- else {
- npt = bp.Pos(ix+1); nvl = bp.Val(ix+1);
- k = (nvl-pvl)/(npt-ppt);
- }
-}
-
-// \todo iteration first, then calculation of k
-V Env::Iter::UpdateFwd(R p)
-{
- do {
- ppt = npt,pvl = nvl;
- if(++ix >= bp.Count()-1) npt = BIG,k = 0;
- else {
- k = ((nvl = bp.Val(ix+1))-pvl)/((npt = bp.Pos(ix+1))-ppt);
- }
- } while(p > npt);
-}
-
-// \todo iteration first, then calculation of k
-V Env::Iter::UpdateBwd(R p)
-{
- do {
- npt = ppt,nvl = pvl;
- if(--ix < 0) ppt = -BIG,k = 0;
- else {
- k = (nvl-(pvl = bp.Val(ix)))/(npt-(ppt = bp.Pos(ix)));
- }
- } while(p < ppt);
-}
diff --git a/externals/grill/vasp/source/env.h b/externals/grill/vasp/source/env.h
deleted file mode 100644
index 11ad68ab..00000000
--- a/externals/grill/vasp/source/env.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
-
-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 flext
-{
-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 MakeList(flext::AtomList &ret) const;
-
- 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
-
diff --git a/externals/grill/vasp/source/main.cpp b/externals/grill/vasp/source/main.cpp
deleted file mode 100644
index 38febd4a..00000000
--- a/externals/grill/vasp/source/main.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-
-
-const C *VASP_VERSION = "0.1.4pre";
-
-#include "opfuns.h"
-
-static V vasp_main()
-{
- post("");
- post("-----------------------------------------");
- post(" VASP modular %s ",VASP_VERSION);
- post(" vector assembling signal processor ");
- post(" (C)2002-2007 Thomas Grill ");
-#ifdef FLEXT_DEBUG
- post(" DEBUG BUILD - " __DATE__ " " __TIME__);
-#endif
- post("");
- post(" http://grrrr.org/ext ");
- post("-----------------------------------------");
- post("");
-
- // call the objects' setup routines
-
- VASP_SETUP(v); // vasp
- VASP_SETUP(multi); // vasp.m
-
- VASP_SETUP(check); // vasp.check
- VASP_SETUP(update); // vasp.update
-// VASP_SETUP(post); // vasp.post
-
- VASP_SETUP(sync); // vasp.sync
- VASP_SETUP(radio); // vasp.radio
-
- VASP_SETUP(vector); // vasp.vector
- VASP_SETUP(qvectors); // vasp.vectors?
-
- VASP_SETUP(size); // vasp.size
- VASP_SETUP(dsize); // vasp.size+
- VASP_SETUP(qsize); // vasp.size?
- VASP_SETUP(msize); // vasp.size*
- VASP_SETUP(rsize); // vasp.size/
-
- VASP_SETUP(offset); // vasp.offset
- VASP_SETUP(doffset); // vasp.offset+
- VASP_SETUP(qoffset); // vasp.offset?
-
- VASP_SETUP(frames); // vasp.frames
- VASP_SETUP(dframes); // vasp.frames+
- VASP_SETUP(qframes); // vasp.frames?
- VASP_SETUP(mframes); // vasp.frames*
- VASP_SETUP(rframes); // vasp.frames/
-
- VASP_SETUP(channel); // vasp.channel
- VASP_SETUP(qchannel); // vasp.channel?
- VASP_SETUP(qchannels); // vasp.channels?
-
- VASP_SETUP(split);
- VASP_SETUP(join);
- VASP_SETUP(spit);
- VASP_SETUP(gather);
- VASP_SETUP(part);
-
- VASP_SETUP(list);
- VASP_SETUP(nonzero);
-
- VASP_SETUP(imm); // vasp.imm
-
- VASP__SETUP(set);
- VASP__SETUP(cset);
- VASP_SETUP(copy);
- VASP_SETUP(ccopy);
-
- VASP__SETUP(add);
- VASP__SETUP(cadd);
- VASP__SETUP(sub);
- VASP__SETUP(csub);
- VASP__SETUP(subr);
- VASP__SETUP(csubr);
- VASP__SETUP(mul);
- VASP__SETUP(cmul);
- VASP__SETUP(div);
- VASP__SETUP(cdiv);
- VASP__SETUP(divr);
- VASP__SETUP(cdivr);
- VASP__SETUP(mod);
-
- VASP__SETUP(sign)
- VASP__SETUP(abs)
- VASP__SETUP(cabs)
-
- VASP_SETUP(qsum)
-
- VASP__SETUP(lwr)
- VASP__SETUP(gtr)
- VASP__SETUP(alwr)
- VASP__SETUP(agtr)
- VASP__SETUP(leq)
- VASP__SETUP(geq)
- VASP__SETUP(aleq)
- VASP__SETUP(ageq)
- VASP__SETUP(equ)
- VASP__SETUP(neq)
-
- VASP__SETUP(min)
- VASP__SETUP(rmin)
- VASP__SETUP(max)
- VASP__SETUP(rmax)
-
- VASP__SETUP(minmax)
-
- VASP_SETUP(qmin)
- VASP_SETUP(qmax)
- VASP_SETUP(qamin)
- VASP_SETUP(qamax)
- VASP_SETUP(qrmin)
- VASP_SETUP(qrmax)
-
- VASP__SETUP(gate);
- VASP__SETUP(rgate);
-// VASP__SETUP(igate);
-// VASP__SETUP(rigate);
-
- VASP_SETUP(peaks)
- VASP_SETUP(valleys)
- VASP_SETUP(rpeaks)
- VASP_SETUP(rvalleys)
-
- VASP_SETUP(qpeaks);
-
-/*
- VASP_SETUP(qvalleys);
- VASP_SETUP(qrpeaks);
- VASP_SETUP(qrvalleys);
-*/
-
- VASP__SETUP(sqr)
- VASP__SETUP(ssqr)
- VASP__SETUP(csqr)
- VASP__SETUP(sqrt)
- VASP__SETUP(ssqrt)
- VASP__SETUP(pow)
- VASP__SETUP(cpowi)
- VASP__SETUP(rpow);
- VASP__SETUP(radd);
-
- VASP__SETUP(exp)
- VASP__SETUP(log)
-
- VASP__SETUP(polar)
- VASP__SETUP(rect)
-
- VASP__SETUP(cnorm)
-// VASP__SETUP(cswap)
-// VASP__SETUP(cconj)
-
- VASP_SETUP(shift)
- VASP_SETUP(xshift)
- VASP__SETUP(rot)
- VASP__SETUP(xrot)
- VASP__SETUP(mirr)
- VASP__SETUP(xmirr)
-
- VASP__SETUP(osc)
- VASP__SETUP(mosc)
- VASP__SETUP(cosc)
- VASP__SETUP(mcosc)
- VASP__SETUP(phasor)
- VASP__SETUP(mphasor)
- VASP__SETUP(noise)
- VASP__SETUP(cnoise)
-
- VASP__SETUP(window)
- VASP__SETUP(mwindow)
- VASP__SETUP(iwindow)
- VASP__SETUP(miwindow)
- VASP__SETUP(xwindow)
- VASP__SETUP(mxwindow)
-
- VASP__SETUP(flp)
- VASP__SETUP(fhp)
-
- VASP__SETUP(int)
- VASP__SETUP(dif)
-
- VASP__SETUP(fix)
-
- VASP__SETUP(tilt)
- VASP__SETUP(xtilt)
-
- VASP__SETUP(soffset)
- VASP__SETUP(sframes)
-
- VASP__SETUP(rfft)
- VASP__SETUP(rifft)
- VASP__SETUP(cfft)
- VASP__SETUP(cifft)
-}
-
-FLEXT_LIB_SETUP(vasp,vasp_main)
-
-
-
-
-
diff --git a/externals/grill/vasp/source/main.h b/externals/grill/vasp/source/main.h
deleted file mode 100644
index d8aa8a65..00000000
--- a/externals/grill/vasp/source/main.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-
-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_H
-#define __VASP_H
-
-// enable attributes
-#define FLEXT_ATTRIBUTES 1
-
-#include <flext.h>
-
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401)
-#error You need at least flext version 0.4.1
-#endif
-
-#if defined(_MSC_VER) && !defined(FLEXT_DEBUG)
-// switch off warnings for the release build
-#pragma warning(disable: 4244)
-#endif
-
-
-#include <typeinfo>
-#include <stdlib.h>
-
-class complex;
-class vector;
-
-#if 0
- #define I int
- #define L long
- #define UL unsigned long
- #define F float
- #define D double
- #define C char
- #define BL bool
- #define V void
- #define S t_sample // type for samples
- #define R double // type for internal calculations
- #define CX complex
- #define VX vector
-#else
- typedef int I;
- typedef long L;
- typedef unsigned long UL;
- typedef float F;
- typedef double D;
- typedef char C;
- typedef bool BL;
- typedef void V;
- typedef t_sample S; // type for samples
- typedef double R; // type for internal calculations
- typedef complex CX;
- typedef vector VX;
-#endif
-
-#if FLEXT_SYS == FLEXT_SYS_PD
-// buffers are never interleaved - special optimizations may occur
-// attention: possibly obsolete when immediate file access is implemented
-#define VASP_CHN1
-#endif
-
-class complex
-{
-public:
- complex() {}
- complex(F re,F im = 0): real(re),imag(im) {}
-
- F real,imag;
-};
-
-class vector
-{
-public:
- vector(): dim(0),data(NULL) {}
- ~vector() { if(data) delete[] data; }
-
- I Dim() const { return dim; }
- F *Data() { return data; }
- const F *Data() const { return data; }
-
- F operator [](I ix) const { return data[ix]; }
- F &operator [](I ix) { return data[ix]; }
-protected:
- I dim; F *data;
-};
-
-#endif
diff --git a/externals/grill/vasp/source/mixfft.cpp b/externals/grill/vasp/source/mixfft.cpp
deleted file mode 100644
index 73d1fca7..00000000
--- a/externals/grill/vasp/source/mixfft.cpp
+++ /dev/null
@@ -1,588 +0,0 @@
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4244)
-#endif
-
-/************************************************************************
- fft(int n, double xRe[], double xIm[], double yRe[], double yIm[])
- ------------------------------------------------------------------------
- NOTE : This is copyrighted material, Not public domain. See below.
- ------------------------------------------------------------------------
- Input/output:
- int n transformation length.
- double xRe[] real part of input sequence.
- double xIm[] imaginary part of input sequence.
- double yRe[] real part of output sequence.
- double yIm[] imaginary part of output sequence.
- ------------------------------------------------------------------------
- Function:
- The procedure performs a fast discrete Fourier transform (FFT) of
- a complex sequence, x, of an arbitrary length, n. The output, y,
- is also a complex sequence of length n.
-
- y[k] = sum(x[m]*exp(-i*2*pi*k*m/n), m=0..(n-1)), k=0,...,(n-1)
-
- The largest prime factor of n must be less than or equal to the
- constant maxPrimeFactor defined below.
- ------------------------------------------------------------------------
- Author:
- Jens Joergen Nielsen For non-commercial use only.
- Bakkehusene 54 A $100 fee must be paid if used
- DK-2970 Hoersholm commercially. Please contact.
- DENMARK
-
- E-mail : jjn@get2net.dk All rights reserved. October 2000.
- Homepage : http://home.get2net.dk/jjn
- ------------------------------------------------------------------------
- Implementation notes:
- The general idea is to factor the length of the DFT, n, into
- factors that are efficiently handled by the routines.
-
- A number of short DFT's are implemented with a minimum of
- arithmetical operations and using (almost) straight line code
- resulting in very fast execution when the factors of n belong
- to this set. Especially radix-10 is optimized.
-
- Prime factors, that are not in the set of short DFT's are handled
- with direct evaluation of the DFP expression.
-
- Please report any problems to the author.
- Suggestions and improvements are welcomed.
- ------------------------------------------------------------------------
- Benchmarks:
- The Microsoft Visual C++ compiler was used with the following
- compile options:
- /nologo /Gs /G2 /W4 /AH /Ox /D "NDEBUG" /D "_DOS" /FR
- and the FFTBENCH test executed on a 50MHz 486DX :
-
- Length Time [s] Accuracy [dB]
-
- 128 0.0054 -314.8
- 256 0.0116 -309.8
- 512 0.0251 -290.8
- 1024 0.0567 -313.6
- 2048 0.1203 -306.4
- 4096 0.2600 -291.8
- 8192 0.5800 -305.1
- 100 0.0040 -278.5
- 200 0.0099 -280.3
- 500 0.0256 -278.5
- 1000 0.0540 -278.5
- 2000 0.1294 -280.6
- 5000 0.3300 -278.4
- 10000 0.7133 -278.5
- ------------------------------------------------------------------------
- The following procedures are used :
- factorize : factor the transformation length.
- transTableSetup : setup table with sofar-, actual-, and remainRadix.
- permute : permutation allows in-place calculations.
- twiddleTransf : twiddle multiplications and DFT's for one stage.
- initTrig : initialise sine/cosine table.
- fft_4 : length 4 DFT, a la Nussbaumer.
- fft_5 : length 5 DFT, a la Nussbaumer.
- fft_10 : length 10 DFT using prime factor FFT.
- fft_odd : length n DFT, n odd.
-*************************************************************************/
-
-/************************************************************************
-
- changes by Thomas Grill:
-
- - introduced REAL type for numbers
- - made functions static
- - threw fft_n functions out of twiddleTransf
- if feasible, these will be inlined by the compiler
- - changed log prints (to post)
-
-************************************************************************/
-
-#define REAL float
-extern "C" void post(const char *c,...);
-
-/************************************************************************/
-
-
-#define maxPrimeFactor 8000 // all static data should fit into 256kB of cache
-#define maxPrimeFactorDiv2 (maxPrimeFactor+1)/2
-#define maxFactorCount 100
-
-static double c3_1 = -1.5000000000000E+00; /* c3_1 = cos(2*pi/3)-1; */
-static double c3_2 = 8.6602540378444E-01; /* c3_2 = sin(2*pi/3); */
-
-static double u5 = 1.2566370614359E+00; /* u5 = 2*pi/5; */
-static double c5_1 = -1.2500000000000E+00; /* c5_1 = (cos(u5)+cos(2*u5))/2-1;*/
-static double c5_2 = 5.5901699437495E-01; /* c5_2 = (cos(u5)-cos(2*u5))/2; */
-static double c5_3 = -9.5105651629515E-01; /* c5_3 = -sin(u5); */
-static double c5_4 = -1.5388417685876E+00; /* c5_4 = -(sin(u5)+sin(2*u5)); */
-static double c5_5 = 3.6327126400268E-01; /* c5_5 = (sin(u5)-sin(2*u5)); */
-static double c8 = 7.0710678118655E-01; /* c8 = 1/sqrt(2); */
-
-static double pi;
-static int groupOffset,dataOffset,blockOffset,adr;
-static int groupNo,dataNo,blockNo,twNo;
-static double omega;
-static REAL tw_re,tw_im;
-static REAL twiddleRe[maxPrimeFactor], twiddleIm[maxPrimeFactor];
-static REAL trigRe[maxPrimeFactor], trigIm[maxPrimeFactor];
-static REAL zRe[maxPrimeFactor], zIm[maxPrimeFactor];
-static REAL vRe[maxPrimeFactorDiv2], vIm[maxPrimeFactorDiv2];
-static REAL wRe[maxPrimeFactorDiv2], wIm[maxPrimeFactorDiv2];
-
-
-static void factorize(int n, int *nFact, int fact[])
-{
- int i,j,k;
- int nRadix;
- int radices[7];
- int factors[maxFactorCount];
-
- nRadix = 6;
- radices[1]= 2;
- radices[2]= 3;
- radices[3]= 4;
- radices[4]= 5;
- radices[5]= 8;
- radices[6]= 10;
-
- if (n==1)
- {
- j=1;
- factors[1]=1;
- }
- else j=0;
- i=nRadix;
- while ((n>1) && (i>0))
- {
- if ((n % radices[i]) == 0)
- {
- n=n / radices[i];
- j=j+1;
- factors[j]=radices[i];
- }
- else i=i-1;
- }
- if (factors[j] == 2) /*substitute factors 2*8 with 4*4 */
- {
- i = j-1;
- while ((i>0) && (factors[i] != 8)) i--;
- if (i>0)
- {
- factors[j] = 4;
- factors[i] = 4;
- }
- }
- if (n>1)
- {
- for (k=2; k<sqrt((double)n)+1; k++)
- while ((n % k) == 0)
- {
- n=n / k;
- j=j+1;
- factors[j]=k;
- }
- if (n>1)
- {
- j=j+1;
- factors[j]=n;
- }
- }
- for (i=1; i<=j; i++)
- {
- fact[i] = factors[j-i+1];
- }
- *nFact=j;
-} /* factorize */
-
-/****************************************************************************
- After N is factored the parameters that control the stages are generated.
- For each stage we have:
- sofar : the product of the radices so far.
- actual : the radix handled in this stage.
- remain : the product of the remaining radices.
- ****************************************************************************/
-
-static bool transTableSetup(int sofar[], int actual[], int remain[],
- int *nFact,
- int *nPoints)
-{
- int i;
-
- factorize(*nPoints, nFact, actual);
- if (actual[1] > maxPrimeFactor)
- {
- // T.Grill - replaced the printfs by a post
- post("FFT: Prime factor of FFT length is too large (%d) - aborted",actual[1]);
- return false;
- }
-
- remain[0]=*nPoints;
- sofar[1]=1;
- remain[1]=*nPoints / actual[1];
- for (i=2; i<=*nFact; i++)
- {
- sofar[i]=sofar[i-1]*actual[i-1];
- remain[i]=remain[i-1] / actual[i];
- }
- return true;
-} /* transTableSetup */
-
-/****************************************************************************
- The sequence y is the permuted input sequence x so that the following
- transformations can be performed in-place, and the final result is the
- normal order.
- ****************************************************************************/
-
-static void permute(int nPoint, int nFact,
- int fact[], int remain[],
- REAL xRe[], REAL xIm[],
- REAL yRe[], REAL yIm[])
-
-{
- int i,j,k;
- int count[maxFactorCount];
-
- for (i=1; i<=nFact; i++) count[i]=0;
- k=0;
- for (i=0; i<=nPoint-2; i++)
- {
- yRe[i] = xRe[k];
- yIm[i] = xIm[k];
- j=1;
- k=k+remain[j];
- count[1] = count[1]+1;
- while (count[j] >= fact[j])
- {
- count[j]=0;
- k=k-remain[j-1]+remain[j+1];
- j=j+1;
- count[j]=count[j]+1;
- }
- }
- yRe[nPoint-1]=xRe[nPoint-1];
- yIm[nPoint-1]=xIm[nPoint-1];
-} /* permute */
-
-
-/****************************************************************************
- Twiddle factor multiplications and transformations are performed on a
- group of data. The number of multiplications with 1 are reduced by skipping
- the twiddle multiplication of the first stage and of the first group of the
- following stages.
- ***************************************************************************/
-
-static void initTrig(int radix)
-{
- int i;
- double w,xre,xim,xre1,xim1;
-
- w=2*pi/radix;
- trigRe[0]=1; trigIm[0]=0;
- xre1=xre=cos(w);
- xim1=xim=-sin(w);
- trigRe[1]=xre; trigIm[1]=xim;
- for (i=2; i<radix; i++)
- {
- trigRe[i] = xre1 = xre*trigRe[i-1] - xim*trigIm[i-1];
- trigIm[i] = xim1 = xim*trigRe[i-1] + xre*trigIm[i-1];
-// trigRe[i] = xre1 = xre*xre1 - xim*xim1;
-// trigIm[i] = xim1 = xim*xre1 + xre*xim1;
- }
-} /* initTrig */
-
-static void fft_2(REAL aRe[], REAL aIm[])
-{
- double gem;
- gem=zRe[0] + zRe[1];
- zRe[1]=zRe[0] - zRe[1]; zRe[0]=gem;
- gem=zIm[0] + zIm[1];
- zIm[1]=zIm[0] - zIm[1]; zIm[0]=gem;
-}
-
-static void fft_3(REAL aRe[], REAL aIm[])
-{
- REAL t1_re,t1_im;
- REAL m2_re,m2_im;
- REAL m1_re,m1_im;
- REAL s1_re,s1_im;
- t1_re=zRe[1] + zRe[2]; t1_im=zIm[1] + zIm[2];
- zRe[0]=zRe[0] + t1_re; zIm[0]=zIm[0] + t1_im;
- m1_re=c3_1*t1_re; m1_im=c3_1*t1_im;
- m2_re=c3_2*(zIm[1] - zIm[2]);
- m2_im=c3_2*(zRe[2] - zRe[1]);
- s1_re=zRe[0] + m1_re; s1_im=zIm[0] + m1_im;
- zRe[1]=s1_re + m2_re; zIm[1]=s1_im + m2_im;
- zRe[2]=s1_re - m2_re; zIm[2]=s1_im - m2_im;
-}
-
-static void fft_4(REAL aRe[], REAL aIm[])
-{
- REAL t1_re,t1_im, t2_re,t2_im;
- REAL m2_re,m2_im, m3_re,m3_im;
-
- t1_re=aRe[0] + aRe[2]; t1_im=aIm[0] + aIm[2];
- t2_re=aRe[1] + aRe[3]; t2_im=aIm[1] + aIm[3];
-
- m2_re=aRe[0] - aRe[2]; m2_im=aIm[0] - aIm[2];
- m3_re=aIm[1] - aIm[3]; m3_im=aRe[3] - aRe[1];
-
- aRe[0]=t1_re + t2_re; aIm[0]=t1_im + t2_im;
- aRe[2]=t1_re - t2_re; aIm[2]=t1_im - t2_im;
- aRe[1]=m2_re + m3_re; aIm[1]=m2_im + m3_im;
- aRe[3]=m2_re - m3_re; aIm[3]=m2_im - m3_im;
-} /* fft_4 */
-
-
-static void fft_5(REAL aRe[], REAL aIm[])
-{
- REAL t1_re,t1_im, t2_re,t2_im, t3_re,t3_im;
- REAL t4_re,t4_im, t5_re,t5_im;
- REAL m2_re,m2_im, m3_re,m3_im, m4_re,m4_im;
- REAL m1_re,m1_im, m5_re,m5_im;
- REAL s1_re,s1_im, s2_re,s2_im, s3_re,s3_im;
- REAL s4_re,s4_im, s5_re,s5_im;
-
- t1_re=aRe[1] + aRe[4]; t1_im=aIm[1] + aIm[4];
- t2_re=aRe[2] + aRe[3]; t2_im=aIm[2] + aIm[3];
- t3_re=aRe[1] - aRe[4]; t3_im=aIm[1] - aIm[4];
- t4_re=aRe[3] - aRe[2]; t4_im=aIm[3] - aIm[2];
- t5_re=t1_re + t2_re; t5_im=t1_im + t2_im;
- aRe[0]=aRe[0] + t5_re; aIm[0]=aIm[0] + t5_im;
- m1_re=c5_1*t5_re; m1_im=c5_1*t5_im;
- m2_re=c5_2*(t1_re - t2_re); m2_im=c5_2*(t1_im - t2_im);
-
- m3_re=-c5_3*(t3_im + t4_im); m3_im=c5_3*(t3_re + t4_re);
- m4_re=-c5_4*t4_im; m4_im=c5_4*t4_re;
- m5_re=-c5_5*t3_im; m5_im=c5_5*t3_re;
-
- s3_re=m3_re - m4_re; s3_im=m3_im - m4_im;
- s5_re=m3_re + m5_re; s5_im=m3_im + m5_im;
- s1_re=aRe[0] + m1_re; s1_im=aIm[0] + m1_im;
- s2_re=s1_re + m2_re; s2_im=s1_im + m2_im;
- s4_re=s1_re - m2_re; s4_im=s1_im - m2_im;
-
- aRe[1]=s2_re + s3_re; aIm[1]=s2_im + s3_im;
- aRe[2]=s4_re + s5_re; aIm[2]=s4_im + s5_im;
- aRe[3]=s4_re - s5_re; aIm[3]=s4_im - s5_im;
- aRe[4]=s2_re - s3_re; aIm[4]=s2_im - s3_im;
-} /* fft_5 */
-
-static void fft_8()
-{
- REAL aRe[4], aIm[4], bRe[4], bIm[4], gem;
-
- aRe[0] = zRe[0]; bRe[0] = zRe[1];
- aRe[1] = zRe[2]; bRe[1] = zRe[3];
- aRe[2] = zRe[4]; bRe[2] = zRe[5];
- aRe[3] = zRe[6]; bRe[3] = zRe[7];
-
- aIm[0] = zIm[0]; bIm[0] = zIm[1];
- aIm[1] = zIm[2]; bIm[1] = zIm[3];
- aIm[2] = zIm[4]; bIm[2] = zIm[5];
- aIm[3] = zIm[6]; bIm[3] = zIm[7];
-
- fft_4(aRe, aIm); fft_4(bRe, bIm);
-
- gem = c8*(bRe[1] + bIm[1]);
- bIm[1] = c8*(bIm[1] - bRe[1]);
- bRe[1] = gem;
- gem = bIm[2];
- bIm[2] =-bRe[2];
- bRe[2] = gem;
- gem = c8*(bIm[3] - bRe[3]);
- bIm[3] =-c8*(bRe[3] + bIm[3]);
- bRe[3] = gem;
-
- zRe[0] = aRe[0] + bRe[0]; zRe[4] = aRe[0] - bRe[0];
- zRe[1] = aRe[1] + bRe[1]; zRe[5] = aRe[1] - bRe[1];
- zRe[2] = aRe[2] + bRe[2]; zRe[6] = aRe[2] - bRe[2];
- zRe[3] = aRe[3] + bRe[3]; zRe[7] = aRe[3] - bRe[3];
-
- zIm[0] = aIm[0] + bIm[0]; zIm[4] = aIm[0] - bIm[0];
- zIm[1] = aIm[1] + bIm[1]; zIm[5] = aIm[1] - bIm[1];
- zIm[2] = aIm[2] + bIm[2]; zIm[6] = aIm[2] - bIm[2];
- zIm[3] = aIm[3] + bIm[3]; zIm[7] = aIm[3] - bIm[3];
-} /* fft_8 */
-
-static void fft_10()
-{
- REAL aRe[5], aIm[5], bRe[5], bIm[5];
-
- aRe[0] = zRe[0]; bRe[0] = zRe[5];
- aRe[1] = zRe[2]; bRe[1] = zRe[7];
- aRe[2] = zRe[4]; bRe[2] = zRe[9];
- aRe[3] = zRe[6]; bRe[3] = zRe[1];
- aRe[4] = zRe[8]; bRe[4] = zRe[3];
-
- aIm[0] = zIm[0]; bIm[0] = zIm[5];
- aIm[1] = zIm[2]; bIm[1] = zIm[7];
- aIm[2] = zIm[4]; bIm[2] = zIm[9];
- aIm[3] = zIm[6]; bIm[3] = zIm[1];
- aIm[4] = zIm[8]; bIm[4] = zIm[3];
-
- fft_5(aRe, aIm); fft_5(bRe, bIm);
-
- zRe[0] = aRe[0] + bRe[0]; zRe[5] = aRe[0] - bRe[0];
- zRe[6] = aRe[1] + bRe[1]; zRe[1] = aRe[1] - bRe[1];
- zRe[2] = aRe[2] + bRe[2]; zRe[7] = aRe[2] - bRe[2];
- zRe[8] = aRe[3] + bRe[3]; zRe[3] = aRe[3] - bRe[3];
- zRe[4] = aRe[4] + bRe[4]; zRe[9] = aRe[4] - bRe[4];
-
- zIm[0] = aIm[0] + bIm[0]; zIm[5] = aIm[0] - bIm[0];
- zIm[6] = aIm[1] + bIm[1]; zIm[1] = aIm[1] - bIm[1];
- zIm[2] = aIm[2] + bIm[2]; zIm[7] = aIm[2] - bIm[2];
- zIm[8] = aIm[3] + bIm[3]; zIm[3] = aIm[3] - bIm[3];
- zIm[4] = aIm[4] + bIm[4]; zIm[9] = aIm[4] - bIm[4];
-} /* fft_10 */
-
-static void fft_odd(int radix)
-{
- REAL rere, reim, imre, imim;
- int i,j,k,n,max;
-
- n = radix;
- max = (n + 1)/2;
- for (j=1; j < max; j++)
- {
- vRe[j] = zRe[j] + zRe[n-j];
- vIm[j] = zIm[j] - zIm[n-j];
- wRe[j] = zRe[j] - zRe[n-j];
- wIm[j] = zIm[j] + zIm[n-j];
- }
-
- for (j=1; j < max; j++)
- {
- zRe[j]=zRe[0];
- zIm[j]=zIm[0];
- zRe[n-j]=zRe[0];
- zIm[n-j]=zIm[0];
- k=j;
- for (i=1; i < max; i++)
- {
- rere = trigRe[k] * vRe[i];
- imim = trigIm[k] * vIm[i];
- reim = trigRe[k] * wIm[i];
- imre = trigIm[k] * wRe[i];
-
- zRe[n-j] += rere + imim;
- zIm[n-j] += reim - imre;
- zRe[j] += rere - imim;
- zIm[j] += reim + imre;
-
- k = k + j;
- if (k >= n) k = k - n;
- }
- }
- for (j=1; j < max; j++)
- {
- zRe[0]=zRe[0] + vRe[j];
- zIm[0]=zIm[0] + wIm[j];
- }
-} /* fft_odd */
-
-
-static void twiddleTransf(int sofarRadix, int radix, int remainRadix,
- REAL yRe[], REAL yIm[])
-
-{ /* twiddleTransf */
- double cosw, sinw, gem;
-
- initTrig(radix);
- omega = 2*pi/(double)(sofarRadix*radix);
- cosw = cos(omega);
- sinw = -sin(omega);
- tw_re = 1.0;
- tw_im = 0;
- dataOffset=0;
- groupOffset=dataOffset;
- adr=groupOffset;
- for (dataNo=0; dataNo<sofarRadix; dataNo++)
- {
- if (sofarRadix>1)
- {
- twiddleRe[0] = 1.0;
- twiddleIm[0] = 0.0;
- twiddleRe[1] = tw_re;
- twiddleIm[1] = tw_im;
- for (twNo=2; twNo<radix; twNo++)
- {
- twiddleRe[twNo]=tw_re*twiddleRe[twNo-1]
- - tw_im*twiddleIm[twNo-1];
- twiddleIm[twNo]=tw_im*twiddleRe[twNo-1]
- + tw_re*twiddleIm[twNo-1];
- }
- gem = cosw*tw_re - sinw*tw_im;
- tw_im = sinw*tw_re + cosw*tw_im;
- tw_re = gem;
- }
- for (groupNo=0; groupNo<remainRadix; groupNo++)
- {
- if ((sofarRadix>1) && (dataNo > 0))
- {
- zRe[0]=yRe[adr];
- zIm[0]=yIm[adr];
- blockNo=1;
- do {
- adr = adr + sofarRadix;
- zRe[blockNo]= twiddleRe[blockNo] * yRe[adr]
- - twiddleIm[blockNo] * yIm[adr];
- zIm[blockNo]= twiddleRe[blockNo] * yIm[adr]
- + twiddleIm[blockNo] * yRe[adr];
-
- blockNo++;
- } while (blockNo < radix);
- }
- else
- for (blockNo=0; blockNo<radix; blockNo++)
- {
- zRe[blockNo]=yRe[adr];
- zIm[blockNo]=yIm[adr];
- adr=adr+sofarRadix;
- }
- switch(radix) {
- // T.Grill - replaced the inlined code by their function counterparts
- case 2 : fft_2(zRe,zIm); break;
- case 3 : fft_3(zRe,zIm); break;
- case 4 : fft_4(zRe,zIm); break;
- case 5 : fft_5(zRe,zIm); break;
- case 8 : fft_8(); break;
- case 10 : fft_10(); break;
- default : fft_odd(radix); break;
- }
- adr=groupOffset;
- for (blockNo=0; blockNo<radix; blockNo++)
- {
- yRe[adr]=zRe[blockNo]; yIm[adr]=zIm[blockNo];
- adr=adr+sofarRadix;
- }
- groupOffset=groupOffset+sofarRadix*radix;
- adr=groupOffset;
- }
- dataOffset=dataOffset+1;
- groupOffset=dataOffset;
- adr=groupOffset;
- }
-} /* twiddleTransf */
-
-bool mixfft(int n, REAL *xRe, REAL *xIm,REAL *yRe, REAL *yIm)
-{
- int sofarRadix[maxFactorCount],
- actualRadix[maxFactorCount],
- remainRadix[maxFactorCount];
- int nFactor;
- int count;
-
- pi = 4*atan(1.);
-
- if(!transTableSetup(sofarRadix, actualRadix, remainRadix, &nFactor, &n)) return false;
- permute(n, nFactor, actualRadix, remainRadix, xRe, xIm, yRe, yIm);
-
- for (count=1; count<=nFactor; count++)
- twiddleTransf(sofarRadix[count], actualRadix[count], remainRadix[count],
- yRe, yIm);
- return true;
-} /* fft */
-
diff --git a/externals/grill/vasp/source/obj_chns.cpp b/externals/grill/vasp/source/obj_chns.cpp
deleted file mode 100644
index 1e7dfb67..00000000
--- a/externals/grill/vasp/source/obj_chns.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-#include "buflib.h"
-
-
-/*! \class vasp_channel
- \remark \b vasp.channel
- \brief Sets channel index of vasp.
- \since 0.0.8
- \param cmdln.1 int - index of vasp vector
- \param inlet vasp - is stored and indexed vasp vector output
- \param inlet bang - triggers indexed vasp vector output
- \param inlet set - vasp to be stored (and not immediately output)
- \retval outlet modified vasp
-*/
-class vasp_channel:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_channel,vasp_tx,Setup)
-
-public:
- vasp_channel(I argc,const t_atom *argv):
- ix(0)
- {
- if(argc >= 1 && CanbeInt(argv[0]))
- ix = GetAInt(argv[0]);
- else if(argc)
- post("%s - Index argument invalid -> set to 0",thisName());
-
- AddInAnything(2);
- AddOutAnything();
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_ix);
- FLEXT_CADDATTR_VAR(c,"index",ix,m_ix);
- }
-
- V m_ix(I i) { ix = i; }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- ret->Channel(ix);
- return ret;
- }
-
- virtual V m_help() { post("%s - Set channel index of vectors in vasp",thisName()); }
-
-protected:
- I ix;
-
-private:
- FLEXT_CALLBACK_I(m_ix);
- FLEXT_CALLSET_I(m_ix);
- FLEXT_ATTRGET_I(ix);
-};
-
-VASP_LIB_V("vasp.channel vasp.c",vasp_channel)
-
-
-
-/*! \class vasp_qc
- \remark \b vasp.c?
- \brief Gets channel index of a vasp.
- \since 0.0.8
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet int - channel index of stored vasp
-
- \note Always returns index of 0th vasp
- \note No output for invalid vasp?
-*/
-class vasp_qchannel:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qchannel,vasp_op)
-
-public:
- vasp_qchannel()
- {
- AddInAnything();
- AddOutInt();
- }
-
- virtual V m_bang()
- {
- if(ref.Ok()) {
- if(ref.Vectors() > 1)
- post("%s - more vectors in vasp, only considering first",thisName());
-
- ToOutInt(0,ref.Vector(0).Channel());
- }
- else
- post("%s - Invalid vasp, no output",thisName());
- }
-
- virtual V m_help() { post("%s - Get channel index of 0th vector in vasp",thisName()); }
-};
-
-VASP_LIB("vasp.channel? vasp.c?",vasp_qchannel)
-
-
-/*! \class vasp_qchannels
- \remark \b vasp.channels?
- \brief Gets number of channels of a vasp.
- \since 0.1.3
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet int - channels of stored vasp
-
- \note No output for invalid vasp?
-*/
-class vasp_qchannels:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qchannels,vasp_op)
-
-public:
- vasp_qchannels()
- {
- AddInAnything();
- AddOutInt();
- }
-
- virtual V m_bang()
- {
- if(ref.Ok()) {
- if(ref.Vectors() > 1)
- post("%s - more vectors in vasp, only considering first",thisName());
-
- VBuffer *buf = BufLib::Get(ref.Vector(0).Symbol());
- ToOutInt(0,buf->Channels());
- delete buf;
- }
- else
- post("%s - Invalid vasp, no output",thisName());
- }
-
- virtual V m_help() { post("%s - Get channel index of 0th vector in vasp",thisName()); }
-};
-
-VASP_LIB("vasp.channels?",vasp_qchannels)
-
-
-
diff --git a/externals/grill/vasp/source/obj_frames.cpp b/externals/grill/vasp/source/obj_frames.cpp
deleted file mode 100644
index 875bcdc6..00000000
--- a/externals/grill/vasp/source/obj_frames.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_frames
- \remark \b vasp.frames
- \brief Sets frame count of vasp.
- \since 0.0.1
- \param cmdln.1 [_time=0] - frame count in time units
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _time - frame count in time units
- \retval outlet vasp - modified vasp
-
- \todo Implement unit processing.
-*/
-class vasp_frames:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_frames,vasp_tx,Setup)
-
-public:
- vasp_frames(I argc,const t_atom *argv,BL abs = true):
- frms(0),setf(false)
- {
- if(argc && CanbeFloat(argv[0]))
- m_arg(GetAFloat(argv[0]));
- else if(argc) {
- post("%s - argument invalid -> ignored",thisName());
- }
-
- AddInAnything();
- AddInFloat();
- AddOutAnything();
-
- if(abs) FLEXT_ADDATTR_VAR("frames",frms,m_arg);
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_arg);
- }
-
- virtual V m_arg(F f)
- {
- frms = (I)f; //! \todo unit processing
- setf = true;
- }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(setf) ret->Frames(frms);
- return ret;
- }
-
- virtual V m_help() { post("%s - Set a vasp's frame count",thisName()); }
-protected:
- I frms;
- BL setf;
-
-private:
- FLEXT_CALLBACK_F(m_arg);
- FLEXT_CALLSET_I(m_arg);
- FLEXT_ATTRGET_I(frms);
-};
-
-VASP_LIB_V("vasp.frames vasp.f",vasp_frames)
-
-
-
-
-/*! \class vasp_dframes
- \remark \b vasp.frames+
- \brief Sets frame count of vasp differentially.
- \since 0.0.1
- \param cmdln.1 [_time=0] - increase of frame count in time units
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _time - increase of frame count in time units
- \retval outlet vasp - modified vasp
-
- \todo Implement unit processing.
-*/
-class vasp_dframes:
- public vasp_frames
-{
- FLEXT_HEADER(vasp_dframes,vasp_frames)
-
-public:
- vasp_dframes(I argc,const t_atom *argv): vasp_frames(argc,argv) {}
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(setf) ret->FramesD(frms);
- return ret;
- }
-
- virtual V m_help() { post("%s - Raise/lower a vasp's frame count",thisName()); }
-};
-
-VASP_LIB_V("vasp.frames+ vasp.f+",vasp_dframes)
-
-
-
-/*! \class vasp_mframes
- \remark \b vasp.frames*
- \brief Sets frame count of vasp by a factor
- \since 0.0.6
- \param cmdln.1 [_number=1] - multiply of frame count
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _number - multiply of frame count
- \retval outlet vasp - modified vasp
-*/
-class vasp_mframes:
- public vasp_frames
-{
- FLEXT_HEADER_S(vasp_mframes,vasp_frames,Setup)
-
-public:
- vasp_mframes(I argc,const t_atom *argv):
- vasp_frames(argc,argv,false)
- {
- if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0]));
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDATTR_VAR(c,"factor",factor,m_arg);
- }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(setf) ret->FramesM(factor);
- return ret;
- }
-
- virtual V m_help() { post("%s - Multiply a vasp's frame count",thisName()); }
-
- virtual V m_arg(F f)
- {
- factor = f;
- setf = true;
- }
-
-protected:
- F factor;
- FLEXT_CALLSET_F(m_arg);
- FLEXT_ATTRGET_F(factor);
-};
-
-VASP_LIB_V("vasp.frames* vasp.f*",vasp_mframes)
-
-
-
-/*! \class vasp_rframes
- \remark \b vasp.frames/
- \brief Sets frame count of vasp by a divisor
- \since 0.0.6
- \param cmdln.1 [_number=1] - multiply of frame count
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _number - divisor of frame count
- \retval outlet vasp - modified vasp
-*/
-class vasp_rframes:
- public vasp_mframes
-{
- FLEXT_HEADER(vasp_rframes,vasp_mframes)
-
-public:
- vasp_rframes(I argc,const t_atom *argv): vasp_mframes(argc,argv) {}
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(setf) ret->FramesR(factor);
- return ret;
- }
-
- virtual V m_help() { post("%s - Divide a vasp's frame count",thisName()); }
-};
-
-VASP_LIB_V("vasp.frames/ vasp.f/",vasp_rframes)
-
-
-
-/*! \class vasp_qframes
- \remark \b vasp.frames?
- \brief Get frame count in time units
- \since 0.0.1
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet _time - frame count of vasp in time units
-
- \note Outputs 0 if vasp is undefined or invalid
-
- \todo Implement unit processing
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
-*/
-class vasp_qframes:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qframes,vasp_op)
-
-public:
-
- vasp_qframes()
- {
- AddInAnything();
- AddOutInt();
- }
-
- virtual V m_bang() { ToOutInt(0,ref.ChkFrames()); } //! \todo unit processing
-
- virtual V m_help() { post("%s - Get a vasp's frame count",thisName()); }
-};
-
-VASP_LIB("vasp.frames? vasp.f?",vasp_qframes)
-
-
diff --git a/externals/grill/vasp/source/obj_imm.cpp b/externals/grill/vasp/source/obj_imm.cpp
deleted file mode 100644
index 258d5049..00000000
--- a/externals/grill/vasp/source/obj_imm.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file vasp_imm.cpp
- \brief Definitions for immediate vasps
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-#include "buflib.h"
-#include "oploop.h"
-
-
-/*! \class vasp_imm
- \remark \b vasp.imm
- \brief Get vasp immediate.
- \since 0.0.6
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.1 frames - minimum frame length
- \param inlet.2 int - minimum frame length
- \retval outlet vasp! - vasp immediate
-
-*/
-class vasp_imm:
- public vasp_op
-{
- FLEXT_HEADER_S(vasp_imm,vasp_op,Setup)
-
-public:
- vasp_imm(I argc,const t_atom *argv):
- frms(0),zero(true)
- {
- if(argc >= 1 && CanbeInt(argv[0]))
- m_frames(GetAInt(argv[0]));
- else if(argc)
- post("%s - Frame count argument invalid -> ignored",thisName());
-
- AddInAnything();
- AddInInt();
- AddOutAnything();
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_frames);
- FLEXT_CADDATTR_VAR(c,"frames",frms,m_frames);
- FLEXT_CADDATTR_VAR1(c,"zero",zero);
- }
-
- V m_frames(I n) { frms = n; }
-
- virtual V m_bang()
- {
- if(!ref.Ok() || !ref.Check()) {
-/*
- if(!frms)
- post("%s - No length defined!",thisName());
- else
-*/
- {
- ImmBuf ibuf(frms,zero);
- Vasp ret(frms,Vasp::Ref(ibuf));
- ToOutVasp(0,ret);
- }
- }
- else if(ref.Vectors() > 1)
- post("%s - More than one vector in vasp!",thisName());
- else {
- VBuffer *buf = ref.Buffer(0);
- const I len = buf->Length(),chns = buf->Channels();
-
- // size of memory reservation (at least frms samples)
- const I rlen = frms > len?frms:len;
-
- ImmBuf imm(rlen,false);
-
- S *dst = imm.Pointer();
- const S *src = buf->Pointer();
-
-// post("!copy: src: %p,%i,%i -> dst: %p,%i",src,len,chns,dst,rlen);
-
- register int i;
- _DE_LOOP(i,len, ( dst[i] = *src,src += chns ) )
- if(zero && rlen > len) ZeroSamples(dst+len,rlen-len);
-
- Vasp::Ref vr(imm);
-
-// post("!vr: %s,%i",vr.Ok()?vr.Symbol().Name():"***",vr.Offset());
-
- Vasp ret(len,vr);
- ToOutVasp(0,ret);
-
- delete buf;
- }
- }
-
- virtual V m_help() { post("%s - Get immediate vasp vectors",thisName()); }
-
-protected:
-
- I frms;
- BL zero;
-
-private:
- FLEXT_CALLBACK_I(m_frames)
- FLEXT_CALLSET_I(m_frames);
- FLEXT_ATTRGET_I(frms);
- FLEXT_ATTRVAR_B(zero);
-};
-
-VASP_LIB_V("vasp.imm vasp.!",vasp_imm)
-
-
diff --git a/externals/grill/vasp/source/obj_offs.cpp b/externals/grill/vasp/source/obj_offs.cpp
deleted file mode 100644
index 6e1a584e..00000000
--- a/externals/grill/vasp/source/obj_offs.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_offset
- \remark \b vasp.offset
- \brief Sets offset of vasp vectors.
- \since 0.0.1
- \param cmdln.1 [_time=0] - offset into buffer(s)
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _time - offset into buffer(s)
- \retval outlet vasp - modified vasp
-
- \attention Normally vasp vectors have individual offsets - this operations sets all the offsets to equal values.
- \todo Implement unit processing.
-*/
-class vasp_offset:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_offset,vasp_tx,Setup)
-
-public:
- vasp_offset(I argc,const t_atom *argv):
- offs(0),seto(false)
- {
- if(argc >= 1 && CanbeFloat(argv[0]))
- m_offs(GetAFloat(argv[0]));
- else if(argc)
- post("%s - Offset argument invalid -> ignored",thisName());
-
- AddInAnything();
- AddInFloat();
- AddOutAnything();
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_offs);
- FLEXT_CADDATTR_VAR(c,"frames",offs,m_offs);
- }
-
- V m_offs(F o)
- {
- offs = (I)o; //! \todo unit processing
- seto = true;
- }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(seto) ret->Offset(offs);
- return ret;
- }
-
- virtual V m_help() { post("%s - Set a vasp's offset(s) into the vector buffers",thisName()); }
-protected:
- I offs;
- BL seto;
-
-private:
- FLEXT_CALLBACK_F(m_offs);
- FLEXT_CALLSET_I(m_offs);
- FLEXT_ATTRGET_I(offs);
-};
-
-VASP_LIB_V("vasp.offset vasp.o",vasp_offset)
-
-
-
-
-/*! \class vasp_doffset
- \remark \b vasp.offset+
- \brief Sets offset of vasp vectors differentially.
- \since 0.0.1
- \param cmdln.1 [_time=0] - increase offset of into buffer(s)
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _time - increase of offset into buffer(s)
- \retval outlet vasp - modified vasp
-
- \todo Implement unit processing
-*/
-class vasp_doffset:
- public vasp_offset
-{
- FLEXT_HEADER(vasp_doffset,vasp_offset)
-
-public:
- vasp_doffset(I argc,const t_atom *argv): vasp_offset(argc,argv) {}
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(seto) ret->OffsetD(offs);
- return ret;
- }
-
- virtual V m_help() { post("%s - Shift a vasp's offset(s) into the vector buffers",thisName()); }
-};
-
-VASP_LIB_V("vasp.offset+ vasp.o+",vasp_doffset)
-
-
-
-/*! \class vasp_qoffset
- \remark \b vasp.offset?
- \brief Get offset of singled vector vasp.
- \since 0.0.1
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet _time - offset into vector buffer
-
- \note Outputs 0 if vasp is undefined or invalid
- \note Only works for a vasp with one vector. No output otherwise.
-
- \todo Implement unit processing
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
-*/
-class vasp_qoffset:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qoffset,vasp_op)
-
-public:
-
- vasp_qoffset()
- {
- AddInAnything();
-// AddOutAnything();
- AddOutFloat();
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok())
- post("%s - Invalid vasp!",thisName());
- else if(ref.Vectors() > 1)
- post("%s - More than one vector in vasp!",thisName());
- else {
- I o = 0;
- if(ref.Vectors() == 1) {
- o = ref.Vector(0).Offset();
- if(o < 0) o = 0;
- else {
- VBuffer *buf = ref.Buffer(0);
- if(buf) {
- I f = buf->Frames();
- if(o > f) o = f;
- delete buf;
- }
- }
- }
- //! \todo unit processing
-// ToOutVasp(0,ref);
- ToOutFloat(0,o);
- }
- }
-
- virtual V m_help() { post("%s - Get a single vectored vasp's offset into the buffer",thisName()); }
-};
-
-VASP_LIB("vasp.offset? vasp.o?",vasp_qoffset)
-
diff --git a/externals/grill/vasp/source/obj_part.cpp b/externals/grill/vasp/source/obj_part.cpp
deleted file mode 100644
index 59c79db3..00000000
--- a/externals/grill/vasp/source/obj_part.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_part
- \remark \b vasp.part
- \brief Gets parts of vasp vectors.
- \since 0.0.1
- \param cmdln.1 list - list of part lengts
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 list - list of part lengts
- \retval outlet.1 vasp - consecutive vasp parts
- \retval outlet.2 vasp - remainder
-
- \todo Implement unit processing.
- \remarks Output zero length vasps?
-*/
-class vasp_part:
- public vasp_op
-{
- FLEXT_HEADER_S(vasp_part,vasp_op,Setup)
-
-public:
- vasp_part(I argc,const t_atom *argv):
- parts(0),part(NULL)
- {
- m_part(argc,argv);
-
- AddInAnything(2);
- AddOutAnything(2);
- }
-
- ~vasp_part() { if(part) delete[] part; }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD_(c,1,"list",m_part);
- FLEXT_CADDATTR_VAR(c,"parts",m_getpart,m_setpart);
- }
-
- V m_part(I argc,const t_atom *argv)
- {
- if(part) delete[] part; parts = 0;
- part = new I[argc];
- for(I i = 0; i < argc; ++i) {
- BL warn = false;
- I p = (I)GetAFloat(argv[i]); // \todo unit processing
- if(p < 0 && !warn) {
- post("%s - invalid part length(s) -> set to 0",thisName());
- p = 0; warn = true;
- }
- part[i] = p; ++parts;
- }
- }
-
- V m_getpart(AtomList &ret)
- {
- ret(parts);
- for(I i = 0; i < parts; ++i) SetInt(ret[i],part[i]);
- }
-
- V m_setpart(const AtomList &ret) { m_part(ret.Count(),ret.Atoms()); }
-
- virtual V m_bang()
- {
- if(!ref.Ok()) {
- post("%s - Invalid vasp!",thisName());
- return;
- }
-
- I fr = ref.ChkFrames(),o = 0,f = 0;
- for(I i = 0; i < parts && (fr < 0 || fr); ++i) {
- I p = part[i];
- if(fr >= 0) { p = min(p,fr); fr -= p; }
-
- Vasp ret(ref);
- ret.Frames(p);
- ret.OffsetD(o);
- ToOutVasp(0,ret);
-
- o += p;
- }
-
- if(fr) {
- Vasp ret(ref);
- ret.Frames(fr);
- ret.OffsetD(o);
- ToOutVasp(1,ret);
- }
- }
-
- virtual V m_help() { post("%s - Return consecutive vasps with lengths given by argument list",thisName()); }
-protected:
- I parts,*part;
-
- FLEXT_CALLBACK_V(m_part)
- FLEXT_CALLVAR_V(m_getpart,m_setpart);
-};
-
-VASP_LIB_V("vasp.part",vasp_part)
-
-
diff --git a/externals/grill/vasp/source/obj_peaks.cpp b/externals/grill/vasp/source/obj_peaks.cpp
deleted file mode 100644
index 2a22979b..00000000
--- a/externals/grill/vasp/source/obj_peaks.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-#include <math.h>
-
-
-/*! \class vasp_qpeaks
- \remark \b vasp.peaks?
- \brief Get most pronounced peaks of a single vasp vector.
- \since 0.0.6
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet.0 list - peak positions
- \retval outlet.1 list - peak values
-
- \note Outputs nothing if vasp is undefined or invalid
- \note Only works for a vasp with one vector. No output otherwise.
- \todo Units for peak position list
-*/
-class vasp_qpeaks:
- public vasp_op
-{
- FLEXT_HEADER_S(vasp_qpeaks,vasp_op,Setup)
-
-public:
- vasp_qpeaks(I argc,const t_atom *argv):
- peaks(1)
- {
- if(argc >= 1 && CanbeInt(argv[0]))
- m_peaks(GetAInt(argv[0]));
- else if(argc)
- post("%s - Number argument invalid -> ignored",thisName());
-
- AddInAnything();
- AddInInt();
- AddOutAnything(2);
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_peaks);
- FLEXT_CADDATTR_VAR(c,"peaks",peaks,m_peaks);
- }
-
- V m_peaks(I n) { peaks = n; }
-
- virtual V m_bang()
- {
- if(!ref.Ok())
- post("%s - Invalid vasp!",thisName());
- else if(ref.Vectors() > 1)
- post("%s - More than one vector in vasp!",thisName());
- else {
- VBuffer *buf = ref.Buffer(0);
- I i,cnt = buf->Length(),pkfnd = 0;
- S *p = buf->Pointer();
-
- I mxpk = min(cnt,peaks);
- t_atom *pos = new t_atom[mxpk],*lst = new t_atom[mxpk];
- for(i = 0; i < mxpk; ++i) SetFloat(lst[i],0);
-
- for(i = 0; i < cnt; ++i) {
- const F v = fabs(p[i]);
-
- if(v && v > GetFloat(lst[mxpk-1])) {
- I ix;
-
- for(ix = min(pkfnd-1,mxpk-1); ix >= 0; --ix) {
- if(v > GetFloat(lst[ix])) {
- if(ix < mxpk-1) {
- pos[ix+1] = pos[ix];
- lst[ix+1] = lst[ix];
- }
- }
- else break;
- }
- ++ix;
-
- SetFloat(pos[ix],i);
- SetFloat(lst[ix],v);
-
- if(++pkfnd > mxpk) pkfnd = mxpk;
- }
- }
-
- ToOutAnything(0,sym_list,pkfnd,pos);
- ToOutAnything(1,sym_list,pkfnd,lst);
- delete[] pos;
- delete[] lst;
-
- delete buf;
- }
- }
-
- virtual V m_help() { post("%s - Get list of most pronounced peaks of a vasp vector",thisName()); }
-
-protected:
- I peaks;
-
-private:
- FLEXT_CALLBACK_I(m_peaks);
- FLEXT_CALLSET_I(m_peaks);
- FLEXT_ATTRGET_I(peaks);
-};
-
-VASP_LIB_V("vasp.peaks?",vasp_qpeaks)
-
-
diff --git a/externals/grill/vasp/source/obj_q.cpp b/externals/grill/vasp/source/obj_q.cpp
deleted file mode 100644
index 9756f4a4..00000000
--- a/externals/grill/vasp/source/obj_q.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_list
- \remark \b vasp.list
- \brief Get samples of a single vasp vector.
- \since 0.0.1
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet vector - vasp samples
-
- \note Outputs 0 if vasp is undefined or invalid
- \note Only works for a vasp with one vector. No output otherwise.
-*/
-class vasp_list:
- public vasp_op
-{
- FLEXT_HEADER(vasp_list,vasp_op)
-
-public:
-
- vasp_list()
- {
- AddInAnything();
- AddOutList();
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok())
- post("%s - Invalid vasp!",thisName());
- else if(ref.Vectors() > 1)
- post("%s - More than one vector in vasp!",thisName());
- else {
- VBuffer *buf = ref.Buffer(0);
- I cnt = buf->Length();
- S *p = buf->Pointer();
- AtomList lst(cnt);
- for(I i = 0; i < cnt; ++i,++p) SetFloat(lst[i],*p);
- ToOutList(0,lst);
-
- delete buf;
- }
- }
-
- virtual V m_help() { post("%s - Get list of samples of a vasp vector",thisName()); }
-};
-
-VASP_LIB("vasp.list vasp.?",vasp_list)
-
-
-
-/*! \class vasp_nonzero
- \remark \b vasp.nonzero
- \brief Get samples of a single vasp vector.
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet.0 list - non-zero samples positions
- \retval outlet.1 list - non-zero sample values
-
- \note Outputs 0 if vasp is undefined or invalid
- \note Only works for a vasp with one vector. No output otherwise.
- \todo units for position list
-*/
-class vasp_nonzero:
- public vasp_op
-{
- FLEXT_HEADER(vasp_nonzero,vasp_op)
-
-public:
-
- vasp_nonzero()
- {
- AddInAnything();
- AddOutList(2);
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok())
- post("%s - Invalid vasp!",thisName());
- else if(ref.Vectors() > 1)
- post("%s - More than one vector in vasp!",thisName());
- else {
- VBuffer *buf = ref.Buffer(0);
- I i,cnt = buf->Length(),cp,ci;
- S *p = buf->Pointer();
- for(cp = i = 0; i < cnt; ++i,++p) if(*p) ++cp;
-
- AtomList pos(cp),lst(cp);
- p = buf->Pointer();
- for(ci = i = 0; ci < cp; ++i,++p)
- if(*p) {
- SetFloat(pos[ci],i);
- SetFloat(lst[ci],*p);
- ++ci;
- }
- ToOutList(0,pos);
- ToOutList(1,lst);
-
- delete buf;
- }
- }
-
- virtual V m_help() { post("%s - Get list of non-zero samples of a vasp vector",thisName()); }
-};
-
-VASP_LIB("vasp.nonzero vasp.??",vasp_nonzero)
-
diff --git a/externals/grill/vasp/source/obj_radio.cpp b/externals/grill/vasp/source/obj_radio.cpp
deleted file mode 100644
index 8932e801..00000000
--- a/externals/grill/vasp/source/obj_radio.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file obj_radio.cpp
- \brief objects for radio messages.
-*/
-
-#include "main.h"
-#include "classes.h"
-
-
-/*! \class vasp_radio
- \remark \b vasp.radio
- \brief Lets only radio messages pass through.
- \since 0.0.6
- \param inlet.1 * - any message
- \retval outlet.1 radio messages
- \retval outlet.2 other messages
-*/
-class vasp_radio:
- public flext_base
-{
- FLEXT_HEADER_S(vasp_radio,flext_base,Setup)
-
-public:
-
- vasp_radio()
- {
- AddInAnything();
- AddOutAnything(2);
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,0,m_any);
- }
-
- virtual V m_any(const t_symbol *s,I argc,const t_atom *argv);
-
- virtual V m_help() { post("%s - split into radio and non-radio messages",thisName()); }
-private:
- FLEXT_CALLBACK_A(m_any);
-};
-
-VASP_LIB("vasp.radio",vasp_radio)
-
-
-V vasp_radio::m_any(const t_symbol *s,I argc,const t_atom *argv)
-{
- ToOutAnything(s == vasp_base::sym_radio?0:1,s,argc,argv);
-}
-
diff --git a/externals/grill/vasp/source/obj_size.cpp b/externals/grill/vasp/source/obj_size.cpp
deleted file mode 100644
index af4ba62e..00000000
--- a/externals/grill/vasp/source/obj_size.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_size
- \remark \b vasp.size
- \brief Resize buffer.
- \since 0.0.6
- \param cmdln.1 [_time=0] - size of buffer
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _time - offset into buffer(s)
- \retval outlet vasp - modified vasp
-
- \attention Normally vasp vectors have individual offsets - this operations sets all the buffer sizes to equal values.
- \todo Implement unit processing.
-*/
-class vasp_size:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_size,vasp_tx,Setup)
-
-public:
- vasp_size(I argc,const t_atom *argv,BL abs = true):
- size(0),sets(false),keep(true),zero(true)
- {
- if(argc >= 1 && CanbeFloat(argv[0]))
- m_arg(GetAFloat(argv[0]));
- else if(argc)
- post("%s - Offset argument invalid -> ignored",thisName());
-
- AddInAnything();
- AddInFloat();
- AddOutAnything();
-
- if(abs) FLEXT_ADDATTR_VAR("frames",size,m_arg);
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_arg);
- FLEXT_CADDATTR_VAR1(c,"keep",keep);
- FLEXT_CADDATTR_VAR1(c,"zero",zero);
- }
-
- virtual V m_arg(F s)
- {
- size = (I)s; // \todo unit processing
- sets = true;
- }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(sets) ret->Size(size,keep,zero);
- return ret;
- }
-
- virtual V m_help() { post("%s - Set the size of the vector buffers",thisName()); }
-protected:
- I size;
- BL sets,keep,zero;
-
-private:
- FLEXT_CALLBACK_F(m_arg);
- FLEXT_CALLSET_I(m_arg);
- FLEXT_ATTRGET_I(size);
- FLEXT_ATTRVAR_B(keep);
- FLEXT_ATTRVAR_B(zero);
-};
-
-VASP_LIB_V("vasp.size vasp.s",vasp_size)
-
-
-
-
-/*! \class vasp_dsize
- \remark \b vasp.size+
- \brief Sets vector buffer sizes differentially.
- \since 0.0.6
- \param cmdln.1 [_time=0] - increase offset of into buffer(s)
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _time - increase of offset into buffer(s)
- \retval outlet vasp - modified vasp
-
- \todo Implement unit processing
-*/
-class vasp_dsize:
- public vasp_size
-{
- FLEXT_HEADER(vasp_dsize,vasp_size)
-
-public:
- vasp_dsize(I argc,const t_atom *argv): vasp_size(argc,argv) {}
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(sets) ret->SizeD(size);
- return ret;
- }
-
- virtual V m_help() { post("%s - Increase the size of the vector buffers",thisName()); }
-};
-
-VASP_LIB_V("vasp.size+ vasp.s+",vasp_dsize)
-
-
-
-/*! \class vasp_msize
- \remark \b vasp.size*
- \brief Sets vector buffer sizes by a factor
- \since 0.0.6
- \param cmdln.1 [_number=1] - factor for size
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _number - factor for size
- \retval outlet vasp - modified vasp
-*/
-class vasp_msize:
- public vasp_size
-{
- FLEXT_HEADER_S(vasp_msize,vasp_size,Setup)
-
-public:
- vasp_msize(I argc,const t_atom *argv):
- vasp_size(argc,argv,false)
- {
- if(argc && CanbeFloat(argv[0])) m_arg(GetAFloat(argv[0]));
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDATTR_VAR(c,"factor",factor,m_arg);
- }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(sets) ret->SizeM(factor);
- return ret;
- }
-
- virtual V m_help() { post("%s - Multiply the size of the vector buffers",thisName()); }
-
- virtual V m_arg(F f)
- {
- factor = f;
- sets = true;
- }
-
-protected:
- R factor;
- FLEXT_CALLSET_F(m_arg);
- FLEXT_ATTRGET_F(factor);
-};
-
-VASP_LIB_V("vasp.size* vasp.s*",vasp_msize)
-
-
-
-/*! \class vasp_rsize
- \remark \b vasp.size/
- \brief Sets vector buffer sizes by a factor
- \since 0.0.6
- \param cmdln.1 [_number=1] - divisor for size
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.2 _number - divisor for size
- \retval outlet vasp - modified vasp
-*/
-class vasp_rsize:
- public vasp_msize
-{
- FLEXT_HEADER(vasp_rsize,vasp_msize)
-
-public:
- vasp_rsize(I argc,const t_atom *argv): vasp_msize(argc,argv) {}
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- if(sets) ret->SizeR(factor);
- return ret;
- }
-
- virtual V m_help() { post("%s - Divide the size of the vector buffers",thisName()); }
-};
-
-VASP_LIB_V("vasp.size/ vasp.s/",vasp_rsize)
-
-
-
-/*! \class vasp_qsize
- \remark \b vasp.size?
- \brief Get size of a vector buffer.
- \since 0.0.6
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet _time - offset into vector buffer
-
- \note Outputs 0 if vasp is undefined or invalid
- \note Only works for a vasp with one vector. No output otherwise.
-
- \todo Implement unit processing
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
-*/
-class vasp_qsize:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qsize,vasp_op)
-
-public:
-
- vasp_qsize()
- {
- AddInAnything();
-// AddOutAnything();
- AddOutFloat();
- }
-
- virtual V m_bang()
- {
- if(!ref.Check())
- post("%s - Invalid vasp!",thisName());
- else if(ref.Vectors() > 1)
- post("%s - More than one vector in vasp!",thisName());
- else {
- I s = 0;
- if(ref.Vectors() == 1) {
- VBuffer *buf = ref.Buffer(0);
- if(buf) {
- s = buf->Frames();
- delete buf;
- }
- }
- //! \todo unit processing
-// ToOutVasp(0,ref);
- ToOutFloat(0,s);
- }
- }
-
- virtual V m_help() { post("%s - Get the buffer size of a vector",thisName()); }
-};
-
-VASP_LIB("vasp.size? vasp.s?",vasp_qsize)
-
diff --git a/externals/grill/vasp/source/obj_split.cpp b/externals/grill/vasp/source/obj_split.cpp
deleted file mode 100644
index 341179d4..00000000
--- a/externals/grill/vasp/source/obj_split.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_split
- \remark \b vasp.split
- \brief Splits a vasp into a number of vectors and the remainder.
- \since 0.0.1
- \param cmdln.1 int - number of vectors to split vasp into (excl. one for the remainder vectors)
- \param inlet.1 vasp - is stored and triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \retval outlet.n vasp - vector of stored vasp
- \retval outlet.+ vasp - remainder of stored vasp
-
- \note if there is no remainder outputs a bang
-*/
-class vasp_split:
- public vasp_op
-{
- FLEXT_HEADER(vasp_split,vasp_op)
-
-public:
- vasp_split(I argc,const t_atom *argv)
- {
- I cnt = -1;
- if(argc) {
- if(CanbeInt(argv[0])) cnt = GetAInt(argv[0]);
- if(cnt <= 1) {
- post("%s - integer argument invalid: set to 2",thisName());
- cnt = 2;
- }
- }
- else cnt = 2;
-
- AddInAnything();
- AddOutAnything(cnt+1);
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok()) {
- post("%s - Invalid vasp!",thisName());
- return;
- }
-
- I outs = CntOut()-1,rem = ref.Vectors()-outs;
- for(I i = min(outs,ref.Vectors())-1; i >= 0; --i) {
- Vasp v(ref.Frames(),ref.Vector(i));
- ToOutVasp(i,v);
- }
- if(rem > 0) {
- Vasp v(ref.Frames(),ref.Vector(outs));
- for(I i = 1; i < rem; ++i) v.AddVector(ref.Vector(outs+i));
- ToOutVasp(outs,v);
- }
- else
- ToOutBang(outs);
- }
-
- virtual V m_help() { post("%s - Split a vasp into its vectors",thisName()); }
-};
-
-VASP_LIB_V("vasp.split",vasp_split)
-
-
-/*! \class vasp_join
- \remark \b vasp.join
- \brief Joins several vasps into one.
- \since 0.0.1
- \param cmdln.1 int - number of vasp slots
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.1 reset - clears slots
- \param inlet.+n vasp - is stored in this slot
- \retval outlet vasp - joined vasp
-
- The several vectors of the several vasps are all joined into one vasp.
-
- \note On different vasp frame count the minmum frame count is taken.
- \note The latest vector input to a slot is taken for the resulting vasp
-*/
-class vasp_join:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_join,vasp_tx,Setup)
-
-public:
- vasp_join(I argc,const t_atom *argv):
- cnt(-1),vi(NULL)
- {
- if(argc) {
- if(CanbeInt(argv[0])) cnt = GetAInt(argv[0]);
- if(cnt <= 1) {
- post("%s - integer argument invalid: set to 2",thisName());
- cnt = 2;
- }
- }
- else cnt = 2;
-
- vi = new Vasp *[cnt-1];
- for(I i = 0; i < cnt-1; ++i) vi[i] = NULL;
-
- AddInAnything(cnt);
- AddOutAnything();
- }
-
- ~vasp_join() { if(vi) delete[] vi; }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
- }
-
- virtual Vasp *x_work() {
- CVasp *ret = new CVasp(ref);
- for(I i = 0; i < cnt-1; ++i) if(vi[i]) *ret += *vi[i];
- return ret;
- }
-
- V m_reset()
- {
- ref.Clear();
- for(I i = 0; i < cnt-1; ++i) if(vi[i]) { delete vi[i]; vi[i] = NULL; }
- }
-
- virtual bool m_method_(I inlet,const t_symbol *s,I argc,const t_atom *argv)
- {
- if(inlet > 0 && s == sym_vasp) {
- if(vi[inlet-1]) delete vi[inlet-1];
- vi[inlet-1] = new Vasp(argc,argv);
- return true;
- }
- else
- return vasp_tx::m_method_(inlet,s,argc,argv);
- }
-
- virtual V m_help() { post("%s - Join several vasps into one",thisName()); }
-private:
- I cnt;
- Vasp **vi;
-
- FLEXT_CALLBACK(m_reset)
-};
-
-VASP_LIB_V("vasp.join",vasp_join)
-
-
-
-/*! \class vasp_spit
- \remark \b vasp.spit
- \brief Spit out vectors of a vasp consecutively.
- \since 0.0.1
- \param inlet.1 vasp - is stored and triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \retval outlet.n vasp - vectors of stored vasp
- \retval outlet.+ bang - triggered after last spit
-*/
-class vasp_spit:
- public vasp_op
-{
- FLEXT_HEADER(vasp_spit,vasp_op)
-
-public:
- vasp_spit(I argc,const t_atom *argv)
- {
- I n = 1;
- if(argc >= 1) n = GetAInt(argv[0]);
- if(n < 1) {
- post("%s - illegal outlet count (%i) -> set to 1",thisName(),n);
- n = 1;
- }
-
- AddInAnything();
- AddOutAnything(n);
- AddOutBang();
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok()) {
- post("%s - Invalid vasp!",thisName());
- return;
- }
-
- I outs = CntOut()-1,rem = ref.Vectors();
- for(I vi = 0; rem;) {
- I r = min(rem,outs);
- for(I i = 0; i < r; ++i) {
- Vasp v(ref.Frames(),ref.Vector(vi+i));
- ToOutVasp(outs-1-i,v);
- }
- vi += r;
- rem -= r;
- }
- ToOutBang(outs);
- }
-
- virtual V m_help() { post("%s - Spit out vectors of a vasp",thisName()); }
-};
-
-VASP_LIB_V("vasp.spit",vasp_spit)
-
-
-/*! \class vasp_gather
- \remark \b vasp.gather
- \brief Gathers several consecutive vasps into one.
- \since 0.0.1
- \param cmdln.1 int - number of vasp slots
- \param inlet.1 vasp - is stored and output triggered
- \param inlet.1 bang - triggers output
- \param inlet.1 set - sets result vasp
- \param inlet.1 reset - clears result
- \param inlet.2 vasp - add to result vasp
- \retval outlet vasp - gathered vasp
-
- The several incoming vectors are all gathered into one vasp.
-
- \note On different vasp frame count the minimum frame count is taken.
-*/
-class vasp_gather:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_gather,vasp_tx,Setup)
-
-public:
- vasp_gather(I argc,const t_atom *argv)
- {
- cnt = 0;
- if(argc >= 1) cnt = GetAInt(argv[0]);
- if(cnt < 0) {
- post("%s - illegal count (%i) -> set to 0 (triggered mode)",thisName(),cnt);
- cnt = 0;
- }
- rem = cnt;
-
- AddInAnything(2);
- AddOutAnything();
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
- FLEXT_CADDMETHOD_(c,1,"vasp",m_add);
- }
-
- virtual Vasp *x_work()
- {
- CVasp *ret = new CVasp(ref);
- *ret += cdst;
- m_reset();
- return ret;
- }
-
- V m_reset() { ref.Clear(); cdst.Clear(); rem = cnt; }
-
- virtual I m_set(I argc,const t_atom *argv) { rem = cnt; return vasp_tx::m_set(argc,argv); }
-
- V m_add(I argc,const t_atom *argv)
- {
- cdst += Vasp(argc,argv);
- if(cnt && !--rem) m_bang();
- }
-
- virtual V m_help() { post("%s - Gather several vasps into one",thisName()); }
-private:
- I cnt,rem;
- CVasp cdst;
-
- FLEXT_CALLBACK(m_reset)
- FLEXT_CALLBACK_V(m_add)
-};
-
-VASP_LIB_V("vasp.gather",vasp_gather)
-
-
-
diff --git a/externals/grill/vasp/source/obj_sync.cpp b/externals/grill/vasp/source/obj_sync.cpp
deleted file mode 100644
index b6ad0963..00000000
--- a/externals/grill/vasp/source/obj_sync.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_sync
- \remark \b vasp.sync
- \brief Waits for all inlets to be hit (by vasps/anything) to trigger output.
- \since 0.0.1
- \param cmdln.1 int - number of sync inlets
- \param inlet.1 vasp - is stored
- \param inlet.1 bang - triggers output
- \param inlet.1 set - vasp to be stored
- \param inlet.1 reset - clear all hit flags
- \param inlet.+n vasp/anything - sets hit flag
- \retval outlet.* vasp - stored vasps
-
- \todo Message for selection if only vasp input triggers (or any one).
- \todo Message for selection of manual or auto reset upon trigger
-*/
-class vasp_sync:
- public vasp_op
-{
- FLEXT_HEADER_S(vasp_sync,vasp_op,Setup)
-
-public:
- vasp_sync(I argc,const t_atom *argv):
- autoreset(true),vasponly(false)
- {
- I cnt = -1;
- if(argc) {
- if(CanbeInt(argv[0])) cnt = GetAInt(argv[0]);
- if(cnt <= 1) {
- post("%s - integer argument invalid: set to 2",thisName());
- cnt = 2;
- }
- }
- else cnt = 2;
-
- flags = new BL[cnt];
- stored = new Vasp[cnt-1];
-
- AddInAnything(cnt);
- AddOutAnything(cnt);
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD_(c,0,"reset",m_reset);
- }
-
- virtual BL Init()
- {
- BL ret = vasp_op::Init();
- m_reset();
- return ret;
- }
-
- ~vasp_sync()
- {
- if(flags) delete[] flags;
- if(stored) delete[] stored;
- }
-
- V chkbang(I n,Vasp *a = NULL)
- {
- if(a && n > 0) {
- stored[n-1] = *a;
- delete a;
- }
-
- BL f = flags[n];
- flags[n] = true;
- if(!f) { // flags have changed
-
- BL all = true;
- for(I i = 0; i < CntIn(); ++i) all = all && flags[i];
-
- if(all) {
- if(ref.Ok()) {
- for(I i = CntIn()-1; i > 0; --i) ToOutVasp(i,stored[i-1]);
- ToOutVasp(0,ref);
- }
- else ToOutBang(0);
-
- if(autoreset) m_reset();
- }
- }
- }
-
- virtual V m_bang() { chkbang(0); }
-
- V m_reset()
- {
- for(I i = 0; i < CntIn(); ++i) flags[i] = false;
- }
-
- virtual bool m_method_(I inlet,const t_symbol *s,I argc,const t_atom *argv)
- {
- if(inlet > 0 && (!vasponly || s == sym_vasp)) {
- Vasp *a = new Vasp(argc,argv);
- chkbang(inlet,a);
- return true;
- }
- else
- return vasp_op::m_method_(inlet,s,argc,argv);
- }
-
- virtual V m_help() { post("%s - Synchronize a number of vasps (default 2)",thisName()); }
-private:
- BL autoreset,vasponly;
- BL *flags;
- Vasp *stored;
-
- FLEXT_CALLBACK(m_reset)
-};
-
-VASP_LIB_V("vasp.sync",vasp_sync)
-
-
diff --git a/externals/grill/vasp/source/obj_vasp.cpp b/externals/grill/vasp/source/obj_vasp.cpp
deleted file mode 100644
index 9b8cfb5d..00000000
--- a/externals/grill/vasp/source/obj_vasp.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file obj_vasp.cpp
- \brief basic vasp objects.
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_v
- \remark \b vasp
- \brief Stores vasp messages.
- \since 0.0.1
- \param cmdln.* vasp - to be stored
- \param inlet.1 vasp - is stored and output
- \param inlet.1 list - if possible list is converted to vasp format
- \param inlet.1 bang - triggers stored Vasp output
- \param inlet.1 set vasp - Vasp is stored (and not immediately output)
- \param inlet.2 vasp - Vasp is stored (and not immediately output)
- \retval outlet vasp
-*/
-class vasp_v:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_v,vasp_tx,Setup)
-
-public:
-
- vasp_v(I argc,const t_atom *argv)
- {
- m_set(argc,argv);
-
- AddInAnything(2);
- AddOutAnything();
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD_(c,0,"list",m_vasp);
-
- FLEXT_CADDMETHOD_(c,1,"list",m_set);
- FLEXT_CADDMETHOD_(c,1,"vasp",m_set);
- FLEXT_CADDMETHOD_(c,1,"radio",a_radio);
- }
-
- V a_radio(I,const t_atom *) {}
-
- virtual Vasp *x_work() { return new Vasp(ref); }
-
- virtual V m_help() { post("%s - Store and output a vasp",thisName()); }
-private:
- FLEXT_CALLBACK_V(a_radio);
-};
-
-VASP_LIB_V("vasp",vasp_v)
-
-
-
-/*! \class vasp_update
- \remark \b vasp.update
- \brief Refreshes buffer graphics for a vasp.
- \since 0.0.1
- \param inlet vasp - is stored and output
- \param inlet bang - triggers stored vasp output
- \param inlet set - vasp to be stored (and not immediately output)
- \retval outlet vasp
-
- \note In Max/MSP only necessary when buffer is in another window.
-*/
-class vasp_update:
- public vasp_tx
-{
- FLEXT_HEADER(vasp_update,vasp_tx)
-
-public:
- vasp_update()
- {
- AddInAnything();
- AddOutAnything();
- }
-
- virtual Vasp *x_work()
- {
- ref.Refresh();
- return new Vasp(ref);
- }
-
- virtual V m_help() { post("%s - Update graphics of a vasp",thisName()); }
-};
-
-VASP_LIB("vasp.update vasp.u",vasp_update)
-
-
-
-/*! \class vasp_check
- \remark \b vasp.check
- \brief Check vasp dimensions.
- \since 0.0.1
- \param inlet vasp - is stored and output
- \param inlet bang - triggers stored vasp output
- \param inlet set - vasp to be stored (and not immediately output)
- \retval outlet vasp
-
- \remark checks and corrects frame count
- \remark checks channel index... no correction, no output on error!
-*/
-class vasp_check:
- public vasp_tx
-{
- FLEXT_HEADER(vasp_check,vasp_tx)
-
-public:
- vasp_check()
- {
- AddInAnything();
- AddOutAnything();
- }
-
- virtual Vasp *x_work()
- {
- Vasp *ret = new Vasp(ref);
- I fr = ret->ChkFrames(); // maximum common frame length
- ret->Frames(fr);
-
- BL chok = true;
-
- for(I i = 0; i < ret->Vectors(); ++i) {
- VBuffer *buf = ret->Buffer(i);
- chok = chok && buf->Ok() && buf->Channel() == ret->Vector(i).Channel();
- delete buf;
- }
-
- if(chok)
- return ret;
- else {
- delete ret;
- return NULL;
- }
- }
-
- virtual V m_help() { post("%s - Check vasp dimensions",thisName()); }
-};
-
-VASP_LIB("vasp.check vasp.chk",vasp_check)
-
-
-
-/*! \class vasp_multi
- \remark \b vasp.m
- \brief Outputs multiple (identical) vasps.
- \since 0.0.1
- \param cmdln.1 int - number of vasp outlets
- \param inlet vasp - is stored and output
- \param inlet bang - triggers stored Vasp output
- \param inlet set - vasp to be stored (and not immediately output)
- \retval outlet.* vasp
-
- \note Outputs in right to left order.
-*/
-class vasp_multi:
- public vasp_op
-{
- FLEXT_HEADER(vasp_multi,vasp_op)
-
-public:
-
- vasp_multi(I argc,const t_atom *argv)
- {
- I cnt = -1;
- if(argc) {
- if(CanbeInt(argv[0])) cnt = GetAInt(argv[0]);
- if(cnt <= 1) {
- post("%s - integer argument invalid: set to 2",thisName());
- cnt = 2;
- }
- }
- else cnt = 2;
-
- AddInAnything();
- AddOutAnything(cnt);
- }
-
- virtual V m_bang()
- {
- if(ref.Check())
- for(I i = CntOut()-1; i >= 0; --i) ToOutVasp(i,ref);
- else
- post("%s - Invalid vasp",thisName());
- }
-
- virtual V m_help() { post("%s - Output a vasp multiple times",thisName()); }
-};
-
-VASP_LIB_V("vasp.multi vasp.m",vasp_multi)
-
diff --git a/externals/grill/vasp/source/obj_vecs.cpp b/externals/grill/vasp/source/obj_vecs.cpp
deleted file mode 100644
index d056189e..00000000
--- a/externals/grill/vasp/source/obj_vecs.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-
-
-/*! \class vasp_vector
- \remark \b vasp.vector
- \brief Gets indexed vector of a vasp.
- \since 0.0.1
- \param cmdln.1 int - index of vasp vector
- \param inlet vasp - is stored and indexed vasp vector output
- \param inlet bang - triggers indexed vasp vector output
- \param inlet set - vasp to be stored (and not immediately output)
- \retval outlet.1 vasp - single indexed vector of vasp
- \retval outlet.2 vasp - remainder of vasp
-
- \note Outputs only on valid index
- \todo Output remainder as vasp.
-*/
-class vasp_vector:
- public vasp_tx
-{
- FLEXT_HEADER_S(vasp_vector,vasp_tx,Setup)
-
-public:
- vasp_vector(I argc,const t_atom *argv):
- ix(0)
- {
- if(argc >= 1 && CanbeInt(argv[0]))
- ix = GetAInt(argv[0]);
- else if(argc)
- post("%s - Index argument invalid -> set to 0",thisName());
-
- AddInAnything(2);
- AddOutAnything();
- }
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDMETHOD(c,1,m_ix);
- FLEXT_CADDATTR_VAR(c,"index",ix,m_ix);
- }
-
- V m_ix(I i) { ix = i; }
-
- virtual Vasp *x_work() { return ix < ref.Vectors()?new Vasp(ref.Frames(),ref.Vector(ix)):NULL; }
-
- virtual V m_help() { post("%s - Get one vector of a vasp",thisName()); }
-
-protected:
- I ix;
-
-private:
- FLEXT_CALLBACK_I(m_ix);
- FLEXT_CALLSET_I(m_ix);
- FLEXT_ATTRGET_I(ix);
-};
-
-VASP_LIB_V("vasp.vector vasp.n",vasp_vector)
-
-
-
-/*! \class vasp_qn
- \remark \b vasp.n?
- \brief Gets number of vector of a vasp.
- \since 0.0.1
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet int - number of vectors in stored vasp
-
- \note Outputs 0 if vasp is undefined or invalid.
-
- \todo Should we disable output with invalid vasp?
-*/
-class vasp_qvectors:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qvectors,vasp_op)
-
-public:
- vasp_qvectors()
- {
- AddInAnything();
-// AddOutAnything();
- AddOutInt();
- }
-
- virtual V m_bang()
- {
-// ToOutVasp(0,ref);
- ToOutInt(0,ref.Ok()?ref.Vectors():0);
- }
-
- virtual V m_help() { post("%s - Get number of vectors of a vasp",thisName()); }
-};
-
-VASP_LIB("vasp.vectors? vasp.n?",vasp_qvectors)
-
-
-
diff --git a/externals/grill/vasp/source/opbase.cpp b/externals/grill/vasp/source/opbase.cpp
deleted file mode 100644
index 5abcb9fa..00000000
--- a/externals/grill/vasp/source/opbase.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "opbase.h"
-#include "opdefs.h"
-
-Vasp *VaspOp::m_run(OpParam &p,CVasp &src,CVasp *dst,opfun fun)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- ret = DoOp(vecs,fun,p);
- delete vecs;
- }
-
- return ret;
-}
-
-Vasp *VaspOp::m_cun(OpParam &p,CVasp &src,CVasp *dst,opfun fun)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- ret = DoOp(vecs,fun,p);
- delete vecs;
- }
-
- return ret;
-}
-
-Vasp *VaspOp::m_rbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,opfun fun)
-{
- Vasp *ret = NULL;
- BL argvasp = arg.IsVasp();
-
- RVecBlock *vecs = argvasp?GetRVecs(p.opname,src,arg.GetVasp(),dst):GetRVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.CanbeDouble()) p.rbin.arg = arg.GetADouble();
- else if(arg.IsEnv()) {
- if(p.args != 1)
- ERRINTERNAL();
- else
- p.arg[0].SetE(&arg.GetEnv());
- }
-
- ret = DoOp(vecs,fun,p);
- delete vecs;
- }
-
- return ret;
-}
-
-Vasp *VaspOp::m_cbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,opfun fun)
-{
- Vasp *ret = NULL;
- BL argvasp = arg.IsVasp();
-
- CVecBlock *vecs = argvasp?GetCVecs(p.opname,src,arg.GetVasp(),dst):GetCVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.CanbeComplex()) {
- CX z = arg.GetAComplex();
- p.cbin.rarg = z.real;
- p.cbin.iarg = z.imag;
- }
- else if(arg.IsEnv()) {
- if(p.args != 1)
- ERRINTERNAL();
- else
- p.arg[0].SetE(&arg.GetEnv());
- }
-
- ret = DoOp(vecs,fun,p);
- delete vecs;
- }
-
- return ret;
-}
diff --git a/externals/grill/vasp/source/opbase.h b/externals/grill/vasp/source/opbase.h
deleted file mode 100644
index bba4a3a6..00000000
--- a/externals/grill/vasp/source/opbase.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-
-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_OPBASE_H
-#define __VASP_OPBASE_H
-
-#include "main.h"
-#include "classes.h"
-#include "vecblk.h"
-#include "opparam.h"
-
-
-namespace VaspOp {
- typedef BL opfun(OpParam &p);
-
- // -------- prepare vectors and do vector operation -----------
- // in opvecs.cpp
-
- RVecBlock *GetRVecs(const C *op,CVasp &src,CVasp *dst = NULL);
- CVecBlock *GetCVecs(const C *op,CVasp &src,CVasp *dst = NULL,BL full = false);
- RVecBlock *GetRVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst = NULL,I multi = -1,BL ssize = true);
- CVecBlock *GetCVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst = NULL,I multi = -1,BL ssize = true,BL full = false);
-
- Vasp *DoOp(RVecBlock *vecs,opfun *fun,OpParam &p,BL symm = false);
- Vasp *DoOp(CVecBlock *vecs,opfun *fun,OpParam &p,BL symm = false);
-
- // -------- transformations -----------------------------------
- // in opbase.cpp
-
- // unary functions
- Vasp *m_run(OpParam &p,CVasp &src,CVasp *dst,opfun fun); // real unary (one vec or real)
- Vasp *m_cun(OpParam &p,CVasp &src,CVasp *dst,opfun fun); // complex unary (one vec or complex)
-
- // binary functions
- Vasp *m_rbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,opfun fun); // real binary (one vec or real)
- Vasp *m_cbin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,opfun fun); // complex binary (one vec or complex)
-
-}
-
-#endif
diff --git a/externals/grill/vasp/source/opdefs.h b/externals/grill/vasp/source/opdefs.h
deleted file mode 100644
index 833163dc..00000000
--- a/externals/grill/vasp/source/opdefs.h
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
-
-VASP modular - vector assembling signal processor / objects for Max/MSP and PD
-
-Copyright (c) 2002-2003 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_OPDEFS_H
-#define __VASP_OPDEFS_H
-
-#include "oploop.h"
-#include "opbase.h"
-
-#ifdef VASP_CHN1
-#define _D_ALWAYS1 1
-#else
-#define _D_ALWAYS1 0
-#endif
-
-
-namespace VecOp {
-
-// multi-layer templates
-
-template<class T,class OP,int LR>
-inline BL vec_un(T *v,const T *a,I n = 0) {
- const I _n = LR?LR:n;
- for(I i = 0; i < _n; ++i) OP::run(v[i],a[i]);
- return true;
-}
-
-template<class T,class OP,int LR>
-inline BL vec_un(T *v,T a,I n = 0) {
- const I _n = LR?LR:n;
- for(I i = 0; i < _n; ++i) OP::run(v[i],a);
- return true;
-}
-
-template<class T,class TR,class OP,int LR>
-inline BL vec_bin(T *v,const T *a,const TR *b,I n = 0) {
- const I _n = LR?LR:n;
- for(I i = 0; i < _n; ++i) OP::rbin(v[i],a[i],b[i]);
- return true;
-}
-
-template<class T,class TR,class OP,int LR>
-inline BL vec_bin(T *v,const T *a,TR b,I n = 0) {
- const I _n = LR?LR:n;
- for(I i = 0; i < _n; ++i) OP::rbin(v[i],a[i],b);
- return true;
-}
-
-/*! \brief skeleton for unary real operations
-*/
-template<class T,class OP> BL V__run(register const T *sr,I rss,register T *dr,I rds,I frames)
-{
- register I i;
- if(sr == dr && OP::run_opt() >= 3)
- if((_D_ALWAYS1 || rds == 1) && OP::run_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::run(*dr,*dr), dr++ ) )
- else
- _DE_LOOP(i,frames, ( OP::run(*dr,*dr), dr += rds ) )
- else
- if((_D_ALWAYS1 || (rss == 1 && rds == 1)) && OP::run_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::run(*dr,*sr), sr++,dr++ ) )
- else
- _DE_LOOP(i,frames, ( OP::run(*dr,*sr), sr += rss,dr += rds ) )
- return true;
-}
-
-
-/*! \brief skeleton for unary complex operations
-*/
-template<class T,class OP> BL V__cun(register const T *sr,register const T *si,I rss,I iss,register T *dr,register T *di,I rds,I ids,I frames)
-{
- register I i;
- if(sr == dr && si == di && OP::cun_opt() >= 3)
- if((_D_ALWAYS1 || (rds == 1 && ids == 1)) && OP::cun_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::cun(*dr,*di,*dr,*di), dr++,di++ ) )
- else
- _DE_LOOP(i,frames, ( OP::cun(*dr,*di,*dr,*di), dr += rds,di += ids ) )
- else
- if((_D_ALWAYS1 || (rss == 1 && iss == 1 && rds == 1 && ids == 1)) && OP::cun_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::cun(*dr,*di,*sr,*si), sr++,si++,dr++,di++ ) )
- else
- _DE_LOOP(i,frames, ( OP::cun(*dr,*di,*sr,*si), sr += rss,si += iss,dr += rds,di += ids ) )
- return true;
-}
-
-template<class T,class OP> BL V__vun(I layers,register const T *sr,register T *dr,I frames)
-{
- register I i;
- switch(layers) {
- case 1:
- V__run<T,OP>(sr,1,dr,1,frames);
- break;
- case 2:
- _DF_LOOP(i,frames, ( vec_un<T,OP,2>(dr,sr,2), sr += 2, dr += 2) )
- break;
- case 3:
- _DF_LOOP(i,frames, ( vec_un<T,OP,3>(dr,sr,3), sr += 3, dr += 3) )
- break;
- case 4:
- _DF_LOOP(i,frames, ( vec_un<T,OP,4>(dr,sr,4), sr += 4, dr += 4) )
- break;
- default:
- _DF_LOOP(i,frames, ( vec_un<T,OP,0>(dr,sr,layers), sr += layers, dr += layers) )
- break;
- }
- return true;
-}
-
-
-template<class T,class OP> BL V__rbin(register const T *sr,I rss,register T *dr,I rds,register const T *ar,I ras,I frames)
-{
- register I i;
- if(sr == dr && OP::rbin_opt() >= 3)
- if((_D_ALWAYS1 || (rds == 1 && ras == 1)) && OP::rbin_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::rbin(*dr,*dr,*ar), dr++,ar++ ) )
- else
- _DE_LOOP(i,frames, ( OP::rbin(*dr,*dr,*ar), dr += rds,ar += ras ) )
- else
- if((_D_ALWAYS1 || (rss == 1 && rds == 1 && ras == 1)) && OP::rbin_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::rbin(*dr,*sr,*ar), sr++,dr++,ar++ ) )
- else
- _DE_LOOP(i,frames, ( OP::rbin(*dr,*sr,*ar), sr += rss,dr += rds,ar += ras ) )
- return true;
-}
-
-template<class T,class OP> BL V__cbin(register const T *sr,register const T *si,I rss,I iss,register T *dr,register T *di,I ids,I rds,const T *ar,const T *ai,I ras,I ias,I frames)
-{
- register I i;
- if(sr == dr && si == di && OP::cbin_opt() >= 3)
- if((_D_ALWAYS1 || (rds == 1 && ids == 1 && ras == 1 && ias == 1)) && OP::cbin_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::cbin(*dr,*di,*dr,*di,*ar,*ai), dr++,di++,ar++,ai++ ) )
- else
- _DE_LOOP(i,frames, ( OP::cbin(*dr,*di,*dr,*di,*ar,*ai), dr += rds,di += ids,ar += ras,ai += ias ) )
- else
- _DE_LOOP(i,frames, ( OP::cbin(*dr,*di,*sr,*si,*ar,*ai), sr += rss,si += iss,dr += rds,di += ids,ar += ras,ai += ias ) )
- return true;
-}
-
-
-template<class TR> class _A__vector {
-public:
- static BL unroll() { return true; }
- static TR ev(const TR *a,I i,I m) { return a[i*m]; }
-};
-
-template<class TR> class _A__scalar {
-public:
- static BL unroll() { return true; }
- static TR ev(TR a,I i,I m) { return a; }
-};
-
-class _A__env {
-public:
- static BL unroll() { return false; }
- static R ev(Env::Iter &a,I i,I m) { return a.ValFwd(i); }
-};
-
-template<class T,class TA,class TR,class OP,class EVARG> BL Vx__rbin(register const T *sr,I rss,register T *dr,I rds,TA ar,I frames)
-{
- register I i;
- if(sr == dr && OP::rbin_opt() >= 3)
- if((_D_ALWAYS1 || rds == 1) && OP::rbin_opt() >= 2)
- _DQ_LOOP(EVARG::unroll(),i,frames, ( OP::rbin(*dr,*dr,EVARG::ev(ar,i,1)), dr++ ) )
- else
- _DQ_LOOP(EVARG::unroll(),i,frames, ( OP::rbin(*dr,*dr,EVARG::ev(ar,i,1)), dr += rds ) )
- else
- if((_D_ALWAYS1 || rss == 1 && rds == 1) && OP::rbin_opt() >= 2)
- _DQ_LOOP(EVARG::unroll(),i,frames, ( OP::rbin(*dr,*sr,EVARG::ev(ar,i,1)), sr++,dr++ ) )
- else
- _DQ_LOOP(EVARG::unroll(),i,frames, ( OP::rbin(*dr,*sr,EVARG::ev(ar,i,1)), sr += rss,dr += rds ) )
- return true;
-}
-
-template<class T,class TA1,class TA2,class TR,class OP,class EVARG1,class EVARG2> BL Vx__cbin(register const T *sr,register const T *si,I rss,I iss,register T *dr,register T *di,I ids,I rds,TA1 ar,TA2 ai,I ras,I ias,I frames)
-{
- register I i;
- if(sr == dr && si == di && OP::cbin_opt() >= 3)
- if((_D_ALWAYS1 || (rds == 1 && ids == 1 && ras == 1 && ias == 1)) && OP::cbin_opt() >= 2)
- _DQ_LOOP(EVARG1::unroll() && EVARG2::unroll(),i,frames, ( OP::cbin(*dr,*di,*dr,*di,EVARG1::ev(ar,i,1),EVARG2::ev(ai,i,1)), dr++,di++ ) )
- else
- _DQ_LOOP(EVARG1::unroll() && EVARG2::unroll(),i,frames, ( OP::cbin(*dr,*di,*dr,*di,EVARG1::ev(ar,i,ras),EVARG2::ev(ai,i,ias)), dr += rds,di += ids ) )
- else
- _DQ_LOOP(EVARG1::unroll() && EVARG2::unroll(),i,frames, ( OP::cbin(*dr,*di,*sr,*si,EVARG1::ev(ar,i,ras),EVARG2::ev(ai,i,ias)), sr += rss,si += iss,dr += rds,di += ids ) )
- return true;
-}
-
-template<class T,class TA,class TR,class OP,class EVARG> BL Vx__vbin(I layers,register const T *sr,register T *dr,TA ar,I frames)
-{
- register I i;
- switch(layers) {
- case 1:
- Vx__rbin<T,TA,TR,OP,EVARG>(sr,1,dr,1,ar,frames);
- break;
- case 2:
- _DF_LOOP(i,frames, ( vec_bin<T,TR,OP,2>(dr,sr,EVARG::ev(ar,i,2),2), sr += 2, dr += 2) )
- break;
- case 3:
- _DF_LOOP(i,frames, ( vec_bin<T,TR,OP,3>(dr,sr,EVARG::ev(ar,i,3),3), sr += 3, dr += 3) )
- break;
- case 4:
- _DF_LOOP(i,frames, ( vec_bin<T,TR,OP,4>(dr,sr,EVARG::ev(ar,i,4),4), sr += 4, dr += 4) )
- break;
- default:
- _DF_LOOP(i,frames, ( vec_bin<T,TR,OP,0>(dr,sr,EVARG::ev(ar,i,layers),layers), sr += layers, dr += layers) )
- break;
- }
- return true;
-}
-
-template<class T,class OP> inline BL V__vbin(I layers,register const T *sr,register T *dr,register const T *ar,I frames)
-{
- return Vx__vbin<T,const T *,T,OP,_A__vector<T> >(layers,sr,dr,ar,frames);
-}
-
-/*! \brief skeleton for binary real operations
-*/
-template<class T,class OP> BL _F__rbin(OpParam &p)
-{
- if(p.HasArg() && p.arg[0].Is()) {
- switch(p.arg[0].argtp) {
- case OpParam::Arg::arg_v: {
- V__rbin<T,OP>(p.rsdt,p.rss,p.rddt,p.rds,p.arg[0].v.rdt,p.arg[0].v.rs,p.frames);
- break;
- }
- case OpParam::Arg::arg_env: {
- Env::Iter it(*p.arg[0].e.env); it.Init(0);
- Vx__rbin<T,Env::Iter &,R,OP,_A__env >(p.rsdt,p.rss,p.rddt,p.rds,it,p.frames);
- break;
- }
- case OpParam::Arg::arg_x: {
- Vx__rbin<T,R,T,OP,_A__scalar<R> >(p.rsdt,p.rss,p.rddt,p.rds,p.arg[0].x.r,p.frames);
- break;
- }
- }
- }
- else {
- Vx__rbin<T,T,T,OP,_A__scalar<T> >(p.rsdt,p.rss,p.rddt,p.rds,p.rbin.arg,p.frames);
- }
- return true;
-}
-
-
-/*! \brief skeleton for binary complex operations
-*/
-template<class T,class OP> BL _F__cbin(OpParam &p)
-{
- if(p.HasArg() && p.arg[0].Is()) {
- switch(p.arg[0].argtp) {
- case OpParam::Arg::arg_v: {
- if(p.arg[0].v.idt)
- V__cbin<T,OP>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.arg[0].v.rdt,p.arg[0].v.idt,p.arg[0].v.rs,p.arg[0].v.is,p.frames);
- else
- Vx__cbin<T,const T *,T,T,OP,_A__vector<T>,_A__scalar<T> >(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.arg[0].v.rdt,0,p.arg[0].v.rs,1,p.frames);
- break;
- }
- case OpParam::Arg::arg_env: {
- Env::Iter it(*p.arg[0].e.env); it.Init(0);
- Vx__cbin<T,Env::Iter &,T,R,OP,_A__env,_A__scalar<T> >(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,it,0,1,1,p.frames);
- break;
- }
- case OpParam::Arg::arg_x: {
- Vx__cbin<T,R,R,R,OP,_A__scalar<R>,_A__scalar<R> >(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.arg[0].x.r,p.arg[0].x.i,1,1,p.frames);
- break;
- }
- }
- }
- else {
- Vx__cbin<T,T,T,T,OP,_A__scalar<T>,_A__scalar<T> >(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.cbin.rarg,p.cbin.iarg,1,1,p.frames);
- }
- return true;
-}
-
-/*! \brief skeleton for real operations with parameter block
-*/
-template<class T,class ARG,class OP> BL V__rop(ARG p,register const S *sr,I rss,register S *dr,I rds,I frames)
-{
- register I i;
- if(sr == dr && OP::rop_opt() >= 3)
- if((_D_ALWAYS1 || rds == 1) && OP::rop_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::rop(*dr,*dr,p), dr++ ) )
- else
- _DE_LOOP(i,frames, ( OP::rop(*dr,*dr,p), dr += rds ) )
- else
- if((_D_ALWAYS1 || (rss == 1 && p.rds == 1)) && OP::rop_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::rop(*dr,*sr,p), sr++,dr++ ) )
- else
- _DE_LOOP(i,frames, ( OP::rop(*dr,*sr,p), sr += rss,dr += rds ) )
- return true;
-}
-
-/*! \brief skeleton for complex operations with parameter block
-*/
-template<class T,class ARG,class OP> BL V__cop(ARG p,register const S *sr,register const S *si,I rss,I iss,register S *dr,register S *di,I rds,I ids,I frames)
-{
- register I i;
- if(sr == dr && si == di && OP::cop_opt() >= 3)
- if((_D_ALWAYS1 || (rds == 1 && ids == 1)) && OP::cop_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::cop(*dr,*di,*dr,*di,p), dr++,di++ ) )
- else
- _DE_LOOP(i,frames, ( OP::cop(*dr,*di,*dr,*di,p), dr += rds,di += ids ) )
- else
- if((_D_ALWAYS1 || (p.rss == 1 && p.iss == 1 && p.rds == 1 && p.ids == 1)) && OP::cop_opt() >= 2)
- _DE_LOOP(i,frames, ( OP::cop(*dr,*di,*sr,*si,p), sr++,si++,dr++,di++ ) )
- else
- _DE_LOOP(i,frames, ( OP::cop(*dr,*di,*sr,*si,p), sr += rss,si += iss,dr += rds,di += ids ) )
- return true;
-}
-
-
-template<class T> BL _d__run(V fun(T &v,T a),OpParam &p)
-{
- int i;
- if(p.rds == 1 && p.rss == 1)
- _DE_LOOP(i,p.frames, ( fun(p.rddt[i],p.rsdt[i]) ) )
- else
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.rsdt[p.rss*i]) ) )
- return true;
-}
-
-template<class T> BL _d__cun(V fun(T &rv,T &iv,T ra,T ia),OpParam &p)
-{
- int i;
- if(p.rds == 1 && p.ids == 1 && p.rss == 1 && p.iss == 1)
- _DE_LOOP(i,p.frames, ( fun(p.rddt[i],p.iddt[i],p.rsdt[i],p.isdt[i]) ) )
- else
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i]) ) )
- return true;
-}
-
-template<class T> BL _d__rbin(V fun(T &v,T a,T b),OpParam &p)
-{
- int i;
- if(p.HasArg() && p.arg[0].Is()) {
- switch(p.arg[0].argtp) {
- case OpParam::Arg::arg_v: {
- const T *adr = p.arg[0].v.rdt;
- const I asr = p.arg[0].v.rs;
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.rsdt[p.rss*i],adr[asr*i]) ) )
- break;
- }
- case OpParam::Arg::arg_env: {
- Env::Iter it(*p.arg[0].e.env); it.Init(0);
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.rsdt[p.rss*i],it.ValFwd(i)) ) )
- break;
- }
- case OpParam::Arg::arg_x: {
- const T av = p.arg[0].x.r;
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.rsdt[p.rss*i],av) ) )
- break;
- }
- }
- }
- else {
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.rsdt[p.rss*i],p.rbin.arg) ) )
- }
- return true;
-}
-
-template<class T> BL _d__cbin(V fun(T &rv,T &iv,T ra,T ia,T rb,T ib),OpParam &p)
-{
- int i;
- if(p.HasArg() && p.arg[0].Is()) {
- switch(p.arg[0].argtp) {
- case OpParam::Arg::arg_v: {
- const T *adr = p.arg[0].v.rdt,*adi = p.arg[0].v.idt;
- const I asr = p.arg[0].v.rs,asi = p.arg[0].v.is;
- if(adi)
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i],adr[asr*i],adi[asi*i]) ) )
- else
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i],adr[asr*i],0) ) )
- break;
- }
- case OpParam::Arg::arg_env: {
- Env::Iter it(*p.arg[0].e.env); it.Init(0);
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i],it.ValFwd(i),0) ) )
- break;
- }
- case OpParam::Arg::arg_x: {
- const T avr = p.arg[0].x.r,avi = p.arg[0].x.i;
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i],avr,avi) ) )
- break;
- }
- }
- }
- else {
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i],p.cbin.rarg,p.cbin.iarg) ) )
- }
- return true;
-}
-
-template<class T> BL _d__rop(V fun(T &v,T a,OpParam &p),OpParam &p)
-{
- int i;
- if(p.rds == 1 && p.rss == 1)
- _DE_LOOP(i,p.frames, ( fun(p.rddt[i],p.rsdt[i],p) ) )
- else
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.rsdt[p.rss*i],p) ) )
- return true;
-}
-
-template<class T> BL _d__cop(V fun(T &rv,T &iv,T ra,T ia,OpParam &p),OpParam &p)
-{
- int i;
- if(p.rds == 1 && p.ids == 1 && p.rss == 1 && p.iss == 1)
- _DE_LOOP(i,p.frames, ( fun(p.rddt[i],p.iddt[i],p.rsdt[i],p.isdt[i],p) ) )
- else
- _DF_LOOP(i,p.frames, ( fun(p.rddt[p.rds*i],p.iddt[p.ids*i],p.rsdt[p.rss*i],p.isdt[p.iss*i],p) ) )
- return true;
-}
-
-
-/*
-template<class T,class CL> inline BL _D__run(OpParam &p) { return V__run<T,CL>(p.rsdt,p.rss,p.rddt,p.rds,p.frames); }
-template<class T,class CL> inline BL _D__cun(OpParam &p) { return V__cun<T,CL>(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); }
-template<class T,class CL> inline BL _D__rbin(OpParam &p) { return _F__rbin<T,CL>(p); }
-template<class T,class CL> inline BL _D__cbin(OpParam &p) { return _F__cbin<T,CL>(p); }
-template<class T,class CL> inline BL _D__rop(OpParam &p) { return V__rop<T,OpParam &,CL>(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames); }
-template<class T,class CL> inline BL _D__cop(OpParam &p) { return V__cop<T,OpParam &,CL>(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames); }
-
-#ifdef VASP_COMPACT
- template<class T,class CL> BL D__run(OpParam &p) { return _d__run<T>(CL::run,p); }
- template<class T,class CL> BL D__cun(OpParam &p) { return _d__cun<T>(CL::cun,p); }
- template<class T,class CL> BL D__rbin(OpParam &p) { return _d__rbin<T>(CL::rbin,p); }
- template<class T,class CL> BL D__cbin(OpParam &p) { return _d__cbin<T>(CL::cbin,p); }
- template<class T,class CL> BL D__rop(OpParam &p) { return _d__rop<T>(CL::rop,p); }
- template<class T,class CL> BL D__cop(OpParam &p) { return _d__cop<T>(CL::cop,p); }
-#else
- template<class T,class CL> BL D__run(OpParam &p) { return CL::run_opt()?_D__run<T,CL>(p):_d__run<T>(CL::run,p); }
- template<class T,class CL> BL D__cun(OpParam &p) { return CL::cun_opt()?_D__cun<T,CL>(p):_d__cun<T>(CL::cun,p); }
- template<class T,class CL> BL D__rbin(OpParam &p) { return CL::rbin_opt()?_D__rbin<T,CL>(p):_d__rbin<T>(CL::rbin,p); }
- template<class T,class CL> BL D__cbin(OpParam &p) { return CL::cbin_opt()?_D__cbin<T,CL>(p):_d__cbin<T>(CL::cbin,p); }
- template<class T,class CL> BL D__rop(OpParam &p) { return CL::rop_opt()?_D__rop<T,CL>(p):_d__rop<T>(CL::rop,p); }
- template<class T,class CL> BL D__cop(OpParam &p) { return CL::cop_opt()?_D__cop<T,CL>(p):_d__cop<T>(CL::cop,p); }
-#endif
-*/
-
-// MSVC 6 can't handle optimization here!! (silently produces wrong code!!!)
-
-#define _D__run(T,CL,p) V__run< T,CL >(p.rsdt,p.rss,p.rddt,p.rds,p.frames)
-#define _D__cun(T,CL,p) V__cun< T,CL >(p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames)
-#define _D__rbin(T,CL,p) _F__rbin< T,CL >(p)
-#define _D__cbin(T,CL,p) _F__cbin< T,CL >(p)
-#define _D__rop(T,CL,p) V__rop< T,OpParam &,CL >(p,p.rsdt,p.rss,p.rddt,p.rds,p.frames)
-#define _D__cop(T,CL,p) V__cop< T,OpParam &,CL >(p,p.rsdt,p.isdt,p.rss,p.iss,p.rddt,p.iddt,p.rds,p.ids,p.frames)
-
-#if defined(VASP_COMPACT) || (defined(_MSC_VER) && _MSC_VER < 1300)
- #define D__run(T,CL,p) _d__run< T >(CL::run,p)
- #define D__cun(T,CL,p) _d__cun< T >(CL::cun,p)
- #define D__rbin(T,CL,p) _d__rbin< T >(CL::rbin,p)
- #define D__cbin(T,CL,p) _d__cbin< T >(CL::cbin,p)
- #define D__rop(T,CL,p) _d__rop< T >(CL::rop,p)
- #define D__cop(T,CL,p) _d__cop< T >(CL::cop,p)
-#else
- #define D__run(T,CL,p) ( CL::run_opt()?_D__run(T,CL,p):_d__run<T>(CL::run,p) )
- #define D__cun(T,CL,p) ( CL::cun_opt()?_D__cun(T,CL,p):_d__cun<T>(CL::cun,p) )
- #define D__rbin(T,CL,p) ( CL::rbin_opt()?_D__rbin(T,CL,p):_d__rbin<T>(CL::rbin,p) )
- #define D__cbin(T,CL,p) ( CL::cbin_opt()?_D__cbin(T,CL,p):_d__cbin<T>(CL::cbin,p) )
- #define D__rop(T,CL,p) ( CL::rop_opt()?_D__rop(T,CL,p):_d__rop<T>(CL::rop,p) )
- #define D__cop(T,CL,p) ( CL::cop_opt()?_D__cop(T,CL,p):_d__cop<T>(CL::cop,p) )
-#endif
-
-
-// process multi-dimensional data
-
-template<class T> inline BL V__vmulti(BL vbin(I layers,const T *sr,T *dr,const T *ar,I len),I layers,const T *sr,T *dr,const T *ar,I dim,const I *dims)
-{
- if(dim == 1 || !dims) {
- return vbin(layers,sr,dr,ar,dims?dims[0]:dim);
- }
- else if(dim > 1) {
- // calculate stride for next dimensions
- I i,s,str = layers*dims[0];
- for(i = 1; i < dim-1; ++i) str *= dims[i];
- const I dimn = dims[i];
-
- for(s = i = 0; i < dimn; ++i,s += str)
- V__vmulti(vbin,layers,sr+s,dr+s,ar+s,dim-1,dims);
- return true;
- }
- else
- return false;
-}
-
-
-
-} // namespace VecOp
-
-#endif
diff --git a/externals/grill/vasp/source/opfuns.h b/externals/grill/vasp/source/opfuns.h
deleted file mode 100644
index 7abbec6f..00000000
--- a/externals/grill/vasp/source/opfuns.h
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
-
-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_OPFUNS_H
-#define __VASP_OPFUNS_H
-
-#include "opdefs.h"
-#include <math.h>
-#include "util.h"
-
-
-namespace VecOp {
-
- // assignment
-
- template<class T> class f_copy {
- public:
- static I run_opt() { return 3; }
- static V run(T &v,T a) { v = a; }
- static I cun_opt() { return 2; }
- static V cun(T &rv,T &iv,T ra,T ia) { rv = ra,iv = ia; }
- };
-
- template<class T> class f_set {
- public:
- static I rbin_opt() { return 3; }
- static V rbin(T &v,T,T b) { v = b; }
- static I cbin_opt() { return 2; }
- static V cbin(T &rv,T &iv,T,T,T rb,T ib) { rv = rb,iv = ib; }
- };
-
- // arithmetic
-
- template<class T> class f_add {
- public:
- static I rbin_opt() { return 3; }
- static V rbin(T &v,T a,T b) { v = a+b; }
- static I cbin_opt() { return 2; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib) { rv = ra+rb,iv = ia+ib; }
- };
-
- template<class T> class f_sub {
- public:
- static I rbin_opt() { return 3; }
- static V rbin(T &v,T a,T b) { v = a-b; }
- static I cbin_opt() { return 2; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib) { rv = ra-rb,iv = ia-ib; }
- };
-
- template<class T> class f_subr {
- public:
- static I rbin_opt() { return 2; }
- static V rbin(T &v,T a,T b) { v = b-a; }
- static I cbin_opt() { return 2; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib) { rv = rb-ra,iv = ib-ia; }
- };
-
- template<class T> class f_mul {
- public:
- static I rbin_opt() { return 3; }
- static V rbin(T &v,T a,T b) { v = a*b; }
- static I cbin_opt() { return 1; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib) { rv = ra*rb-ia*ib, iv = ra*ib+rb*ia; }
- };
-
- template<class T> class f_div {
- public:
- static I rbin_opt() { return 2; }
- static V rbin(T &v,T a,T b) { v = a/b; }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib)
- {
- register const T den = sqabs(rb,ib);
- rv = (ra*rb+ia*ib)/den;
- iv = (ia*rb-ra*ib)/den;
- }
- };
-
- template<class T> class f_divr {
- public:
- static I rbin_opt() { return 2; }
- static V rbin(T &v,T a,T b) { v = b/a; }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib)
- {
- register const T den = sqabs(ra,ia);
- rv = (rb*ra+ib*ia)/den;
- iv = (ib*ra-rb*ia)/den;
- }
- };
-
- template<class T> class f_mod {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &v,T a,T b) { v = fmod(a,b); }
- };
-
- template<class T> class f_abs {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = fabs(a); }
- static I cun_opt() { return 0; }
- static V cun(T &rv,T &iv,T ra,T ia) { rv = sqrt(ra*ra+ia*ia),iv = 0; }
- };
-
- template<class T> class f_sign {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = (a == 0?0:(a < 0?-1.:1.)); }
- };
-
- template<class T> class f_sqr {
- public:
- static I run_opt() { return 3; }
- static V run(T &v,T a) { v = a*a; }
- static I cun_opt() { return 1; }
- static V cun(T &rv,T &iv,T ra,T ia) { rv = ra*ra-ia*ia; iv = ra*ia*2; }
- };
-
- template<class T> class f_ssqr {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = a*fabs(a); }
- };
-
-
- template<class T> class f_sumq {
- public:
- static I rop_opt() { return 2; }
- static V rop(T &,T ra,OpParam &p)
- {
- p.norm.minmax += ra;
- }
- };
-
- // transcendent
-
- template<class T> class f_powi {
- public:
- static I cop_opt() { return 0; }
- static V cop(T &rv,T &iv,T ra,T ia,OpParam &p)
- {
- register const I powi = p.ibin.arg;
- register T rt,it; VecOp::f_sqr<T>::cun(rt,it,ra,ia);
- for(I i = 2; i < powi; ++i) VecOp::f_mul<T>::cbin(rt,it,rt,it,ra,ia);
- rv = rt,iv = it;
- }
- };
-
- template<class T> class f_pow {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &v,T a,T b) { v = pow(fabs(a),b)*sgn(a); }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T)
- {
- register const T _abs = sqrt(sqabs(ra,ia));
- if(_abs) {
- register const T _p = pow(_abs,rb)/_abs;
- rv = _p*ra,iv = _p*ia;
- }
- else
- rv = iv = 0;
- }
- protected:
- static T sgn(T x) { return x?(x > 0?1:-1):0; }
- };
-
- template<class T> class f_sqrt {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = sqrt(fabs(a)); }
- };
-
- template<class T> class f_ssqrt {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = sqrt(fabs(a))*sgn(a); }
- };
-
-
- template<class T> class f_exp {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = exp(a); }
- };
-
- template<class T> class f_log {
- public:
- static I run_opt() { return 0; }
- static V run(T &v,T a) { v = log(a); } // \todo detect NANs
- };
-
- // comparisons
-
- template<class T> class f_lwr {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a < b?1:0; }
- };
-
- template<class T> class f_gtr {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a > b?1:0; }
- };
-
- template<class T> class f_alwr {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &v,T a,T b) { v = fabs(a) < fabs(b)?1:0; }
- };
-
- template<class T> class f_agtr {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &v,T a,T b) { v = fabs(a) > fabs(b)?1:0; }
- };
-
- template<class T> class f_leq {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a <= b?1:0; }
- };
-
- template<class T> class f_geq {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a >= b?1:0; }
- };
-
- template<class T> class f_aleq {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &v,T a,T b) { v = fabs(a) <= fabs(b)?1:0; }
- };
-
- template<class T> class f_ageq {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &v,T a,T b) { v = fabs(a) >= fabs(b)?1:0; }
- };
-
- template<class T> class f_equ {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a == b?1:0; }
- };
-
- template<class T> class f_neq {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a != b?1:0; }
- };
-
- // min/max
-
- template<class T> class f_min {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a < b?a:b; }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib)
- {
- if(sqabs(ra,ia) < sqabs(rb,ib)) rv = ra,iv = ia;
- else rv = rb,iv = ib;
- }
- };
-
- template<class T> class f_max {
- public:
- static I rbin_opt() { return 1; }
- static V rbin(T &v,T a,T b) { v = a > b?a:b; }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T ib)
- {
- if(sqabs(ra,ia) > sqabs(rb,ib)) rv = ra,iv = ia;
- else rv = rb,iv = ib;
- }
- };
-
- template<class T> class f_minmax {
- public:
- static I cun_opt() { return 0; }
- static V cun(T &rv,T &iv,T ra,T ia)
- {
- if(ra < ia) rv = ra,iv = ia;
- else rv = ia,iv = ra;
- }
- };
-
- template<class T> class f_minq {
- public:
- static I rop_opt() { return 0; }
- static V rop(T &,T ra,OpParam &p)
- {
- if(ra < p.norm.minmax) p.norm.minmax = ra;
- }
-
- static I cop_opt() { return 0; }
- static V cop(T &,T &,T ra,T ia,OpParam &p)
- {
- register T s = sqabs(ra,ia);
- if(s < p.norm.minmax) p.norm.minmax = s;
- }
- };
-
- template<class T> class f_maxq {
- public:
- static I rop_opt() { return 0; }
- static V rop(T &,T ra,OpParam &p)
- {
- if(ra > p.norm.minmax) p.norm.minmax = ra;
- }
-
- static I cop_opt() { return 0; }
- static V cop(T &,T &,T ra,T ia,OpParam &p)
- {
- register T s = sqabs(ra,ia);
- if(s > p.norm.minmax) p.norm.minmax = s;
- }
- };
-
- template<class T> class f_aminq {
- public:
- static I rop_opt() { return 0; }
- static V rop(T &,T ra,OpParam &p)
- {
- register T s = fabs(ra);
- if(s < p.norm.minmax) p.norm.minmax = s;
- }
- };
-
- template<class T> class f_amaxq {
- public:
- static I rop_opt() { return 0; }
- static V rop(T &,T ra,OpParam &p)
- {
- register T s = fabs(ra);
- if(s > p.norm.minmax) p.norm.minmax = s;
- }
- };
-
-
- // gating
-
- template<class T> class f_gate {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &rv,T ra,T rb) { rv = fabs(ra) >= rb?ra:0; }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T)
- {
- register const T _abs = sqabs(ra,ia);
-
- if(_abs >= rb*rb) rv = ra,iv = ia;
- else rv = iv = 0;
- }
- };
-
- template<class T> class f_igate {
- public:
- static I rbin_opt() { return 0; }
- static V rbin(T &rv,T ra,T rb) { rv = fabs(ra) <= rb?ra:0; }
-
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T)
- {
- register const T _abs = sqabs(ra,ia);
-
- if(_abs <= rb*rb) rv = ra,iv = ia;
- else rv = iv = 0;
- }
- };
-
- // complex
-
- template<class T> class f_norm {
- public:
- static I cun_opt() { return 0; }
- static V cun(T &rv,T &iv,T ra,T ia)
- {
- register T f = sqabs(ra,ia);
- if(f) { f = 1./sqrt(f); rv = ra*f,iv = ia*f; }
- else rv = iv = 0;
- }
- };
-
- template<class T> class f_conj {
- public:
- static I cun_opt() { return 2; }
- static V cun(T &,T &iv,T,T ia) { iv = -ia; }
- };
-
- template<class T> class f_polar {
- public:
- static I cun_opt() { return 0; }
- static V cun(T &rv,T &iv,T ra,T ia) { rv = sqrt(sqabs(ra,ia)),iv = arg(ra,ia); }
- };
-
- template<class T> class f_rect {
- public:
- static I cun_opt() { return 0; }
- static V cun(T &rv,T &iv,T ra,T ia) { rv = ra*cos(ia),iv = ra*sin(ia); }
- };
-
- template<class T> class f_radd {
- public:
- static I cbin_opt() { return 0; }
- static V cbin(T &rv,T &iv,T ra,T ia,T rb,T)
- {
- register const T _abs = sqrt(sqabs(ra,ia))+rb;
- register const T _phi = arg(ra,ia);
-
- rv = _abs*cos(_phi),iv = _abs*sin(_phi);
- }
- };
-
- // extra
-
- template<class T> class f_fix {
- public:
- /*! \brief Bashes denormals and NANs to zero
-
- \param a argument list
- \param v destination vasp (NULL for in-place operation)
- \return normalized destination vasp
- */
- static I run_opt() { return 0; }
- static V run(T &v,T a)
- {
- if(a != a) // NAN
- v = 0;
- else {
- // denormal bashing (doesn't propagate to the next stage)
-
- static const T anti_denormal = (T)1.e-18;
- a += anti_denormal;
- a -= anti_denormal;
- v = a;
- }
- }
- };
-
-}
-
-
-
-#define DEFOP(T,FUN,OP,KIND) \
-namespace VecOp { inline BL FUN(OpParam &p) { return D__##KIND(T,f_##OP < T > ,p); } }
-
-
-#define DEFVEC_R(T,OP) \
- static BL r_##OP (I len,T *dr,I rds,const T *sr,I rss) { return VecOp::V__rbin<T,VecOp::f_##OP <T> >(sr,rss,dr,rds,len); } \
- static BL v_##OP##_(I layers,const T *sr,T *dr,const T *ar,I len) { return VecOp::V__vbin<T,VecOp::f_##OP <T> >(layers,sr,dr,ar,len); } \
- static BL v_##OP (I dim,const I *dims,I layers,T *dr,const T *sr,const T *ar) { return VecOp::V__vmulti<T>(v_##OP##_,layers,sr,dr,ar,dim,dims); }
-
-#define DEFVEC_C(T,OP) \
- static BL c_##OP (I len,T *dr,T *di,I rds,I ids,const T *sr,I rss,I iss) { return VecOp::V__cbin<T,VecOp::f_##OP <T> >(sr,rss,iss,dr,rds,ids,len); }
-
-#define DEFVEC_B(T,OP) DEFVEC_R(T,OP) DEFVEC_C(T,OP)
-
-
-template<class T>
-class VecFun {
-public:
- DEFVEC_B(T,copy)
-
- DEFVEC_B(T,add)
- DEFVEC_B(T,sub)
- DEFVEC_B(T,subr)
- DEFVEC_B(T,mul)
- DEFVEC_B(T,div)
- DEFVEC_B(T,divr)
- DEFVEC_R(T,mod)
- DEFVEC_B(T,abs)
- DEFVEC_R(T,sign)
- DEFVEC_B(T,sqr)
- DEFVEC_R(T,ssqr)
-
- DEFVEC_C(T,powi)
- DEFVEC_B(T,pow)
- DEFVEC_R(T,sqrt)
- DEFVEC_R(T,ssqrt)
- DEFVEC_R(T,exp)
- DEFVEC_R(T,log)
-
- DEFVEC_R(T,lwr)
- DEFVEC_R(T,gtr)
- DEFVEC_R(T,alwr)
- DEFVEC_R(T,agtr)
- DEFVEC_R(T,leq)
- DEFVEC_R(T,geq)
- DEFVEC_R(T,aleq)
- DEFVEC_R(T,ageq)
- DEFVEC_R(T,equ)
- DEFVEC_R(T,neq)
-
- DEFVEC_B(T,min)
- DEFVEC_B(T,max)
- DEFVEC_C(T,minmax)
- DEFVEC_C(T,gate)
- DEFVEC_C(T,igate)
-
- DEFVEC_C(T,norm)
- DEFVEC_C(T,conj)
- DEFVEC_C(T,polar)
- DEFVEC_C(T,rect)
- DEFVEC_C(T,radd)
-
- DEFVEC_R(T,fix)
-};
-
-
-
-#endif
diff --git a/externals/grill/vasp/source/oploop.h b/externals/grill/vasp/source/oploop.h
deleted file mode 100644
index ec805c13..00000000
--- a/externals/grill/vasp/source/oploop.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-
-VASP modular - vector assembling signal processor / objects for Max/MSP and PD
-
-Copyright (c) 2002-2006 Thomas Grill (gr@grrrr.org)
-For information on usage and redistribution, and for a DISCLAIMER OF ALL
-WARRANTIES, see the file, "license.txt," in this distribution.
-
-*/
-
-#ifndef __VASP_OPLOOP_H
-#define __VASP_OPLOOP_H
-
-#define _D_BLOCK 4096
-
-#define _D_MIN(a,b) ((a) < (b)?(a):(b))
-
-#ifdef FLEXT_THREADS
-
- #define _D_LOOP(VAR,LEN) { \
- for(register int __i__ = 0; __i__ < LEN; flext_base::ThrYield()) { \
- register const I __m__ = _D_MIN(LEN,__i__+_D_BLOCK); \
- for(; __i__ < __m__; ++__i__) { VAR = __i__;
-
- #define _E_LOOP } if(__i__ < __m__) break; }}
-
- #define _D_WHILE(COND) { \
- for(; (COND) ; flext_base::ThrYield()) { \
- register I __i__ = 0; \
- for(; __i__ < _D_BLOCK && (COND); ++__i__) {
-
- #define _E_WHILE } if(__i__ < _D_BLOCK) break; }}
-
-#else
-
- #define _D_LOOP(VAR,LEN) { \
- for(VAR = 0; VAR < LEN; ++VAR) {
-
- #define _E_LOOP }}
-
- #define _D_WHILE(COND) { \
- while(COND) {
-
- #define _E_WHILE }}
-
-#endif
-
-
-#define _DE_WHILE(COND,BODY) { _D_WHILE(COND) BODY; _E_WHILE }
-#define _DF_LOOP(VAR,LEN,BODY) { _D_LOOP(VAR,LEN) BODY; _E_LOOP }
-
-#ifdef VASP_COMPACT
-
- #define _DE_LOOP(VAR,LEN,BODY) _DF_LOOP(VAR,LEN,BODY)
-
-#else
-
- #ifdef FLEXT_THREADS
-
- #define _DE_LOOP(VAR,LEN,BODY) { \
- for(VAR = 0; VAR < LEN; flext_base::ThrYield()) { \
- register const I __m__ = _D_MIN(LEN,VAR+_D_BLOCK); \
- for(; VAR <= __m__-4; ) { \
- BODY; ++VAR; \
- BODY; ++VAR; \
- BODY; ++VAR; \
- BODY; ++VAR; \
- } \
- for(; VAR < __m__; ++VAR) { \
- BODY; \
- } \
- } \
- }
-
- #else
-
- #define _DE_LOOP(VAR,LEN,BODY) { \
- for(VAR = 0; VAR <= LEN-4; ) { \
- BODY; ++VAR; \
- BODY; ++VAR; \
- BODY; ++VAR; \
- BODY; ++VAR; \
- } \
- for(; VAR < LEN; ++VAR) { \
- BODY; \
- } \
- }
-
- #endif
-
-#endif
-
-#define _DQ_LOOP(UNROLL,VAR,LEN,BODY) { if(UNROLL) _DE_LOOP(VAR,LEN,BODY) else _DF_LOOP(VAR,LEN,BODY) }
-
-#endif
diff --git a/externals/grill/vasp/source/opparam.cpp b/externals/grill/vasp/source/opparam.cpp
deleted file mode 100644
index 1c1fd450..00000000
--- a/externals/grill/vasp/source/opparam.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "opparam.h"
-//#include <math.h>
-
-/*
-// Duplication of breakpoint lists should be avoided
-OpParam::Arg &OpParam::Arg::operator =(const Arg &op)
-{
- Clear();
-
- switch(argtp = op.argtp) {
- case arg_x: x = op.x; break;
- case arg_v: v = op.v; break;
- case arg_bp: {
- // Copy breakpoint list (find a different way, e.g. store them in a pool)
- bp.pts = op.bp.pts;
- bp.pt = new R[bp.pts];
- for(I i = 0; i < bp.pts; ++i)
- bp.pt[i] = op.bp.pt[i];
- break;
- }
- }
-
- return *this;
-}
-*/
-V OpParam::Arg::Clear()
-{
-// if(argtp == arg_bp && bp.pt) delete[] bp.pt;
- argtp = arg_;
-}
-
-OpParam::Arg &OpParam::Arg::SetX(S r,S i)
-{
- Clear();
- argtp = arg_x;
- x.r = r,x.i = i;
- return *this;
-}
-
-OpParam::Arg &OpParam::Arg::SetV(S *r,I rs,S *i,I is)
-{
- Clear();
- argtp = arg_v;
- v.rdt = r,v.rs = rs;
- v.idt = i,v.is = is;
- return *this;
-}
-
-/*
-OpParam::Arg &OpParam::Arg::SetB(I pts,const R *pt)
-{
- Clear();
- argtp = arg_bp;
- bp.pts = pts;
- bp.pt = new R[pts];
- for(I ix = 0; ix < pts; ix) bp.pt[ix] = pt[ix];
- return *this;
-}
-*/
-
-OpParam::Arg &OpParam::Arg::SetE(const Env *env)
-{
- Clear();
- argtp = arg_env;
- e.env = env;
- return *this;
-}
-
-
-/*
-V OpParam::SDR_Rev() { SR_Rev(); DR_Rev(); }
-V OpParam::SDI_Rev() { SI_Rev(); DI_Rev(); }
-V OpParam::SDC_Rev() { SDR_Rev(); SDI_Rev(); }
-V OpParam::ADR_Rev() { AR_Rev(); DR_Rev(); }
-V OpParam::ADI_Rev() { AI_Rev(); DI_Rev(); }
-V OpParam::ADC_Rev() { ADR_Rev(); ADI_Rev(); }
-V OpParam::SADR_Rev() { SR_Rev(); AR_Rev(); DR_Rev(); }
-V OpParam::SADI_Rev() { SI_Rev(); AI_Rev(); DI_Rev(); }
-V OpParam::SADC_Rev() { SADR_Rev(); SADI_Rev(); }
-*/
-
-OpParam::OpParam(const C *opnm,I nargs):
- opname(opnm),frames(0),args(0),arg(NULL),
- /*part(false),*/ ovrlap(false),revdir(false),oddrem(false)
-{
- InitArgs(nargs);
-}
-
-OpParam::~OpParam() { Clear(); }
-
-V OpParam::InitArgs(I n)
-{
- if(arg) Clear();
- args = n;
- if(args) arg = new Arg[args];
-}
-
-V OpParam::Clear()
-{
- if(arg) { delete[] arg; arg = NULL; }
- args = 0;
-}
-
-
-/*! \brief Reverse direction of real vector operation
- \todo Check for existence of vectors!
-*/
-V OpParam::R_Rev()
-{
-
- SR_Rev();
- DR_Rev();
- AR_Rev();
- revdir = true;
-}
-
-/*! \brief Reverse direction of complex vector operation
- \todo Check for existence of vectors!
-*/
-V OpParam::C_Rev()
-{
- SR_Rev(); SI_Rev();
- DR_Rev(); DI_Rev();
- AR_Rev(); AI_Rev();
- revdir = true;
-}
-
-
-V OpParam::AR_Rev(I bl)
-{
- if(arg[bl].argtp == Arg::arg_v && arg[bl].v.rdt)
- arg[bl].v.rdt -= (frames-1)*(arg[bl].v.rs = -arg[bl].v.rs);
-}
-
-V OpParam::AI_Rev(I bl)
-{
- if(arg[bl].argtp == Arg::arg_v && arg[bl].v.idt)
- arg[bl].v.idt -= (frames-1)*(arg[bl].v.is = -arg[bl].v.is);
-}
-
-BL OpParam::AR_In(I bl) const
-{
- return arg[bl].argtp == Arg::arg_v && arg[bl].v.rdt && rddt > arg[bl].v.rdt && rddt < arg[bl].v.rdt+frames*arg[bl].v.rs;
-}
-
-BL OpParam::AI_In(I bl) const
-{
- return arg[bl].argtp == Arg::arg_v && arg[bl].v.idt && iddt > arg[bl].v.idt && iddt < arg[bl].v.idt+frames*arg[bl].v.is;
-}
-
-BL OpParam::AR_Can(I bl) const
-{
- return arg[bl].argtp != Arg::arg_v || !arg[bl].v.rdt || arg[bl].v.rdt <= rddt || arg[bl].v.rdt >= rddt+frames*rds;
-}
-
-BL OpParam::AI_Can(I bl) const
-{
- return arg[bl].argtp != Arg::arg_v || !arg[bl].v.idt || arg[bl].v.idt <= iddt || arg[bl].v.idt >= iddt+frames*ids;
-}
-
-BL OpParam::AR_Ovr(I bl) const
-{
- return arg[bl].argtp == Arg::arg_v && arg[bl].v.rdt && rddt != arg[bl].v.rdt && rddt < arg[bl].v.rdt+frames*arg[bl].v.rs && arg[bl].v.rdt < rddt+frames*rds;
-}
-
-BL OpParam::AI_Ovr(I bl) const
-{
- return arg[bl].argtp == Arg::arg_v && arg[bl].v.idt && iddt != arg[bl].v.idt && iddt < arg[bl].v.idt+frames*arg[bl].v.is && arg[bl].v.idt < iddt+frames*ids;
-}
-
-
-
-BL OpParam::AR_In() const
-{
- for(I i = 0; i < args; ++i)
- if(AR_In(i)) return true;
- return false;
-}
-
-BL OpParam::AI_In() const
-{
- for(I i = 0; i < args; ++i)
- if(AI_In(i)) return true;
- return false;
-}
-
-BL OpParam::AR_Can() const
-{
- for(I i = 0; i < args; ++i)
- if(!AR_Can(i)) return false;
- return true;
-}
-
-BL OpParam::AI_Can() const
-{
- for(I i = 0; i < args; ++i)
- if(!AI_Can(i)) return false;
- return true;
-}
-
-BL OpParam::AR_Ovr() const
-{
- for(I i = 0; i < args; ++i)
- if(!AR_Ovr(i)) return false;
- return true;
-}
-
-BL OpParam::AI_Ovr() const
-{
- for(I i = 0; i < args; ++i)
- if(!AI_Ovr(i)) return false;
- return true;
-}
-
-
-V OpParam::AR_Rev()
-{
- for(I i = 0; i < args; ++i) AR_Rev(i);
-}
-
-V OpParam::AI_Rev()
-{
- for(I i = 0; i < args; ++i) AI_Rev(i);
-}
-
-V OpParam::SkipOddMiddle()
-{
- if(symm == 0 && oddrem) {
- // don't process middle sample!
- if(revdir) rsdt += rss,rddt += rds;
- frames--;
- }
-}
-
-V OpParam::SkipOddMiddle(S m)
-{
- if(symm == 0 && oddrem) {
- // set and skip middle sample!
- frames--;
- if(revdir) *rddt = m,rsdt += rss,rddt += rds;
- else rddt[frames] = m;
- }
-}
-
diff --git a/externals/grill/vasp/source/opparam.h b/externals/grill/vasp/source/opparam.h
deleted file mode 100644
index 1c0193d4..00000000
--- a/externals/grill/vasp/source/opparam.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-
-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_OPPARAM_H
-#define __VASP_OPPARAM_H
-
-#include "vecblk.h"
-#include "arg.h"
-
-class OpParam {
-public:
- OpParam(const C *opnm,I args);
- ~OpParam();
-
- V InitArgs(I nargs);
- V Clear();
-
- BL HasArg() const { return arg != NULL; }
-
- const C *opName() const { return opname; }
-
- // check for overlap
- // \remark if on same vector, stride is the same for src, arg, dst!
- inline BL SR_In() const { return rddt > rsdt && rddt < rsdt+frames*rss; }
- inline BL SI_In() const { return iddt > isdt && iddt < isdt+frames*iss; }
- BL AR_In(I bl) const;
- BL AI_In(I bl) const;
- BL AR_In() const;
- BL AI_In() const;
-
- // Can we reverse direction?
- inline BL SR_Can() const { return rsdt <= rddt || rsdt >= rddt+frames*rds; }
- inline BL SI_Can() const { return isdt <= iddt || isdt >= iddt+frames*ids; }
- BL AR_Can(I bl) const;
- BL AI_Can(I bl) const;
- BL AR_Can() const;
- BL AI_Can() const;
-
- // does it overlap? (works only with rss,rds,ras.... > 0)
- inline BL SR_Ovr() const { return rddt != rsdt && rddt < rsdt+frames*rss && rsdt < rddt+frames*rds; }
- inline BL SI_Ovr() const { return iddt != isdt && iddt < isdt+frames*iss && isdt < iddt+frames*ids; }
- BL AR_Ovr(I bl) const;
- BL AI_Ovr(I bl) const;
- BL AR_Ovr() const;
- BL AI_Ovr() const;
-
- V AR_Rev();
- V AI_Rev();
-
- V R_Rev();
- V C_Rev();
-
- V SkipOddMiddle();
- V SkipOddMiddle(S m);
-
- const C *opname;
- I frames,symm,args;
- BL ovrlap,revdir,oddrem;
- S *rsdt,*isdt; I rss,iss;
- S *rddt,*iddt; I rds,ids;
-
- class Arg
- {
- public:
- Arg(): argtp(arg_) {}
-// Arg(const Arg &op) { operator =(op); }
- ~Arg() { Clear(); }
- V Clear();
-
- BL Is() const { return argtp != arg_; }
-
-// Arg &operator =(const Arg &op);
-// Arg &operator =(const Argument &arg);
-
- Arg &SetX(S r,S i = 0);
- Arg &SetV(S *r,I rs,S *i = NULL,I is = 0);
- Arg &SetE(const Env *bp);
-
- struct env_t { const Env *env; };
- struct v_t { S *rdt,*idt; I rs,is; };
- struct x_t { R r,i; };
-
- enum { arg_ = 0,arg_x,arg_v,arg_env } argtp;
- union {
- x_t x;
- v_t v;
- env_t e;
- };
- };
-
- Arg *arg;
-
- union {
- struct { R coef,carry; I rep; } flt;
- struct { R carry; I rep; } intdif;
- struct { BL cx; R density; I cnt; } peaks;
- struct { R ph,phinc; } gen;
- struct { R factor,center; I mode,fill; } tilt;
- struct { R cur,inc; } bvl;
- struct { R sh; I ish; I fill; } sh;
- struct { I wndtp; BL inv,mul; R p1,p2,p3; } wnd;
- struct { R minmax,scl; } norm;
- struct { I arg; } ibin;
- struct { R arg; } rbin;
- struct { R rarg,iarg; } cbin;
- struct { I *order; } perm;
- struct { R val; I offs,dif,dir,slope; BL incl; } srch;
- };
-
-private:
- // reverse direction
- inline V SR_Rev() { rsdt -= (frames-1)*(rss = -rss); }
- inline V SI_Rev() { isdt -= (frames-1)*(iss = -iss); }
- V AR_Rev(I bl);
- V AI_Rev(I bl);
- inline V DR_Rev() { rddt -= (frames-1)*(rds = -rds); }
- inline V DI_Rev() { iddt -= (frames-1)*(ids = -ids); }
-
-};
-
-#endif
diff --git a/externals/grill/vasp/source/oppermute.h b/externals/grill/vasp/source/oppermute.h
deleted file mode 100644
index 45221a1f..00000000
--- a/externals/grill/vasp/source/oppermute.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-
-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_OPPERMUTE_H
-#define __VASP_OPPERMUTE_H
-
-#include "opparam.h"
-#include "oploop.h"
-
-#define PERMTMPL
-#define MAXPERMDIM 2
-
-template<class T>
-inline void permswap(T &a,T &b) { register T t = a; a = b; b = t; }
-
-#ifdef PERMTMPL
-template<class T,int origination(int pos, int sz,OpParam &p)>
-void permutation1(OpParam &p)
-#else
-template<class T>
-void permutation1(OpParam &p,int (*origination)(int pos, int sz,OpParam &p))
-#endif
-{
- T *ddt = p.rddt;
- const I ds = p.rds;
- const I sz = p.frames;
-
- if(ddt != p.rsdt) {
- // not in place
- const T *sdt = p.rsdt;
- const I ss = p.rss;
- I i;
- _DE_LOOP(i,sz, ( ddt[origination(i,sz,p)*ds] = sdt[i*ss] ) )
- }
- else {
- // in place
- // \todo try to come from both sides!
- I i;
- _D_LOOP(i,sz-1)
- int cur = i;
- do { cur = origination(cur,sz,p); } while(cur < i);
- if(cur > i) {
- // swap
- permswap(ddt[cur*ds],ddt[i*ds]);
- }
- _E_LOOP
- }
-}
-
-#ifdef PERMTMPL
-template<class T,int origination(int pos, int sz,OpParam &p)>
-void permutation2(OpParam &p)
-#else
-template<class T>
-void permutation2(OpParam &p,int (*origination)(int pos, int sz,OpParam &p))
-#endif
-{
- T *rddt = p.rddt,*iddt = p.iddt;
- const I rds = p.rds,ids = p.ids;
- const I sz = p.frames;
- bool rinpl = rddt == p.rsdt,iinpl = iddt == p.isdt;
-
- if(rinpl == iinpl) {
- // re and im both in place
- I i;
- _D_LOOP(i,sz-1)
- int cur = i;
- do { cur = origination(cur,sz,p); } while(cur < i);
- if(cur > i) {
- // swap
- permswap(rddt[cur*rds],rddt[i*rds]);
- permswap(iddt[cur*ids],iddt[i*ids]);
- }
- _E_LOOP
- }
- else {
- if(!rinpl) {
- const T *sdt = p.rsdt;
- const I ss = p.rss;
- I i;
- if(ss == 1 && rds == 1)
- _DE_LOOP(i,sz, ( *(rddt++) = *(sdt++) ) )
- else
- _DE_LOOP(i,sz, ( *rddt = *sdt,rddt += rds,sdt += ss ) )
- rddt = p.rddt;
- }
- else permutation1<T>(p,origination);
-
- if(!iinpl) {
- const T *sdt = p.isdt;
- const I ss = p.iss;
- I i;
- if(ss == 1 && ids == 1)
- _DE_LOOP(i,sz, ( *(iddt++) = *(sdt++) ) )
- else
- _DE_LOOP(i,sz, ( *iddt = *sdt,iddt += ids,sdt += ss ) )
- iddt = p.iddt;
- }
- else {
- permswap(p.rddt,p.iddt); permswap(p.rds,p.ids);
- permutation1<T>(p,origination);
- permswap(p.rddt,p.iddt); permswap(p.rds,p.ids);
- }
- }
-}
-
-#ifdef PERMTMPL
-#define PERMUTATION(tp,dim,p,func) permutation ## dim <tp,func>(p)
-#else
-#define PERMUTATION(tp,dim,p,func) permutation ## dim <tp>(p,func)
-#endif
-
-#endif
-
diff --git a/externals/grill/vasp/source/ops.h b/externals/grill/vasp/source/ops.h
deleted file mode 100644
index 00dc8e44..00000000
--- a/externals/grill/vasp/source/ops.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-
-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_OPS_H
-#define __VASP_OPS_H
-
-#include "ops_assign.h"
-#include "ops_arith.h"
-#include "ops_trnsc.h"
-#include "ops_cmp.h"
-#include "ops_cplx.h"
-#include "ops_flt.h"
-#include "ops_dft.h"
-#include "ops_gen.h"
-#include "ops_wnd.h"
-#include "ops_rearr.h"
-#include "ops_resmp.h"
-#include "ops_feature.h"
-
-#endif
diff --git a/externals/grill/vasp/source/ops_arith.cpp b/externals/grill/vasp/source/ops_arith.cpp
deleted file mode 100644
index eb05f8a0..00000000
--- a/externals/grill/vasp/source/ops_arith.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-
-VASP modular - vector assembling signal processor / objects for Max/MSP and PD
-
-Copyright (c) 2002-2003 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 "ops_arith.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-
-VASP_BINARY("vasp.+",add,true,VASP_ARG_R(0),"Adds a value, envelope or vasp")
-VASP_BINARY("vasp.-",sub,true,VASP_ARG_R(0),"Subtracts a value, envelope or vasp")
-VASP_BINARY("vasp.!-",subr,true,VASP_ARG_R(0),"Reverse subtracts a value, envelope or vasp")
-VASP_BINARY("vasp.*",mul,true,VASP_ARG_R(1),"Multiplies with a value, envelope or vasp")
-VASP_BINARY("vasp./",div,true,VASP_ARG_R(1),"Divides by a value, envelope or vasp")
-VASP_BINARY("vasp.!/",divr,true,VASP_ARG_R(1),"Reverse divides by a value, envelope or vasp")
-VASP_BINARY("vasp.%",mod,true,VASP_ARG_R(0),"Calculates the remainder of the division by a value, envelope or vasp")
-
-// -----------------------------------------------------
-
-VASP_UNARY("vasp.sqr",sqr,true,"Calculates the square")
-VASP_UNARY("vasp.ssqr",ssqr,true,"Calculates the square with preservation of the sign")
-
-// -----------------------------------------------------
-
-VASP_UNARY("vasp.sign",sign,true,"Calculates the sign (signum function)")
-VASP_UNARY("vasp.abs",abs,true,"Calculates the absolute value")
-
-
-
-/*! \class vasp_qsum
- \remark \b vasp.sum?
- \brief Get sum of sample values
- \since 0.1.3
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet float - sample value sum
-
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qsum:
- public vasp_unop
-{
- FLEXT_HEADER(vasp_qsum,vasp_unop)
-
-public:
- vasp_qsum(): vasp_unop(true,XletCode(xlet_float,0)) {}
-
- virtual Vasp *do_opt(OpParam &p)
- {
- p.norm.minmax = 0;
- CVasp cref(ref);
- Vasp *ret = VaspOp::m_qsum(p,cref);
- return ret;
- }
-
- virtual Vasp *tx_work()
- {
- OpParam p(thisName(),0);
- Vasp *ret = do_opt(p);
- ToOutFloat(1,p.norm.minmax);
- return ret;
- }
-
- virtual V m_help() { post("%s - Get the sum of a vasp's sample values",thisName()); }
-};
-
-VASP_LIB("vasp.sum?",vasp_qsum)
-
diff --git a/externals/grill/vasp/source/ops_arith.h b/externals/grill/vasp/source/ops_arith.h
deleted file mode 100644
index dd8f88b3..00000000
--- a/externals/grill/vasp/source/ops_arith.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-
-VASP modular - vector assembling signal processor / objects for Max/MSP and PD
-
-Copyright (c) 2002-2003 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_OPS_ARITH_H
-#define __VASP_OPS_ARITH_H
-
-#include "opfuns.h"
-
-// Arithmetic math functions
-
-DEFOP(S,d_add,add,rbin)
-DEFOP(S,d_sub,sub,rbin)
-DEFOP(S,d_subr,subr,rbin)
-DEFOP(S,d_mul,mul,rbin)
-DEFOP(S,d_div,div,rbin)
-DEFOP(S,d_divr,divr,rbin)
-DEFOP(S,d_mod,mod,rbin)
-
-DEFOP(S,d_sqr,sqr,run)
-DEFOP(S,d_ssqr,ssqr,run)
-
-DEFOP(S,d_sign,sign,run)
-DEFOP(S,d_abs,abs,run)
-
-DEFOP(S,d_sumq,sumq,rop)
-
-
-namespace VaspOp {
-
- inline Vasp *m_add(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_add); } // add to (one vec or real)
- inline Vasp *m_sub(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_sub); } // sub from (one vec or real)
- inline Vasp *m_subr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_subr); } // reverse sub from (one vec or real)
- inline Vasp *m_mul(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_mul); } // mul with (one vec or real)
- inline Vasp *m_div(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_div); } // div by (one vec or real)
- inline Vasp *m_divr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_divr); } // reverse div by (one vec or real)
- inline Vasp *m_mod(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_mod); } // modulo by (one vec or real)
-
- inline Vasp *m_sqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sqr); } // unsigned square
- inline Vasp *m_ssqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_ssqr); } // signed square
-
- inline Vasp *m_sign(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sign); } // sign function
- inline Vasp *m_abs(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_abs); } // absolute values
-
- inline Vasp *m_qsum(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_sumq); } // get sum of sample values
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_assign.cpp b/externals/grill/vasp/source/ops_assign.cpp
deleted file mode 100644
index e0adc444..00000000
--- a/externals/grill/vasp/source/ops_assign.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_assign.h"
-#include "opdefs.h"
-
-
-VASP_BINARY("vasp.set vasp.=",set,false,VASP_ARG_R(0),"Assigns a value, envelope or vasp")
-VASP_BINARY("vasp.cset vasp.c=",cset,false,VASP_ARG_R(0),"Assigns a complex value, real envelope or vasp")
-
-
-
-Vasp *VaspOp::m_copy(OpParam &p,CVasp &src,CVasp &arg)
-{
- Vasp *s = NULL,*d = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,&arg);
- if(vecs) {
- d = DoOp(vecs,VecOp::d_copy,p);
- s = vecs->SrcVasp();
- if(d) arg = *d; else { arg.Clear(); delete d; }
- delete vecs;
- }
- return s;
-}
-
-Vasp *VaspOp::m_ccopy(OpParam &p,CVasp &src,CVasp &arg)
-{
- Vasp *s = NULL,*d = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,&arg);
- if(vecs) {
- d = DoOp(vecs,VecOp::d_ccopy,p);
- s = vecs->SrcVasp();
- if(d) arg = *d; else { arg.Clear(); delete d; }
- delete vecs;
- }
- return s;
-}
-
-
-class vasp_copy:
- public vasp_anyop
-{
- FLEXT_HEADER(vasp_copy,vasp_anyop)
-public:
-
- vasp_copy(I argc,const t_atom *argv): vasp_anyop(argc,argv,VASP_ARG(),true,XletCode(xlet_any,0)) {}
-
- virtual V m_to(I,const t_atom *) { post("s - destination vasp is ignored!",thisName()); }
-
- virtual Vasp *do_copy(OpParam &p,CVasp &dst) { CVasp cref(ref); return VaspOp::m_copy(p,cref,dst); }
-
- virtual Vasp *tx_work(const Argument &arg)
- {
- OpParam p(thisName(),0);
-
- if(arg.CanbeVasp()) {
- CVasp dst(arg.GetAVasp());
- Vasp *ret = do_copy(p,dst);
- ToOutVasp(1,dst);
- return ret;
- }
- else {
- post("%s - argument is not a valid vasp!",thisName()); // \todo check earlier!
- return NULL;
- }
- }
-
- virtual V m_help() { post("%s - Copies the triggering vasp to the argument vasp",thisName()); }
-};
-VASP_LIB_V("vasp.copy vasp.->",vasp_copy)
-
-
-class vasp_ccopy:
- public vasp_copy
-{
- FLEXT_HEADER(vasp_ccopy,vasp_copy)
-public:
-
- vasp_ccopy(I argc,const t_atom *argv): vasp_copy(argc,argv) {}
-
- virtual Vasp *do_copy(OpParam &p,CVasp &dst) { CVasp cref(ref); return VaspOp::m_ccopy(p,cref,dst); }
-
- virtual V m_help() { post("%s - Copies complex pairs of the triggering vasp to the argument vasp",thisName()); }
-};
-VASP_LIB_V("vasp.ccopy vasp.c->",vasp_ccopy)
-
-
diff --git a/externals/grill/vasp/source/ops_assign.h b/externals/grill/vasp/source/ops_assign.h
deleted file mode 100644
index 78a3392e..00000000
--- a/externals/grill/vasp/source/ops_assign.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-
-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_OPS_ASSIGN_H
-#define __VASP_OPS_ASSIGN_H
-
-#include "opfuns.h"
-
-// Assignment functions
-
-DEFOP(S,d_copy,copy,run)
-DEFOP(S,d_ccopy,copy,cun)
-
-DEFOP(S,d_set,set,rbin)
-DEFOP(S,d_cset,set,cbin)
-
-
-namespace VaspOp {
- inline Vasp *m_set(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_set); } // copy to (one vec or real)
- inline Vasp *m_cset(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cset); } // complex copy (pairs of vecs or complex)
-
- Vasp *m_copy(OpParam &p,CVasp &src,CVasp &dst);
- Vasp *m_ccopy(OpParam &p,CVasp &src,CVasp &dst);
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_carith.cpp b/externals/grill/vasp/source/ops_carith.cpp
deleted file mode 100644
index 5a964cca..00000000
--- a/externals/grill/vasp/source/ops_carith.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_carith.h"
-#include "ops_assign.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-
-VASP_BINARY("vasp.c+",cadd,true,VASP_ARG_R(0),"adds a complex value or vasp")
-VASP_BINARY("vasp.c-",csub,true,VASP_ARG_R(0),"subtracts a complex value or vasp")
-VASP_BINARY("vasp.c!-",csubr,true,VASP_ARG_R(0),"reverse subtracts a complex value or vasp")
-VASP_BINARY("vasp.c*",cmul,true,VASP_ARG_R(1),"multiplies by a complex value or vasp")
-VASP_BINARY("vasp.c/",cdiv,true,VASP_ARG_R(1),"divides by a complex value or vasp")
-VASP_BINARY("vasp.c!/",cdivr,true,VASP_ARG_R(1),"reverse divides by a complex value or vasp")
-
-
-// -----------------------------------------------------
-
-
-VASP_UNARY("vasp.csqr",csqr,true,"complex square")
-
-// -----------------------------------------------------
-
-Vasp *VaspOp::m_cpowi(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- I powi = 1;
- if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeInt(arg.GetList()[0]))
- powi = flext::GetAInt(arg.GetList()[0]);
- else
- post("%s - power arg is invalid -> set to 1",p.opname);
-
- if(powi < 0) {
- post("%s - negative integer power is not allowed",p.opname);
- }
- else {
- switch(powi) {
- case 0: {
- p.cbin.rarg = 1,p.cbin.iarg = 0;
- ret = DoOp(vecs,VecOp::d_cset,p);
- break;
- }
- case 1: {
- // set arg to src
- ret = DoOp(vecs,VecOp::d_ccopy,p);
- break;
- }
- case 2: {
- ret = DoOp(vecs,VecOp::d_csqr,p);
- break;
- }
- default: {
- p.ibin.arg = powi;
- ret = DoOp(vecs,VecOp::d_cpowi,p);
- break;
- }
- }
- }
-
- delete vecs;
- }
- return ret;
-}
-
-VASP_ANYOP("vasp.cpowi",cpowi,0,true,VASP_ARG_I(1),"complex integer power")
-
-// -----------------------------------------------------
-
-VASP_UNARY("vasp.cabs",cabs,true,"set real part to complex absolute value, imaginary part becomes zero")
-
diff --git a/externals/grill/vasp/source/ops_carith.h b/externals/grill/vasp/source/ops_carith.h
deleted file mode 100644
index 04514a10..00000000
--- a/externals/grill/vasp/source/ops_carith.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-
-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_OPS_CARITH_H
-#define __VASP_OPS_CARITH_H
-
-#include "opfuns.h"
-
-// Arithmetic math functions
-
-DEFOP(S,d_cadd,add,cbin)
-DEFOP(S,d_csub,sub,cbin)
-DEFOP(S,d_csubr,subr,cbin)
-DEFOP(S,d_cmul,mul,cbin)
-DEFOP(S,d_cdiv,div,cbin)
-DEFOP(S,d_cdivr,divr,cbin)
-
-DEFOP(S,d_csqr,sqr,cun)
-
-DEFOP(S,d_cpowi,powi,cop)
-
-DEFOP(S,d_cabs,abs,cun)
-
-
-namespace VaspOp {
- inline Vasp *m_cadd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cadd); } // complex add (pairs of vecs or complex)
- inline Vasp *m_csub(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csub); } // complex sub (pairs of vecs or complex)
- inline Vasp *m_csubr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_csubr); } // reverse complex sub (pairs of vecs or complex)
- inline Vasp *m_cmul(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cmul); } // complex mul (pairs of vecs or complex)
- inline Vasp *m_cdiv(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdiv); } // complex div (pairs of vecs or complex)
- inline Vasp *m_cdivr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_cdivr); } // complex reverse div (pairs of vecs or complex)
-
- inline Vasp *m_csqr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqr); } // complex square (with each two channels)
-// inline Vasp *m_csqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_csqrt); } // complex square root (how about branches?)
-
- Vasp *m_cpowi(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // complex integer power (with each two channels)
-
- inline Vasp *m_cabs(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cabs); } // absolute values
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_cmp.cpp b/externals/grill/vasp/source/ops_cmp.cpp
deleted file mode 100644
index 34b7a98a..00000000
--- a/externals/grill/vasp/source/ops_cmp.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_cmp.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-// --------------------------------------------------------------
-
-VASP_BINARY("vasp.<",lwr,true,VASP_ARG_R(0),"set destination to 1 if source < argument, 0 otherwise")
-VASP_BINARY("vasp.>",gtr,true,VASP_ARG_R(0),"set destination to 1 if source > argument, 0 otherwise")
-VASP_BINARY("vasp.a<",alwr,true,VASP_ARG_R(0),"set destination to 1 if abs(source) < abs(argument), 0 otherwise")
-VASP_BINARY("vasp.a>",agtr,true,VASP_ARG_R(0),"set destination to 1 if abs(source) > abs(argument), 0 otherwise")
-VASP_BINARY("vasp.<=",leq,true,VASP_ARG_R(0),"set destination to 1 if source <= argument, 0 otherwise")
-VASP_BINARY("vasp.>=",geq,true,VASP_ARG_R(0),"set destination to 1 if source >= argument, 0 otherwise")
-VASP_BINARY("vasp.a<=",aleq,true,VASP_ARG_R(0),"set destination to 1 if abs(source) <= abs(argument), 0 otherwise")
-VASP_BINARY("vasp.a>=",ageq,true,VASP_ARG_R(0),"set destination to 1 if abs(source) >= abs(argument), 0 otherwise")
-VASP_BINARY("vasp.==",equ,true,VASP_ARG_R(0),"set destination to 1 if source == argument, 0 otherwise")
-VASP_BINARY("vasp.!=",neq,true,VASP_ARG_R(0),"set destination to 1 if source != argument, 0 otherwise")
-
-
-// --------------------------------------------------------------
-
-VASP_BINARY("vasp.min",min,true,VASP_ARG_R(0),"assigns the minimum of the comparison with a value or vasp")
-VASP_BINARY("vasp.max",max,true,VASP_ARG_R(0),"assigns the maximum of the comparison with a value or vasp")
-
-VASP_BINARY("vasp.rmin",rmin,true,VASP_ARG_R(0),"assigns the minimum of the radius comparison with a complex value or vasp")
-VASP_BINARY("vasp.rmax",rmax,true,VASP_ARG_R(0),"assigns the maximum of the radius comparison with a complex value or vasp")
-
-
-// --------------------------------------------------------------
-
-VASP_UNARY("vasp.minmax",minmax,true,"compare two vectors, assign the lower values to the first and the higher to the second one")
-
-
-
-
-
-
-
diff --git a/externals/grill/vasp/source/ops_cmp.h b/externals/grill/vasp/source/ops_cmp.h
deleted file mode 100644
index ae445b94..00000000
--- a/externals/grill/vasp/source/ops_cmp.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-
-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_OPS_CMP_H
-#define __VASP_OPS_CMP_H
-
-#include "opfuns.h"
-
-// Comparison functions
-
-DEFOP(S,d_lwr,lwr,rbin)
-DEFOP(S,d_gtr,gtr,rbin)
-DEFOP(S,d_alwr,alwr,rbin)
-DEFOP(S,d_agtr,agtr,rbin)
-DEFOP(S,d_leq,leq,rbin)
-DEFOP(S,d_geq,geq,rbin)
-DEFOP(S,d_aleq,aleq,rbin)
-DEFOP(S,d_ageq,ageq,rbin)
-DEFOP(S,d_equ,equ,rbin)
-DEFOP(S,d_neq,neq,rbin)
-
-DEFOP(S,d_min,min,rbin)
-DEFOP(S,d_max,max,rbin)
-DEFOP(S,d_rmin,min,cbin)
-DEFOP(S,d_rmax,max,cbin)
-
-DEFOP(S,d_minmax,minmax,cun)
-
-DEFOP(S,d_minq,minq,rop)
-DEFOP(S,d_maxq,maxq,rop)
-DEFOP(S,d_rminq,minq,cop)
-DEFOP(S,d_rmaxq,maxq,cop)
-DEFOP(S,d_aminq,aminq,rop)
-DEFOP(S,d_amaxq,amaxq,rop)
-
-DEFOP(S,d_gate,gate,rbin)
-DEFOP(S,d_igate,igate,rbin)
-DEFOP(S,d_rgate,gate,cbin)
-DEFOP(S,d_rigate,igate,cbin)
-
-
-namespace VaspOp {
- inline Vasp *m_lwr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_lwr); } // lower than
- inline Vasp *m_gtr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_gtr); } // greater than
- inline Vasp *m_alwr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_alwr); } // abs lower than
- inline Vasp *m_agtr(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_agtr); } // abs greater than
- inline Vasp *m_leq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_leq); } // abs lower than
- inline Vasp *m_geq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_geq); } // abs greater than
- inline Vasp *m_aleq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_aleq); } // lower than
- inline Vasp *m_ageq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_ageq); } // greater than
- inline Vasp *m_equ(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_equ); } // lower than
- inline Vasp *m_neq(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_neq); } // greater than
-
- inline Vasp *m_min(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_min); } // min (one vec or real)
- inline Vasp *m_max(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_max); } // max (one vec or real)
-
- inline Vasp *m_rmin(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_rmin); } // complex (radius) min (pairs of vecs or complex)
- inline Vasp *m_rmax(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_cbin(p,src,arg,dst,VecOp::d_rmax); } // complex (radius) max (pairs of vecs or complex)
-
- inline Vasp *m_minmax(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_minmax); } // min/max
-
- inline Vasp *m_qmin(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_minq); } // get minimum sample value
- inline Vasp *m_qmax(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_maxq); } // get maximum sample value
- inline Vasp *m_qamin(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_aminq); } // get minimum sample value
- inline Vasp *m_qamax(OpParam &p,CVasp &src) { return m_run(p,src,NULL,VecOp::d_amaxq); } // get maximum sample value
-
- inline Vasp *m_qrmin(OpParam &p,CVasp &src) { return m_cun(p,src,NULL,VecOp::d_rminq); } // get minimum sample value
- inline Vasp *m_qrmax(OpParam &p,CVasp &src) { return m_cun(p,src,NULL,VecOp::d_rmaxq); } // get maximum sample value
-
- Vasp *m_gate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // gate
- Vasp *m_igate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // inverse gate
- Vasp *m_rgate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // radius gate
- Vasp *m_rigate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // inverse radius gate
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_cplx.cpp b/externals/grill/vasp/source/ops_cplx.cpp
deleted file mode 100644
index 275f6f2d..00000000
--- a/externals/grill/vasp/source/ops_cplx.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_cplx.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-// -----------------------------------------------------
-
-VASP_UNARY("vasp.polar",polar,true,"convert complex vector pair from rectangular to polar coordinates")
-VASP_UNARY("vasp.rect",rect,true,"convert complex vector pair from polar to rectangular coordinates")
-
-
-// -----------------------------------------------------
-
-
-Vasp *VaspOp::m_radd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeFloat(arg.GetList()[0]))
- p.cbin.rarg = flext::GetAFloat(arg.GetList()[0]);
- else {
- post("%s - argument is invalid -> set to 0",p.opname);
- p.cbin.rarg = 0;
- }
- p.cbin.iarg = 0; // not used anyway
-
- ret = DoOp(vecs,VecOp::d_radd,p);
- delete vecs;
- }
- return ret;
-}
-
-
-VASP_ANYOP("vasp.r+",radd,0,true,VASP_ARG_R(0),"add offset to complex radius (of complex vector pair)")
-
-
-// -----------------------------------------------------
-
-VASP_UNARY("vasp.cnorm",cnorm,true,"normalize complex radius to 1 (but preserve angle)")
-
-// -----------------------------------------------------
-
-//VASP_UNARY("vasp.cconj",cconj,true,"complex conjugate: multiply imaginary part with -1") // should be replaced by an abstraction
-
diff --git a/externals/grill/vasp/source/ops_cplx.h b/externals/grill/vasp/source/ops_cplx.h
deleted file mode 100644
index 9ca9d74e..00000000
--- a/externals/grill/vasp/source/ops_cplx.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-
-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_OPS_CPLX_H
-#define __VASP_OPS_CPLX_H
-
-#include "opfuns.h"
-
-// Complex functions
-
-DEFOP(S,d_polar,polar,cun)
-DEFOP(S,d_rect,rect,cun)
-
-DEFOP(S,d_radd,radd,cbin)
-
-DEFOP(S,d_cnorm,norm,cun)
-
-//DEFOP(S,d_cconj,conj,cun)
-
-
-namespace VaspOp {
- inline Vasp *m_polar(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_polar); } // cartesian -> polar (each two)
- inline Vasp *m_rect(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_rect); } // polar -> cartesian (each two)
-
- Vasp *m_radd(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // radius offset
-
- inline Vasp *m_cnorm(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cnorm); } // complex normalize
-
-// inline Vasp *m_cswap(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cswap); } // swap real and imaginary parts
-// inline Vasp *m_cconj(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cconj); } // complex conjugate
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_dft.cpp b/externals/grill/vasp/source/ops_dft.cpp
deleted file mode 100644
index fd00d921..00000000
--- a/externals/grill/vasp/source/ops_dft.cpp
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file ops_dft.cpp
- \brief Implementation of DFT routines
-
- \todo align temporary memory allocations
-
- All DFTs are normalized by 1/sqrt(n), hence the complex ones are repeatable
-
- - complex FFT radix-2: in-place
- - real FFT radix-2 (split-radix): in-place
- - complex DFT radix-n (split-radix): out-of-place
- - real DFT radix-n: out-of-place / based on complex DFT radix-n (inefficient)
-
- In-place transformation is only possible for stride=1
-*/
-
-#include "main.h"
-#include "ops_dft.h"
-#include <math.h>
-#include <string.h>
-
-///////////////////////////////////////////////////////////////
-
-BL mixfft(I n,F *xRe,F *xIm,F *yRe,F *yIm);
-
-#ifdef FLEXT_THREADS
-static flext::ThrMutex mixmtx;
-#endif
-
-//! Real forward DFT radix-n (managing routine)
-static BL fft_fwd_real_any(I cnt,F *rsdt,I _rss,F *rddt,I _rds)
-{
- if(!rddt) rddt = rsdt,_rds = _rss;
-
-#ifdef VASP_CHN1
- const I rds = 1,rss = 1;
-#else
- const I rds = _rds,rss = _rss;
-#endif
-
- const BL rst = rss != 1;
- const BL rdt = rsdt == rddt || rds != 1;
-
- F *rstmp,*istmp;
- register I i;
-
- if(rst) {
- rstmp = new F[cnt];
- // happens only if rss != 1, no optimization necessary
- for(i = 0; i < cnt; ++i) rstmp[i] = rsdt[i*rss];
- }
- else
- rstmp = rsdt;
-
- istmp = new F[cnt];
- flext::ZeroMem(istmp,cnt*sizeof(*istmp));
-
- F *rdtmp = rdt?new F[cnt]:rddt;
- F *idtmp = new F[cnt];
-
- BL ret;
- {
- // mixfft is not thread-safe
-#ifdef FLEXT_THREADS
- mixmtx.Lock();
-#endif
- ret = mixfft(cnt,rstmp,istmp,rdtmp,idtmp);
-#ifdef FLEXT_THREADS
- mixmtx.Unlock();
-#endif
- }
- if(ret) {
- const F nrm = 1./sqrt((F)cnt);
- const I n2 = cnt/2;
-
-#ifndef VASP_COMPACT
- if(rds == 1) {
- for(i = 0; i <= n2; ++i) rddt[i] = rdtmp[i]*nrm;
- for(i = 1; i < cnt-n2; ++i) rddt[i+n2] = idtmp[i]*nrm;
- }
- else
-#endif
- {
- for(i = 0; i <= n2; ++i) rddt[i*rds] = rdtmp[i]*nrm;
- for(i = 1; i < cnt-n2; ++i) rddt[(i+n2)*rds] = idtmp[i]*nrm;
- }
- }
-
- if(rst) delete[] rstmp;
- delete[] istmp;
- if(rdt) delete[] rdtmp;
- delete[] idtmp;
-
- return ret;
-}
-
-
-//! Real inverse DFT radix-n (managing routine)
-static BL fft_inv_real_any(I cnt,F *rsdt,I _rss,F *rddt,I _rds)
-{
- if(!rddt) rddt = rsdt,_rds = _rss;
-
-#ifdef VASP_CHN1
- const I rds = 1,rss = 1;
-#else
- const I rds = _rds,rss = _rss;
-#endif
-
- const BL rst = rss != 1;
- const BL rdt = rsdt == rddt || rds != 1;
-
- const I n2 = cnt/2;
- F *rstmp,*istmp;
- istmp = new F[cnt];
- register I i;
-
- if(rst) {
- rstmp = new F[cnt];
- // happens only if rss != 1, no optimization necessary
- for(i = 0; i <= n2; ++i) rstmp[i] = rsdt[i*rss];
- for(i = 1; i < cnt-n2; ++i) istmp[cnt-i] = rsdt[(n2+i)*rss];
- }
- else {
- rstmp = rsdt;
- for(i = 1; i < cnt-n2; ++i) istmp[cnt-i] = rsdt[n2+i];
- }
-
- // make symmetric parts
- for(i = 1; i < cnt-n2; ++i) {
- istmp[i] = -istmp[cnt-i];
- rstmp[cnt-i] = rstmp[i];
- }
- istmp[0] = 0;
- if(cnt%2 == 0) istmp[n2] = 0;
-
-
- F *rdtmp = rdt?new F[cnt]:rddt;
- F *idtmp = new F[cnt];
-
- BL ret;
- {
-#ifdef FLEXT_THREADS
- mixmtx.Lock();
-#endif
- // mixfft is not thread-safe
- ret = mixfft(cnt,rstmp,istmp,rdtmp,idtmp);
-#ifdef FLEXT_THREADS
- mixmtx.Unlock();
-#endif
- }
- if(ret) {
- const F nrm = 1./sqrt((F)cnt);
-#ifndef VASP_COMPACT
- if(rds == 1)
- for(i = 0; i < cnt; ++i)
- rddt[i] = rdtmp[i]*nrm;
- else
-#endif
- for(i = 0; i < cnt; ++i)
- rddt[i*rds] = rdtmp[i]*nrm;
- }
-
- if(rst) delete[] rstmp;
- delete[] istmp;
- if(rdt) delete[] rdtmp;
- delete[] idtmp;
-
- return ret;
-}
-
-///////////////////////////////////////////////////////////////
-
-//! Complex forward DFT radix-n (managing routine)
-static BL fft_fwd_complex_any(I cnt,F *rsdt,I _rss,F *isdt,I _iss,F *rddt,I _rds,F *iddt,I _ids)
-{
- if(!rddt) rddt = rsdt,_rds = _rss;
- if(!iddt) iddt = isdt,_ids = _iss;
-
-#ifdef VASP_CHN1
- const I rds = 1,ids = 1,rss = 1,iss = 1;
-#else
- const I rds = _rds,ids = _ids,rss = _rss,iss = _iss;
-#endif
-
- const BL rst = rss != 1;
- const BL ist = iss != 1;
- const BL rdt = rsdt == rddt || rds != 1;
- const BL idt = isdt == iddt || ids != 1;
-
- F *rstmp,*istmp;
- register I i;
-
- if(rst) {
- rstmp = new F[cnt];
- // happens only if rss != 1, no optimization necessary
- for(i = 0; i < cnt; ++i) rstmp[i] = rsdt[i*rss];
- }
- else
- rstmp = rsdt;
-
- if(ist) {
- istmp = new F[cnt];
- // happens only if iss != 1, no optimization necessary
- for(i = 0; i < cnt; ++i) istmp[i] = isdt[i*iss];
- }
- else
- istmp = isdt;
-
- F *rdtmp = rdt?new F[cnt]:rddt;
- F *idtmp = idt?new F[cnt]:iddt;
-
- BL ret;
- {
-#ifdef FLEXT_THREADS
- mixmtx.Lock();
-#endif
- // mixfft is not thread-safe
- ret = mixfft(cnt,rstmp,istmp,rdtmp,idtmp);
-#ifdef FLEXT_THREADS
- mixmtx.Unlock();
-#endif
- }
- if(ret) {
- const F nrm = 1./sqrt((F)cnt);
-
-#ifdef VASP_COMPACT
- for(i = 0; i < cnt; ++i) {
- rddt[i*rds] = rdtmp[i]*nrm;
- iddt[i*ids] = idtmp[i]*nrm;
- }
-#else
- if(rdt) {
- if(rds != 1)
- for(i = 0; i < cnt; ++i) rddt[i*rds] = rdtmp[i]*nrm;
- else
- for(i = 0; i < cnt; ++i) rddt[i] = rdtmp[i]*nrm;
- }
- else // ok, this branch is not absolutely necessary
- if(rds != 1)
- for(i = 0; i < cnt; ++i) rddt[i*rds] *= nrm;
- else
- for(i = 0; i < cnt; ++i) rddt[i] *= nrm;
-
- if(idt) {
- if(ids != 1)
- for(i = 0; i < cnt; ++i) iddt[i*ids] = idtmp[i]*nrm;
- else
- for(i = 0; i < cnt; ++i) iddt[i] = idtmp[i]*nrm;
- }
- else // ok, this branch is not absolutely necessary
- if(ids != 1)
- for(i = 0; i < cnt; ++i) iddt[i*ids] *= nrm;
- else
- for(i = 0; i < cnt; ++i) iddt[i] *= nrm;
-#endif
- }
-
- if(rst) delete[] rstmp;
- if(ist) delete[] istmp;
- if(rdt) delete[] rdtmp;
- if(idt) delete[] idtmp;
-
- return ret;
-}
-
-//! Complex inverse DFT radix-n (managing routine)
-static BL fft_inv_complex_any(I cnt,F *rsdt,I _rss,F *isdt,I _iss,F *rddt,I _rds,F *iddt,I _ids)
-{
- I i;
-
- if(!rddt) rddt = rsdt,_rds = _rss;
- if(!iddt) iddt = isdt,_ids = _iss;
-
-#ifdef VASP_CHN1
- const I rds = 1,ids = 1,rss = 1,iss = 1;
-#else
- const I rds = _rds,ids = _ids,rss = _rss,iss = _iss;
-#endif
-
-#ifndef VASP_COMPACT
- if(iss == 1)
- for(i = 0; i < cnt; ++i) isdt[i] = -isdt[i];
- else
-#endif
- for(i = 0; i < cnt; ++i) isdt[i*iss] *= -1;
-
- BL ret = fft_fwd_complex_any(cnt,rsdt,rss,isdt,iss,rddt,rds,iddt,ids);
-
- if(ret) {
-#ifndef VASP_COMPACT
- if(ids == 1)
- for(i = 0; i < cnt; ++i) iddt[i] = -iddt[i];
- else
-#endif
- for(i = 0; i < cnt; ++i) iddt[i*ids] *= -1;
- }
-
- // reverse minus on input
- if(isdt != iddt) {
-#ifndef VASP_COMPACT
- if(iss == 1)
- for(i = 0; i < cnt; ++i) isdt[i] = -isdt[i];
- else
-#endif
- for(i = 0; i < cnt; ++i) isdt[i*iss] *= -1;
- }
- return ret;
-}
-
-///////////////////////////////////////////////////////////////
-
-bool fft_bidir_complex_radix2(int size,float *real,float *imag,int dir);
-
-//! Complex forward FFT radix-2 (managing routine)
-static BL fft_complex_radix2(I cnt,F *rsdt,I _rss,F *isdt,I _iss,F *rddt,I _rds,F *iddt,I _ids,I dir)
-{
- if(!rddt) rddt = rsdt,_rds = _rss;
- if(!iddt) iddt = isdt,_ids = _iss;
-
-#ifdef VASP_CHN1
- const I rds = 1,ids = 1,rss = 1,iss = 1;
-#else
- const I rds = _rds,ids = _ids,rss = _rss,iss = _iss;
-#endif
-
- BL rt = false,it = false;
- F *rtmp,*itmp;
- register I i;
-
- if(rss == 1)
- rtmp = rsdt;
- else {
- if(rsdt == rddt || rds != 1)
- rtmp = new F[cnt],rt = true;
- else
- rtmp = rddt;
- for(i = 0; i < cnt; ++i) rtmp[i] = rsdt[i*rss];
- }
-
- if(iss == 1)
- itmp = isdt;
- else {
- if(isdt == iddt || ids != 1)
- itmp = new F[cnt],it = true;
- else
- itmp = iddt;
- for(i = 0; i < cnt; ++i) itmp[i] = isdt[i*iss];
- }
-
- BL ret = fft_bidir_complex_radix2(cnt,rtmp,itmp,dir);
-
- if(ret) {
- const F nrm = 1./sqrt((F)cnt);
-
-#ifndef VASP_COMPACT
- if(rtmp == rddt)
- for(i = 0; i < cnt; ++i) rddt[i] *= nrm;
- else if(rds == 1)
- for(i = 0; i < cnt; ++i) rddt[i] = rtmp[i]*nrm;
- else
-#endif
- for(i = 0; i < cnt; ++i) rddt[i*rds] = rtmp[i]*nrm;
-
-#ifndef VASP_COMPACT
- if(itmp == iddt)
- for(i = 0; i < cnt; ++i) iddt[i] *= nrm;
- else if(ids == 1)
- for(i = 0; i < cnt; ++i) iddt[i] = itmp[i]*nrm;
- else
-#endif
- for(i = 0; i < cnt; ++i) iddt[i*ids] = itmp[i]*nrm;
- }
-
- if(rt) delete[] rtmp;
- if(it) delete[] itmp;
-
- return ret;
-}
-
-inline BL fft_fwd_complex_radix2(I cnt,F *rsdt,I _rss,F *isdt,I _iss,F *rddt,I _rds,F *iddt,I _ids)
-{
- return fft_complex_radix2(cnt,rsdt,_rss,isdt,_iss,rddt,_rds,iddt,_ids,1);
-}
-
-inline BL fft_inv_complex_radix2(I cnt,F *rsdt,I _rss,F *isdt,I _iss,F *rddt,I _rds,F *iddt,I _ids)
-{
- return fft_complex_radix2(cnt,rsdt,_rss,isdt,_iss,rddt,_rds,iddt,_ids,-1);
-}
-
-///////////////////////////////////////////////////////////////
-
-void realfft_split(float *data,int n);
-void irealfft_split(float *data,int n);
-
-// normalize and reverse imaginary part in-place
-static void nrmirev(float *data,int n,float fn)
-{
- int i;
- const I n2 = n/2,n4 = n2/2;
- for(i = 0; i <= n2; ++i) data[i] *= fn;
- for(i = 1; i < n4; ++i) {
- register F tmp = data[n2+i];
- data[n2+i] = data[n-i]*fn;
- data[n-i] = tmp*fn;
- }
- if(n2%2 == 0) data[n2+n4] *= fn;
-}
-
-//! Real forward FFT radix-2 (managing routine)
-BL fft_fwd_real_radix2(I cnt,F *src,I _sstr,F *dst,I _dstr)
-{
-#ifdef VASP_CHN1
- const I dstr = 1,sstr = 1;
-#else
- const I dstr = _dstr,sstr = _sstr;
-#endif
-
- register I i;
- const I n2 = cnt/2;
- const F fn = (F)(1./sqrt((F)cnt));
- F *stmp;
- if(!dst || src == dst) {
- // in-place
-
- if(sstr == 1)
- stmp = src;
- else {
- stmp = new F[cnt];
- for(i = 0; i < cnt; ++i) stmp[i] = src[i*sstr];
- }
-
- realfft_split(stmp,cnt);
-
- if(sstr == 1) {
- // src == stmp !!!
- nrmirev(stmp,cnt,fn);
- }
- else {
- for(i = 0; i <= n2; ++i) src[i*sstr] = stmp[i]*fn;
- for(i = 1; i < n2; ++i) src[(n2+i)*sstr] = stmp[cnt-i]*fn;
- delete[] stmp;
- }
- }
- else {
- // out of place
-
- if(sstr == 1)
- stmp = src;
- else {
- stmp = dstr == 1?dst:new F[cnt];
- for(i = 0; i < cnt; ++i) stmp[i] = src[i*sstr];
- }
-
- realfft_split(stmp,cnt);
-
- if(sstr == 1) {
-#ifdef VASP_COMPACT
- if(dstr == 1) {
- for(i = 0; i <= n2; ++i) dst[i] = stmp[i]*fn;
- for(i = 1; i < n2; ++i) dst[n2+i] = stmp[cnt-i]*fn;
- }
- else
-#endif
- {
- for(i = 0; i <= n2; ++i) dst[i*dstr] = stmp[i]*fn;
- for(i = 1; i < n2; ++i) dst[(n2+i)*dstr] = stmp[cnt-i]*fn;
- }
- }
- else {
- if(dstr == 1) {
- // dst == stmp !!!
- nrmirev(stmp,cnt,fn);
- }
- else {
- for(i = 0; i <= n2; ++i) dst[i*dstr] = stmp[i]*fn;
- for(i = 1; i < n2; ++i) dst[(n2+i)*dstr] = stmp[cnt-i]*fn;
- delete[] dst;
- }
- }
- }
-
- return true;
-}
-
-//! Real inverse FFT radix-2 (managing routine)
-BL fft_inv_real_radix2(I cnt,F *src,I _sstr,F *dst,I _dstr)
-{
-#ifdef VASP_CHN1
- const I dstr = 1,sstr = 1;
-#else
- const I dstr = _dstr,sstr = _sstr;
-#endif
-
- register I i;
- const I n2 = cnt/2;
- const F fn = (F)(1./sqrt((F)cnt));
- F *stmp;
- if(!dst || src == dst) {
- // in-place
-
- if(sstr == 1) {
- stmp = src;
- nrmirev(stmp,cnt,fn);
- }
- else {
- stmp = new F[cnt];
-
-#ifdef VASP_COMPACT
- if(sstr == 1) {
- for(i = 0; i <= n2; ++i) stmp[i] = src[i]*fn;
- for(i = 1; i < n2; ++i) stmp[cnt-i] = src[n2+i]*fn;
- }
- else
-#endif
- {
- for(i = 0; i <= n2; ++i) stmp[i] = src[i*sstr]*fn;
- for(i = 1; i < n2; ++i) stmp[cnt-i] = src[(n2+i)*sstr]*fn;
- }
- }
-
- irealfft_split(stmp,cnt);
-
- if(sstr != 1) {
- for(i = 0; i < cnt; ++i) src[i*sstr] = stmp[i];
- delete[] stmp;
- }
- }
- else {
- // out of place
-
- if(dstr == 1) {
- stmp = dst;
-#ifdef VASP_COMPACT
- if(sstr == 1) {
- for(i = 0; i <= n2; ++i) stmp[i] = src[i]*fn;
- for(i = 1; i < n2; ++i) stmp[cnt-i] = src[n2+i]*fn;
- }
- else
-#endif
- {
- for(i = 0; i <= n2; ++i) stmp[i] = src[i*sstr]*fn;
- for(i = 1; i < n2; ++i) stmp[cnt-i] = src[(n2+i)*sstr]*fn;
- }
- }
- else {
- stmp = new F[cnt];
- if(sstr == 1) {
- // dst == stmp !!!
- nrmirev(stmp,cnt,fn);
- }
- else {
- for(i = 0; i <= n2; ++i) stmp[i] = src[i*sstr]*fn;
- for(i = 1; i < n2; ++i) stmp[cnt-i] = src[(n2+i)*sstr]*fn;
- }
- }
-
- irealfft_split(stmp,cnt);
-
- if(dstr != 1) {
- for(i = 0; i < cnt; ++i) dst[i*dstr] = stmp[i];
- delete[] stmp;
- }
- }
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////
-
-//! Determine if size is radix-2
-static I radix2(I size)
-{
- I i,j;
- for(i = j = 1; j < size; i++,j <<= 1) (void)0;
- return j == size?i:-1;
-}
-
-Vasp *VaspOp::m_rfft(OpParam &p,CVasp &src,CVasp *dst,BL inv)
-{
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- BL ok = true;
- for(I i = 0; ok && i < vecs->Vecs(); ++i) {
- VBuffer *s = vecs->Src(i);
- VBuffer *d = vecs->Dst(i);
- if(!d) d = s;
-
- if(vecs->Frames() > 1)
- if(radix2(vecs->Frames()) >= 1)
- // radix-2
- if(inv)
- ok = fft_inv_real_radix2(vecs->Frames(),s->Pointer(),s->Channels(),d->Pointer(),d->Channels());
- else
- ok = fft_fwd_real_radix2(vecs->Frames(),s->Pointer(),s->Channels(),d->Pointer(),d->Channels());
- else
- // radix-n
- if(inv)
- ok = fft_inv_real_any(vecs->Frames(),s->Pointer(),s->Channels(),d->Pointer(),d->Channels());
- else
- ok = fft_fwd_real_any(vecs->Frames(),s->Pointer(),s->Channels(),d->Pointer(),d->Channels());
- }
- return ok?vecs->ResVasp():NULL;
- }
- else
- return NULL;
-}
-
-Vasp *VaspOp::m_cfft(OpParam &p,CVasp &src,CVasp *dst,BL inv)
-{
- CVecBlock *vecs = GetCVecs(p.opname,src,dst,true);
- if(vecs) {
- BL ok = true;
- for(I i = 0; ok && i < vecs->Pairs(); ++i) {
- VBuffer *sre = vecs->ReSrc(i),*sim = vecs->ImSrc(i);
- VBuffer *dre = vecs->ReDst(i),*dim = vecs->ImDst(i);
- if(!dre) dre = sre;
- if(!dim) dim = sim;
-
- if(vecs->Frames() > 1)
- if(radix2(vecs->Frames()) >= 1)
- // radix-2
- if(inv)
- ok = fft_inv_complex_radix2(vecs->Frames(),sre->Pointer(),sre->Channels(),sim?sim->Pointer():NULL,sim?sim->Channels():0,dre->Pointer(),dre->Channels(),dim->Pointer(),dim->Channels());
- else
- ok = fft_fwd_complex_radix2(vecs->Frames(),sre->Pointer(),sre->Channels(),sim?sim->Pointer():NULL,sim?sim->Channels():0,dre->Pointer(),dre->Channels(),dim->Pointer(),dim->Channels());
- else
- // radix-n
- if(inv)
- ok = fft_inv_complex_any(vecs->Frames(),sre->Pointer(),sre->Channels(),sim?sim->Pointer():NULL,sim?sim->Channels():0,dre->Pointer(),dre->Channels(),dim->Pointer(),dim->Channels());
- else
- ok = fft_fwd_complex_any(vecs->Frames(),sre->Pointer(),sre->Channels(),sim?sim->Pointer():NULL,sim?sim->Channels():0,dre->Pointer(),dre->Channels(),dim->Pointer(),dim->Channels());
- }
- return ok?vecs->ResVasp():NULL;
- }
- else
- return NULL;
-}
-
-VASP_UNARY("vasp.rfft",rfft,true,"Real DFT")
-VASP_UNARY("vasp.r!fft",rifft,true,"Real inverse DFT")
-VASP_UNARY("vasp.cfft",cfft,true,"Complex DFT")
-VASP_UNARY("vasp.c!fft",cifft,true,"Complex inverse DFT")
-
diff --git a/externals/grill/vasp/source/ops_dft.h b/externals/grill/vasp/source/ops_dft.h
deleted file mode 100644
index 24b9a23d..00000000
--- a/externals/grill/vasp/source/ops_dft.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-
-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_OPS_DFT_H
-#define __VASP_OPS_DFT_H
-
-#include "opbase.h"
-
-// Fourier transforms
-
-namespace VaspOp {
- Vasp *m_rfft(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); // real forward
- inline Vasp *m_rifft(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_rfft(p,src,dst,true); } // real inverse
- Vasp *m_cfft(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); // complex forward
- inline Vasp *m_cifft(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cfft(p,src,dst,true); } // complex inverse
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_feature.cpp b/externals/grill/vasp/source/ops_feature.cpp
deleted file mode 100644
index 89e3a156..00000000
--- a/externals/grill/vasp/source/ops_feature.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_feature.h"
-#include "oploop.h"
-#include "util.h"
-#include <math.h>
-
-// --- find peaks
-
-BL higher(S a,S b) { return a > b; }
-BL lower(S a,S b) { return a < b; }
-
-/*! \brief Find peaks or valleys (depending on cmp function)
- \param rep repetition count
-
- \remark real peak search is mangled into complex domain
-
- \todo how to treat <=, >=
- \todo separate real and complex functionality
-*/
-
-static BL d_vlpk(OpParam &p,BL cmpf(S a,S b))
-{
- I dpeaks = (I)(p.frames*p.peaks.density);
- if(dpeaks < 1) dpeaks = 1;
-
- I cnt;
- do {
- cnt = 0;
-
- I i;
- S *rdst = p.rddt,*rsrc = p.rsdt;
- S *idst = p.iddt,*isrc = p.isdt;
-
- if(!p.peaks.cx || !idst) idst = rdst,p.ids = p.rds;
- if(!p.peaks.cx || !isrc) isrc = rsrc,p.iss = p.rss;
-
- // preset sample values
- S d1 = -1,d0 = -1,dn = -1;
-
- // search first non-null sample
- _D_LOOP(i,p.frames)
- if((dn = sqabs(rsrc[i*p.rss],isrc[i*p.iss])) != 0)
- break; // non-null -> break!
- else
- rdst[i*p.rds] = idst[i*p.ids] = 0; // copy null samples to dst
- _E_LOOP
-
- // i points to first non-null sample
-
- _D_WHILE(i < p.frames)
- // current samples -> previous samples
- d1 = d0,d0 = dn;
-
- // save current index
- I ci = i;
-
- // search next non-null sample
- dn = -1;
- while(++i < p.frames)
- if((dn = sqabs(rsrc[i*p.rss],isrc[i*p.iss])) != 0) {
- break; // non-null -> break!
- }
- else
- rdst[i*p.rds] = idst[i*p.ids] = 0;
-
- if((d1 < 0 || cmpf(d0,d1)) && (dn < 0 || cmpf(d0,dn))) {
- // is peak/valley
- rdst[ci*p.rds] = rsrc[ci*p.rss];
- idst[ci*p.ids] = isrc[ci*p.iss];
- ++cnt;
- }
- else
- rdst[ci*p.rds] = idst[ci*p.ids] = 0;
- _E_WHILE
- } while(cnt > dpeaks);
-
- p.peaks.density = p.frames?(R)cnt/p.frames:(cnt?1:0);
- return true;
-}
-
-inline BL d_peaks(OpParam &p) { return d_vlpk(p,higher); }
-inline BL d_valleys(OpParam &p) { return d_vlpk(p,lower); }
-inline BL d_rpeaks(OpParam &p) { return d_vlpk(p,higher); }
-inline BL d_rvalleys(OpParam &p) { return d_vlpk(p,lower); }
-
-/*! \brief Finds peaks or valleys in a vasp.
-
- \param arg argument list
- \param arg.rep repetition count
- \param dst destination vasp (NULL for in-place operation)
- \param inv true for valley operation
- \return normalized destination vasp
-*/
-Vasp *VaspOp::m_peaks(OpParam &p,CVasp &src,CVasp *dst,BL inv)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- p.peaks.cx = false;
- ret = DoOp(vecs,inv?d_valleys:d_peaks,p);
- delete vecs;
- }
- return ret;
-}
-
-
-
-/*! \brief Finds peaks or valleys by radius in a complex vasp.
-
- \param arg argument list
- \param arg.rep repetition count
- \param dst destination vasp (NULL for in-place operation)
- \param inv true for valley operation
- \return normalized destination vasp
-*/
-Vasp *VaspOp::m_rpeaks(OpParam &p,CVasp &src,CVasp *dst,BL inv)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- p.peaks.cx = true;
- ret = DoOp(vecs,inv?d_rvalleys:d_rpeaks,p);
- delete vecs;
- }
- return ret;
-}
-
-
-class vasp_peaks:
- public vasp_anyop
-{
- FLEXT_HEADER(vasp_peaks,vasp_anyop)
-public:
-
- vasp_peaks(I argc,const t_atom *argv):
- vasp_anyop(argc,argv,VASP_ARG(),true,XletCode(xlet_float,0))
- {}
-
- virtual Vasp *do_peaks(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_peaks(p,cref,&cdst);
- }
-
- virtual Vasp *tx_work(const Argument &arg)
- {
- OpParam p(thisName(),0);
-
- if(arg.IsList() && arg.GetList().Count() >= 1 && CanbeFloat(arg.GetList()[0])) {
- p.peaks.density = GetAFloat(arg.GetList()[0]);
- }
- else {
- if(!arg.IsNone()) post("%s - invalid density argument -> set to 1",p.opname);
- p.peaks.density = 1;
- }
-
- Vasp *ret = do_peaks(p);
- ToOutFloat(1,p.peaks.density);
- return ret;
- }
-
- virtual V m_help() { post("%s - Get non-zero values only for peaks",thisName()); }
-};
-VASP_LIB_V("vasp.peaks",vasp_peaks)
-
-
-class vasp_valleys:
- public vasp_peaks
-{
- FLEXT_HEADER(vasp_valleys,vasp_peaks)
-public:
- vasp_valleys(I argc,const t_atom *argv): vasp_peaks(argc,argv) {}
- virtual Vasp *do_peaks(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_valleys(p,cref,&cdst);
- }
-
- virtual V m_help() { post("%s - Get non-zero values only for values",thisName()); }
-};
-VASP_LIB_V("vasp.valleys",vasp_valleys)
-
-
-class vasp_rpeaks:
- public vasp_peaks
-{
- FLEXT_HEADER(vasp_rpeaks,vasp_peaks)
-public:
- vasp_rpeaks(I argc,const t_atom *argv): vasp_peaks(argc,argv) {}
- virtual Vasp *do_peaks(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_rpeaks(p,cref,&cdst);
- }
-
- virtual V m_help() { post("%s - Get non-zero values only for peaks of the complex radius",thisName()); }
-};
-VASP_LIB_V("vasp.rpeaks",vasp_rpeaks)
-
-
-class vasp_rvalleys:
- public vasp_peaks
-{
- FLEXT_HEADER(vasp_rvalleys,vasp_peaks)
-public:
- vasp_rvalleys(I argc,const t_atom *argv): vasp_peaks(argc,argv) {}
- virtual Vasp *do_peaks(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_rvalleys(p,cref,&cdst);
- }
-
- virtual V m_help() { post("%s - Get non-zero values only for valleys of the complex radius",thisName()); }
-};
-VASP_LIB_V("vasp.rvalleys",vasp_rvalleys)
-
diff --git a/externals/grill/vasp/source/ops_feature.h b/externals/grill/vasp/source/ops_feature.h
deleted file mode 100644
index 95293bad..00000000
--- a/externals/grill/vasp/source/ops_feature.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-
-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_OPS_FEATURE_H
-#define __VASP_OPS_FEATURE_H
-
-#include "opbase.h"
-
-// Feature extraction functions
-
-namespace VecOp {
-}
-
-namespace VaspOp {
- // extrema functions
- Vasp *m_peaks(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); //! find peaks
- inline Vasp *m_valleys(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_peaks(p,src,dst,true); } //! find valleys
- Vasp *m_rpeaks(OpParam &p,CVasp &src,CVasp *dst = NULL,BL inv = false); //! find radius peaks
- inline Vasp *m_rvalleys(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_rpeaks(p,src,dst,true); } //! find radius valleys
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_flt.cpp b/externals/grill/vasp/source/ops_flt.cpp
deleted file mode 100644
index deecc5ff..00000000
--- a/externals/grill/vasp/source/ops_flt.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_flt.h"
-#include "opdefs.h"
-#include "util.h"
-
-// --- highpass ---------------------------------------
-
-//! \todo handle carry
-//! \todo handle yield
-
-BL VecOp::d_fhp(OpParam &p)
-{
- if(p.revdir)
- post("%s - reversing operation direction due to overlap: opposite sample delay",p.opname);
-
-/*
- R coef = (2*PI)/perln;
- if(coef > 1) coef = 1;
-*/
- const R coef = 1-p.flt.coef;
- const I arep = abs(p.flt.rep);
- S *src = p.rsdt,*dst = p.rddt;
-
- for(I ti = 0; ti < arep; ++ti) {
- register S v1;
- I i;
-
- // t+ direction
- for(i = 0,v1 = 0; i < p.frames; ++i) {
- register const S v0 = *src + coef*v1;
- *dst = v0-v1;
- v1 = v0;
- src += p.rss,dst += p.rds;
- }
-
- if(p.flt.rep < 0) {
- if(++ti == arep) break;
-
- // t- direction
- for(i = p.frames-1,v1 = 0; i >= 0; --i) {
- src -= p.rss,dst -= p.rds;
- register const S v0 = *src + coef*v1;
- *dst = v0-v1;
- v1 = v0;
- }
- }
- }
-
- return true;
-}
-
-
-// --- lowpass ---------------------------------------
-
-//! \todo handle carry
-//! \todo handle yield
-
-BL VecOp::d_flp(OpParam &p)
-{
- if(p.revdir)
- post("%s - reversing operation direction due to overlap: opposite sample delay",p.opname);
-
-/*
- R coef = (2*PI)/perln;
- if(coef > 1) coef = 1;
-*/
-
- const R coef = p.flt.coef,feed = 1-coef;
- const I arep = abs(p.flt.rep);
-
- for(I ti = 0; ti < arep; ++ti) {
- register S v1;
- I i;
- S *src = p.rsdt,*dst = p.rddt;
-
- // t+ direction
- for(i = 0,v1 = 0; i < p.frames; ++i) {
- v1 = *dst = coef* *src + feed*v1;
- src += p.rss,dst += p.rds;
- }
-
- if(p.flt.rep < 0) {
- if(++ti == arep) break;
-
- // t- direction
- for(i = p.frames-1,v1 = 0; i >= 0; --i) {
- src -= p.rss,dst -= p.rds;
- v1 = *dst = coef* *src + feed*v1;
- }
- }
- }
-
- return true;
-}
-
-
-
-Vasp *VaspOp::m_fhp(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL hp)
-{
- Vasp *ret = NULL;
- if(arg.IsList() && arg.GetList().Count() >= 1) {
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- p.flt.coef = 2*PI/flext::GetAFloat(arg.GetList()[0]);
- if(p.flt.coef > 1) p.flt.coef = 1;
- p.flt.rep = arg.GetList().Count() >= 2?flext::GetAInt(arg.GetList()[1]):1;
- p.flt.rep = -p.flt.rep; // fwd/bwd operation
-/*
- if(p.SROvr()) {
- p.SDRRev();
- post("%s - reversing operation direction due to overlap: opposite sample delay",opnm);
- }
-*/
- ret = DoOp(vecs,hp?VecOp::d_fhp:VecOp::d_flp,p);
-
- delete vecs;
- }
- }
-
- return ret;
-}
-
-VASP_ANYOP("vasp.flp",flp,1,true,VASP_ARG(),"Passive low pass filter")
-VASP_ANYOP("vasp.fhp",fhp,1,true,VASP_ARG(),"Passive high pass filter")
-
-
-// --- integrate/differentiate
-
-/*! \brief Integration
- \remark The delay of the result is +/- one sample, depending on the direction of the calculation
-
- \todo different modes how to initialize first carry?
- \todo repetition count
-*/
-BL VecOp::d_int(OpParam &p)
-{
- if(p.revdir)
- post("%s - reversed operation direction due to overlap: opposite sample delay",p.opname);
-
- register S d = p.intdif.carry;
- register I i;
- _DE_LOOP(i,p.frames, ( *p.rddt = (d += *p.rsdt), p.rsdt += p.rss,p.rddt += p.rds ) )
- p.intdif.carry = d;
- return true;
-}
-
-/*! \brief Differentiation
- \remark The delay of the result is +/- one sample, depending on the direction of the calculation
-
- \todo different modes how to initialize first carry?
- \todo repetition count
-*/
-BL VecOp::d_dif(OpParam &p)
-{
- if(p.revdir)
- post("%s - reversed operation direction due to overlap: opposite sample delay",p.opname);
-
- register S d = p.intdif.carry,d1;
- register I i;
- _DE_LOOP(i,p.frames, ( d1 = *p.rsdt, *p.rddt = d1-d,d = d1, p.rsdt += p.rss,p.rddt += p.rds ) )
- p.intdif.carry = d;
- return true;
-}
-
-/*! \brief Does vasp integration/differentiation.
-
- \param arg argument list
- \param dst destination vasp (NULL for in-place operation)
- \param inv true for differentiation
- \return normalized destination vasp
-*/
-Vasp *VaspOp::m_int(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL inv)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- p.intdif.carry = 0,p.intdif.rep = 1;
- if(arg.IsList() && arg.GetList().Count() >= 1) p.intdif.rep = flext::GetAInt(arg.GetList()[0]);
-
- if(p.intdif.rep < 0) {
- post("%s - invalid repetition count (%i) -> set to 1",p.opname,p.intdif.rep);
- p.intdif.rep = 1;
- }
-
- ret = DoOp(vecs,inv?VecOp::d_dif:VecOp::d_int,p);
- delete vecs;
- }
- return ret;
-}
-
-VASP_ANYOP("vasp.int",int,0,true,VASP_ARG_I(1),"Integration")
-VASP_ANYOP("vasp.dif",dif,0,true,VASP_ARG_I(1),"Differentiation")
-
-
-VASP_UNARY("vasp.fix",fix,true,"Bashes denormals/NANs to zero")
diff --git a/externals/grill/vasp/source/ops_flt.h b/externals/grill/vasp/source/ops_flt.h
deleted file mode 100644
index debb4039..00000000
--- a/externals/grill/vasp/source/ops_flt.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-
-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_OPS_FLT_H
-#define __VASP_OPS_FLT_H
-
-#include "opfuns.h"
-
-// Filtering functions
-
-namespace VecOp {
- BL d_flp(OpParam &p);
- BL d_fhp(OpParam &p);
-
- BL d_int(OpParam &p);
- BL d_dif(OpParam &p);
-}
-
-DEFOP(S,d_fix,fix,run)
-
-namespace VaspOp {
- // passive filters
- Vasp *m_fhp(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL hp = true); //! hi pass
- inline Vasp *m_flp(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_fhp(p,src,arg,dst,false); } //! lo pass
-
- // int/dif functions
- Vasp *m_int(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL inv = false); //! integrate
- inline Vasp *m_dif(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_int(p,src,arg,dst,true); } //! differentiate
-
- // fix denormals/NANs
- inline Vasp *m_fix(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_fix); } // ! NAN/denormal filter
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_gate.cpp b/externals/grill/vasp/source/ops_gate.cpp
deleted file mode 100644
index 919ee07f..00000000
--- a/externals/grill/vasp/source/ops_gate.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_cmp.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-// --------------------------------------------------------------
-
-
-Vasp *VaspOp::m_gate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeFloat(arg.GetList()[0]))
- p.rbin.arg = flext::GetAFloat(arg.GetList()[0]);
- else {
- post("%s - argument is invalid -> set to 1",p.opname);
- p.rbin.arg = 1;
- }
-
- ret = DoOp(vecs,VecOp::d_gate,p);
- delete vecs;
- }
- return ret;
-}
-
-
-Vasp *VaspOp::m_rgate(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeFloat(arg.GetList()[0]))
- p.cbin.rarg = flext::GetAFloat(arg.GetList()[0]);
- else {
- post("%s - argument is invalid -> set to 1",p.opname);
- p.cbin.rarg = 1;
- }
- p.cbin.iarg = 0; // not used anyway
-
- ret = DoOp(vecs,VecOp::d_rgate,p);
- delete vecs;
- }
- return ret;
-}
-
-VASP_ANYOP("vasp.gate",gate,1,true,VASP_ARG_R(1),"set destination to 0 if source < argument")
-VASP_ANYOP("vasp.rgate",rgate,1,true,VASP_ARG_R(1),"complex radius gate: set destination to 0 if rad(complex source) < rad(complex argument)")
-
-
-// --------------------------------------------------------------
-
diff --git a/externals/grill/vasp/source/ops_gen.cpp b/externals/grill/vasp/source/ops_gen.cpp
deleted file mode 100644
index 73aaab5c..00000000
--- a/externals/grill/vasp/source/ops_gen.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_gen.h"
-#include "util.h"
-#include <math.h>
-
-// --- osc ---------------------------------------
-
-/*! \brief Generator for real (cos) oscillations
-*/
-BL VecOp::d_osc(OpParam &p)
-{
- register R ph = p.gen.ph,phinc = p.gen.phinc;
- if(p.revdir) ph -= (p.frames-1)*(phinc = -phinc);
-
- for(I i = 0; i < p.frames; ++i,ph += phinc,p.rddt += p.rds) *p.rddt = cos(ph);
- return true;
-}
-
-/*! \brief multiplicative generator for real (cos) oscillations
-*/
-BL VecOp::d_mosc(OpParam &p)
-{
- register R ph = p.gen.ph,phinc = p.gen.phinc;
- if(p.revdir) ph -= (p.frames-1)*(phinc = -phinc);
-
- for(I i = 0; i < p.frames; ++i,ph += phinc,p.rsdt += p.rss,p.rddt += p.rds)
- *p.rddt = *p.rsdt * cos(ph);
- return true;
-}
-
-/*! \brief Generator for real (cos) oscillations.
-
- \param arg argument list
- \param arg.perlen Period length (in samples)
- \param arg.stph Starting phase
- \param mul true for multiplication to exisiting date
- \return normalized destination vasp
-
- \todo Replace period length by frequency specification
-*/
-Vasp *VaspOp::m_osc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul)
-{
- Vasp *ret = NULL;
- if(arg.IsList() && arg.GetList().Count() >= 1) {
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- // period length
- p.gen.phinc = 2*PI/flext::GetAFloat(arg.GetList()[0]);
- // starting phase
- p.gen.ph = arg.GetList().Count() >= 2?flext::GetAFloat(arg.GetList()[1]):0;
-
- ret = DoOp(vecs,mul?VecOp::d_mosc:VecOp::d_osc,p);
- delete vecs;
- }
- }
- else
- post("%s - no arguments: no operation",p.opName());
-
- return ret;
-}
-
-
-/*! \brief Generator for complex oscillations.
-*/
-BL VecOp::d_cosc(OpParam &p)
-{
- register R ph = p.gen.ph,phinc = p.gen.phinc;
- if(p.revdir) ph -= (p.frames-1)*(phinc = -phinc);
-
- for(; p.frames--; ph += phinc,p.rddt += p.rds,p.iddt += p.ids)
- *p.rddt = cos(ph),*p.iddt = sin(ph);
- return true;
-}
-
-/*! \brief Multiplicative generator for complex oscillations.
-*/
-BL VecOp::d_mcosc(OpParam &p)
-{
- register R ph = p.gen.ph,phinc = p.gen.phinc;
- if(p.revdir) ph -= (p.frames-1)*(phinc = -phinc);
-
- for(; p.frames--; ph += phinc,p.rsdt += p.rss,p.isdt += p.iss,p.rddt += p.rds,p.iddt += p.ids) {
- R zre = cos(ph),zim = sin(ph);
-
- register const R r = *p.rsdt * zre - *p.isdt * zim;
- *p.iddt = *p.isdt * zre + *p.rsdt * zim;
- *p.rddt = r;
- }
- return true;
-}
-
-/*! \brief Generator for complex (cos+i sin) oscillations.
-
- \param arg argument list
- \param arg.perlen Period length (in samples)
- \param arg.stph Starting phase
- \param mul true for multiplication to exisiting date
- \return normalized destination vasp
-
- \todo Replace period length by frequency specification
-*/
-Vasp *VaspOp::m_cosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul)
-{
- Vasp *ret = NULL;
- if(arg.IsList() && arg.GetList().Count() >= 1) {
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- // period length
- p.gen.phinc = 2*PI/flext::GetAFloat(arg.GetList()[0]);
- // starting phase
- p.gen.ph = arg.GetList().Count() >= 2?flext::GetAFloat(arg.GetList()[1]):0;
-
- ret = DoOp(vecs,mul?VecOp::d_mcosc:VecOp::d_cosc,p);
- delete vecs;
- }
- }
- else
- post("%s - no arguments: no operation",p.opName());
-
- return ret;
-}
-
-
-VASP_ANYOP("vasp.osc",osc,1,false,VASP_ARG(),"Calculates a cosine wave")
-VASP_ANYOP("vasp.*osc",mosc,1,true,VASP_ARG(),"Multiplies with a cosine wave")
-VASP_ANYOP("vasp.cosc",cosc,1,false,VASP_ARG(),"Calculates a complex oscillation (cos + i sin)")
-VASP_ANYOP("vasp.*cosc",mcosc,1,true,VASP_ARG(),"Multiplies with a complex oscillation (cos + i sin)")
-
-// --- phasor ---------------------------------------
-
-// ! look up Höldrich's pd phasor code
-
-/*! \brief Generator for saw wave oscillations.
-*/
-BL VecOp::d_phasor(OpParam &p)
-{
- register R ph = p.gen.ph,phinc = p.gen.phinc;
- if(p.revdir) ph -= (p.frames-1)*(phinc = -phinc);
-
- for(; p.frames--; ph += phinc,p.rddt += p.rds) *p.rddt = fmod((F)ph,1.F);
- return true;
-}
-
-/*! \brief Multiplicative generator for saw wave oscillations.
-*/
-BL VecOp::d_mphasor(OpParam &p)
-{
- register R ph = p.gen.ph,phinc = p.gen.phinc;
- if(p.revdir) ph -= (p.frames-1)*(phinc = -phinc);
-
- for(; p.frames--; ph += phinc,p.rddt += p.rds,p.rsdt += p.rss) *p.rddt = *p.rsdt * fmod((F)ph,1.F);
- return true;
-}
-
-/*! \brief Generator for sawtooth oscillations.
-
- \param arg argument list
- \param arg.perlen Period length (in samples)
- \param arg.stph Starting phase
- \param mul true for multiplication to exisiting date
- \return normalized destination vasp
-
- \todo Replace period length by frequency specification
-*/
-Vasp *VaspOp::m_phasor(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul)
-{
- Vasp *ret = NULL;
- if(arg.IsList() && arg.GetList().Count() >= 1) {
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- // period length
- p.gen.phinc = 1./flext::GetAFloat(arg.GetList()[0]);
- // starting phase
- p.gen.ph = arg.GetList().Count() >= 2?flext::GetAFloat(arg.GetList()[1]):0;
-
- ret = DoOp(vecs,mul?VecOp::d_mphasor:VecOp::d_phasor,p);
- delete vecs;
- }
- }
- else
- post("%s - no arguments: no operation",p.opName());
-
- return ret;
-}
-
-
-VASP_ANYOP("vasp.phasor",phasor,1,false,VASP_ARG(),"Calculates a sawtooth wave")
-VASP_ANYOP("vasp.*phasor",mphasor,1,true,VASP_ARG(),"Multiplies with a sawtooth wave")
-
-// --- noise --------------------------------
-
-static F rnd()
-{
- static I val = 307*1319;
- F ret = ((F)((val&0x7fffffff)-0x40000000))*(F)(1.0/0x40000000);
- val = val * 435898247 + 382842987;
- return ret;
-}
-
-/*! \brief Vector function for pseudorandom noise.
-*/
-BL VecOp::d_noise(OpParam &p)
-{
- for(; p.frames--; p.rddt += p.rds) *p.rddt = rnd();
- return true;
-}
-
-
-/*! \brief Generator for real valued noise.
-
- \return normalized destination vasp
-*/
-Vasp *VaspOp::m_noise(OpParam &p,CVasp &src,CVasp *dst)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- ret = DoOp(vecs,VecOp::d_noise,p);
- delete vecs;
- }
- return ret;
-}
-
-/*! \brief Vector function for pseudorandom complex noise.
-*/
-BL VecOp::d_cnoise(OpParam &p)
-{
- for(; p.frames--; p.rddt += p.rds,p.iddt += p.ids) {
- R amp = rnd();
- R arg = rnd()*(2.*PI);
- *p.rddt = amp*cos(arg);
- *p.iddt = amp*sin(arg);
- }
- return true;
-}
-
-/*! \brief Generator for complex noise (complex abs, complex arg).
-
- \return normalized destination vasp
-
- \todo Replace period length by frequency specification
-*/
-Vasp *VaspOp::m_cnoise(OpParam &p,CVasp &src,CVasp *dst)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- ret = DoOp(vecs,VecOp::d_cnoise,p);
- delete vecs;
- }
- return ret;
-}
-
-VASP_UNARY("vasp.noise",noise,false,"Fills the vectors with white noise")
-VASP_UNARY("vasp.cnoise",cnoise,false,"Fills the vectors with complex white noise (radius and angle are random)")
-
diff --git a/externals/grill/vasp/source/ops_gen.h b/externals/grill/vasp/source/ops_gen.h
deleted file mode 100644
index eff28710..00000000
--- a/externals/grill/vasp/source/ops_gen.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-
-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_OPS_GEN_H
-#define __VASP_OPS_GEN_H
-
-#include "opbase.h"
-
-// Generator functions
-
-namespace VecOp {
- BL d_osc(OpParam &p);
- BL d_cosc(OpParam &p);
- BL d_mosc(OpParam &p);
- BL d_mcosc(OpParam &p);
- BL d_phasor(OpParam &p);
- BL d_mphasor(OpParam &p);
- BL d_noise(OpParam &p);
- BL d_cnoise(OpParam &p);
-}
-
-namespace VaspOp {
- Vasp *m_osc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul = false); // real osc
- inline Vasp *m_mosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_osc(p,src,arg,dst,true); } // * real osc
- Vasp *m_cosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul = false); // complex osc (phase rotates)
- inline Vasp *m_mcosc(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_cosc(p,src,arg,dst,true); } // * complex osc (phase rotates)
- Vasp *m_phasor(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL mul = false); // phasor
- inline Vasp *m_mphasor(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_phasor(p,src,arg,dst,true); } // * phasor
- Vasp *m_noise(OpParam &p,CVasp &src,CVasp *dst); // real noise
- Vasp *m_cnoise(OpParam &p,CVasp &src,CVasp *dst); // complex noise (arg and abs random)
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_qminmax.cpp b/externals/grill/vasp/source/ops_qminmax.cpp
deleted file mode 100644
index 22ae6128..00000000
--- a/externals/grill/vasp/source/ops_qminmax.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_cmp.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-// --------------------------------------------------------------
-
-// --------------------------------------------------------------
-
-
-/*! \class vasp_qmin
- \remark \b vasp.min?
- \brief Get minimum sample value
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet float - minimum sample value
-
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qmin:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qmin,vasp_op)
-
-public:
- vasp_qmin() {
- AddInAnything();
- AddOutList();
- }
-
- virtual F do_opt(OpParam &p,CVasp &v)
- {
- p.norm.minmax = BIG;
- Vasp *ret = VaspOp::m_qmin(p,v);
- delete ret;
- return p.norm.minmax == BIG?0:p.norm.minmax;
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok()) return;
-
- AtomList ret(ref.Vectors());
- OpParam p(thisName(),0);
-
- for(I i = 0; i < ret.Count(); ++i) {
- Vasp vasp(ref.Frames(),ref.Vector(i));
- CVasp ref(vasp);
- F v = do_opt(p,ref);
- SetFloat(ret[i],v);
- }
- ToOutList(0,ret);
- }
-
- virtual V m_help() { post("%s - Get a vasp's minimum sample value",thisName()); }
-};
-
-VASP_LIB("vasp.min?",vasp_qmin)
-
-
-/*! \class vasp_qamin
- \remark \b vasp.amin?
- \brief Get minimum absolute sample value
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet float - minimum absolute sample value
-
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qamin:
- public vasp_qmin
-{
- FLEXT_HEADER(vasp_qamin,vasp_qmin)
-public:
- virtual F do_opt(OpParam &p,CVasp &v)
- {
- p.norm.minmax = BIG;
- Vasp *ret = VaspOp::m_qmin(p,v);
- delete ret;
- return p.norm.minmax == BIG?0:p.norm.minmax;
- }
-
- virtual V m_help() { post("%s - Get a vasp's minimum absolute sample value",thisName()); }
-};
-
-VASP_LIB("vasp.amin?",vasp_qamin)
-
-
-
-/*! \class vasp_qmax
- \remark \b vasp.max?
- \brief Get maximum sample value
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet float - maximum sample value
-
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qmax:
- public vasp_qmin
-{
- FLEXT_HEADER(vasp_qmax,vasp_qmin)
-public:
- virtual F do_opt(OpParam &p,CVasp &v)
- {
- p.norm.minmax = -BIG;
- Vasp *ret = VaspOp::m_qmax(p,v);
- delete ret;
- return p.norm.minmax == -BIG?0:p.norm.minmax;
- }
-
- virtual V m_help() { post("%s - Get a vasp's maximum sample value",thisName()); }
-};
-
-VASP_LIB("vasp.max?",vasp_qmax)
-
-
-
-/*! \class vasp_qamax
- \remark \b vasp.amax?
- \brief Get minimum absolute sample value
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet float - maximum absolute sample value
-
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qamax:
- public vasp_qmax
-{
- FLEXT_HEADER(vasp_qamax,vasp_qmax)
-public:
- virtual F do_opt(OpParam &p,CVasp &v)
- {
- p.norm.minmax = 0;
- Vasp *ret = VaspOp::m_qamax(p,v);
- delete ret;
- return p.norm.minmax;
- }
-
- virtual V m_help() { post("%s - Get a vasp's maximum absolute sample value",thisName()); }
-};
-
-VASP_LIB("vasp.amax?",vasp_qamax)
-
-
-
-
-/*! \class vasp_qrmin
- \remark \b vasp.rmin?
- \brief Get minimum complex radius of samples
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet list - minimum radius value per complex vector pair
-
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qrmin:
- public vasp_op
-{
- FLEXT_HEADER(vasp_qrmin,vasp_op)
-public:
- vasp_qrmin() {
- AddInAnything();
- AddOutList();
- }
-
- virtual F do_opt(OpParam &p,CVasp &v)
- {
- p.norm.minmax = BIG;
- Vasp *ret = VaspOp::m_qrmin(p,v);
- delete ret;
- return sqrt(p.norm.minmax == BIG?0:p.norm.minmax);
- }
-
- virtual V m_bang()
- {
- if(!ref.Ok()) return;
-
- AtomList ret(ref.Vectors()/2);
- OpParam p(thisName(),0);
-
- for(I i = 0; i < ret.Count(); ++i) {
- Vasp vasp(ref.Frames(),ref.Vector(i*2));
- vasp.AddVector(ref.Vector(i*2+1));
- CVasp ref(vasp);
- F v = do_opt(p,ref);
- SetFloat(ret[i],v);
- }
-
- if(ref.Vectors()%2) {
- post("%s - omitting dangling vector of complex pairs",thisName());
- }
-
- ToOutList(0,ret);
- }
-
- virtual V m_help() { post("%s - Get a vasp's minimum complex radius",thisName()); }
-};
-
-VASP_LIB("vasp.rmin?",vasp_qrmin)
-
-
-
-/*! \class vasp_qrmax
- \remark \b vasp.rmax?
- \brief Get maximum complex radius of samples
- \since 0.0.2
- \param inlet vasp - is stored and output triggered
- \param inlet bang - triggers output
- \param inlet set - vasp to be stored
- \retval outlet float - maximum radius value per complex vector pair
-
- \todo Should we provide a cmdln default vasp?
- \todo Should we inhibit output for invalid vasps?
- \remark Returns 0 for a vasp with 0 frames
-*/
-class vasp_qrmax:
- public vasp_qrmin
-{
- FLEXT_HEADER(vasp_qrmax,vasp_qrmin)
-public:
- virtual F do_opt(OpParam &p,CVasp &v)
- {
- p.norm.minmax = 0;
- Vasp *ret = VaspOp::m_qrmax(p,v);
- delete ret;
- return sqrt(p.norm.minmax);
- }
-
- virtual V m_help() { post("%s - Get a vasp's maximum complex radius",thisName()); }
-};
-
-VASP_LIB("vasp.rmax?",vasp_qrmax)
-
-
-
-
diff --git a/externals/grill/vasp/source/ops_rearr.cpp b/externals/grill/vasp/source/ops_rearr.cpp
deleted file mode 100644
index fc86b327..00000000
--- a/externals/grill/vasp/source/ops_rearr.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_rearr.h"
-#include "oploop.h"
-#include "oppermute.h"
-
-/*! \brief vasp shift or rotation
- \todo units for shift
-*/
-Vasp *VaspOp::m_shift(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL shift,BL symm)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeFloat(arg.GetList()[0])) {
- // shift length
- p.sh.sh = flext::GetAFloat(arg.GetList()[0]);
- }
- else {
- post("%s - invalid argument -> set to 0",p.opname);
- p.sh.sh = 0;
- }
-
- ret = DoOp(vecs,shift?VecOp::d_shift:VecOp::d_rot,p,symm);
- delete vecs;
- }
-
- return ret;
-}
-
-
-/*! \brief shift buffer
-*/
-BL VecOp::d_shift(OpParam &p)
-{
- if(p.ovrlap) {
- post("%s - cannot operate on overlapped vectors",p.opname);
- return false;
- }
-
- I ish = (I)p.sh.sh;
- if(p.sh.sh != ish) { // integer shift
- // requires interpolation
- post("non-integer shift not implemented - truncating to integer");
- p.sh.sh = ish;
- }
-
- p.SkipOddMiddle();
-
- if(p.symm == 1) ish = -ish;
-
- I aish = abs(ish);
- if(aish > p.frames) aish = ish = p.frames;
-
- I i,cnt = p.frames-aish;
- const S *sd = p.rsdt-ish*p.rss;
- S *dd = p.rddt;
-
- if(ish > 0) {
- sd += (p.frames-1)*p.rss,dd += (p.frames-1)*p.rds;
- p.rss = -p.rss,p.rds = -p.rds;
- }
-
- // do shift
- if(cnt > 0) {
- if(p.rss == 1 && p.rds == 1)
- _DE_LOOP(i,cnt, ( *(dd++) = *(sd++) ) )
- else if(p.rss == -1 && p.rds == -1)
- _DE_LOOP(i,cnt, ( *(dd--) = *(sd--) ) )
- else
- _DE_LOOP(i,cnt, ( *dd = *sd,sd += p.rss,dd += p.rds ) )
- }
-
- // fill spaces
- if(p.sh.fill) {
- S vfill = p.sh.fill == 1?0:dd[-p.rds];
- I aish = abs(ish);
- if(p.rds == 1)
- _DE_LOOP(i,aish, ( *(dd++) = vfill ) )
- else if(p.rds == -1)
- _DE_LOOP(i,aish, ( *(dd--) = vfill ) )
- else
- _DE_LOOP(i,aish, ( *dd = vfill,dd += p.rds ) )
- }
-
- return true;
-}
-
-
-class vasp_shift:
- public vasp_anyop
-{
- FLEXT_HEADER_S(vasp_shift,vasp_anyop,Setup)
-public:
-
- vasp_shift(I argc,const t_atom *argv):
- vasp_anyop(argc,argv,VASP_ARG_I(0),true),
- fill(xsf_zero)
- {}
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDATTR_VAR1_E(c,"fill",fill);
- }
-
- enum xs_fill {
- xsf__ = -1, // don't change
- xsf_none = 0,xsf_zero,xsf_edge
- };
-
- virtual Vasp *do_shift(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_shift(p,cref,arg,&cdst);
- }
-
- virtual Vasp *tx_work(const Argument &arg)
- {
- OpParam p(thisName(),0);
- p.sh.fill = (I)fill;
-
- Vasp *ret = do_shift(p);
- return ret;
- }
-
- virtual V m_help() { post("%s - Shifts buffer data",thisName()); }
-
-protected:
- xs_fill fill;
-
-private:
- FLEXT_ATTRVAR_E(fill,xs_fill)
-};
-VASP_LIB_V("vasp.shift",vasp_shift)
-
-
-class vasp_xshift:
- public vasp_shift
-{
- FLEXT_HEADER(vasp_xshift,vasp_shift)
-public:
-
- vasp_xshift(I argc,const t_atom *argv): vasp_shift(argc,argv) {}
-
- virtual Vasp *do_shift(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_xshift(p,cref,arg,&cdst);
- }
-
- virtual V m_help() { post("%s - Shifts buffer data symmetrically (in two halves)",thisName()); }
-};
-VASP_LIB_V("vasp.xshift",vasp_xshift)
-
-
-inline int rotation(int ij, int n,OpParam &p) { return (ij+n-p.sh.ish)%n; }
-
-#define ROTBLOCK 1024
-
-/*! \brief rotate buffer
- \todo implement temporary storage for faster transformation (use abstract permute algorithm)
-*/
-BL VecOp::d_rot(OpParam &p)
-{
- if(p.ovrlap) {
- post("%s - cannot operate on overlapped vectors",p.opname);
- return false;
- }
-
- p.sh.ish = (I)p.sh.sh;
- if(p.sh.sh != p.sh.ish) {
- // requires interpolation
- post("%s - non-integer shift not implemented - truncating to integer",p.opname);
- }
-
- p.SkipOddMiddle();
-
- p.sh.ish = p.sh.ish%p.frames;
- if(p.symm == 1) p.sh.ish = -p.sh.ish;
-
-/*
- if(p.frames >= ROTBLOCK) {
- //use temporary space;
- S *tmp = new S[ROTBLOCK];
-
- delete[] tmp;
- }
- else
-*/
- PERMUTATION(S,1,p,rotation);
- return true;
-}
-
-VASP_ANYOP("vasp.rot",rot,0,true,VASP_ARG_I(0),"Rotates buffer data")
-VASP_ANYOP("vasp.xrot",xrot,0,true,VASP_ARG_I(0),"Rotates buffer data symmetrically (in two halves)")
-
-
-/*! \brief mirror buffer
-*/
-BL VecOp::d_mirr(OpParam &p)
-{
- if(p.ovrlap) {
- post("%s - cannot operate on overlapped vectors",p.opname);
- return false;
- }
-
- p.SkipOddMiddle();
-
- if(p.rsdt == p.rddt) {
- S *dl = p.rddt,*du = p.rddt+(p.frames-1)*p.rds;
- register S t;
- _DE_WHILE(dl < du, ( t = *dl, *dl = *du, *du = t, dl += p.rds,du -= p.rds ) )
- }
- else {
- I i;
- const S *ds = p.rsdt;
- S *dd = p.rddt+(p.frames-1)*p.rds;
- _DE_LOOP(i,p.frames, ( *dd = *ds,ds += p.rss,dd -= p.rds ) )
- }
- return true;
-}
-
-/*! \brief vasp mirror
-*/
-Vasp *VaspOp::m_mirr(OpParam &p,CVasp &src,CVasp *dst,BL symm)
-{
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- ret = DoOp(vecs,VecOp::d_mirr,p,symm);
- delete vecs;
- }
- return ret;
-}
-
-VASP_UNARY("vasp.mirr",mirr,true,"Mirrors buffer data")
-VASP_UNARY("vasp.xmirr",xmirr,true,"Mirrors buffer data symmetrically (in two halves)")
-
-
diff --git a/externals/grill/vasp/source/ops_rearr.h b/externals/grill/vasp/source/ops_rearr.h
deleted file mode 100644
index aa412937..00000000
--- a/externals/grill/vasp/source/ops_rearr.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-
-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_OPS_REARR_H
-#define __VASP_OPS_REARR_H
-
-#include "opbase.h"
-
-// Rearrange buffer
-
-namespace VecOp {
- BL d_shift(OpParam &p);
- BL d_rot(OpParam &p);
- BL d_mirr(OpParam &p);
-}
-
-namespace VaspOp {
- Vasp *m_shift(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL sh = true,BL symm = false); // shift buffer
- inline Vasp *m_xshift(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_shift(p,src,arg,dst,true,true); } // shift buffer (symmetrically)
- inline Vasp *m_rot(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_shift(p,src,arg,dst,false,false); } // rotate buffer
- inline Vasp *m_xrot(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_shift(p,src,arg,dst,false,true); } // rotate buffer (symmetrically)
- Vasp *m_mirr(OpParam &p,CVasp &src,CVasp *dst = NULL,BL symm = false); //! mirror buffer
- inline Vasp *m_xmirr(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_mirr(p,src,dst,true); } //! mirror buffer (symmetrically)
-
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_resmp.cpp b/externals/grill/vasp/source/ops_resmp.cpp
deleted file mode 100644
index b37dd8dc..00000000
--- a/externals/grill/vasp/source/ops_resmp.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file vasp__resmp.cpp
- \brief Routines for resampling
-*/
-
-#include "main.h"
-#include "ops_resmp.h"
-
-
-// --- resample ---------------------
-
-/*! \brief Subroutine for resampling.
-
- \param cnt frame count
- \param src source data
- \param sstr source data stride
- \param dst destination data
- \param dstr destination data stride
- \param factor resampling factor
- \param center resampling center (this will remain untouched by the transformation)
- \param mode interpolation mode
- \return true on success
-
- \todo implement averaging interpolation methods
- \todo check for operation direction!
- \todo check for src/dst overlap
- \todo support different frame lengths for src and dst
-*/
-
-static V do_tilt(OpParam &p)
-{
- I mode = p.tilt.mode;
- if(mode == 0&& (p.tilt.factor < 0 || p.tilt.center < 0 || p.tilt.factor >= p.frames)) mode = 1;
-
- const R center = p.tilt.center;
- const I icenter = (I)center;
- S fll,flr;
- if(p.tilt.fill)
- fll = p.rsdt[0],flr = p.rsdt[p.frames-1];
- else
- fll = flr = 0;
-
- if(mode >= 1 && mode <= 3) {
- S *tmp;
- I rss;
- if(p.rsdt == p.rddt) {
- tmp = new S[p.frames],rss = 1;
- for(int i = 0; i < p.frames; ++i) tmp[i] = p.rsdt[i*p.rss];
- }
- else tmp = p.rsdt,rss = p.rss;
-
- switch(mode) {
- case 1: {
- // no interpolation
- for(int i = 0; i < p.frames; ++i) {
- I pi = (I)(center+(i-center)*p.tilt.factor);
- p.rddt[i*p.rds] = pi >= 0?(pi < p.frames?tmp[pi*rss]:flr):fll;
- }
- break;
- }
- case 2: {
- // linear interpolation
- for(int i = 0; i < p.frames; ++i) {
- R pr = center+(i-center)*p.tilt.factor,v;
- I ip = (I)pr;
- if(ip >= 0)
- if(ip < p.frames-1) {
- R r = pr-ip;
- v = (1-r)*tmp[ip*rss]+r*tmp[(ip+1)*rss];
- }
- else
- v = ip == p.frames-1?tmp[ip*rss]:flr;
- else
- v = fll;
- p.rddt[i*p.rds] = v;
- }
- break;
- }
- case 3: {
- // 4-point interpolation
- R f[4];
- for(int i = 0; i < p.frames; ++i) {
- R pr = center+(i-center)*p.tilt.factor;
- const I ip = (I)pr;
- const S *t = tmp+ip*rss;
- const R r = pr-ip;
- if(ip >= 1)
- if(ip < p.frames-2) {
- f[0] = t[-rss];
- f[1] = t[0];
- f[2] = t[rss];
- f[3] = t[rss*2];
- }
- else {
- f[0] = ip < p.frames+1?t[-rss]:flr;
- f[1] = ip < p.frames?t[0]:flr;
- f[2] = ip < p.frames-1?t[rss]:flr;
- f[3] = flr;
- }
- else {
- f[0] = fll;
- f[1] = ip >= 0?t[0]:fll;
- f[2] = ip >= -1?t[rss]:fll;
- f[3] = ip >= -2?t[rss*2]:fll;
- }
-
- const R cmb = f[2]-f[1];
- p.rddt[i*p.rds] = f[1]+r*(cmb-0.5*(r-1.)*((f[0]-f[3]+3.*cmb)*r+(f[1]-f[0]-cmb)));
- }
- break;
- }
- }
-
- if(p.rsdt == p.rddt) delete[] tmp;
- }
- else {
- const R rem = center-icenter; // 0 <= rem < 1
- // quick and dirty... but in-place!
-
- if(p.tilt.factor > 1) {
- I i;
- for(i = 0; i <= icenter; ++i) {
- I sp = (I)(center-(i+rem)*p.tilt.factor);
- p.rddt[(icenter-i)*p.rds] = sp >= 0?(sp < p.frames?p.rsdt[sp*p.rss]:flr):fll;
- }
- for(i = 1; i < p.frames-icenter; ++i) {
- I sp = (I)(center+(i-rem)*p.tilt.factor);
- p.rddt[(icenter+i)*p.rds] = sp >= 0?(sp < p.frames?p.rsdt[sp*p.rss]:flr):fll;
- }
- }
- else {
- I i;
- for(i = icenter; i >= 0; --i) {
- I sp = (I)(center-(i+rem)*p.tilt.factor);
- p.rddt[(icenter-i)*p.rds] = p.rsdt[sp*p.rss];
- }
- for(i = p.frames-1-icenter; i > 0; --i) {
- I sp = (I)(center+(i-rem)*p.tilt.factor);
- p.rddt[(icenter+i)*p.rds] = p.rsdt[sp*p.rss];
- }
- }
- }
-}
-
-
-BL VecOp::d_tilt(OpParam &p)
-{
- if(p.frames <= 1 || p.tilt.factor == 1) return true;
-
- // symmetric operation
- if(p.symm == 1)
- p.tilt.center = p.frames-1-p.tilt.center;
-
- do_tilt(p);
-
- return true;
-}
-
-
-/*! \brief Does vasp resampling.
-
- \param arg argument list
- \param arg.factor factor for resampling
- \param arg.center center of resampling
- \param dst destination vasp (NULL for in-place operation)
- \param symm true for symmetric operation
- \param mode interpolation mode
- \return normalized destination vasp
-*/
-Vasp *VaspOp::m_tilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL symm)
-{
- Vasp *ret = NULL;
- if(arg.IsList() && arg.GetList().Count() >= 1) {
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- p.tilt.factor = flext::GetAFloat(arg.GetList()[0]);
- p.tilt.center = arg.GetList().Count() >= 2?flext::GetAFloat(arg.GetList()[1]):0;
-
- ret = DoOp(vecs,VecOp::d_tilt,p,symm);
-
- delete vecs;
- }
- }
- else
- post("%s - no arguments: no operation",p.opName());
-
- return ret;
-}
-
-
-
-class vasp_tilt:
- public vasp_anyop
-{
- FLEXT_HEADER_S(vasp_tilt,vasp_anyop,Setup)
-public:
-
- vasp_tilt(I argc,t_atom *argv):
- vasp_anyop(argc,argv,VASP_ARG_R(1),true),
- fill(xtf_zero),inter(xti_4p)
- {}
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDATTR_VAR1_E(c,"fill",fill);
- FLEXT_CADDATTR_VAR1_E(c,"inter",inter);
- }
-
- enum xt_fill {
- xtf__ = -1, // don't change
- xtf_zero = 0,xtf_edge
- };
-
- enum xt_inter {
- xti__ = -1, // don't change
- xti_inpl = 0,xti_none,xti_lin,xti_4p
- };
-
- virtual Vasp *do_shift(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_tilt(p,cref,arg,&cdst);
- }
-
- virtual Vasp *tx_work(const Argument &arg)
- {
- OpParam p(thisName(),1);
- p.tilt.fill = (I)fill;
- p.tilt.mode = (I)inter;
-
- Vasp *ret = do_shift(p);
- return ret;
- }
-
- virtual V m_help() { post("%s - Resamples buffer data",thisName()); }
-
-protected:
- xt_fill fill;
- xt_inter inter;
-
-private:
- FLEXT_ATTRVAR_E(fill,xt_fill)
- FLEXT_ATTRVAR_E(inter,xt_inter)
-};
-VASP_LIB_V("vasp.tilt",vasp_tilt)
-
-
-class vasp_xtilt:
- public vasp_tilt
-{
- FLEXT_HEADER(vasp_xtilt,vasp_tilt)
-public:
-
- vasp_xtilt(I argc,t_atom *argv): vasp_tilt(argc,argv) {}
-
- virtual Vasp *do_shift(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_xtilt(p,cref,arg,&cdst);
- }
-
- virtual V m_help() { post("%s - Resamples buffer data symmetrically (in two halves)",thisName()); }
-};
-VASP_LIB_V("vasp.xtilt",vasp_xtilt)
-
-
diff --git a/externals/grill/vasp/source/ops_resmp.h b/externals/grill/vasp/source/ops_resmp.h
deleted file mode 100644
index e164ee0b..00000000
--- a/externals/grill/vasp/source/ops_resmp.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-
-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_OPS_RESMP_H
-#define __VASP_OPS_RESMP_H
-
-#include "opbase.h"
-
-// Resampling (around center sample)
-
-namespace VecOp {
- BL d_tilt(OpParam &p);
-}
-
-namespace VaspOp {
- Vasp *m_tilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL,BL symm = false);
- // Symmetric resampling (around center sample)
- inline Vasp *m_xtilt(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_tilt(p,src,arg,dst,true); }
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_search.cpp b/externals/grill/vasp/source/ops_search.cpp
deleted file mode 100644
index cf7e7df3..00000000
--- a/externals/grill/vasp/source/ops_search.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_search.h"
-#include "util.h"
-#include "oploop.h"
-
-
-BL VecOp::d_search(OpParam &p)
-{
- const I off = p.srch.offs;
- const S val = p.srch.val;
- const R cur = p.rsdt[off];
-
- I i,ofl = -1,ofr = -1;
-
- if(p.srch.incl && cur == val) {
- // if @incl attribute is set and current sample matches
- ofl = ofr = off;
- }
- else {
- if(p.srch.dir <= 0) {
- BL y = cur >= val;
- i = off-1;
- _D_WHILE(i >= 0)
- BL y2 = p.rsdt[i] >= val;
- if(y != y2) {
- if(p.srch.slope <= 0 && y2) break;
- if(p.srch.slope >= 0 && !y2) break;
- }
- y = y2;
- --i;
- _E_WHILE
-
- if(i >= 0) ofl = i;
- }
-
- if(p.srch.dir >= 0) {
- BL y = cur >= val;
- i = off+1;
- _D_WHILE(i < p.frames)
- BL y2 = p.rsdt[i] >= val;
- if(y != y2) {
- if(p.srch.slope <= 0 && !y2) break;
- if(p.srch.slope >= 0 && y2) break;
- }
- y = y2;
- ++i;
- _E_WHILE
-
- if(i < p.frames) ofr = i;
- }
- }
-
- if(!p.srch.dir) {
- if(ofl >= 0) {
- p.srch.dif = ofl-off;
- if(ofr >= 0 && abs(p.srch.dif) < abs(ofr-off)) p.srch.dif = ofr-off;
- }
- else
- p.srch.dif = ofr >= 0?ofr-off:0;
- }
- else if(p.srch.dir > 0)
- p.srch.dif = ofr >= 0?ofr-off:0;
- else
- p.srch.dif = ofl >= 0?ofl-off:0;
-
- return true;
-}
-
-Vasp *VaspOp::m_search(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL st)
-{
- Vasp *ret = NULL;
- if(src.Vectors() != 1)
- post("%s - Need exactly one vector in vasp!",p.opName());
- else if(arg.CanbeFloat() || (arg.IsList() && arg.GetList().Count() >= 1)) {
- I fr = src.Frames();
- I o = src.Vector(0).Offset();
-
- VBuffer *buf = src.Buffer(0);
- I sz = buf->Frames();
- delete buf;
-
- CVasp all(src);
- if(st) {
- // search start point
- p.srch.offs = o;
-
- // set bounds of search buffer
- all.Offset(0);
- all.Frames(fr+o); // all frames of buffer
- }
- else {
- // search end point
- p.srch.offs = o+fr;
- // check if current offset is past buffer
- if(p.srch.offs >= sz) p.srch.offs = sz-1;
-
- // set bounds of search buffer
- all.Offset(o);
- all.Frames(sz-o); // all frames of buffer
- }
-
- RVecBlock *vecs = GetRVecs(p.opname,all,dst);
- if(vecs) {
- p.srch.val = arg.IsList()?flext::GetAFloat(arg.GetList()[0]):arg.GetAFloat();
-
- ret = DoOp(vecs,VecOp::d_search,p);
-
- if(st) o += p.srch.dif,fr -= p.srch.dif;
- else fr += p.srch.dif;
-
- if(ret) {
- ret->Offset(o);
- ret->Frames(fr);
- ret->Frames(ret->ChkFrames()); // What's that????
- }
-
- delete vecs;
- }
- }
- else
- post("%s - no arguments: no operation",p.opName());
-
- return ret;
-}
-
-
-class vasp_search:
- public vasp_anyop
-{
- FLEXT_HEADER_S(vasp_search,vasp_anyop,Setup)
-public:
-
- vasp_search(I argc,t_atom *argv):
- vasp_anyop(argc,argv,VASP_ARG_R(0),false,XletCode(xlet_float,0)),
- slope(0),dir(0),incl(false)
- {}
-
- static V Setup(t_classid c)
- {
- FLEXT_CADDATTR_VAR1(c,"dir",dir);
- FLEXT_CADDATTR_VAR1(c,"slope",slope);
- FLEXT_CADDATTR_VAR1(c,"incl",incl);
- }
-
- virtual Vasp *do_work(OpParam &p) = 0;
-
- virtual Vasp *tx_work(const Argument &arg)
- {
- OpParam p(thisName(),1);
- p.srch.dir = dir;
- p.srch.slope = slope;
- p.srch.incl = incl;
-
- Vasp *ret = do_work(p);
- if(ret) ToOutFloat(1,p.srch.dif);
- return ret;
- }
-
-protected:
- I dir,slope;
- BL incl;
-
-private:
- FLEXT_ATTRVAR_I(dir)
- FLEXT_ATTRVAR_I(slope)
- FLEXT_ATTRVAR_B(incl)
-};
-
-
-class vasp_soffset:
- public vasp_search
-{
- FLEXT_HEADER(vasp_soffset,vasp_search)
-public:
- vasp_soffset(I argc,t_atom *argv): vasp_search(argc,argv) {}
- virtual Vasp *do_work(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_soffset(p,cref,arg,&cdst);
- }
-
- virtual V m_help() { post("%s - Define starting point by searching for given value",thisName()); }
-};
-VASP_LIB_V("vasp.offset= vasp.o=",vasp_soffset)
-
-
-class vasp_sframes:
- public vasp_search
-{
- FLEXT_HEADER(vasp_sframes,vasp_search)
-public:
- vasp_sframes(I argc,t_atom *argv): vasp_search(argc,argv) {}
- virtual Vasp *do_work(OpParam &p)
- {
- CVasp cdst(dst),cref(ref);
- return VaspOp::m_sframes(p,cref,arg,&cdst);
- }
-
- virtual V m_help() { post("%s - Define vasp frame length by searching for given value",thisName()); }
-};
-VASP_LIB_V("vasp.frames= vasp.f=",vasp_sframes)
-
-
diff --git a/externals/grill/vasp/source/ops_search.h b/externals/grill/vasp/source/ops_search.h
deleted file mode 100644
index ef199f71..00000000
--- a/externals/grill/vasp/source/ops_search.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-
-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_OPS_SEARCH_H
-#define __VASP_OPS_SEARCH_H
-
-#include "opbase.h"
-
-// Sample search functions
-
-namespace VecOp {
- BL d_search(OpParam &p); //! find values
-}
-
-namespace VaspOp {
- // search functions
- Vasp *m_search(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL st); //! find values
- inline Vasp *m_soffset(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_search(p,src,arg,dst,true); }
- inline Vasp *m_sframes(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_search(p,src,arg,dst,false); }
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_trnsc.cpp b/externals/grill/vasp/source/ops_trnsc.cpp
deleted file mode 100644
index 8bbda8e9..00000000
--- a/externals/grill/vasp/source/ops_trnsc.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_trnsc.h"
-#include "opdefs.h"
-#include "util.h"
-#include <math.h>
-
-// --------------------------------------------------------------
-
-Vasp *VaspOp::m_rpow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst)
-{
- Vasp *ret = NULL;
- CVecBlock *vecs = GetCVecs(p.opname,src,dst);
- if(vecs) {
- if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeFloat(arg.GetList()[0]))
- p.cbin.rarg = flext::GetAFloat(arg.GetList()[0]);
- else {
- post("%s - argument is invalid -> set to 1",p.opname);
- p.cbin.rarg = 1;
- }
- p.cbin.iarg = 0; // not used anyway
-
- ret = DoOp(vecs,VecOp::d_rpow,p);
- delete vecs;
- }
- return ret;
-}
-
-VASP_BINARY("vasp.pow",pow,true,VASP_ARG_R(1),"Real power function")
-VASP_ANYOP("vasp.rpow",rpow,0,true,VASP_ARG_R(1),"Power function acting on complex radius")
-
-
-// --------------------------------------------------------------
-
-VASP_UNARY("vasp.sqrt",sqrt,true,"Square root")
-VASP_UNARY("vasp.ssqrt",ssqrt,true,"Square root preserving the sign")
-
-// --------------------------------------------------------------
-
-VASP_UNARY("vasp.exp",exp,true,"Exponential function")
-VASP_UNARY("vasp.log",log,true,"Natural logarithm")
-
-
diff --git a/externals/grill/vasp/source/ops_trnsc.h b/externals/grill/vasp/source/ops_trnsc.h
deleted file mode 100644
index 408aeb9b..00000000
--- a/externals/grill/vasp/source/ops_trnsc.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-
-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_OPS_TRNSC_H
-#define __VASP_OPS_TRNSC_H
-
-#include "opfuns.h"
-
-// Transcendent math functions
-
-DEFOP(S,d_pow,pow,rbin)
-DEFOP(S,d_rpow,pow,cbin)
-
-DEFOP(S,d_sqrt,sqrt,run)
-DEFOP(S,d_ssqrt,ssqrt,run)
-
-DEFOP(S,d_exp,exp,run)
-DEFOP(S,d_log,log,run)
-
-namespace VaspOp {
- inline Vasp *m_pow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL) { return m_rbin(p,src,arg,dst,VecOp::d_pow); } // power
-
- Vasp *m_rpow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst = NULL); // radius power (with each two channels)
-
- inline Vasp *m_sqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_sqrt); } // square root (from abs value)
- inline Vasp *m_ssqrt(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_ssqrt); } // square root (from abs value)
-
- inline Vasp *m_exp(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_exp); } // exponential function
- inline Vasp *m_log(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_run(p,src,dst,VecOp::d_log); } // natural logarithm
-
-// inline Vasp *m_cexp(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_cexp); } // complex exponential function
-// inline Vasp *m_clog(OpParam &p,CVasp &src,CVasp *dst = NULL) { return m_cun(p,src,dst,VecOp::d_clog); } // complex logarithm (how about branches?)
-
-}
-
-#endif
diff --git a/externals/grill/vasp/source/ops_wnd.cpp b/externals/grill/vasp/source/ops_wnd.cpp
deleted file mode 100644
index 278e7bf1..00000000
--- a/externals/grill/vasp/source/ops_wnd.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "ops_wnd.h"
-#include "oploop.h"
-#include <math.h>
-#include <string.h>
-
-#ifndef PI
-#define PI 3.1415926535897932384
-#endif
-
-// --- window --------------------------
-
-typedef R (*wfunc)(R i,const OpParam &p);
-
-inline R wf_sin(R i,const OpParam &p) { return sin(i*p.wnd.p1+p.wnd.p2); }
-inline R wf_hanning(R i,const OpParam &p) { return 0.5*(1+cos(i*p.wnd.p1+p.wnd.p2)); }
-inline R wf_hamming(R i,const OpParam &p) { return 0.54 + 0.46 * cos(i*p.wnd.p1+p.wnd.p2); }
-inline R wf_blackman(R i,const OpParam &p) { const R x = i*p.wnd.p1+p.wnd.p2; return 0.42+0.5*cos(x)+0.08*cos(2*x); }
-inline R wf_connes(R i,const OpParam &p) { const R x = i*p.wnd.p1+p.wnd.p2,x2 = 1-x*x; return x2*x2; }
-inline R wf_welch(R i,const OpParam &p) { const R x = i*p.wnd.p1+p.wnd.p2; return 1-x*x; }
-inline R wf_lanczos(R i,const OpParam &p) { const R x = i*p.wnd.p1+p.wnd.p2; return x?sin(x)/x:1; }
-//inline R wf_gaussian(R i,const OpParam &p) { const R x = i*p.wnd.p1+p.wnd.p2; return pow(2, (-1 * (x / p.wnd.p3) * (x / p.wnd.p3))); }
-//inline R wf_kaiser(R i,const OpParam &p) { const R x = i*p.wnd.p1+p.wnd.p2; return i0(p.wnd.p3 * sqrt(1 - (x * x))) / i0(p.wnd.p3); }
-
-
-static V WndOp(wfunc wf,OpParam &p) {
- register I i;
-
- if(!p.wnd.mul) {
- register S *dd = p.rddt;
- _D_LOOP(i,p.frames) *dd = wf(i,p),dd += p.rds; _E_LOOP
- }
- else {
- register const S *sd = p.rsdt;
- register S *dd = p.rddt;
- _D_LOOP(i,p.frames) *dd = *sd*wf(i,p),sd += p.rss,dd += p.rds; _E_LOOP
- }
-}
-
-#define WNDOP(WFUNC,OPP) WndOp(WFUNC,OPP)
-
-
-
-BL VecOp::d_window(OpParam &p)
-{
- // reverse direction?
- BL rev = ((p.revdir?1:0)^(p.symm == 1?1:0)^(p.wnd.inv?1:0)) != 0;
-
- // set middle sample (if existent) to 1
- if(p.oddrem) p.SkipOddMiddle(1);
-
- switch(p.wnd.wndtp) {
- case 0: { // bevel (Bartlett)
- register R inc,cur;
- inc = (rev?-1.:1.)/p.frames; // increase
- cur = rev?(1+inc/2):inc/2; // start
-
- if(!p.wnd.mul) {
- register S *dd = p.rddt;
- register I i;
- if(p.rds == 1)
- _D_LOOP(i,p.frames) *(dd++) = cur,cur += inc; _E_LOOP
- else
- _D_LOOP(i,p.frames) *dd = cur,dd += p.rds,cur += inc; _E_LOOP
- }
- else {
- register const S *sd = p.rsdt;
- register S *dd = p.rddt;
- register I i;
- if(sd == dd)
- if(p.rss == 1 && p.rds == 1)
- _D_LOOP(i,p.frames) *(dd++) *= cur,cur += inc; _E_LOOP
- else
- _D_LOOP(i,p.frames) *dd *= cur,dd += p.rds,cur += inc; _E_LOOP
- else
- if(p.rss == 1 && p.rds == 1)
- _D_LOOP(i,p.frames) *(dd++) = *(sd++) * cur,cur += inc; _E_LOOP
- else
- _D_LOOP(i,p.frames) *dd = *sd * cur,sd += p.rss,dd += p.rds,cur += inc; _E_LOOP
- }
- break;
- }
- case 1: { // sine
- p.wnd.p1 = (PI/2)/p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?PI/2:0);
- WNDOP(wf_sin,p);
- break;
- }
- case 2: { // Hanning
- p.wnd.p1 = PI/p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?0:PI);
- WNDOP(wf_hanning,p);
- break;
- }
- case 3: { // Hamming
- p.wnd.p1 = PI/p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?0:PI);
- WNDOP(wf_hamming,p);
- break;
- }
- case 4: { // Blackman
- p.wnd.p1 = PI/p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?0:PI);
- WNDOP(wf_blackman,p);
- break;
- }
- case 5: { // Connes (xxx)
- p.wnd.p1 = 1./p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?1:0);
- WNDOP(wf_connes,p);
- break;
- }
- case 6: { // Welch (xxx)
- p.wnd.p1 = 1./p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?1:0);
- WNDOP(wf_welch,p);
- break;
- }
- case 7: { // Lanczos (xxx)
- p.wnd.p1 = PI/p.frames;
- p.wnd.p2 = p.wnd.p1/2+(rev?0:PI);
- WNDOP(wf_lanczos,p);
- break;
- }
- default: {
- post("%s: Window function #%i not known",p.opname,p.wnd.wndtp);
- return false;
- }
- }
-
- return true;
-}
-
-Vasp *VaspOp::m_window(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL inv,BL mul,BL symm)
-{
- static const int wndnum = 8;
- static const char *wndtps[wndnum] = {"lin","sin","hanning","hamming","blackman","connes","welch","lanczos" /*,"gaussian","kaiser"*/};
-
- Vasp *ret = NULL;
- RVecBlock *vecs = GetRVecs(p.opname,src,dst);
- if(vecs) {
- p.wnd.wndtp = -1;
-
- if(arg.IsList() && arg.GetList().Count() >= 1) {
- // window mode
- const flext::AtomList &l = arg.GetList();
- if(flext::IsSymbol(l[0])) {
- I i;
- const C *s = flext::GetString(l[0]);
- p.wnd.wndtp = -1;
- for(i = 0; i < wndnum; ++i)
- if(!strcmp(wndtps[i],s)) { p.wnd.wndtp = i; break; }
- }
- else if(flext::CanbeInt(l[0])) {
- p.wnd.wndtp = flext::GetAInt(l[0]);
- }
- else p.wnd.wndtp = -1;
- }
-
- if(p.wnd.wndtp < 0) {
- post("%s - invalid window type - using lin",p.opname);
- p.wnd.wndtp = 0;
- }
-
- p.wnd.inv = inv;
- p.wnd.mul = mul;
- ret = DoOp(vecs,VecOp::d_window,p,symm);
- delete vecs;
- }
-
- return ret;
-}
-
-VASP_ANYOP("vasp.window vasp.wnd",window,0,false,VASP_ARG(),"Sets target vasp to window function")
-VASP_ANYOP("vasp.*window vasp.*wnd",mwindow,0,true,VASP_ARG(),"Multiplies a vasp by window function")
-VASP_ANYOP("vasp.!window vasp.!wnd",iwindow,0,false,VASP_ARG(),"Sets target vasp to reverse window function")
-VASP_ANYOP("vasp.*!window vasp.!wnd",miwindow,0,true,VASP_ARG(),"Multiplies a vasp by reverse window function")
-VASP_ANYOP("vasp.xwindow vasp.xwnd",xwindow,0,false,VASP_ARG(),"Sets target vasp to symmetrical window function")
-VASP_ANYOP("vasp.*xwindow vasp.*xwnd",mxwindow,0,true,VASP_ARG(),"Multiplies a vasp by symmetrical window function")
-
-
-
diff --git a/externals/grill/vasp/source/ops_wnd.h b/externals/grill/vasp/source/ops_wnd.h
deleted file mode 100644
index 9103d978..00000000
--- a/externals/grill/vasp/source/ops_wnd.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-
-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_OPS_WND_H
-#define __VASP_OPS_WND_H
-
-#include "opbase.h"
-
-// Window functions
-
-namespace VecOp {
-/*
- BL d_bevel(OpParam &p);
- BL d_mbevel(OpParam &p);
-*/
- BL d_window(OpParam &p);
-}
-
-namespace VaspOp {
-/*
- Vasp *m_bevelup(OpParam &p,CVasp &src,CVasp *dst,BL up = true,BL mul = false); // bevel up
- inline Vasp *m_mbevelup(OpParam &p,CVasp &src,CVasp *dst) { return m_bevelup(p,src,dst,true,true); } // * bevel up (fade in)
- inline Vasp *m_beveldn(OpParam &p,CVasp &src,CVasp *dst) { return m_bevelup(p,src,dst,false,false); } // bevel down
- inline Vasp *m_mbeveldn(OpParam &p,CVasp &src,CVasp *dst) { return m_bevelup(p,src,dst,false,true); } // * bevel down (fade out)
-*/
- Vasp *m_window(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst,BL inv = false,BL mul = false,BL symm = false); // window curve
- inline Vasp *m_mwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,false,true,false); } // * window curve
- inline Vasp *m_iwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,true,false,false); } // inverse window curve
- inline Vasp *m_miwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,true,true,false); } // * inverse window curve
- inline Vasp *m_xwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,false,false,true); } // symmetrical window curve
- inline Vasp *m_mxwindow(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) { return m_window(p,src,arg,dst,false,true,true); } // * symmetrical window curve
-}
-
-#endif
diff --git a/externals/grill/vasp/source/opvecs.cpp b/externals/grill/vasp/source/opvecs.cpp
deleted file mode 100644
index f78210be..00000000
--- a/externals/grill/vasp/source/opvecs.cpp
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
-
-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.
-
-*/
-
-/*! \file vasp__ctrl.cpp
- \brief Methods for handling of vector data for real, complex and multi-vector cases.
-
-*/
-
-#include "main.h"
-#include "opbase.h"
-#include "classes.h"
-#include "vecblk.h"
-#include "util.h"
-
-/*! \brief Corrects for the common vector frame count
- \param frms frame count to correct
- \param bl new frame count
- \return true if a correction was made
-*/
-static BL corrlen(I &frms,I bl,I bf = -1,I bo = 0)
-{
- if(bf < 0) bf = bl;
-
- BL corr = false;
- BL all = frms < 0;
- if(all)
- frms = bl;
- else if(frms > bl) {
- // longer than vector length -> correct
- frms = bl;
- corr = true;
- }
-
- if(bo+frms > bf) {
- // now check if buffer size is exceeded
-// post("%s - %s vector (%s) exceeds buffer size: cropped",op,bli == 0?"src":"dst",bref->Name());
- frms = bf-bo;
- if(frms < 0) frms = 0;
- corr = true;
- }
-
- return corr;
-}
-
-
-inline BL corrlen(I &frms,VBuffer &b)
-{
- return corrlen(frms,b.Length(),b.Frames(),b.Offset());
-}
-
-
-/*! \brief Make real vector block for unary operations.
-
- \param op operation name
- \param src source vasp
- \param dst optional destination vasp
- \return struct with vector data
-
- \remark working size is maximum common vector size
-*/
-RVecBlock *VaspOp::GetRVecs(const C *op,CVasp &src,CVasp *dst)
-{
- I nvecs = src.Vectors();
- if(dst && dst->Ok() && dst->Vectors() != nvecs) {
- nvecs = min(nvecs,dst->Vectors());
- post("%s - src/dst vector number not equal -> taking minimum",op);
- }
-
- RVecBlock *ret = new RVecBlock(nvecs);
-
- BL ok = true,dlens = false;
- I tfrms = -1;
-
- Vasp *vbl[2] = {&src,dst};
-
- for(I bli = 0; bli < 2; ++bli)
- for(I ci = 0; ok && ci < nvecs; ++ci) {
- VBuffer *bref = NULL;
- if(vbl[bli] && vbl[bli]->Ok()) {
- bref = vbl[bli]->Buffer(ci);
- if(!bref->Data()) {
- post("%s - %s vector (%s) is invalid",op,bli == 0?"src":"dst",bref->Name());
- delete bref; bref = NULL;
- ok = false;
- }
- else
- dlens = dlens || corrlen(tfrms,*bref);
- }
-
- if(bli == 0)
- ret->Src(ci,bref);
- else
- ret->Dst(ci,bref);
- }
-
- if(dlens) post("%s - vector length has been limited to maximum common length (%i)",op,tfrms);
-
- ret->Frames(tfrms < 0?0:tfrms);
-
- if(ok) return ret;
- else { delete ret; return NULL; }
-}
-
-/*! \brief Make real vector block for unary operations.
-
- \param op operation name
- \param src source vasp
- \param dst optional destination vasp
- \param full true if imaginary part is compulsory
- \return struct with vector data
-*/
-CVecBlock *VaspOp::GetCVecs(const C *op,CVasp &src,CVasp *dst,BL full)
-{
- I nvecs = src.Vectors();
- if(dst && dst->Ok() && dst->Vectors() != nvecs) {
- nvecs = min(nvecs,dst->Vectors());
- post("%s - src/dst vector number not equal -> taking minimum",op);
- }
-
- I pairs = nvecs/2;
- if(nvecs != pairs*2)
- if(full) {
- post("%s - number of vectors is odd - not allowed",op);
- return NULL;
- }
- else {
- post("%s - number of vectors is odd - omitting last vector",op);
- }
-
- CVecBlock *ret = new CVecBlock(pairs);
- BL ok = true,dlens = false;
- I tfrms = -1;
-
- Vasp *vbl[2] = {&src,dst};
-
- for(I bli = 0; bli < 2; ++bli)
- for(I ci = 0; ci < pairs; ++ci) {
- VBuffer *bre = NULL,*bim = NULL; // complex channels
- if(vbl[bli] && vbl[bli]->Ok()) {
- const C *vnm = bli == 0?"src":"dst";
- bre = vbl[bli]->Buffer(ci*2);
- bim = vbl[bli]->Buffer(ci*2+1); // complex channels
-
- if(!bre->Data()) {
- post("%s - real %s vector (%s) is invalid",op,vnm,bre->Name());
- delete bre; bre = NULL;
- ok = false;
- }
- if(bim && !bim->Data()) {
- post("%s - imag %s vector (%s) is invalid",op,vnm,bim->Name());
- delete bim; bim = NULL;
- ok = false;
- }
-
- // check against common vector length
- if(bre) {
- dlens = dlens || corrlen(tfrms,*bre);
- }
- if(bim) {
- dlens = dlens || corrlen(tfrms,*bim);
- }
-
- }
-
- if(bli == 0)
- ret->Src(ci,bre,bim);
- else
- ret->Dst(ci,bre,bim);
- }
-
- if(dlens) post("%s - vector src/dst length has been limited to maximum common length (%i)",op,tfrms);
-
- ret->Frames(tfrms < 0?0:tfrms);
-
- if(ok) return ret;
- else { delete ret; return NULL; }
-}
-
-
-/*! \brief Make real vector block for binary operations.
-
- \param op operation name
- \param src source vasp
- \param arg argument vasp
- \param dst optional destination vasp
- \param multi 0 off/1 on/-1 auto... controls whether argument vector is single- or multi-vectored
- \return struct with vector data
-*/
-RVecBlock *VaspOp::GetRVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst,I multi,BL ssize)
-{
- if(!arg.Ok()) {
- post("%s - invalid argument vasp detected and ignored",op);
- return NULL;
- }
-
- I nvecs = src.Vectors();
- if(dst && dst->Ok() && dst->Vectors() != nvecs) {
- nvecs = min(nvecs,dst->Vectors());
- post("%s - src/dst vector number not equal -> taking minimum",op);
- }
-
- RVecBlock *ret;
-
- if(multi < 0) { // auto mode
- multi = arg.Vectors() > 1;
- }
-
- if(multi) {
- if(arg.Vectors() < nvecs) {
- nvecs = arg.Vectors();
- post("%s - too few arg vectors, operating on only first %i vectors",op,nvecs);
- }
- ret = new RVecBlock(nvecs,nvecs,1);
- for(I i = 0; i < nvecs; ++i)
- ret->Arg(i,arg.Buffer(i));
- }
- else {
- if(arg.Vectors() > 1) {
- post("%s - using only first arg vector for all operations",op);
- }
- ret = new RVecBlock(nvecs,nvecs,1);
- for(I i = 0; i < nvecs; ++i)
- ret->Arg(i,arg.Buffer(0));
- }
-
- BL ok = true,dlens = false,dalens = false;
- I tfrms = -1,afrms = -1;
-
- for(I ci = 0; ok && ci < nvecs; ++ci) {
- VBuffer *bref = src.Buffer(ci);
- VBuffer *barg = ret->Arg(multi?ci:0);
- VBuffer *bdst = dst && dst->Ok()?dst->Buffer(ci):NULL;
-
- if(barg && (multi || ci == 0) && !barg->Data()) {
- post("%s - arg vector (%s) is invalid",op,barg->Name());
- ok = false; break; // really break?
- }
- else if(!bref->Data()) {
- post("%s - src vector (%s) is invalid",op,bref->Name());
- ok = false; break; // really break?
- }
-
- // check src/dst frame lengths
- dlens = dlens || corrlen(tfrms,*bref);
- if(bdst) dlens = dlens || corrlen(tfrms,*bdst);
-
- // check arg frame length
- if(barg) dalens = dalens || corrlen(afrms,*barg);
-
- ret->Src(ci,bref);
- if(bdst) ret->Dst(ci,bdst);
- }
-
- if(dlens) post("%s - vector src/dst length has been limited to maximum common length (%i)",op,tfrms);
- if(dalens) post("%s - vector arg length has been limited to maximum common length (%i)",op,afrms);
-
- if(ssize) {
- if(corrlen(tfrms,afrms))
- post("%s - vector src/dst and arg lengths are unequal -> set to max. common length (%i)",op,tfrms);
- afrms = tfrms;
- }
-
- ret->Frames(tfrms < 0?0:tfrms);
- ret->ArgFrames(afrms < 0?0:afrms);
-
- if(ok) return ret;
- else { delete ret; return NULL; }
-}
-
-
-/*! \brief Make real complex block for binary operations.
-
- \param op operation name
- \param src source vasp
- \param arg argument vasp
- \param dst optional destination vasp
- \param multi 0 off/1 on/-1 auto... controls whether argument vector is single- or multi-vectored
- \param full true if imaginary part is compulsory
- \return struct with vector data
-*/
-CVecBlock *VaspOp::GetCVecs(const C *op,CVasp &src,const CVasp &arg,CVasp *dst,I multi,BL ssize,BL full)
-{
- if(!arg.Ok()) {
- post("%s - invalid argument vasp detected and ignored",op);
- return NULL;
- }
-
- I nvecs = src.Vectors();
- if(dst && dst->Ok() && dst->Vectors() != nvecs) {
- nvecs = min(nvecs,dst->Vectors());
- post("%s - src/dst vector number not equal -> taking minimum",op);
- }
-
- I pairs = nvecs/2;
- CVecBlock *ret;
-
- if(multi < 0) { // auto mode
- multi = arg.Vectors() > 2; // more than one argument pair -> multi
- }
-
- if(multi) {
- I apairs = arg.Vectors()/2;
- if(arg.Vectors() != apairs*2)
- if(full) {
- post("%s - number of arg vectors is odd - not allowed",op);
- return NULL;
- }
- else {
- post("%s - number of arg vectors is odd - assuming complex part as 0",op);
- ++apairs;
- }
-
- if(apairs < pairs) {
- pairs = apairs;
- post("%s - too few arg vectors, operating on only first %i vector pairs",op,pairs);
- }
- ret = new CVecBlock(pairs,pairs,1);
- for(I i = 0; i < pairs; ++i)
- ret->Arg(i,arg.Buffer(i*2),arg.Buffer(i*2+1));
- }
- else {
- if(arg.Vectors() > 2) {
- post("%s - using only first arg vector pair for all operations",op);
- }
- ret = new CVecBlock(pairs,pairs,1);
- for(I i = 0; i < pairs; ++i)
- ret->Arg(i,arg.Buffer(0),arg.Buffer(1));
- }
-
- BL ok = true,dlens = false,dalens = false;
- I tfrms = -1,afrms = -1;
-
- {
- if(nvecs != pairs*2) {
- post("%s - number of src vectors is odd - omitting last vector",op);
- // clear superfluous vector?
- }
-
- for(I ci = 0; ok && ci < pairs; ++ci) {
- // --- arg stuff ----------------
-
- VBuffer *brarg = ret->ReArg(ci),*biarg = ret->ImArg(ci);
-
- if(multi || ci == 0) {
- if(!brarg->Data()) {
- post("%s - real arg vector (%s) is invalid",op,brarg->Name());
- ok = false; break;
- }
- else if(biarg && !biarg->Data()) {
- post("%s - imag arg vector (%s) is invalid",op,biarg->Name());
- ok = false; break;
- }
- }
-
- // check against common arg length
- if(brarg) dalens = dalens || corrlen(afrms,*brarg);
- if(biarg) dalens = dalens || corrlen(afrms,*biarg);
-
- // --- src/dst stuff ----------------
-
- VBuffer *brref = src.Buffer(ci*2),*biref = src.Buffer(ci*2+1);
- VBuffer *brdst,*bidst;
- if(dst && dst->Ok()) brdst = dst->Buffer(ci*2),bidst = dst->Buffer(ci*2+1);
- else brdst = bidst = NULL;
-
- if(!brref->Data()) {
- post("%s - real src vector (%s) is invalid",op,brref->Name());
- ok = false; break; // really break?
- }
- else if(biref && !biref->Data()) {
- post("%s - imag src vector (%s) is invalid",op,biref->Name());
- ok = false; break; // really break?
- }
- else {
- dlens = dlens || corrlen(tfrms,*brref);
- if(biref) dlens = dlens || corrlen(tfrms,*biref);
- if(brdst) dlens = dlens || corrlen(tfrms,*brdst);
- if(bidst) dlens = dlens || corrlen(tfrms,*bidst);
- }
-
- ret->Src(ci,brref,biref);
- if(brdst) ret->Dst(ci,brdst,bidst);
- }
- }
-
- if(dlens) post("%s - vector src/dst length has been limited to maximum common length (%i)",op,tfrms);
- if(dalens) post("%s - vector arg length has been limited to maximum common length (%i)",op,afrms);
-
- if(ssize) {
- if(corrlen(tfrms,afrms))
- post("%s - vector src/dst and arg lengths are unequal -> set to max. common length (%i)",op,tfrms);
- afrms = tfrms;
- }
-
- ret->Frames(tfrms < 0?0:tfrms);
- ret->ArgFrames(afrms < 0?0:afrms);
-
- if(ok) return ret;
- else { delete ret; return NULL; }
-}
-
-
-/*! \brief Run the operation on the various real vectors.
-
- \param vecs src/arg/dst vector block
- \param fun operative function
- \param p parameter block for operative function
- \return normalized vasp or NULL on error
-
- \todo set overlap flag
-
- \remark operative function must be capable of handling reversed direction
-*/
-Vasp *VaspOp::DoOp(RVecBlock *vecs,opfun *fun,OpParam &p,BL symm)
-{
- BL ok = true;
-
- if(vecs->ArgBlks() && (!p.arg || p.args < vecs->ArgBlks())) {
- post("%s - not enough argument blocks",p.opname);
- ok = false;
- }
-
- const I scnt = symm?2:1;
- for(I i = 0; ok && i < vecs->Vecs(); ++i)
- for(I si = 0; ok && si < scnt; ++si) {
- p.frames = vecs->Frames();
-
- VBuffer *s = vecs->Src(i),*d = vecs->Dst(i);
- p.rsdt = s->Pointer(),p.rss = s->Channels();
-
- if(d) p.rddt = d->Pointer(),p.rds = d->Channels();
- else p.rddt = p.rsdt,p.rds = p.rss;
-
- for(I bi = 0; bi < vecs->ArgBlks(); ++bi) {
- VBuffer *a = vecs->Arg(i,bi);
- p.arg[bi].SetV(a?a->Pointer():NULL,a?a->Channels():0);
- }
-
- if(!symm)
- p.symm = -1;
- else {
- const I hcnt = p.frames/2;
- p.oddrem = p.frames != 2*hcnt;
-
- if((p.symm = si) == 0) {
- p.frames = hcnt+(p.oddrem?1:0);
- }
- else {
- const I r = p.frames-hcnt;
- p.frames = hcnt;
- p.rsdt += r*p.rss,p.rddt += r*p.rds;
-
- // What to do with arguments in symmetric mode?
- // let the object decide!!
- }
- }
-
- { // ---- Check out and try to resolve overlap situation ------------
-
- BL sovr = p.SR_In(); // check whether dst is before src
- if(p.HasArg()) {
- // has argument
- if(sovr) {
- // src/dst needs reversal -> check if ok for arg/dst
- p.ovrlap = true;
-
- if(p.AR_Can())
- p.R_Rev(); // Revert vectors
- else {
- post("%s - vector overlap situation can't be resolved",p.opname);
- ok = false;
- }
- }
- else if(p.AR_In()) {
- // arg/dst needs reversal -> check if ok for src/dst
- p.ovrlap = true;
-
- if(p.SR_Can())
- p.R_Rev(); // Revert vectors
- else {
- post("%s - vector overlap situation can't be resolved",p.opname);
- ok = false;
- }
- }
- }
- else { // No arg
- if(sovr) {
- p.ovrlap = true;
- p.R_Rev(); // if overlapping revert vectors
- }
- else
- p.ovrlap = p.SR_Ovr();
- }
- }
-
- ok = fun(p);
-
-#ifdef FLEXT_THREAD
- flext_base::ThrYield();
-#endif
- }
- return ok?vecs->ResVasp():NULL;
-}
-
-
-/*! \brief Run the operation on the various complex vector pairs.
-
- \param vecs src/arg/dst vector block
- \param fun operative function
- \param p parameter block for operative function
- \return normalized vasp or NULL on error
-
- \todo set overlap flag
-
- \remark operative function must be capable of handling reversed direction
-*/
-Vasp *VaspOp::DoOp(CVecBlock *vecs,opfun *fun,OpParam &p,BL symm)
-{
- BL ok = true;
-
- if(vecs->ArgBlks() && (!p.arg || p.args < vecs->ArgBlks())) {
- post("%s - not enough argument blocks",p.opname);
- ok = false;
- }
-
- const I scnt = symm?2:1;
- for(I i = 0; ok && i < vecs->Pairs(); ++i)
- for(I si = 0; ok && si < scnt; ++si) {
- p.frames = vecs->Frames();
-
- VBuffer *rsv = vecs->ReSrc(i),*isv = vecs->ImSrc(i);
- p.rsdt = rsv->Pointer(),p.rss = rsv->Channels();
- p.isdt = isv->Pointer(),p.iss = isv->Channels();
-
- VBuffer *rdv = vecs->ReDst(i),*idv = vecs->ImDst(i);
- if(rdv) {
- p.rddt = rdv->Pointer(),p.rds = rdv->Channels();
- if(idv) p.iddt = idv->Pointer(),p.ids = idv->Channels();
- else p.iddt = NULL; //,p.ids = 0; // Can that be NULL??
- }
- else {
- p.rddt = p.rsdt,p.rds = p.rss,p.iddt = p.isdt,p.ids = p.iss;
- }
-
- for(I bi = 0; bi < vecs->ArgBlks(); ++bi) {
- VBuffer *rav = vecs->ReArg(i,bi),*iav = vecs->ImArg(i,bi);
- p.arg[bi].SetV(rav?rav->Pointer():NULL,rav?rav->Channels():0,iav?iav->Pointer():NULL,iav?iav->Channels():0);
- }
-
- if(!symm)
- p.symm = -1;
- else {
- const I hcnt = p.frames/2;
- p.oddrem = p.frames != 2*hcnt;
-
- if((p.symm = si) == 0) {
- p.frames = hcnt+(p.oddrem?1:0);
- }
- else {
- const I r = p.frames-hcnt;
- p.frames = hcnt;
- p.rsdt += r*p.rss,p.isdt += r*p.iss;
- p.rddt += r*p.rds;
- if(p.iddt) p.iddt += r*p.ids; // Can that be NULL??
-
- // What to do with arguments?
- // let objects decide!!
- }
- }
-
- { // ---- Check out and try to resolve overlap situation ------------
-
- BL sovr = p.SR_In(); // check whether dst is before src
- if(sovr && !p.SI_Can()) {
- post("%s - src/dst overlap of re/im vectors not resolvable",p.opname);
- ok = false;
- }
-
- if(ok && p.HasArg()) {
- // has argument
- if(sovr) {
- // src/dst needs reversal -> check if ok for arg/dst
- p.ovrlap = true;
-
- if(p.AR_Can() && p.AI_Can())
- p.C_Rev(); // Revert vectors
- else {
- post("%s - vector overlap situation can't be resolved",p.opname);
- ok = false;
- }
- }
- else if(p.AR_In() || p.AI_In()) {
- // arg/dst needs reversal -> check if ok for src/dst
- p.ovrlap = true;
-
- if(p.AR_Can() && p.AI_Can() && p.SR_Can() && p.SI_Can())
- p.C_Rev(); // Revert vectors
- else {
- post("%s - vector overlap situation can't be resolved",p.opname);
- ok = false;
- }
- }
- }
- else { // No arg
- if(sovr) {
- p.ovrlap = true;
- p.C_Rev(); // if overlapping revert vectors
- }
- else
- p.ovrlap = p.SR_Ovr() || p.SI_Ovr();
- }
- }
-
- ok = fun(p);
-
-#ifdef FLEXT_THREAD
- flext_base::ThrYield();
-#endif
- }
- return ok?vecs->ResVasp():NULL;
-}
-
-
-
diff --git a/externals/grill/vasp/source/rdx2fft.cpp b/externals/grill/vasp/source/rdx2fft.cpp
deleted file mode 100644
index b4ecf6c9..00000000
--- a/externals/grill/vasp/source/rdx2fft.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <math.h>
-
-#define PI 3.1415926535897932384f
-
-//////////////////////////////////////////////////////////////////////////
-
-/* calculate bidirectional fourier transform of complex data radix 2 */
-/* adapted from subroutine FOUREA listed in */
-/* Programs for Digital Signal Processing */
-/* edited by Digital Signal Processing Committee */
-/* IEEE Acoustics Speech and Signal Processing Committee */
-/* Chapter 1 Section 1.1 Page 1.1-4,5 */
-/* direct -1 forward +1 reverse */
-
-bool fft_bidir_complex_radix2(int size,float *real,float *imag,int direct)
-{
- int i,j,m,mmax,istep;
- float c,s,treal,timag,theta;
-
- /* compute transform */
-
- j=1;
- for(i=1;i<=size;i++)
- {
- if(i<j)
- {
- treal=real[j-1];
- timag=imag[j-1];
- real[j-1]=real[i-1];
- imag[j-1]=imag[i-1];
- real[i-1]=treal;
- imag[i-1]=timag;
- }
- m=size/2;
- while(j>m)
- {
- j-=m;
- m=(m+1)/2;
- }
- j+=m;
- }
- mmax=1;
- while(size>mmax)
- {
- istep=2*mmax;
- for(m=1;m<=mmax;m++)
- {
- theta=PI*(float)direct*(float)(m-1)/(float)mmax;
- c=(float)cos(theta);
- s=(float)sin(theta);
- for(i=m;i<=size;i+=istep)
- {
- j=i+mmax;
- treal=real[j-1]*c-imag[j-1]*s;
- timag=imag[j-1]*c+real[j-1]*s;
- real[j-1]=real[i-1]-treal;
- imag[j-1]=imag[i-1]-timag;
- real[i-1]+=treal;
- imag[i-1]+=timag;
- }
- }
- mmax=istep;
- }
-
- return true;
-}
-
-#if 0
-/* calculate forward fourier transform of complex data radix 2 */
-
-bool fft_fwd_complex_radix2(int size,float *real,float *imag)
-{
- return fft_bidir_complex_radix2(size,real,imag,-1);
-}
-
-/* calculate inverse fourier transform of complex data radix 2 */
-
-bool fft_inv_complex_radix2(int size,float *real,float *imag)
-{
- return fft_bidir_complex_radix2(size,real,imag,1);
-}
-#endif
diff --git a/externals/grill/vasp/source/rvfft.cpp b/externals/grill/vasp/source/rvfft.cpp
deleted file mode 100644
index b7d81c93..00000000
--- a/externals/grill/vasp/source/rvfft.cpp
+++ /dev/null
@@ -1,357 +0,0 @@
-#include <math.h>
-
-#ifdef _MSC_VER
-#pragma warning(disable: 4244)
-#endif
-
-#define PI 3.14159265358979
-
-/////////////////////////////////////////////////////////
-// Sorensen in-place split-radix FFT for real values
-// data: array of floats:
-// re(0),re(1),re(2),...,re(size-1)
-//
-// output:
-// re(0),re(1),re(2),...,re(size/2),im(size/2-1),...,im(1)
-// normalized by array length
-//
-// Source:
-// Sorensen et al: Real-Valued Fast Fourier Transform Algorithms,
-// IEEE Trans. ASSP, ASSP-35, No. 6, June 1987
-
-void realfft_split(float *data,int n)
-{
-
- int i,j,k,i5,i6,i7,i8,i0,id,i1,i2,i3,i4,n2,n4,n8;
- float t1,t2,t3,t4,t5,t6,a3,ss1,ss3,cc1,cc3,a,e,sqrt2;
-
- sqrt2=sqrt(2.0);
- n4=n-1;
-
- //data shuffling
- for (i=0,j=0,n2=n/2; i<n4 ; i++){
- if (i<j){
- t1=data[j];
- data[j]=data[i];
- data[i]=t1;
- }
- k=n2;
- while (k<=j){
- j-=k;
- k>>=1;
- }
- j+=k;
- }
-
-/*----------------------*/
-
- //length two butterflies
- i0=0;
- id=4;
- do{
- for (; i0<n4; i0+=id){
- i1=i0+1;
- t1=data[i0];
- data[i0]=t1+data[i1];
- data[i1]=t1-data[i1];
- }
- id<<=1;
- i0=id-2;
- id<<=1;
- } while ( i0<n4 );
-
- /*----------------------*/
- //L shaped butterflies
-n2=2;
-for(k=n;k>2;k>>=1){
- n2<<=1;
- n4=n2>>2;
- n8=n2>>3;
- e = 2*PI/(n2);
- i1=0;
- id=n2<<1;
- do{
- for (; i1<n; i1+=id){
- i2=i1+n4;
- i3=i2+n4;
- i4=i3+n4;
- t1=data[i4]+data[i3];
- data[i4]-=data[i3];
- data[i3]=data[i1]-t1;
- data[i1]+=t1;
- if (n4!=1){
- i0=i1+n8;
- i2+=n8;
- i3+=n8;
- i4+=n8;
- t1=(data[i3]+data[i4])/sqrt2;
- t2=(data[i3]-data[i4])/sqrt2;
- data[i4]=data[i2]-t1;
- data[i3]=-data[i2]-t1;
- data[i2]=data[i0]-t2;
- data[i0]+=t2;
- }
- }
- id<<=1;
- i1=id-n2;
- id<<=1;
- } while ( i1<n );
- a=e;
- for (j=2; j<=n8; j++){
- a3=3*a;
- cc1=cos(a);
- ss1=sin(a);
- cc3=cos(a3);
- ss3=sin(a3);
- a=j*e;
- i=0;
- id=n2<<1;
- do{
- for (; i<n; i+=id){
- i1=i+j-1;
- i2=i1+n4;
- i3=i2+n4;
- i4=i3+n4;
- i5=i+n4-j+1;
- i6=i5+n4;
- i7=i6+n4;
- i8=i7+n4;
- t1=data[i3]*cc1+data[i7]*ss1;
- t2=data[i7]*cc1-data[i3]*ss1;
- t3=data[i4]*cc3+data[i8]*ss3;
- t4=data[i8]*cc3-data[i4]*ss3;
- t5=t1+t3;
- t6=t2+t4;
- t3=t1-t3;
- t4=t2-t4;
- t2=data[i6]+t6;
- data[i3]=t6-data[i6];
- data[i8]=t2;
- t2=data[i2]-t3;
- data[i7]=-data[i2]-t3;
- data[i4]=t2;
- t1=data[i1]+t5;
- data[i6]=data[i1]-t5;
- data[i1]=t1;
- t1=data[i5]+t4;
- data[i5]-=t4;
- data[i2]=t1;
- }
- id<<=1;
- i=id-n2;
- id<<=1;
- } while(i<n);
- }
- }
-}
-
-
-/////////////////////////////////////////////////////////
-// Sorensen in-place inverse split-radix FFT for real values
-// data: array of doubles:
-// re(0),re(1),re(2),...,re(size/2),im(size/2-1),...,im(1)
-//
-// output:
-// re(0),re(1),re(2),...,re(size-1)
-// NOT normalized by array length
-//
-// Source:
-// Sorensen et al: Real-Valued Fast Fourier Transform Algorithms,
-// IEEE Trans. ASSP, ASSP-35, No. 6, June 1987
-
-void irealfft_split(float *data,int n){
-
- int i,j,k,i5,i6,i7,i8,i0,id,i1,i2,i3,i4,n2,n4,n8,n1;
- float t1,t2,t3,t4,t5,a3,ss1,ss3,cc1,cc3,a,e,sqrt2;
-
- sqrt2=sqrt(2.0);
-
-n1=n-1;
-n2=n<<1;
-for(k=n;k>2;k>>=1){
- id=n2;
- n2>>=1;
- n4=n2>>2;
- n8=n2>>3;
- e = 2*PI/(n2);
- i1=0;
- do{
- for (; i1<n; i1+=id){
- i2=i1+n4;
- i3=i2+n4;
- i4=i3+n4;
- t1=data[i1]-data[i3];
- data[i1]+=data[i3];
- data[i2]*=2;
- data[i3]=t1-2*data[i4];
- data[i4]=t1+2*data[i4];
- if (n4!=1){
- i0=i1+n8;
- i2+=n8;
- i3+=n8;
- i4+=n8;
- t1=(data[i2]-data[i0])/sqrt2;
- t2=(data[i4]+data[i3])/sqrt2;
- data[i0]+=data[i2];
- data[i2]=data[i4]-data[i3];
- data[i3]=2*(-t2-t1);
- data[i4]=2*(-t2+t1);
- }
- }
- id<<=1;
- i1=id-n2;
- id<<=1;
- } while ( i1<n1 );
- a=e;
- for (j=2; j<=n8; j++){
- a3=3*a;
- cc1=cos(a);
- ss1=sin(a);
- cc3=cos(a3);
- ss3=sin(a3);
- a=j*e;
- i=0;
- id=n2<<1;
- do{
- for (; i<n; i+=id){
- i1=i+j-1;
- i2=i1+n4;
- i3=i2+n4;
- i4=i3+n4;
- i5=i+n4-j+1;
- i6=i5+n4;
- i7=i6+n4;
- i8=i7+n4;
- t1=data[i1]-data[i6];
- data[i1]+=data[i6];
- t2=data[i5]-data[i2];
- data[i5]+=data[i2];
- t3=data[i8]+data[i3];
- data[i6]=data[i8]-data[i3];
- t4=data[i4]+data[i7];
- data[i2]=data[i4]-data[i7];
- t5=t1-t4;
- t1+=t4;
- t4=t2-t3;
- t2+=t3;
- data[i3]=t5*cc1+t4*ss1;
- data[i7]=-t4*cc1+t5*ss1;
- data[i4]=t1*cc3-t2*ss3;
- data[i8]=t2*cc3+t1*ss3;
- }
- id<<=1;
- i=id-n2;
- id<<=1;
- } while(i<n1);
- }
- }
-
- /*----------------------*/
- i0=0;
- id=4;
- do{
- for (; i0<n1; i0+=id){
- i1=i0+1;
- t1=data[i0];
- data[i0]=t1+data[i1];
- data[i1]=t1-data[i1];
- }
- id<<=1;
- i0=id-2;
- id<<=1;
- } while ( i0<n1 );
-
-/*----------------------*/
-
-//data shuffling
- for (i=0,j=0,n2=n/2; i<n1 ; i++){
- if (i<j){
- t1=data[j];
- data[j]=data[i];
- data[i]=t1;
- }
- k=n2;
- while (k<=j){
- j-=k;
- k>>=1;
- }
- j+=k;
- }
-}
-
-
-#if 0
-/////////////////////////////////////////////////////////
-// Sorensen in-place radix-2 FFT for real values
-// data: array of floats:
-// re(0),re(1),re(2),...,re(size-1)
-//
-// output:
-// re(0),re(1),re(2),...,re(size/2),im(size/2-1),...,im(1)
-// normalized by array length
-//
-// Source:
-// Sorensen et al: Real-Valued Fast Fourier Transform Algorithms,
-// IEEE Trans. ASSP, ASSP-35, No. 6, June 1987
-
-void realfft_radix2(float *data,int n){
-
- float xt,a,e, t1, t2, cc, ss;
- int i, j, k, n1, n2, n3, n4, i1, i2, i3, i4;
-
- n4=n-1;
- //data shuffling
- for (i=0,j=0,n2=n/2; i<n4 ; i++){
- if (i<j){
- xt=data[j];
- data[j]=data[i];
- data[i]=xt;
- }
- k=n2;
- while (k<=j){
- j-=k;
- k>>=1;
- }
- j+=k;
- }
-
-/* -------------------- */
- for (i=0; i<n; i += 2)
- {
- xt = data[i];
- data[i] = xt + data[i+1];
- data[i+1] = xt - data[i+1];
- }
-/* ------------------------ */
- n2 = 1;
- for (k=n;k>2;k>>=1){
- n4 = n2;
- n2 = n4 << 1;
- n1 = n2 << 1;
- e = 2*PI/(n1);
- for (i=0; i<n; i+=n1){
- xt = data[i];
- data[i] = xt + data[i+n2];
- data[i+n2] = xt-data[i+n2];
- data[i+n4+n2] = -data[i+n4+n2];
- a = e;
- n3=n4-1;
- for (j = 1; j <=n3; j++){
- i1 = i+j;
- i2 = i - j + n2;
- i3 = i1 + n2;
- i4 = i - j + n1;
- cc = cos(a);
- ss = sin(a);
- a += e;
- t1 = data[i3] * cc + data[i4] * ss;
- t2 = data[i3] * ss - data[i4] * cc;
- data[i4] = data[i2] - t2;
- data[i3] = -data[i2] - t2;
- data[i2] = data[i1] - t1;
- data[i1] += t1;
- }
- }
- }
-}
-#endif
diff --git a/externals/grill/vasp/source/util.cpp b/externals/grill/vasp/source/util.cpp
deleted file mode 100644
index 0b1050c1..00000000
--- a/externals/grill/vasp/source/util.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "util.h"
-#include <math.h>
-
-/*
-R arg(R re,R im)
-{
- if(re)
- return fmod(atan(im/re)+(re < 0?2*PI:PI),2*PI)-PI;
- else
- if(im || re) return im > 0?PI/2:-PI/2;
- else return 0;
-}
-*/
diff --git a/externals/grill/vasp/source/util.h b/externals/grill/vasp/source/util.h
deleted file mode 100644
index 7f7cd080..00000000
--- a/externals/grill/vasp/source/util.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-
-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_UTIL_H
-#define __VASP_UTIL_H
-
-#include "main.h"
-
-#ifndef PI
-#define PI 3.1415926535897932385
-#endif
-
-#define BIG 1.e10
-
-#ifdef min
-#undef min
-#endif
-
-#ifdef max
-#undef max
-#endif
-
-template<class T>
-inline V swap(T &a,T &b) { T c = a; a = b; b = c; }
-
-template<class T>
-inline T min(T a,T b) { return a < b?a:b; }
-
-template<class T>
-inline T max(T a,T b) { return a > b?a:b; }
-
-
-template<class T>
-T arg(T re,T im)
-{
- if(re)
- return (T)(fmod(atan(im/re)+(re < 0?2*PI:PI),2*PI)-PI);
- else
- if(im || re) return (T)(im > 0?PI/2:-PI/2);
- else return 0;
-}
-
-template<class T>
-inline T sgn(T x) { return (T)(x?(x < 0?-1:1):0); }
-
-template<class T>
-inline T sqabs(T re,T im) { return re*re+im*im; }
-
-
-
-#endif
diff --git a/externals/grill/vasp/source/vasp.cpp b/externals/grill/vasp/source/vasp.cpp
deleted file mode 100644
index 3fe91330..00000000
--- a/externals/grill/vasp/source/vasp.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "classes.h"
-#include "util.h"
-#include "buflib.h"
-
-///////////////////////////////////////////////////////////////////////////
-// Vasp class
-///////////////////////////////////////////////////////////////////////////
-
-Vasp::Ref::Ref(VBuffer &b): sym(b.Symbol()),chn(b.Channel()),offs(b.Offset()) {}
-Vasp::Ref::Ref(VSymbol &s,I c,I o): sym(s),chn(c),offs(o) {}
-Vasp::Ref::~Ref() {}
-
-Vasp::Ref &Vasp::Ref::operator =(const Ref &r)
-{
- sym = r.sym,chn = r.chn,offs = r.offs;
- return *this;
-}
-
-V Vasp::Ref::Symbol(const VSymbol &s) { sym = s; }
-
-
-Vasp::Vasp():
- refs(0),chns(0),ref(NULL),
- frames(0)
-{
-}
-
-Vasp::Vasp(I argc,const t_atom *argv):
- refs(0),chns(0),ref(NULL),
- frames(0)
-{
- operator ()(argc,argv);
-}
-
-Vasp::Vasp(const Vasp &v):
- refs(0),chns(0),ref(NULL),
- frames(0)
-{
- operator =(v);
-}
-
-Vasp::Vasp(I fr,const Ref &r):
- refs(0),chns(0),ref(NULL),
- frames(fr)
-{
- AddVector(r);
-}
-
-
-Vasp::~Vasp()
-{
- Clear();
-}
-
-Vasp &Vasp::Clear()
-{
- refs = frames = chns = 0;
- if(ref) { delete[] ref; ref = NULL; }
- return *this;
-}
-
-
-BL Vasp::ChkArgs(I argc,const t_atom *argv)
-{
- I ix = 0;
-
- // vasp keyword
- t_symbol *v = ix < argc?flext::GetASymbol(argv[ix]):NULL;
- if(v && v == vasp_base::sym_vasp) ix++; // if it is "vasp" ignore it
-
- // length argument
- if(argc > ix && flext::CanbeInt(argv[ix])) ix++;
-
- while(argc > ix) {
- // check for symbol
- t_symbol *bsym = flext::GetASymbol(argv[ix]);
- if(!bsym || !flext::GetString(bsym) || !flext::GetString(bsym)[0]) { // expect a symbol
- // not symbol -> bail out
- return false;
- }
- else
- ix++;
-
- // check for offset
- if(argc > ix && flext::CanbeInt(argv[ix])) ix++;
-
- // check for channel
- if(argc > ix && flext::CanbeInt(argv[ix])) ix++;
- }
-
- return true;
-}
-
-V Vasp::Resize(I rcnt) {
- if(!ref) {
- ref = new Ref[refs = rcnt];
- chns = 0;
- }
- else if(rcnt > refs) {
- Ref *rnew = new Ref[refs = rcnt];
- for(I ix = 0; ix < chns; ++ix) rnew[ix] = ref[ix];
- delete[] ref;
- ref = rnew;
- }
-}
-
-
-
-Vasp &Vasp::operator =(const Vasp &v)
-{
- if(!v.Ok())
- Clear();
- else {
- frames = v.frames;
- if(!ref || v.chns > refs) {
- if(ref) delete[] ref;
- ref = new Ref[refs = v.chns];
- }
-
- chns = v.chns;
- for(I ix = 0; ix < chns; ++ix) {
- ref[ix] = v.ref[ix];
- }
- }
-
- return *this;
-}
-
-
-Vasp &Vasp::AddVector(const Ref &r)
-{
- Resize(chns+1);
- ref[chns++] = r;
- return *this;
-}
-
-
-// parse argument list
-Vasp &Vasp::operator ()(I argc,const t_atom *argv)
-{
- BL lenset = false;
- I ix = 0;
-
- I maxneeded = argc; // maximum number of ref'd buffers
- // rather use a temp storage
- if(!ref || refs < maxneeded) {
- if(ref) delete[] ref;
- ref = new Ref[refs = maxneeded];
- }
-
- t_symbol *v = ix < argc?flext::GetASymbol(argv[ix]):NULL;
- if(v && v == vasp_base::sym_vasp) ix++; // if it is "vasp" ignore it
-
- if(argc > ix && flext::CanbeInt(argv[ix])) {
- frames = flext::GetAInt(argv[ix]);
- lenset = true;
- ix++;
- }
- else
- frames = -1;
-
- chns = 0;
- while(argc > ix) {
- t_symbol *bsym = flext::GetASymbol(argv[ix]);
- if(!bsym || !flext::GetString(bsym) || !flext::GetString(bsym)[0]) { // expect a symbol
- Clear();
- return *this;
- }
- else
- ix++;
-
- // is a symbol!
- Ref &r = ref[chns];
- r.Symbol(VSymbol(bsym));
-
- if(argc > ix && flext::CanbeInt(argv[ix])) {
- r.Offset((I)flext::GetAInt(argv[ix]));
- ix++;
- }
- else
- r.Offset(0);
-
- if(argc > ix && flext::CanbeInt(argv[ix])) {
- r.Channel((I)flext::GetAInt(argv[ix]));
- ix++;
- }
- else
- r.Channel(0);
-
- chns++;
- }
-
- if(!lenset) {
- // set length to maximum!
- // or let it be -1 to represent the maximum?!
- frames = -1;
- // if len is already set then where to check for oversize?
- }
-
- return *this;
-}
-
-
-VBuffer *Vasp::Buffer(I ix) const
-{
- if(ix >= Vectors())
- return NULL;
- else {
- const Ref &r = Vector(ix);
- VBuffer *ret = BufLib::Get(r.Symbol(),r.Channel(),Frames(),r.Offset());
- return ret;
- }
-}
-
-// generate Vasp list of buffer references
-V Vasp::MakeList(flext::AtomList &ret,BL withvasp) const
-{
- I voffs = withvasp?1:0;
- I needed = voffs+1+Vectors()*3;
- ret(needed);
-
- if(withvasp)
- flext::SetSymbol(ret[0],vasp_base::sym_vasp); // VASP
-
- flext::SetInt(ret[voffs],frames); // frames
-
- for(I ix = 0; ix < Vectors(); ++ix) {
- const Ref &r = Vector(ix);
- flext::SetSymbol(ret[voffs+1+ix*3],r.Symbol().Symbol()); // buf
- flext::SetInt(ret[voffs+2+ix*3],r.Offset()); // offs
- flext::SetInt(ret[voffs+3+ix*3],r.Channel()); // chn
- }
-}
-
-
-// generate Vasp list of buffer references
-flext::AtomList *Vasp::MakeList(BL withvasp) const
-{
- flext::AtomList *ret = new flext::AtomList;
- MakeList(*ret,withvasp);
- return ret;
-}
-
-
-V Vasp::Refresh()
-{
- for(I i = 0; i < Vectors(); ++i) {
- VBuffer *vb = Buffer(i);
- if(vb) {
- vb->Refresh();
- delete vb;
- }
- }
-}
-
-V Vasp::Offset(I o)
-{
- for(I i = 0; i < Vectors(); ++i) Vector(i).Offset(o);
-}
-
-V Vasp::OffsetD(I od)
-{
- for(I i = 0; i < Vectors(); ++i) Vector(i).OffsetD(od);
-}
-
-
-V Vasp::Channel(I c)
-{
- for(I i = 0; i < Vectors(); ++i) Vector(i).Channel(c);
-}
-
-
-V Vasp::Size(I s,BL keep,BL zero)
-{
- for(I i = 0; i < Vectors(); ++i) {
- VBuffer *buf = Buffer(i);
- if(buf) {
- buf->Frames(s,keep,zero);
- delete buf;
- }
- }
-}
-
-V Vasp::SizeD(I sd,BL keep,BL zero)
-{
- for(I i = 0; i < Vectors(); ++i) {
- VBuffer *buf = Buffer(i);
- if(buf) {
- I s = buf->Frames()+sd;
- buf->Frames(s >= 0?s:0,keep,zero);
- delete buf;
- }
- }
-}
-
-
-V Vasp::SizeM(R f,BL keep,BL zero)
-{
- for(I i = 0; i < Vectors(); ++i) {
- VBuffer *buf = Buffer(i);
- if(buf) {
- I s = (I)(buf->Frames()*f);
- buf->Frames(s >= 0?s:0,keep,zero);
- delete buf;
- }
- }
-}
-
-BL Vasp::Check() const
-{
- BL ok = true;
- for(I i = 0; ok && i < Vectors(); ++i) {
- VBuffer *buf = Buffer(i);
- if(!buf)
- ok = false;
- else {
- ok = buf->Data() != NULL;
- delete buf;
- }
- }
- return ok;
-}
-
-I Vasp::ChkFrames() const
-{
- if(Vectors() == 0) return 0;
-
- I frms = -1;
- for(I i = 0; i < Vectors(); ++i) {
- VBuffer *buf = Buffer(i);
- if(buf) {
- I f = buf->Length();
- if(frms < 0 || f < frms) frms = f;
- delete buf;
- }
- }
-
- return frms < 0?0:frms;
-}
-
-
-// ------------------------------------
-
-CVasp::CVasp() {}
-
-CVasp::CVasp(const Vasp &v):
- Vasp(v)
-{
- if(!Check())
- Clear();
- else
- Frames(ChkFrames());
-}
-
-CVasp &CVasp::operator +=(const CVasp &v)
-{
- if(v.Ok()) {
- if(!Ok()) *this = v;
- else {
- I f = Frames(),vf = v.Frames();
-
- if(f != vf) {
- post("vasp - Frame count of joined vasps is different - taking the minimum");
- Frames(min(f,vf));
- }
-
- Resize(Vectors()+v.Vectors());
- for(I i = 0; i < v.Vectors(); ++i) AddVector(v.Vector(i));
- }
- }
- return *this;
-}
-
diff --git a/externals/grill/vasp/source/vasp.h b/externals/grill/vasp/source/vasp.h
deleted file mode 100644
index 0cc80be8..00000000
--- a/externals/grill/vasp/source/vasp.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-
-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__H
-#define __VASP__H
-
-#include "vbuffer.h"
-
-class Vasp:
- public flext
-{
-public:
- class Ref:
- public flext
- {
- public:
- Ref(): sym(NULL) {}
- Ref(VBuffer &b);
- Ref(VSymbol &s,I c,I o);
- Ref(const Ref &r) { operator =(r); }
- ~Ref();
-
- Ref &operator =(const Ref &r);
-
- V Clear() { sym.Clear(); }
- BL Ok() const { return sym.Ok(); }
-
- VSymbol &Symbol() { return sym; }
- const VSymbol &Symbol() const { return sym; }
- V Symbol(const VSymbol &s);
- I Channel() const { return chn; }
- V Channel(I c) { chn = c; }
- I Offset() const { return offs; }
- V Offset(I o) { offs = o; }
- V OffsetD(I o) { offs += o; }
-
- protected:
- VSymbol sym;
- I chn;
- I offs; // counted in frames
- };
-
- Vasp();
- Vasp(I argc,const t_atom *argv);
- Vasp(const Vasp &v);
- Vasp(I frames,const Ref &r);
- ~Vasp();
-
- static BL ChkArgs(I argc,const t_atom *argv);
-
- const C *thisName() const { return typeid(*this).name(); }
-
- // check if vasp reference is valid
- BL Check() const;
-
- Vasp &operator =(const Vasp &v);
- Vasp &operator ()(I argc,const t_atom *argv /*,BL withvasp = false*/);
-
- // set used channels to 0
- Vasp &Clear();
-
- // used vectors
- I Vectors() const { return chns; }
-
- // length of the vasp (in frames)
- I Frames() const { return frames; }
- // set frame count
- V Frames(I fr) { frames = fr; }
- // set frame count differentially
- V FramesD(I frd) { if(frames >= 0) frames += frd; }
- // set frame count
- V FramesM(R f) { if(frames >= 0) frames = (int)(frames*f); }
- // set frame count
- V FramesR(R f) { if(f) FramesM(1./f); else Frames(0); }
-
- // set buffer sizes
- V Size(I fr,BL keep = true,BL zero = true);
- // set frame count differentially
- V SizeD(I frd,BL keep = true,BL zero = true);
- // set frame count
- V SizeM(R f,BL keep = true,BL zero = true);
- // set frame count
- V SizeR(R f,BL keep = true,BL zero = true) { if(f) SizeM(1./f,keep,zero); else Size(0,false); }
-
- // actual length of the vasp (in frames)
- I ChkFrames() const;
-
- // set offset(s)
- V Offset(I fr);
- // set offset(s) differentially
- V OffsetD(I fr);
-
- // set channel(s)
- V Channel(I ch);
-
- BL Ok() const { return ref && Vectors() > 0; }
- BL IsComplex() const { return ref && Vectors() >= 2 && ref[1].Ok(); }
-
- // get any vector - test if in range 0..Vectors()-1!
- const Ref &Vector(I ix) const { return ref[ix]; }
- Ref &Vector(I ix) { return ref[ix]; }
-
- // get real part - be sure that Ok!
- const Ref &Real() const { return Vector(0); }
- Ref &Real() { return Vector(0); }
-
- // get imaginary part - be sure that Complex!
- const Ref &Imag() const { return Vector(1); }
- Ref &Imag() { return Vector(1); }
-
- // get buffer associated to a channel
- VBuffer *Buffer(I ix) const;
-
- // add another vector
- Vasp &AddVector(const Ref &r);
-
- // Real/Complex
- VBuffer *ReBuffer() const { return Buffer(0); }
- VBuffer *ImBuffer() const { return Buffer(1); }
-
- // prepare and reference t_atom list for output
- V MakeList(flext::AtomList &ret,BL withvasp = true) const;
- // prepare and reference t_atom list for output
- flext::AtomList *MakeList(BL withvasp = true) const;
-
- // make a graphical update of all buffers in vasp
- V Refresh();
-
-protected:
- I frames; // length counted in frames
- I chns; // used channels
- I refs; // allocated channels (>= chns)
- Ref *ref;
-
- V Resize(I rcnt);
-};
-
-/*! \brief Checked vasp
- \remark Only use that for immediate operation!
-*/
-class CVasp:
- public Vasp
-{
-public:
- CVasp();
- CVasp(const Vasp &v);
-
- // add vectors of another vasp
- CVasp &operator +=(const CVasp &v);
-
-};
-
-
-#endif
diff --git a/externals/grill/vasp/source/vasp.rsrc b/externals/grill/vasp/source/vasp.rsrc
deleted file mode 100755
index 632ebe43..00000000
--- a/externals/grill/vasp/source/vasp.rsrc
+++ /dev/null
@@ -1,13 +0,0 @@
-(This file must be converted with BinHex 4.0)
-:!!"bFh*M8P0&4!#3#!)RpQ8!N!3"!!!!!I!!!!$`!!!!0b"MEfjdB@PZC@3JE@9
-cFf&RC5"TEL"LD@jKFRNJ+Lm0$@KcE'PNCA+j,R*cFQ-#!!)!FR0bBe*6483"!2q
-3"!)!FR0bBe*6483"!2q3"!#3%U((pmm!N!B%Z#TLAhC`D@il#3N[+L"`BA4MD'P
-ZE'9d)'PZ)(4SDA-JF'&dBfKPFLGc)(CTFfpLDL!U,`d*#94&5'&ZC'aP)'*IG'9
-S1`Q3"#mU)(4PH(3JC@4TG'pb)'KKEQ4XC5!U,`d*I5"LAh9Z1`ep1`d0,bSJBQp
-i)'CXB@Gc)#S[$3dMC!!!!1aJ#J!!E8&i6!a#!!"1qJ!`6R8LAb!I,S"R%L"!F!!
-3%'!%%1J!!9()rrT#%%l4@8m[,`!)6VVrh#"I)!K1G8j@r[T)j`!`*Qi!#&P2,ca
-Y3AK-2c`!!DJ1)&mN5#!+Cbi[#NKZr[T)E[lm5'lr!+QS5'lr!%kkrlK)E[m!3IS
-!,NK3)'X!N!"1N!"2l`!-B!j"qJ!f5&!JD`#3!%k3!&K260m-!%jH6R@%E@&TEJ!
-!3#9c1L"ZEh3JBACKD@aKBQaP)'C[FL!f1%X!G'KTFb"[BQTPBh3JDA-JEQpd)'&
-fB@PXB@*XC5"QEh)J0MK,!*!%!3!!!!(`!!!!m!!!!$F4Y4E8!`B!!!!F!$)!!'e
-"H%`!!!!+(d!!N!B4Y4A!"(CKFh!6F!:
diff --git a/externals/grill/vasp/source/vbuffer.cpp b/externals/grill/vasp/source/vbuffer.cpp
deleted file mode 100644
index 0308358f..00000000
--- a/externals/grill/vasp/source/vbuffer.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "vbuffer.h"
-#include "buflib.h"
-
-V VSymbol::Inc() { if(sym) BufLib::IncRef(sym); }
-V VSymbol::Dec() { if(sym) BufLib::DecRef(sym); }
-
-///////////////////////////////////////////////////////////////////////////
-// SysBuf class
-///////////////////////////////////////////////////////////////////////////
-
-SysBuf &SysBuf::Set(const VSymbol &s,I c,I l,I o)
-{
- buf.Set(s.Symbol());
-
- chn = c;
- if(chn > Channels()) {
- I chn1 = Channels()-1;
- post("vasp - buffer %s: Channel index (%i) is out of range, set to highest (%i)",s.Name(),chn,chn1);
- chn = chn1; // simply correct the channel??
- }
- offs = o;
- if(offs < 0) {
- post("vasp - buffer %s: Offset (%i) is out of range, set to 0",s.Name(),offs);
- offs = 0;
- }
- if(offs > Frames()) {
-// post("vasp - buffer %s: Offset (%i) is out of range, set to %i",s.Name(),offs,Frames());
- offs = Frames();
- }
- len = l >= 0?l:Frames();
- if(offs+len > Frames()) {
- I len1 = Frames()-offs;
- if(l >= 0) post("vasp - buffer %s: Length (%i) is out of range, corrected to %i",s.Name(),len,len1);
- len = len1;
- }
-
- return *this;
-}
-
-
diff --git a/externals/grill/vasp/source/vbuffer.h b/externals/grill/vasp/source/vbuffer.h
deleted file mode 100644
index a87685c9..00000000
--- a/externals/grill/vasp/source/vbuffer.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-
-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_VBUFFER_H
-#define __VASP_VBUFFER_H
-
-#include "main.h"
-
-class VSymbol:
- public flext
-{
-public:
- VSymbol(const t_symbol *s = NULL): sym(s) { Inc(); }
- VSymbol(const VSymbol &s): sym(s.sym) { Inc(); }
- ~VSymbol() { Dec(); }
-
- BL Ok() const { return sym != NULL; }
- V Clear() { Dec(); sym = NULL; }
-
-// V *Thing() { return sym?flext_base::GetThing(sym):NULL; }
-// V Thing(V *th) { if(sym) flext_base::GetThing(sym); }
-
- VSymbol &operator =(const VSymbol &s) { Dec(); sym = s.sym; Inc(); return *this; }
-
- const t_symbol *Symbol() const { return sym; }
- const C *Name() const { return flext::GetAString(Symbol()); }
-
-protected:
- V Inc();
- V Dec();
-
- const t_symbol *sym;
-};
-
-class VBuffer:
- public flext
-{
-public:
- virtual ~VBuffer() {}
-
- virtual BL Ok() const = 0;
- virtual I Frames() const = 0;
- virtual V Frames(I fr,BL keep,BL zero) = 0;
-
- virtual I Channels() const = 0;
- virtual S *Data() = 0;
-
- virtual V Refresh() {}
- virtual V Dirty() {}
-
- S *Pointer() { return Data()+Offset()*Channels()+Channel(); }
-
- virtual VSymbol Symbol() const = 0;
- const C *Name() const { return Symbol().Name(); }
-
- I Channel() const { return chn; }
- V Channel(I c) { chn = c; }
-
- I Offset() const { return offs; }
- V Offset(I o) { offs = o; }
-
- I Length() const { return len; }
- V Length(I l) { len = l; }
-
-protected:
- VBuffer(I c = 0,I l = 0,I o = 0): chn(c),offs(o),len(l) {}
-
- I chn,offs,len;
-};
-
-
-class SysBuf:
- public VBuffer
-{
-public:
- SysBuf(const VSymbol &s,I chn = 0,I len = -1,I offs = 0) { Set(s,chn,len,offs); }
-
- virtual BL Ok() const { return buf.Ok(); }
- virtual V Refresh() { buf.Dirty(true); }
- virtual V Dirty() { buf.Dirty(false); }
-
- virtual VSymbol Symbol() const { return buf.Symbol(); }
-
- SysBuf &Set(const VSymbol &s,I chn = 0,I len = -1,I offs = 0);
-
- virtual I Frames() const { return buf.Frames(); }
- virtual V Frames(I fr,BL keep,BL zero) { buf.Frames(fr,keep,zero); }
-
- virtual I Channels() const { return buf.Channels(); }
- virtual S *Data() { return buf.Data(); }
-
-protected:
- flext::buffer buf;
-};
-
-
-class BufEntry;
-
-class ImmBuf:
- public VBuffer
-{
-public:
- ImmBuf(I len,BL zero = true);
- ImmBuf(BufEntry *e,I len = -1,I offs = 0);
-
- virtual BL Ok() const { return entry != NULL; }
-
- virtual VSymbol Symbol() const;
-
- virtual I Frames() const;
- virtual V Frames(I fr,BL keep,BL zero);
-
- virtual I Channels() const { return 1; }
- virtual S *Data();
-
-protected:
- BufEntry *entry;
-};
-
-
-#endif
diff --git a/externals/grill/vasp/source/vecblk.cpp b/externals/grill/vasp/source/vecblk.cpp
deleted file mode 100644
index 80917237..00000000
--- a/externals/grill/vasp/source/vecblk.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-
-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.
-
-*/
-
-#include "main.h"
-#include "vecblk.h"
-//#include <math.h>
-
-
-///////////////////////////////////////////////////////////////////////////
-// VecBlock class
-///////////////////////////////////////////////////////////////////////////
-
-VecBlock::VecBlock(BL cx,I msrc,I mdst,I marg,I blarg):
- cplx(cx),asrc(msrc),barg(blarg),aarg(marg*blarg),adst(mdst)
-{
- I i,all = asrc+aarg*blarg+adst;
- vecs = new VBuffer *[all];
- for(i = 0; i < all; ++i) vecs[i] = NULL;
-}
-
-VecBlock::~VecBlock()
-{
- if(vecs) {
- I all = asrc+aarg*barg+adst;
- for(I i = 0; i < all; ++i)
- if(vecs[i]) delete vecs[i];
- delete[] vecs;
- }
-}
-
-Vasp *VecBlock::_DstVasp(I n)
-{
- Vasp *ret = new Vasp;
- ret->Frames(Frames());
- for(I i = 0; i < n; ++i) ret->AddVector(Vasp::Ref(*_Dst(i)));
- return ret;
-}
-
-Vasp *VecBlock::_SrcVasp(I n)
-{
- Vasp *ret = new Vasp;
- ret->Frames(Frames());
- for(I i = 0; i < n; ++i) ret->AddVector(Vasp::Ref(*_Src(i)));
- return ret;
-}
-
-Vasp *VecBlock::_ResVasp(I n)
-{
- return _Dst(0)?_DstVasp(n):_SrcVasp(n);
-}
-
-
-
diff --git a/externals/grill/vasp/source/vecblk.h b/externals/grill/vasp/source/vecblk.h
deleted file mode 100644
index 7ca4ca94..00000000
--- a/externals/grill/vasp/source/vecblk.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-
-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_VECBLK_H
-#define __VASP_VECBLK_H
-
-#include "vasp.h"
-
-class VecBlock:
- public flext
-{
-public:
-
- I Frames() const { return frms; }
- V Frames(I fr) { frms = fr; }
- I ArgFrames() const { return afrms; }
- V ArgFrames(I fr) { afrms = fr; }
- I ArgBlks() const { return barg; }
-
- BL Complex() { return cplx; }
-
-protected:
- VecBlock(BL cplx,I msrc,I mdst,I marg,I blarg);
- ~VecBlock();
-
- Vasp *_SrcVasp(I n);
- Vasp *_DstVasp(I n);
- Vasp *_ResVasp(I n); // either Dst or Src
-
- VBuffer *_Src(I ix) { return vecs[ix]; }
- VBuffer *_Dst(I ix) { return vecs[asrc+aarg*barg+ix]; }
- V _Src(I ix,VBuffer *v) { vecs[ix] = v; }
- V _Dst(I ix,VBuffer *v) { vecs[asrc+aarg*barg+ix] = v; }
-
- VBuffer *_Arg(I ix,I bl = 0) { return vecs[asrc+bl*aarg+ix]; }
- V _Arg(I ix,VBuffer *v,I bl = 0) { vecs[asrc+bl*aarg+ix] = v; }
-
-private:
- BL cplx;
- I asrc,adst,aarg,barg;
- VBuffer **vecs;
- I frms,afrms;
-};
-
-
-class RVecBlock:
- public VecBlock
-{
-public:
- RVecBlock(I _n,I _a = 0,I _ba = 0): VecBlock(false,_n,_n,_a,_ba),n(_n),a(_a) {}
-
- VBuffer *Src(I ix) { return _Src(ix); }
- VBuffer *Dst(I ix) { return _Dst(ix); }
- V Src(I ix,VBuffer *v) { _Src(ix,v); }
- V Dst(I ix,VBuffer *v) { _Dst(ix,v); }
-
- VBuffer *Arg(I ix,I bl = 0) { return _Arg(ix,bl); }
- V Arg(I ix,VBuffer *v,I bl = 0) { _Arg(ix,v,bl); }
-
- I Vecs() const { return n; }
- I Args() const { return a; }
-
- Vasp *SrcVasp() { return _SrcVasp(n); }
- Vasp *DstVasp() { return _DstVasp(n); }
- Vasp *ResVasp() { return _ResVasp(n); }
-
-protected:
- I n,a;
-};
-
-class CVecBlock:
- public VecBlock
-{
-public:
- CVecBlock(I _np,I _ap = 0,I _bap = 0): VecBlock(true,_np*2,_np*2,_ap*2,_bap),np(_np),ap(_ap) {}
-
- VBuffer *ReSrc(I ix) { return _Src(ix*2); }
- VBuffer *ImSrc(I ix) { return _Src(ix*2+1); }
- VBuffer *ReDst(I ix) { return _Dst(ix*2); }
- VBuffer *ImDst(I ix) { return _Dst(ix*2+1); }
- V Src(I ix,VBuffer *vre,VBuffer *vim) { _Src(ix*2,vre); _Src(ix*2+1,vim); }
- V Dst(I ix,VBuffer *vre,VBuffer *vim) { _Dst(ix*2,vre); _Dst(ix*2+1,vim); }
-
- VBuffer *ReArg(I ix,I bl = 0) { return _Arg(ix*2,bl); }
- VBuffer *ImArg(I ix,I bl = 0) { return _Arg(ix*2+1,bl); }
- V Arg(I ix,VBuffer *vre,VBuffer *vim,I bl = 0) { _Arg(ix*2,vre,bl); _Arg(ix*2+1,vim,bl); }
-
- I Pairs() const { return np; }
- I Args() const { return ap; }
-
- Vasp *SrcVasp() { return _SrcVasp(np*2); }
- Vasp *DstVasp() { return _DstVasp(np*2); }
- Vasp *ResVasp() { return _ResVasp(np*2); }
-
-protected:
- I np,ap;
-};
-
-#endif