From b27da754180a1d86346f5f77179d607d22befe34 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 25 Feb 2003 18:18:32 +0000 Subject: "" svn path=/trunk/; revision=430 --- externals/grill/flext/config-pd-bcc.txt | 54 +-- externals/grill/flext/config-pd-cygwin.txt | 6 +- externals/grill/flext/config-pd-darwin.txt | 57 ++- externals/grill/flext/config-pd-linux.txt | 62 +-- externals/grill/flext/flext.cw | Bin 440331 -> 440331 bytes externals/grill/flext/flext.doxy | 2 +- externals/grill/flext/source/flatom_pr.cpp | 207 ++++++--- externals/grill/flext/source/fldsp.cpp | 630 +++++++++++++++++--------- externals/grill/flext/source/flext.h | 128 +++--- externals/grill/flext/source/flsupport.cpp | 6 +- externals/grill/flext/tutorial/adv1/adv1.cw | Bin 146697 -> 146697 bytes externals/grill/flext/tutorial/adv2/adv2.cw | Bin 101183 -> 148873 bytes externals/grill/flext/tutorial/adv3/adv3.cw | Bin 101183 -> 148873 bytes externals/grill/flext/tutorial/attr1/attr1.cw | Bin 101183 -> 147321 bytes externals/grill/flext/tutorial/attr2/attr2.cw | Bin 101183 -> 148873 bytes externals/grill/flext/tutorial/attr3/attr3.cw | Bin 101183 -> 148873 bytes 16 files changed, 715 insertions(+), 437 deletions(-) (limited to 'externals') diff --git a/externals/grill/flext/config-pd-bcc.txt b/externals/grill/flext/config-pd-bcc.txt index 15b8a37e..8083e294 100644 --- a/externals/grill/flext/config-pd-bcc.txt +++ b/externals/grill/flext/config-pd-bcc.txt @@ -1,27 +1,27 @@ -# flext - C++ layer for Max/MSP and pd (pure data) externals -# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) -# - -# where is PD? -PDPATH=c:\programme\audio\pd - -# where is BorlandC++? -BCCPATH=c:\programme\prog\bcc55 - -# where is the SndObj include directory? -# (leave blank or comment out to disable SndObj support) -SNDOBJ=f:\prog\packs\sndobj\include - -# where is the STK include directory? -# (leave blank or comment out to disable STK support) -STK=f:\prog\packs\stk\include - -# build directory for flext libraries? -OUTPATH=.\pd-bcc - -# where should flext libraries be installed? -# (leave blank to omit installation) -INSTDIR=$(PDPATH)\flext - - - +# flext - C++ layer for Max/MSP and pd (pure data) externals +# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +# + +# where is PD? +PDPATH=c:\programme\audio\pd + +# where is BorlandC++? +BCCPATH=c:\programme\prog\bcc55 + +# where is the SndObj include directory? +# (leave blank or comment out to disable SndObj support) +SNDOBJ=f:\prog\audio\sndobj\include + +# where is the STK include directory? +# (leave blank or comment out to disable STK support) +STK=f:\pprog\audio\stk\include + +# build directory for flext libraries? +OUTPATH=.\pd-bcc + +# where should flext libraries be installed? +# (leave blank to omit installation) +INSTDIR=$(PDPATH)\flext + + + diff --git a/externals/grill/flext/config-pd-cygwin.txt b/externals/grill/flext/config-pd-cygwin.txt index 1347dfff..b0b8aee0 100644 --- a/externals/grill/flext/config-pd-cygwin.txt +++ b/externals/grill/flext/config-pd-cygwin.txt @@ -10,11 +10,11 @@ PDPATH=/cygdrive/c/programme/audio/pd # where is the SndObj include directory? # (leave blank or comment out to disable SndObj support) -SNDOBJ=/cygdrive/f/prog/packs/sndobj/include +SNDOBJ=/cygdrive/f/prog/audio/sndobj/include # where is the STK include directory? # (leave blank or comment out to disable STK support) -STK=/cygdrive/f/prog/packs/stk/include +STK=/cygdrive/f/prog/audio/stk/include # where should flext libraries be built? TARGDIR=./pd-cygwin @@ -25,4 +25,4 @@ INSTDIR=${PDPATH}/flext # additional compiler flags # (check if they fit for your system!) -# UFLAGS=-mcpu=pentium3 -msse \ No newline at end of file +UFLAGS=-mcpu=pentium3 -msse \ No newline at end of file diff --git a/externals/grill/flext/config-pd-darwin.txt b/externals/grill/flext/config-pd-darwin.txt index 68954991..91a61558 100644 --- a/externals/grill/flext/config-pd-darwin.txt +++ b/externals/grill/flext/config-pd-darwin.txt @@ -1,29 +1,28 @@ -# flext - C++ layer for Max/MSP and pd (pure data) externals -# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) -# - -# your c++ compiler (define only if it's different than g++) -# CXX=g++ - -# where are the PD header files? (m_pd.h, m_imp.h, g_canvas.h) -PDPATH=/usr/local/pd/src - -# where is the SndObj include directory? -# (leave blank or comment out to disable SndObj support) -# SNDOBJ=/usr/src/sndobj/include - -# where is the STK include directory? -# (leave blank or comment out to disable STK support) -# STK=/usr/src/stk/include - -# where should flext libraries be built? -TARGDIR=./pd-darwin - -# where should flext libraries be installed? -# (leave blank to omit installation) -INSTDIR=/usr/local/pd/flext - -# additional compiler flags -# (check if they fit for your system!) -UFLAGS=-malign-power -maltivec - +# flext - C++ layer for Max/MSP and pd (pure data) externals +# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +# + +# your c++ compiler (define only if it's different than g++) +# CXX=g++ + +# where are the PD header files? (m_pd.h, m_imp.h, g_canvas.h) +PDPATH=/usr/local/pd/src + +# where is the SndObj include directory? +# (leave blank or comment out to disable SndObj support) +# SNDOBJ=/usr/src/sndobj/include + +# where is the STK include directory? +# (leave blank or comment out to disable STK support) +# STK=/usr/src/stk/include + +# where should flext libraries be built? +TARGDIR=./pd-darwin + +# where should flext libraries be installed? +# (leave blank to omit installation) +INSTDIR=/usr/local/pd/flext + +# additional compiler flags +# (check if they fit for your system!) +UFLAGS=-malign-power -maltivec diff --git a/externals/grill/flext/config-pd-linux.txt b/externals/grill/flext/config-pd-linux.txt index f74144a8..9b07a5b7 100644 --- a/externals/grill/flext/config-pd-linux.txt +++ b/externals/grill/flext/config-pd-linux.txt @@ -1,31 +1,31 @@ -# flext - C++ layer for Max/MSP and pd (pure data) externals -# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) -# - -# your c++ compiler (define only if it's different than g++) -# CXX=g++ - -# where are the PD header files? (m_pd.h, m_imp.h, g_canvas.h) -# if it is a system include path (like /usr/local/include) -# you should leave it blank (as e.g. g++ 3.2 complains about it) -PDPATH= - -# where is the SndObj include directory? -# (leave blank or comment out to disable SndObj support) -SNDOBJ=/usr/local/include/SndObj - -# where is the STK include directory? -# (leave blank or comment out to disable STK support) -STK=/usr/src/stk-4.1.1/include - -# where should flext libraries be built? -TARGDIR=./pd-linux - -# where should flext libraries be installed? -# (leave blank to omit installation) -INSTDIR=/usr/local/lib/pd/flext - -# additional compiler flags -# (check if they fit for your system!) -UFLAGS=-mcpu=pentiumpro # gcc 2.95 -# UFLAGS=-mcpu=pentium3 -msse # gcc 3.2 +# flext - C++ layer for Max/MSP and pd (pure data) externals +# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net) +# + +# your c++ compiler (define only if it's different than g++) +# CXX=g++ + +# where are the PD header files? (m_pd.h, m_imp.h, g_canvas.h) +# if it is a system include path (like /usr/local/include) +# you should leave it blank (as e.g. g++ 3.2 complains about it) +PDPATH= + +# where is the SndObj include directory? +# (leave blank or comment out to disable SndObj support) +SNDOBJ=/usr/local/include/SndObj + +# where is the STK include directory? +# (leave blank or comment out to disable STK support) +STK=/usr/src/stk-4.1.1/include + +# where should flext libraries be built? +TARGDIR=./pd-linux + +# where should flext libraries be installed? +# (leave blank to omit installation) +INSTDIR=/usr/local/lib/pd/flext + +# additional compiler flags +# (check if they fit for your system!) +UFLAGS=-mcpu=pentiumpro # gcc 2.95 +# UFLAGS=-mcpu=pentium3 -msse # gcc 3.2 diff --git a/externals/grill/flext/flext.cw b/externals/grill/flext/flext.cw index 79e2896c..58c9749b 100644 Binary files a/externals/grill/flext/flext.cw and b/externals/grill/flext/flext.cw differ diff --git a/externals/grill/flext/flext.doxy b/externals/grill/flext/flext.doxy index 7e9dbdb0..433f3b4d 100644 --- a/externals/grill/flext/flext.doxy +++ b/externals/grill/flext/flext.doxy @@ -4,7 +4,7 @@ # General configuration options #--------------------------------------------------------------------------- PROJECT_NAME = flext -PROJECT_NUMBER = "version 0.4.1" +PROJECT_NUMBER = "version 0.4.2" OUTPUT_DIRECTORY = f:/prog/max/flext/doc/ OUTPUT_LANGUAGE = English EXTRACT_ALL = NO diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp index b6cc0e5f..c43da7b0 100644 --- a/externals/grill/flext/source/flatom_pr.cpp +++ b/externals/grill/flext/source/flatom_pr.cpp @@ -1,69 +1,138 @@ -/* - -flext - C++ layer for Max/MSP and pd (pure data) externals - -Copyright (c) 2001-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. - -*/ - -/*! \file flatom_pr.cpp - \brief Definitions for printing and scanning the t_atom type. -*/ - -#include "flext.h" -#include -#include -#include -#include - -#ifdef __MWERKS__ -#define STD std -#else -#define STD -#endif - -void flext::PrintAtom(const t_atom &a,char *buf,int bufsz) -{ - GetAString(a,buf,bufsz?bufsz:100000); -} - -bool flext::ScanAtom(t_atom &a,const char *buf) -{ - // skip whitespace - while(*buf && isspace(*buf)) ++buf; - if(!*buf) return false; - - char tmp[1024]; - strcpy(tmp,buf); - char *c = tmp; - - // check for word type (s = 0,1,2 ... int,float,symbol) - int s = 0; - for(; *c && !isspace(*c); ++c) { - if(!isdigit(*c)) - s = (*c != '.' || s == 1)?2:1; - } - - switch(s) { - case 0: // integer -#if FLEXT_SYS == FLEXT_SYS_MAX - SetInt(a,atol(tmp)); - break; -#endif - case 1: // float - SetFloat(a,(float)atof(tmp)); - break; - default: { // anything else is a symbol - char t = *c; *c = 0; - SetString(a,tmp); - *c = t; - break; - } - } - - return true; -} - - +/* + + + +flext - C++ layer for Max/MSP and pd (pure data) externals + + + +Copyright (c) 2001-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. + + + +*/ + + + +/*! \file flatom_pr.cpp + + \brief Definitions for printing and scanning the t_atom type. + +*/ + + + +#include "flext.h" + +#include + +#include + +#include + +#include + + + +#ifdef __MWERKS__ + +#define STD std + +#else + +#define STD + +#endif + + + +void flext::PrintAtom(const t_atom &a,char *buf,int bufsz) + +{ + + GetAString(a,buf,bufsz?bufsz:100000); + +} + + + +bool flext::ScanAtom(t_atom &a,const char *buf) + +{ + + // skip whitespace + + while(*buf && isspace(*buf)) ++buf; + + if(!*buf) return false; + + + + char tmp[1024]; + + strcpy(tmp,buf); + + char *c = tmp; + + + + // check for word type (s = 0,1,2 ... int,float,symbol) + + int s = 0; + + for(; *c && !isspace(*c); ++c) { + + if(!isdigit(*c)) + + s = (*c != '.' || s == 1)?2:1; + + } + + + + switch(s) { + + case 0: // integer + +#if FLEXT_SYS == FLEXT_SYS_MAX + + SetInt(a,atol(tmp)); + + break; + +#endif + + case 1: // float + + SetFloat(a,(float)atof(tmp)); + + break; + + default: { // anything else is a symbol + + char t = *c; *c = 0; + + SetString(a,tmp); + + *c = t; + + break; + + } + + } + + + + return true; + +} + + + + + diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp index a90545d2..5763aa94 100644 --- a/externals/grill/flext/source/fldsp.cpp +++ b/externals/grill/flext/source/fldsp.cpp @@ -1,210 +1,420 @@ -/* - -flext - C++ layer for Max/MSP and pd (pure data) externals - -Copyright (c) 2001-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. - -*/ - -/*! \file fldsp.cpp - \brief Implementation of the flext dsp base class. -*/ - -#include "flext.h" -#include "flinternal.h" -#include - - - -// === flext_dsp ============================================== - -#if FLEXT_SYS == FLEXT_SYS_JMAX -const t_symbol *flext_dsp::dspsym = MakeSymbol("__flext_dspfun__"); -#endif - -void flext_dsp::Setup(t_classid id) -{ - t_class *c = getClass(id); - -#if FLEXT_SYS == FLEXT_SYS_MAX -// dsp_initclass(); - dsp_initboxclass(); - add_dsp(c,cb_dsp); -#elif FLEXT_SYS == FLEXT_SYS_PD - CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal - add_dsp(c,cb_dsp); - add_method1(c,cb_enable,"enable",A_FLOAT); -#elif FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_declare_function(dspsym,dspmeth); - fts_class_message_varargs(c, fts_s_put, cb_dsp); - fts_class_message_varargs(c, MakeSymbol("enable"), cb_enable); -#endif -} - -flext_dsp::flext_dsp(): -#if FLEXT_SYS == FLEXT_SYS_JMAX - srate(fts_dsp_get_sample_rate()), // should we set it? - blksz(fts_dsp_get_tick_size()), -#else - srate(sys_getsr()), // should we set it? - blksz(sys_getblksize()), -#endif -#if FLEXT_SYS == FLEXT_SYS_PD - chnsin(sys_get_inchannels()), - chnsout(sys_get_outchannels()), -#elif FLEXT_SYS == FLEXT_SYS_MAX - chnsin(sys_getch()), - chnsout(sys_getch()), -#elif FLEXT_SYS == FLEXT_SYS_JMAX - #pragma message("not implemented") - chnsin(0),chnsout(0), -#else -#error -#endif -#if FLEXT_SYS != FLEXT_SYS_MAX - dspon(true), -#endif - invecs(NULL),outvecs(NULL) -{ -#if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_object_init(thisHdr()); -#endif -} - - -flext_dsp::~flext_dsp() -{ -#if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_object_delete(thisHdr()); -#endif - if(invecs) delete[] invecs; - if(outvecs) delete[] outvecs; -} - -#if FLEXT_SYS == FLEXT_SYS_JMAX -void flext_dsp::dspmeth(fts_word_t *w) -{ -} -#else -t_int *flext_dsp::dspmeth(t_int *w) -{ - flext_dsp *obj = (flext_dsp *)w[1]; -#if FLEXT_SYS == FLEXT_SYS_MAX - if(!obj->thisHdr()->z_disabled) -#else - if(obj->dspon) -#endif - obj->m_signal((int)w[2],obj->invecs,obj->outvecs); - return w+3; -} -#endif - -#if FLEXT_SYS == FLEXT_SYS_JMAX -void flext_dsp::cb_dsp(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) -#else -void flext_dsp::cb_dsp(t_class *c,t_signal **sp) -#endif -{ - flext_dsp *obj = thisObject(c); - - if(obj->CntInSig()+obj->CntOutSig() == 0) return; - - // store current dsp parameters -#if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_pointer(at+0); - obj->srate = fts_dsp_get_input_srate(dsp,0); - obj->blksz = fts_dsp_get_input_size(dsp,0); // is this guaranteed to be the same as sys_getblksize() ? -#else - obj->srate = sp[0]->s_sr; - obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ? -#endif - -#if FLEXT_SYS == FLEXT_SYS_PD - obj->chnsin = sys_get_inchannels(); - obj->chnsout = sys_get_outchannels(); -#elif FLEXT_SYS == FLEXT_SYS_MAX - obj->chnsin = obj->chnsout = sys_getch(); -#elif FLEXT_SYS == FLEXT_SYS_JMAX - #pragma message ("How to query the channels?") -#else -#error -#endif - - // store in and out signal vectors - int i,in = obj->CntInSig(),out = obj->CntOutSig(); - -#if FLEXT_SYS == FLEXT_SYS_PD - // min. 1 input channel! (CLASS_MAININLET in pd...) - if(!in) in = 1; -#endif - - if(obj->invecs) delete[] obj->invecs; - obj->invecs = new t_signalvec[in]; - for(i = 0; i < in; ++i) - obj->invecs[i] = -#if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_get_input_name(dsp,i); -#else - sp[i]->s_vec; -#endif - - if(obj->outvecs) delete[] obj->outvecs; - obj->outvecs = new t_signalvec[out]; - for(i = 0; i < out; ++i) - obj->outvecs[i] = -#if FLEXT_SYS == FLEXT_SYS_JMAX - fts_dsp_get_output_name(dsp,i); -#else - sp[in+i]->s_vec; -#endif - - // with the following call derived classes can do their eventual DSP setup - obj->m_dsp(obj->blksz,obj->invecs,obj->outvecs); - - // set the DSP function -#if FLEXT_SYS == FLEXT_SYS_JMAX - fts_atom_t args[2]; - fts_set_pointer(args+0,obj); - fts_set_int(args+1,obj->blksz); - fts_dsp_add_function(dspsym,2,args); -#else - dsp_add((t_dspmethod)dspmeth,2,obj,obj->blksz); -#endif -} - -/* -#if FLEXT_SYS == FLEXT_SYS_JMAX -void flext_dsp::cb_dsp_init(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at) -{ - fts_dsp_add_object(c); -} - -void flext_dsp::cb_dsp_delete(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at) -{ - fts_dsp_remove_object(c); -} -#endif -*/ - -void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {} - -void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs) -{ - for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n); -} - -#if FLEXT_SYS != FLEXT_SYS_MAX - -#if FLEXT_SYS == FLEXT_SYS_PD -void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->m_enable(on != 0); } -#elif FLEXT_SYS == FLEXT_SYS_JMAX -void flext_dsp::cb_enable(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) -{ thisObject(c)->m_enable(fts_get_int(at+0) != 0); } -#endif - -void flext_dsp::m_enable(bool en) { dspon = en; } -#endif - - +/* + + + +flext - C++ layer for Max/MSP and pd (pure data) externals + + + +Copyright (c) 2001-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. + + + +*/ + + + +/*! \file fldsp.cpp + + \brief Implementation of the flext dsp base class. + +*/ + + + +#include "flext.h" + +#include "flinternal.h" + +#include + + + + + + + +// === flext_dsp ============================================== + + + +#if FLEXT_SYS == FLEXT_SYS_JMAX + +const t_symbol *flext_dsp::dspsym = MakeSymbol("__flext_dspfun__"); + +#endif + + + +void flext_dsp::Setup(t_classid id) + +{ + + t_class *c = getClass(id); + + + +#if FLEXT_SYS == FLEXT_SYS_MAX + +// dsp_initclass(); + + dsp_initboxclass(); + + add_dsp(c,cb_dsp); + +#elif FLEXT_SYS == FLEXT_SYS_PD + + CLASS_MAINSIGNALIN(c,flext_hdr,defsig); // float messages going into the left inlet are converted to signal + + add_dsp(c,cb_dsp); + + add_method1(c,cb_enable,"enable",A_FLOAT); + +#elif FLEXT_SYS == FLEXT_SYS_JMAX + + fts_dsp_declare_function(dspsym,dspmeth); + + fts_class_message_varargs(c, fts_s_put, cb_dsp); + + fts_class_message_varargs(c, MakeSymbol("enable"), cb_enable); + +#endif + +} + + + +flext_dsp::flext_dsp(): + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + srate(fts_dsp_get_sample_rate()), // should we set it? + + blksz(fts_dsp_get_tick_size()), + +#else + + srate(sys_getsr()), // should we set it? + + blksz(sys_getblksize()), + +#endif + +#if FLEXT_SYS == FLEXT_SYS_PD + + chnsin(sys_get_inchannels()), + + chnsout(sys_get_outchannels()), + +#elif FLEXT_SYS == FLEXT_SYS_MAX + + chnsin(sys_getch()), + + chnsout(sys_getch()), + +#elif FLEXT_SYS == FLEXT_SYS_JMAX + + #pragma message("not implemented") + + chnsin(0),chnsout(0), + +#else + +#error + +#endif + +#if FLEXT_SYS != FLEXT_SYS_MAX + + dspon(true), + +#endif + + invecs(NULL),outvecs(NULL) + +{ + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + fts_dsp_object_init(thisHdr()); + +#endif + +} + + + + + +flext_dsp::~flext_dsp() + +{ + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + fts_dsp_object_delete(thisHdr()); + +#endif + + if(invecs) delete[] invecs; + + if(outvecs) delete[] outvecs; + +} + + + +#if FLEXT_SYS == FLEXT_SYS_JMAX + +void flext_dsp::dspmeth(fts_word_t *w) + +{ + +} + +#else + +t_int *flext_dsp::dspmeth(t_int *w) + +{ + + flext_dsp *obj = (flext_dsp *)w[1]; + +#if FLEXT_SYS == FLEXT_SYS_MAX + + if(!obj->thisHdr()->z_disabled) + +#else + + if(obj->dspon) + +#endif + + obj->m_signal((int)w[2],obj->invecs,obj->outvecs); + + return w+3; + +} + +#endif + + + +#if FLEXT_SYS == FLEXT_SYS_JMAX + +void flext_dsp::cb_dsp(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) + +#else + +void flext_dsp::cb_dsp(t_class *c,t_signal **sp) + +#endif + +{ + + flext_dsp *obj = thisObject(c); + + + + if(obj->CntInSig()+obj->CntOutSig() == 0) return; + + + + // store current dsp parameters + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + fts_dsp_descr_t *dsp = (fts_dsp_descr_t *)fts_get_pointer(at+0); + + obj->srate = fts_dsp_get_input_srate(dsp,0); + + obj->blksz = fts_dsp_get_input_size(dsp,0); // is this guaranteed to be the same as sys_getblksize() ? + +#else + + obj->srate = sp[0]->s_sr; + + obj->blksz = sp[0]->s_n; // is this guaranteed to be the same as sys_getblksize() ? + +#endif + + + +#if FLEXT_SYS == FLEXT_SYS_PD + + obj->chnsin = sys_get_inchannels(); + + obj->chnsout = sys_get_outchannels(); + +#elif FLEXT_SYS == FLEXT_SYS_MAX + + obj->chnsin = obj->chnsout = sys_getch(); + +#elif FLEXT_SYS == FLEXT_SYS_JMAX + + #pragma message ("How to query the channels?") + +#else + +#error + +#endif + + + + // store in and out signal vectors + + int i,in = obj->CntInSig(),out = obj->CntOutSig(); + + + +#if FLEXT_SYS == FLEXT_SYS_PD + + // min. 1 input channel! (CLASS_MAININLET in pd...) + + if(!in) in = 1; + +#endif + + + + if(obj->invecs) delete[] obj->invecs; + + obj->invecs = new t_signalvec[in]; + + for(i = 0; i < in; ++i) + + obj->invecs[i] = + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + fts_dsp_get_input_name(dsp,i); + +#else + + sp[i]->s_vec; + +#endif + + + + if(obj->outvecs) delete[] obj->outvecs; + + obj->outvecs = new t_signalvec[out]; + + for(i = 0; i < out; ++i) + + obj->outvecs[i] = + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + fts_dsp_get_output_name(dsp,i); + +#else + + sp[in+i]->s_vec; + +#endif + + + + // with the following call derived classes can do their eventual DSP setup + + obj->m_dsp(obj->blksz,obj->invecs,obj->outvecs); + + + + // set the DSP function + +#if FLEXT_SYS == FLEXT_SYS_JMAX + + fts_atom_t args[2]; + + fts_set_pointer(args+0,obj); + + fts_set_int(args+1,obj->blksz); + + fts_dsp_add_function(dspsym,2,args); + +#else + + dsp_add((t_dspmethod)dspmeth,2,obj,obj->blksz); + +#endif + +} + + + +/* + +#if FLEXT_SYS == FLEXT_SYS_JMAX + +void flext_dsp::cb_dsp_init(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at) + +{ + + fts_dsp_add_object(c); + +} + + + +void flext_dsp::cb_dsp_delete(fts_object_t *c, int winlet, fts_symbol_t *s, int ac, const fts_atom_t *at) + +{ + + fts_dsp_remove_object(c); + +} + +#endif + +*/ + + + +void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const * /*outsigs*/) {} + + + +void flext_dsp::m_signal(int n,t_sample *const * /*insigs*/,t_sample *const *outs) + +{ + + for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n); + +} + + + +#if FLEXT_SYS != FLEXT_SYS_MAX + + + +#if FLEXT_SYS == FLEXT_SYS_PD + +void flext_dsp::cb_enable(t_class *c,t_float on) { thisObject(c)->m_enable(on != 0); } + +#elif FLEXT_SYS == FLEXT_SYS_JMAX + +void flext_dsp::cb_enable(fts_object_t *c, int winlet, fts_symbol_t s, int ac, const fts_atom_t *at) + +{ thisObject(c)->m_enable(fts_get_int(at+0) != 0); } + +#endif + + + +void flext_dsp::m_enable(bool en) { dspon = en; } + +#endif + + + + + diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h index b62b583e..8bef1f02 100644 --- a/externals/grill/flext/source/flext.h +++ b/externals/grill/flext/source/flext.h @@ -1,64 +1,64 @@ -/* - -flext - C++ layer for Max/MSP and pd (pure data) externals - -Copyright (c) 2001-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. - -*/ - -/*! \file flext.h - \brief This is the main flext include file. - - The basic definitions are set here and the necessary header files are included -*/ - -#ifndef __FLEXT_H -#define __FLEXT_H - - -/*! \defgroup FLEXT_GLOBAL Flext global definitions - @{ -*/ - -//! \brief flext version number -#define FLEXT_VERSION 402 - -//! \brief flext version string -#define FLEXT_VERSTR "0.4.2pre" - -//! @} - - -// determine System/OS/CPU -#include "flprefix.h" - -// include headers necessary for multi-threading -#ifdef FLEXT_THREADS - #if FLEXT_THREADS == FLEXT_THR_POSIX - extern "C" { - #include - #include - } - #elif FLEXT_THREADS == FLEXT_THR_MP - #include - #elif FLEXT_THREADS == FLEXT_THR_WIN32 - #include - #else - #error "Thread model not supported" - #endif -#endif - -// include all the flext interface definitions -#include "fldefs.h" - -// include the basic flext object classes -#include "flclass.h" - -// include the flext dsp class -#include "fldsp.h" - -#endif // FLEXT_H - - +/* + +flext - C++ layer for Max/MSP and pd (pure data) externals + +Copyright (c) 2001-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. + +*/ + +/*! \file flext.h + \brief This is the main flext include file. + + The basic definitions are set here and the necessary header files are included +*/ + +#ifndef __FLEXT_H +#define __FLEXT_H + + +/*! \defgroup FLEXT_GLOBAL Flext global definitions + @{ +*/ + +//! \brief flext version number +#define FLEXT_VERSION 402 + +//! \brief flext version string +#define FLEXT_VERSTR "0.4.2" + +//! @} + + +// determine System/OS/CPU +#include "flprefix.h" + +// include headers necessary for multi-threading +#ifdef FLEXT_THREADS + #if FLEXT_THREADS == FLEXT_THR_POSIX + extern "C" { + #include + #include + } + #elif FLEXT_THREADS == FLEXT_THR_MP + #include + #elif FLEXT_THREADS == FLEXT_THR_WIN32 + #include + #else + #error "Thread model not supported" + #endif +#endif + +// include all the flext interface definitions +#include "fldefs.h" + +// include the basic flext object classes +#include "flclass.h" + +// include the flext dsp class +#include "fldsp.h" + +#endif // FLEXT_H + + diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp index d56028d8..05dac9ba 100644 --- a/externals/grill/flext/source/flsupport.cpp +++ b/externals/grill/flext/source/flsupport.cpp @@ -125,9 +125,9 @@ void flext::GetAString(const t_atom &a,char *buf,int szbuf) atom_string(const_cast(&a),buf,szbuf); #else // no checking for size here - if(IsSymbol(a)) sprintf(tmp,GetString(a)); - else if(IsFloat(a)) sprintf(tmp,"%f",GetFloat(a)); - else if(IsInt(a)) sprintf(tmp,"%i",GetInt(a)); + if(IsSymbol(a)) sprintf(buf,GetString(a)); + else if(IsFloat(a)) sprintf(buf,"%f",GetFloat(a)); + else if(IsInt(a)) sprintf(buf,"%i",GetInt(a)); else *buf = 0; #endif } diff --git a/externals/grill/flext/tutorial/adv1/adv1.cw b/externals/grill/flext/tutorial/adv1/adv1.cw index 52ef4c98..7b89200a 100755 Binary files a/externals/grill/flext/tutorial/adv1/adv1.cw and b/externals/grill/flext/tutorial/adv1/adv1.cw differ diff --git a/externals/grill/flext/tutorial/adv2/adv2.cw b/externals/grill/flext/tutorial/adv2/adv2.cw index 0050c301..b46cd6d9 100755 Binary files a/externals/grill/flext/tutorial/adv2/adv2.cw and b/externals/grill/flext/tutorial/adv2/adv2.cw differ diff --git a/externals/grill/flext/tutorial/adv3/adv3.cw b/externals/grill/flext/tutorial/adv3/adv3.cw index 9a417948..a951fec5 100755 Binary files a/externals/grill/flext/tutorial/adv3/adv3.cw and b/externals/grill/flext/tutorial/adv3/adv3.cw differ diff --git a/externals/grill/flext/tutorial/attr1/attr1.cw b/externals/grill/flext/tutorial/attr1/attr1.cw index 4ed59172..a597bf1e 100755 Binary files a/externals/grill/flext/tutorial/attr1/attr1.cw and b/externals/grill/flext/tutorial/attr1/attr1.cw differ diff --git a/externals/grill/flext/tutorial/attr2/attr2.cw b/externals/grill/flext/tutorial/attr2/attr2.cw index f0b7c6a0..f1dbec3b 100755 Binary files a/externals/grill/flext/tutorial/attr2/attr2.cw and b/externals/grill/flext/tutorial/attr2/attr2.cw differ diff --git a/externals/grill/flext/tutorial/attr3/attr3.cw b/externals/grill/flext/tutorial/attr3/attr3.cw index c5e46da7..9384e993 100755 Binary files a/externals/grill/flext/tutorial/attr3/attr3.cw and b/externals/grill/flext/tutorial/attr3/attr3.cw differ -- cgit v1.2.1