aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2004-06-21 14:08:57 +0000
committerThomas Grill <xovo@users.sourceforge.net>2004-06-21 14:08:57 +0000
commite728a5bc3db296b4b67c2d3e5b56558c42c566a8 (patch)
tree180656eeb13352bc2cee7fb759e2ff74332069d2 /externals/grill/flext/source
parentcefab503b7db648244a4244ef255d15609e2c205 (diff)
""
svn path=/trunk/; revision=1826
Diffstat (limited to 'externals/grill/flext/source')
-rwxr-xr-xexternals/grill/flext/source/flatom_app.cpp80
-rwxr-xr-xexternals/grill/flext/source/flatom_part.cpp18
-rw-r--r--externals/grill/flext/source/flatom_pr.cpp132
-rw-r--r--externals/grill/flext/source/flattr_ed.cpp980
-rw-r--r--externals/grill/flext/source/flbase.cpp108
-rw-r--r--externals/grill/flext/source/flbase.h8
-rw-r--r--externals/grill/flext/source/flbind.cpp56
-rw-r--r--externals/grill/flext/source/flbuf.cpp362
-rwxr-xr-xexternals/grill/flext/source/flcwmax-thr.h8
-rwxr-xr-xexternals/grill/flext/source/flcwmax-x-thr.h8
-rw-r--r--externals/grill/flext/source/flcwmax.h8
-rwxr-xr-xexternals/grill/flext/source/flcwpd-x-thr.h8
-rwxr-xr-xexternals/grill/flext/source/flcwpd-x.h8
-rw-r--r--externals/grill/flext/source/fldefs.h20
-rw-r--r--externals/grill/flext/source/fldefs_attradd.h46
-rw-r--r--externals/grill/flext/source/fldefs_attrcb.h16
-rw-r--r--externals/grill/flext/source/fldefs_attrvar.h16
-rw-r--r--externals/grill/flext/source/fldefs_methadd.h48
-rw-r--r--externals/grill/flext/source/fldefs_methcall.h4
-rw-r--r--externals/grill/flext/source/fldefs_methcb.h6
-rw-r--r--externals/grill/flext/source/fldefs_setup.h114
-rw-r--r--externals/grill/flext/source/fldoxygen.h56
-rw-r--r--externals/grill/flext/source/fldsp.cpp160
-rw-r--r--externals/grill/flext/source/flext.cpp206
-rw-r--r--externals/grill/flext/source/flext.h4
-rw-r--r--externals/grill/flext/source/flinternal.h6
-rwxr-xr-xexternals/grill/flext/source/flitem.cpp62
-rwxr-xr-xexternals/grill/flext/source/fllib.cpp166
-rwxr-xr-xexternals/grill/flext/source/flmeth.cpp146
-rwxr-xr-xexternals/grill/flext/source/flmsg.cpp374
-rwxr-xr-xexternals/grill/flext/source/flmspbuffer.h102
-rw-r--r--externals/grill/flext/source/flout.cpp584
-rwxr-xr-xexternals/grill/flext/source/flprefix.h484
-rwxr-xr-xexternals/grill/flext/source/flproxy.cpp112
-rwxr-xr-xexternals/grill/flext/source/flqueue.cpp352
-rwxr-xr-xexternals/grill/flext/source/flsimd.cpp1861
-rw-r--r--externals/grill/flext/source/flsndobj.cpp142
-rw-r--r--externals/grill/flext/source/flsndobj.h106
-rw-r--r--externals/grill/flext/source/flstdc.h5
-rw-r--r--externals/grill/flext/source/flstk.cpp120
-rw-r--r--externals/grill/flext/source/flstk.h94
-rw-r--r--externals/grill/flext/source/flsupport.h16
-rwxr-xr-xexternals/grill/flext/source/fltimer.cpp202
-rw-r--r--externals/grill/flext/source/flutil.cpp26
-rwxr-xr-xexternals/grill/flext/source/flxlet.cpp92
45 files changed, 3810 insertions, 3722 deletions
diff --git a/externals/grill/flext/source/flatom_app.cpp b/externals/grill/flext/source/flatom_app.cpp
index 90b4af82..96fe010d 100755
--- a/externals/grill/flext/source/flatom_app.cpp
+++ b/externals/grill/flext/source/flatom_app.cpp
@@ -17,60 +17,60 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext::AtomList &flext::AtomList::Append(const t_atom &a)
{
- t_atom *nlst = new t_atom[cnt+1];
- for(int i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
- SetAtom(nlst[cnt],a);
-
- if(lst) delete[] lst;
- lst = nlst;
- ++cnt;
+ t_atom *nlst = new t_atom[cnt+1];
+ for(int i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
+ SetAtom(nlst[cnt],a);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ ++cnt;
- return *this;
+ return *this;
}
flext::AtomList &flext::AtomList::Append(int argc,const t_atom *argv)
{
- if(argc) {
- t_atom *nlst = new t_atom[cnt+argc];
- int i;
- for(i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
- if(argv)
- for(i = 0; i < argc; ++i) SetAtom(nlst[cnt+i],argv[i]);
-
- if(lst) delete[] lst;
- lst = nlst;
- cnt += argc;
- }
- return *this;
+ if(argc) {
+ t_atom *nlst = new t_atom[cnt+argc];
+ int i;
+ for(i = 0; i < cnt; ++i) SetAtom(nlst[i],lst[i]);
+ if(argv)
+ for(i = 0; i < argc; ++i) SetAtom(nlst[cnt+i],argv[i]);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ cnt += argc;
+ }
+ return *this;
}
flext::AtomList &flext::AtomList::Prepend(const t_atom &a)
{
- t_atom *nlst = new t_atom[cnt+1];
- for(int i = 0; i < cnt; ++i) SetAtom(nlst[i+1],lst[i]);
- SetAtom(nlst[0],a);
-
- if(lst) delete[] lst;
- lst = nlst;
- ++cnt;
+ t_atom *nlst = new t_atom[cnt+1];
+ for(int i = 0; i < cnt; ++i) SetAtom(nlst[i+1],lst[i]);
+ SetAtom(nlst[0],a);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ ++cnt;
- return *this;
+ return *this;
}
flext::AtomList &flext::AtomList::Prepend(int argc,const t_atom *argv)
{
- if(argc) {
- t_atom *nlst = new t_atom[cnt+argc];
- int i;
+ if(argc) {
+ t_atom *nlst = new t_atom[cnt+argc];
+ int i;
- if(argv)
- for(i = 0; i < argc; ++i) SetAtom(nlst[i],argv[i]);
- for(i = 0; i < cnt; ++i) SetAtom(nlst[argc+i],lst[i]);
-
- if(lst) delete[] lst;
- lst = nlst;
- cnt += argc;
- }
- return *this;
+ if(argv)
+ for(i = 0; i < argc; ++i) SetAtom(nlst[i],argv[i]);
+ for(i = 0; i < cnt; ++i) SetAtom(nlst[argc+i],lst[i]);
+
+ if(lst) delete[] lst;
+ lst = nlst;
+ cnt += argc;
+ }
+ return *this;
}
diff --git a/externals/grill/flext/source/flatom_part.cpp b/externals/grill/flext/source/flatom_part.cpp
index 05a3710d..e5c9c533 100755
--- a/externals/grill/flext/source/flatom_part.cpp
+++ b/externals/grill/flext/source/flatom_part.cpp
@@ -16,22 +16,22 @@ WARRANTIES, see the file, "license.txt," in this distribution.
int flext::AtomList::Get(t_atom *argv,int mxsz) const
{
- int argc = Count();
- if(mxsz >= 0 && argc > mxsz) argc = mxsz;
+ int argc = Count();
+ if(mxsz >= 0 && argc > mxsz) argc = mxsz;
- for(int i = 0; i < argc; ++i) SetAtom(argv[i],lst[i]);
+ for(int i = 0; i < argc; ++i) SetAtom(argv[i],lst[i]);
- return argc;
+ return argc;
}
flext::AtomList flext::AtomList::GetPart(int offs,int len) const
{
- if(offs+len > Count()) {
- len = Count()-offs;
- if(len < 0) len = 0;
- }
+ if(offs+len > Count()) {
+ len = Count()-offs;
+ if(len < 0) len = 0;
+ }
- return AtomList(len,Atoms()+offs);
+ return AtomList(len,Atoms()+offs);
}
diff --git a/externals/grill/flext/source/flatom_pr.cpp b/externals/grill/flext/source/flatom_pr.cpp
index 9d5eeb29..43721388 100644
--- a/externals/grill/flext/source/flatom_pr.cpp
+++ b/externals/grill/flext/source/flatom_pr.cpp
@@ -25,95 +25,95 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// \TODO take bufsz into account!
bool flext::PrintAtom(const t_atom &a,char *buf,int bufsz)
{
- bool ok = true;
- if(IsFloat(a)) {
- STD::snprintf(buf,bufsz,"%g",GetFloat(a));
- }
- else if(IsInt(a)) {
- STD::snprintf(buf,bufsz,"%i",GetInt(a));
- }
- else if(IsSymbol(a)) {
+ bool ok = true;
+ if(IsFloat(a)) {
+ STD::snprintf(buf,bufsz,"%g",GetFloat(a));
+ }
+ else if(IsInt(a)) {
+ STD::snprintf(buf,bufsz,"%i",GetInt(a));
+ }
+ else if(IsSymbol(a)) {
if(!FLEXT_ASSERT(GetSymbol(a))) *buf = 0;
else
STD::strncpy(buf,GetString(a),bufsz);
- }
- else if(IsPointer(a)) {
- STD::snprintf(buf,bufsz,"%p",GetPointer(a));
- }
+ }
+ else if(IsPointer(a)) {
+ STD::snprintf(buf,bufsz,"%p",GetPointer(a));
+ }
#if FLEXT_SYS == FLEXT_SYS_PD
- else if(a.a_type == A_DOLLAR) {
- STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index);
- }
- else if(a.a_type == A_DOLLSYM) {
- STD::snprintf(buf,bufsz,"$%s",GetString(a));
- }
+ else if(a.a_type == A_DOLLAR) {
+ STD::snprintf(buf,bufsz,"$%d",a.a_w.w_index);
+ }
+ else if(a.a_type == A_DOLLSYM) {
+ STD::snprintf(buf,bufsz,"$%s",GetString(a));
+ }
#elif FLEXT_SYS == FLEXT_SYS_MAX
- else if(a.a_type == A_DOLLAR) {
- STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long);
- }
+ else if(a.a_type == A_DOLLAR) {
+ STD::snprintf(buf,bufsz,"$%d",a.a_w.w_long);
+ }
#else
//#pragma message("Not implemented")
#endif
- else {
+ else {
error("flext: atom type unknown");
- ok = false;
- }
- return ok;
+ ok = false;
+ }
+ return ok;
}
bool flext::PrintList(int argc,const t_atom *argv,char *buf,int bufsz)
{
- bool ok = true;
+ bool ok = true;
for(int i = 0; ok && i < argc && bufsz > 0; ++i) {
- if(i) { *(buf++) = ' '; --bufsz; } // prepend space
-
- if(PrintAtom(argv[i],buf,bufsz)) {
- int len = strlen(buf);
- buf += len,bufsz -= len;
- }
- else
- ok = false;
+ if(i) { *(buf++) = ' '; --bufsz; } // prepend space
+
+ if(PrintAtom(argv[i],buf,bufsz)) {
+ int len = strlen(buf);
+ buf += len,bufsz -= len;
+ }
+ else
+ ok = false;
}
- *buf = 0;
+ *buf = 0;
return ok;
}
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
+ // 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;
+ 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;
+ 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/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp
index 797eec19..8a4b98f5 100644
--- a/externals/grill/flext/source/flattr_ed.cpp
+++ b/externals/grill/flext/source/flattr_ed.cpp
@@ -45,18 +45,18 @@ static void (*ori_vis)(t_gobj *c, t_glist *, int vis) = NULL;
void flext_base::SetAttrEditor(t_classid c)
{
- // widgetbehavior struct MUST be resident... (static is just ok here)
+ // widgetbehavior struct MUST be resident... (static is just ok here)
#ifndef FLEXT_CLONEWIDGET
- ori_vis = c->c_wb->w_visfn;
- widgetbehavior.w_getrectfn = c->c_wb->w_getrectfn;
+ ori_vis = c->c_wb->w_visfn;
+ widgetbehavior.w_getrectfn = c->c_wb->w_getrectfn;
widgetbehavior.w_displacefn = c->c_wb->w_displacefn;
widgetbehavior.w_selectfn = c->c_wb->w_selectfn;
widgetbehavior.w_activatefn = c->c_wb->w_activatefn;
widgetbehavior.w_deletefn = c->c_wb->w_deletefn;
widgetbehavior.w_clickfn = c->c_wb->w_clickfn;
#else
- widgetbehavior.w_getrectfn = text_widgetbehavior.w_getrectfn;
+ widgetbehavior.w_getrectfn = text_widgetbehavior.w_getrectfn;
widgetbehavior.w_displacefn = text_widgetbehavior.w_displacefn;
widgetbehavior.w_selectfn = text_widgetbehavior.w_selectfn;
widgetbehavior.w_activatefn = text_widgetbehavior.w_activatefn;
@@ -75,80 +75,80 @@ void flext_base::SetAttrEditor(t_classid c)
widgetbehavior.w_visfn = cb_GfxVis;
class_setwidget(c, &widgetbehavior);
- // generate the script for the property dialog
+ // generate the script for the property dialog
- sys_gui(
- "proc flext_apply {id alen} {\n"
- // strip "." from the TK id to make a variable name suffix
- "set vid [string trimleft $id .]\n"
+ sys_gui(
+ "proc flext_apply {id alen} {\n"
+ // strip "." from the TK id to make a variable name suffix
+ "set vid [string trimleft $id .]\n"
- // make a list of the attribute values (including save flags)
+ // make a list of the attribute values (including save flags)
- "set lst {}\n"
- "for {set ix 1} {$ix <= $alen} {incr ix} {\n"
- "set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
- "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
- "set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
- "set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
- "set var_attr_type [concat [concat var_type_$ix]_$vid ]\n"
+ "set lst {}\n"
+ "for {set ix 1} {$ix <= $alen} {incr ix} {\n"
+ "set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
+ "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
+ "set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
+ "set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
+ "set var_attr_type [concat [concat var_type_$ix]_$vid ]\n"
- "global $var_attr_name $var_attr_init $var_attr_val $var_attr_save $var_attr_type\n"
-
- "if { [expr $$var_attr_type] != 0 } {\n"
- // attribute is puttable
+ "global $var_attr_name $var_attr_init $var_attr_val $var_attr_save $var_attr_type\n"
+
+ "if { [expr $$var_attr_type] != 0 } {\n"
+ // attribute is puttable
- "lappend lst [eval concat $$var_attr_name]\n"
+ "lappend lst [eval concat $$var_attr_name]\n"
- // process current value
+ // process current value
"set tmp [eval concat $$var_attr_val]\n"
- "set len [llength $tmp]\n"
- "if { $len == 1 } {\n"
- // it's an atom
+ "set len [llength $tmp]\n"
+ "if { $len == 1 } {\n"
+ // it's an atom
// if atom starts with $, replace it by # ($ can't be passed by TCL)
"if { [string index $tmp 0] == \"$\" } {\n"
"set tmp [string replace $tmp 0 0 #]\n"
"}\n"
"lappend lst $tmp\n"
- "} else {\n"
- // it's a list
- "set lst [concat $lst {list} $len $tmp]\n"
- "}\n"
-
- // process init value
- "set tmp [eval concat $$var_attr_init]\n"
- "set len [llength $tmp]\n"
- "if { $len == 1 } {\n"
- // it's an atom
+ "} else {\n"
+ // it's a list
+ "set lst [concat $lst {list} $len $tmp]\n"
+ "}\n"
+
+ // process init value
+ "set tmp [eval concat $$var_attr_init]\n"
+ "set len [llength $tmp]\n"
+ "if { $len == 1 } {\n"
+ // it's an atom
// if atom starts with $, replace it by # ($ can't be passed by TCL)
"if { [string index $tmp 0] == \"$\" } {\n"
"set tmp [string replace $tmp 0 0 #]\n"
"}\n"
"lappend lst $tmp\n"
- "} else {\n"
- // it's a list
- "set lst [concat $lst {list} $len $tmp]\n"
- "}\n"
+ "} else {\n"
+ // it's a list
+ "set lst [concat $lst {list} $len $tmp]\n"
+ "}\n"
- "lappend lst [eval concat $$var_attr_save]\n"
- "}\n"
- "}\n"
+ "lappend lst [eval concat $$var_attr_save]\n"
+ "}\n"
+ "}\n"
- "set cmd [concat $id attributedialog $lst \\;]\n"
- "pd $cmd\n"
- "}\n"
+ "set cmd [concat $id attributedialog $lst \\;]\n"
+ "pd $cmd\n"
+ "}\n"
- "proc flext_cancel {id} {\n"
- "set cmd [concat $id cancel \\;]\n"
- "pd $cmd\n"
- "}\n"
+ "proc flext_cancel {id} {\n"
+ "set cmd [concat $id cancel \\;]\n"
+ "pd $cmd\n"
+ "}\n"
- "proc flext_ok {id alen} {\n"
- "flext_apply $id $alen\n"
- "flext_cancel $id\n"
- "}\n"
+ "proc flext_ok {id alen} {\n"
+ "flext_apply $id $alen\n"
+ "flext_cancel $id\n"
+ "}\n"
"proc flext_help {id} {\n"
- "toplevel $id.hw\n"
+ "toplevel $id.hw\n"
"wm title $id.hw \"Flext attribute editor help\"\n"
"frame $id.hw.buttons\n"
@@ -161,7 +161,7 @@ void flext_base::SetAttrEditor(t_classid c)
"button $id.hw.buttons.ok -text OK -command \"destroy $id.hw\"\n"
"pack $id.hw.buttons.ok -side left -expand 1\n"
- "bind $id.hw {<KeyPress-Escape>} \"destroy $id.hw\"\n"
+ "bind $id.hw {<KeyPress-Escape>} \"destroy $id.hw\"\n"
"$id.hw.text tag configure big -font {Arial 10 bold}\n"
"$id.hw.text configure -font {Arial 8 bold}\n"
@@ -172,22 +172,22 @@ void flext_base::SetAttrEditor(t_classid c)
"Ctrl-Button on a text field will open an editor window where text can be entered more comfortably.\n"
"\"\n"
"$id.hw.text configure -state disabled\n"
- "}\n"
+ "}\n"
- "proc flext_copyval {dst src} {\n"
- "global $src $dst\n"
- "set $dst [expr $$src]\n"
- "}\n"
+ "proc flext_copyval {dst src} {\n"
+ "global $src $dst\n"
+ "set $dst [expr $$src]\n"
+ "}\n"
- "proc flext_textcopy {id idtxt var} {\n"
- "global $var\n"
+ "proc flext_textcopy {id idtxt var} {\n"
+ "global $var\n"
"set $var [eval $idtxt get 0.0 end]\n"
"destroy $id\n"
- "}\n"
+ "}\n"
- "proc flext_textzoom {id var title attr edit} {\n"
- "global $var\n"
- "toplevel $id.w\n"
+ "proc flext_textzoom {id var title attr edit} {\n"
+ "global $var\n"
+ "toplevel $id.w\n"
"wm title $id.w [concat $title \" @\" $attr]\n"
// "wm iconname $w \"text\"\n"
// "positionWindow $id.w\n"
@@ -203,27 +203,27 @@ void flext_base::SetAttrEditor(t_classid c)
"$id.w.text insert 0.0 [expr $$var]\n"
"$id.w.text mark set insert 0.0\n"
- "if { $edit != 0 } then {\n"
+ "if { $edit != 0 } then {\n"
"button $id.w.buttons.ok -text OK -command \"flext_textcopy $id.w $id.w.text $var\"\n"
"pack $id.w.buttons.ok -side left -expand 1\n"
-// "bind $id.w {<Shift-KeyPress-Return>} \"flext_textcopy $id.w $id.w.text $var\"\n"
+// "bind $id.w {<Shift-KeyPress-Return>} \"flext_textcopy $id.w $id.w.text $var\"\n"
"} "
"else { $id.w.text configure -state disabled }\n"
"button $id.w.buttons.cancel -text Cancel -command \"destroy $id.w\"\n"
"pack $id.w.buttons.cancel -side left -expand 1\n"
- "bind $id.w {<KeyPress-Escape>} \"destroy $id.w\"\n"
+ "bind $id.w {<KeyPress-Escape>} \"destroy $id.w\"\n"
"}\n"
- "proc pdtk_flext_dialog {id title attrlist} {\n"
- "set vid [string trimleft $id .]\n"
- "set alen [expr [llength $attrlist] / 6 ]\n"
+ "proc pdtk_flext_dialog {id title attrlist} {\n"
+ "set vid [string trimleft $id .]\n"
+ "set alen [expr [llength $attrlist] / 6 ]\n"
- "toplevel $id\n"
- "wm title $id $title\n"
- "wm protocol $id WM_DELETE_WINDOW [concat flext_cancel $id]\n"
+ "toplevel $id\n"
+ "wm title $id $title\n"
+ "wm protocol $id WM_DELETE_WINDOW [concat flext_cancel $id]\n"
- "set row 0\n"
+ "set row 0\n"
// set grow parameters
"grid columnconfigure $id 0 -weight 1\n" // label
@@ -233,266 +233,266 @@ void flext_base::SetAttrEditor(t_classid c)
// "grid rowconfigure $id {0 1 2} -weight 0\n"
- // set column labels
- "label $id.label -text {attribute} -height 2 -font {Helvetica 9 bold}\n"
- "label $id.init -text {initial value} -height 2 -font {Helvetica 9 bold}\n"
- "label $id.copy -text {copy} -height 2 -font {Helvetica 9 bold}\n"
- "label $id.val -text {current value} -height 2 -font {Helvetica 9 bold}\n"
- "foreach {i txt} {0 {don't\rsave} 1 {do\rinit} 2 {always\rsave} } {\n"
- "label $id.b$i -text $txt -height 2 -font {Helvetica 9 bold}\n"
- "}\n"
-// "label $id.options -text {options} -height 2\n"
-
- "grid config $id.label -column 0 -row $row \n"
- "grid config $id.init -column 1 -row $row \n"
- "grid config $id.copy -column 2 -columnspan 2 -row $row \n"
- "grid config $id.val -column 4 -row $row \n"
- "foreach i {0 1 2} { grid config $id.b$i -column [expr $i + 5] -row $row }\n"
-// "grid config $id.options -column 3 -row 0 \n"
- "incr row\n"
-
- // Separator
- "frame $id.sep -relief ridge -bd 1 -height 2\n"
- "grid config $id.sep -column 0 -columnspan 8 -row $row -pady 2 -sticky {snew}\n"
- "incr row\n"
-
- "set ix 1\n"
- "foreach {an av ai atp asv afl} $attrlist {\n"
+ // set column labels
+ "label $id.label -text {attribute} -height 2 -font {Helvetica 9 bold}\n"
+ "label $id.init -text {initial value} -height 2 -font {Helvetica 9 bold}\n"
+ "label $id.copy -text {copy} -height 2 -font {Helvetica 9 bold}\n"
+ "label $id.val -text {current value} -height 2 -font {Helvetica 9 bold}\n"
+ "foreach {i txt} {0 {don't\rsave} 1 {do\rinit} 2 {always\rsave} } {\n"
+ "label $id.b$i -text $txt -height 2 -font {Helvetica 9 bold}\n"
+ "}\n"
+// "label $id.options -text {options} -height 2\n"
+
+ "grid config $id.label -column 0 -row $row \n"
+ "grid config $id.init -column 1 -row $row \n"
+ "grid config $id.copy -column 2 -columnspan 2 -row $row \n"
+ "grid config $id.val -column 4 -row $row \n"
+ "foreach i {0 1 2} { grid config $id.b$i -column [expr $i + 5] -row $row }\n"
+// "grid config $id.options -column 3 -row 0 \n"
+ "incr row\n"
+
+ // Separator
+ "frame $id.sep -relief ridge -bd 1 -height 2\n"
+ "grid config $id.sep -column 0 -columnspan 8 -row $row -pady 2 -sticky {snew}\n"
+ "incr row\n"
+
+ "set ix 1\n"
+ "foreach {an av ai atp asv afl} $attrlist {\n"
"grid rowconfigure $id $row -weight 0\n"
// get attribute name
- "set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
- "global $var_attr_name\n"
- "set $var_attr_name $an\n"
-
- // get attribute init value (list)
- "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
- "global $var_attr_init\n"
- "set $var_attr_init $ai\n"
-
- // get attribute value (list)
- "set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
- "global $var_attr_val\n"
- "set $var_attr_val $av\n"
-
- // get save flag
- "set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
- "global $var_attr_save\n"
- "set $var_attr_save $asv\n"
-
- // get type flag
- "set var_attr_type [concat [concat var_type_$ix]_$vid ]\n"
- "global $var_attr_type\n"
- "set $var_attr_type $afl\n"
-
- // add dialog elements to window
-
- // attribute label
- "label $id.label-$ix -text \"$an :\" -font {Helvetica 8 bold}\n"
- "grid config $id.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n"
-
- "if { $afl != 0 } {\n"
- // attribute is puttable
-
- // entry field for initial value
- // entry field for current value
-
- // choose entry field type
- "switch $atp {\n"
- "0 - 1 {\n" // int or float
- "entry $id.init-$ix -textvariable $var_attr_init\n"
- "entry $id.val-$ix -textvariable $var_attr_val\n"
- "}\n"
- "2 {\n" // boolean
- "checkbutton $id.init-$ix -variable $var_attr_init\n"
- "checkbutton $id.val-$ix -variable $var_attr_val\n"
- "}\n"
- "3 {\n" // symbol
- "entry $id.init-$ix -textvariable $var_attr_init\n"
- "entry $id.val-$ix -textvariable $var_attr_val\n"
- "}\n"
- "4 - 5 {\n" // list or unknown
- "entry $id.init-$ix -textvariable $var_attr_init\n"
+ "set var_attr_name [concat [concat var_name_$ix]_$vid ]\n"
+ "global $var_attr_name\n"
+ "set $var_attr_name $an\n"
+
+ // get attribute init value (list)
+ "set var_attr_init [concat [concat var_init_$ix]_$vid ]\n"
+ "global $var_attr_init\n"
+ "set $var_attr_init $ai\n"
+
+ // get attribute value (list)
+ "set var_attr_val [concat [concat var_val_$ix]_$vid ]\n"
+ "global $var_attr_val\n"
+ "set $var_attr_val $av\n"
+
+ // get save flag
+ "set var_attr_save [concat [concat var_save_$ix]_$vid ]\n"
+ "global $var_attr_save\n"
+ "set $var_attr_save $asv\n"
+
+ // get type flag
+ "set var_attr_type [concat [concat var_type_$ix]_$vid ]\n"
+ "global $var_attr_type\n"
+ "set $var_attr_type $afl\n"
+
+ // add dialog elements to window
+
+ // attribute label
+ "label $id.label-$ix -text \"$an :\" -font {Helvetica 8 bold}\n"
+ "grid config $id.label-$ix -column 0 -row $row -padx 5 -sticky {e}\n"
+
+ "if { $afl != 0 } {\n"
+ // attribute is puttable
+
+ // entry field for initial value
+ // entry field for current value
+
+ // choose entry field type
+ "switch $atp {\n"
+ "0 - 1 {\n" // int or float
+ "entry $id.init-$ix -textvariable $var_attr_init\n"
+ "entry $id.val-$ix -textvariable $var_attr_val\n"
+ "}\n"
+ "2 {\n" // boolean
+ "checkbutton $id.init-$ix -variable $var_attr_init\n"
+ "checkbutton $id.val-$ix -variable $var_attr_val\n"
+ "}\n"
+ "3 {\n" // symbol
+ "entry $id.init-$ix -textvariable $var_attr_init\n"
+ "entry $id.val-$ix -textvariable $var_attr_val\n"
+ "}\n"
+ "4 - 5 {\n" // list or unknown
+ "entry $id.init-$ix -textvariable $var_attr_init\n"
"bind $id.init-$ix {<Control-Button-1>} \" flext_textzoom $id.init-$ix $var_attr_init { $title } $an 1\"\n"
- "entry $id.val-$ix -textvariable $var_attr_val\n"
+ "entry $id.val-$ix -textvariable $var_attr_val\n"
"bind $id.val-$ix {<Control-Button-1>} \" flext_textzoom $id.val-$ix $var_attr_val { $title } $an 1\"\n"
- "}\n"
- "}\n"
-
- "grid config $id.init-$ix -column 1 -row $row -padx 5 -sticky {ew}\n"
- "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
-
- "button $id.b2i-$ix -text {<-} -height 1 -command \" flext_copyval $var_attr_init $var_attr_val \"\n"
- "grid config $id.b2i-$ix -column 2 -row $row -sticky {ew}\n"
- "button $id.b2c-$ix -text {->} -height 1 -command \" flext_copyval $var_attr_val $var_attr_init \"\n"
- "grid config $id.b2c-$ix -column 3 -row $row -sticky {ew}\n"
-
- // "tk_optionMenu $id.opt-$ix $var_attr_save {don't save} {initialize} {always save}\n"
- // "grid config $id.opt-$ix -column 5 -row $ix \n"
-
- // radiobuttons
- "foreach {i c} {0 black 1 blue 2 red} {\n"
- "radiobutton $id.b$i-$ix -value $i -foreground $c -variable $var_attr_save \n"
- "grid config $id.b$i-$ix -column [expr $i + 5] -row $row \n"
- "}\n"
- "} else {\n"
- // attribute is gettable only
-
- // entry field for current value (read-only)
-
- // choose display field type
- "switch $atp {\n"
- "0 - 1 {\n" // int or float
- "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
- "}\n"
- "2 {\n" // boolean
- "checkbutton $id.val-$ix -variable $var_attr_val -state disabled\n"
- "}\n"
- "3 {\n" // symbol
- "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
- "}\n"
- "4 - 5 {\n" // list or unknown
- "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
+ "}\n"
+ "}\n"
+
+ "grid config $id.init-$ix -column 1 -row $row -padx 5 -sticky {ew}\n"
+ "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
+
+ "button $id.b2i-$ix -text {<-} -height 1 -command \" flext_copyval $var_attr_init $var_attr_val \"\n"
+ "grid config $id.b2i-$ix -column 2 -row $row -sticky {ew}\n"
+ "button $id.b2c-$ix -text {->} -height 1 -command \" flext_copyval $var_attr_val $var_attr_init \"\n"
+ "grid config $id.b2c-$ix -column 3 -row $row -sticky {ew}\n"
+
+ // "tk_optionMenu $id.opt-$ix $var_attr_save {don't save} {initialize} {always save}\n"
+ // "grid config $id.opt-$ix -column 5 -row $ix \n"
+
+ // radiobuttons
+ "foreach {i c} {0 black 1 blue 2 red} {\n"
+ "radiobutton $id.b$i-$ix -value $i -foreground $c -variable $var_attr_save \n"
+ "grid config $id.b$i-$ix -column [expr $i + 5] -row $row \n"
+ "}\n"
+ "} else {\n"
+ // attribute is gettable only
+
+ // entry field for current value (read-only)
+
+ // choose display field type
+ "switch $atp {\n"
+ "0 - 1 {\n" // int or float
+ "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
+ "}\n"
+ "2 {\n" // boolean
+ "checkbutton $id.val-$ix -variable $var_attr_val -state disabled\n"
+ "}\n"
+ "3 {\n" // symbol
+ "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
+ "}\n"
+ "4 - 5 {\n" // list or unknown
+ "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
"bind $id.val-$ix {<Control-Button-1>} \" flext_textzoom $id.val-$ix $var_attr_val { $title } $an 0\"\n"
- "}\n"
- "}\n"
+ "}\n"
+ "}\n"
-// "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
- "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
+// "entry $id.val-$ix -textvariable $var_attr_val -state disabled\n"
+ "grid config $id.val-$ix -column 4 -row $row -padx 5 -sticky {ew}\n"
- "label $id.readonly-$ix -text \"read-only\"\n"
- "grid config $id.readonly-$ix -column 5 -columnspan 3 -row $row -padx 5 -sticky {ew}\n"
- "}\n"
+ "label $id.readonly-$ix -text \"read-only\"\n"
+ "grid config $id.readonly-$ix -column 5 -columnspan 3 -row $row -padx 5 -sticky {ew}\n"
+ "}\n"
- // increase counter
- "incr ix\n"
- "incr row\n"
- "}\n"
+ // increase counter
+ "incr ix\n"
+ "incr row\n"
+ "}\n"
- // Separator
- "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
+ // Separator
+ "frame $id.sep2 -relief ridge -bd 1 -height 2\n"
// "grid rowconfigure $id $row -weight 0\n"
- "grid config $id.sep2 -column 0 -columnspan 8 -row $row -pady 5 -sticky {snew}\n"
- "incr row\n"
+ "grid config $id.sep2 -column 0 -columnspan 8 -row $row -pady 5 -sticky {snew}\n"
+ "incr row\n"
- // Buttons
- "frame $id.buttonframe\n"
- "pack $id.buttonframe -side bottom -fill x\n"
+ // Buttons
+ "frame $id.buttonframe\n"
+ "pack $id.buttonframe -side bottom -fill x\n"
- "button $id.buttonframe.cancel -text {Cancel} -width 20 -command \" flext_cancel $id \"\n"
- "button $id.buttonframe.apply -text {Apply} -width 20 -command \" flext_apply $id $alen \"\n"
- "button $id.buttonframe.ok -text {OK} -width 20 -command \" flext_ok $id $alen \"\n"
- "button $id.buttonframe.help -text {Help} -width 10 -command \" flext_help $id \"\n"
+ "button $id.buttonframe.cancel -text {Cancel} -width 20 -command \" flext_cancel $id \"\n"
+ "button $id.buttonframe.apply -text {Apply} -width 20 -command \" flext_apply $id $alen \"\n"
+ "button $id.buttonframe.ok -text {OK} -width 20 -command \" flext_ok $id $alen \"\n"
+ "button $id.buttonframe.help -text {Help} -width 10 -command \" flext_help $id \"\n"
- "pack $id.buttonframe.cancel -side left -expand 1\n"
- "pack $id.buttonframe.apply -side left -expand 1\n"
- "pack $id.buttonframe.ok -side left -expand 1\n"
- "pack $id.buttonframe.help -side left -expand 1\n"
+ "pack $id.buttonframe.cancel -side left -expand 1\n"
+ "pack $id.buttonframe.apply -side left -expand 1\n"
+ "pack $id.buttonframe.ok -side left -expand 1\n"
+ "pack $id.buttonframe.help -side left -expand 1\n"
// "grid rowconfigure $id $row -weight 0\n"
- "grid config $id.buttonframe -column 0 -columnspan 8 -row $row -pady 5 -sticky {ew}\n"
-
- // Key bindings
- "bind $id {<KeyPress-Escape>} \" flext_cancel $id \"\n"
- "bind $id {<KeyPress-Return>} \" flext_ok $id $alen \"\n"
- "bind $id {<Shift-KeyPress-Return>} \" flext_apply $id $alen \"\n"
- "}\n"
- );
+ "grid config $id.buttonframe -column 0 -columnspan 8 -row $row -pady 5 -sticky {ew}\n"
+
+ // Key bindings
+ "bind $id {<KeyPress-Escape>} \" flext_cancel $id \"\n"
+ "bind $id {<KeyPress-Return>} \" flext_ok $id $alen \"\n"
+ "bind $id {<Shift-KeyPress-Return>} \" flext_apply $id $alen \"\n"
+ "}\n"
+ );
}
void flext_base::cb_GfxProperties(t_gobj *c, t_glist *)
{
- flext_base *th = thisObject(c);
- char buf[10000],*b = buf;
-
- STD::sprintf(b, "pdtk_flext_dialog %%s { "); b += strlen(b);
-
- t_text *x = (t_text *)c;
- FLEXT_ASSERT(x->te_binbuf);
-
- int argc = binbuf_getnatom(x->te_binbuf);
- t_atom *argv = binbuf_getvec(x->te_binbuf);
-
- PrintList(argc,argv,b,sizeof(buf)+buf-b); b += strlen(b);
-
- STD::sprintf(b, " } { "); b += strlen(b);
-
- AtomList la;
- th->ListAttrib(la);
- int cnt = la.Count();
-
- for(int i = 0; i < cnt; ++i) {
- const t_symbol *sym = GetSymbol(la[i]);
-
- // get attribute
- AttrItem *gattr = th->FindAttrib(sym,true);
- // get puttable attribute
- AttrItem *pattr = gattr?gattr->Counterpart():th->FindAttrib(sym,false);
-
- // get flags
- int sv;
- const AtomList *initdata;
- AttrDataCont::iterator it = th->attrdata->find(sym);
- if(it == th->attrdata->end())
- sv = 0,initdata = NULL;
- else {
- const AttrData &a = *it.data();
- if(a.IsSaved())
- sv = 2;
- else if(a.IsInit())
- sv = 1;
- else
- sv = 0;
- initdata = a.IsInitValue()?&a.GetInitValue():NULL;
- }
-
- // get attribute type
- int tp;
- bool list;
- switch((gattr?gattr:pattr)->argtp) {
- case a_int: tp = 0; list = false; break;
- case a_float: tp = 1; list = false; break;
- case a_bool: tp = 2; list = false; break;
- case a_symbol: tp = 3; list = true; break;
- case a_list:
- case a_LIST: tp = 4; list = true; break;
- default:
- tp = 5; list = true;
- FLEXT_ASSERT(false);
- }
-
- STD::sprintf(b,list?"%s {":"%s ",GetString(sym)); b += strlen(b);
-
- AtomList lv;
- if(gattr) { // gettable attribute is present
- // Retrieve attribute value
- th->GetAttrib(sym,gattr,lv);
-
- PrintList(lv.Count(),lv.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b);
- }
- else {
- strcpy(b,"{}"); b += strlen(b);
- }
-
- strcpy(b, list?"} {":" "); b += strlen(b);
-
- if(pattr) {
- // if there is initialization data take this, otherwise take the current data
- const AtomList &lp = initdata?*initdata:lv;
-
- PrintList(lp.Count(),lp.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b);
- }
- else {
- strcpy(b,"{}"); b += strlen(b);
- }
-
-
- STD::sprintf(b, list?"} %i %i %i ":" %i %i %i ",tp,sv,pattr?(pattr->BothExist()?2:1):0); b += strlen(b);
- }
-
- strcpy(b, " }\n");
-
- gfxstub_new((t_pd *)th->thisHdr(), th->thisHdr(), buf);
+ flext_base *th = thisObject(c);
+ char buf[10000],*b = buf;
+
+ STD::sprintf(b, "pdtk_flext_dialog %%s { "); b += strlen(b);
+
+ t_text *x = (t_text *)c;
+ FLEXT_ASSERT(x->te_binbuf);
+
+ int argc = binbuf_getnatom(x->te_binbuf);
+ t_atom *argv = binbuf_getvec(x->te_binbuf);
+
+ PrintList(argc,argv,b,sizeof(buf)+buf-b); b += strlen(b);
+
+ STD::sprintf(b, " } { "); b += strlen(b);
+
+ AtomList la;
+ th->ListAttrib(la);
+ int cnt = la.Count();
+
+ for(int i = 0; i < cnt; ++i) {
+ const t_symbol *sym = GetSymbol(la[i]);
+
+ // get attribute
+ AttrItem *gattr = th->FindAttrib(sym,true);
+ // get puttable attribute
+ AttrItem *pattr = gattr?gattr->Counterpart():th->FindAttrib(sym,false);
+
+ // get flags
+ int sv;
+ const AtomList *initdata;
+ AttrDataCont::iterator it = th->attrdata->find(sym);
+ if(it == th->attrdata->end())
+ sv = 0,initdata = NULL;
+ else {
+ const AttrData &a = *it.data();
+ if(a.IsSaved())
+ sv = 2;
+ else if(a.IsInit())
+ sv = 1;
+ else
+ sv = 0;
+ initdata = a.IsInitValue()?&a.GetInitValue():NULL;
+ }
+
+ // get attribute type
+ int tp;
+ bool list;
+ switch((gattr?gattr:pattr)->argtp) {
+ case a_int: tp = 0; list = false; break;
+ case a_float: tp = 1; list = false; break;
+ case a_bool: tp = 2; list = false; break;
+ case a_symbol: tp = 3; list = true; break;
+ case a_list:
+ case a_LIST: tp = 4; list = true; break;
+ default:
+ tp = 5; list = true;
+ FLEXT_ASSERT(false);
+ }
+
+ STD::sprintf(b,list?"%s {":"%s ",GetString(sym)); b += strlen(b);
+
+ AtomList lv;
+ if(gattr) { // gettable attribute is present
+ // Retrieve attribute value
+ th->GetAttrib(sym,gattr,lv);
+
+ PrintList(lv.Count(),lv.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b);
+ }
+ else {
+ strcpy(b,"{}"); b += strlen(b);
+ }
+
+ strcpy(b, list?"} {":" "); b += strlen(b);
+
+ if(pattr) {
+ // if there is initialization data take this, otherwise take the current data
+ const AtomList &lp = initdata?*initdata:lv;
+
+ PrintList(lp.Count(),lp.Atoms(),b,sizeof(buf)+buf-b); b += strlen(b);
+ }
+ else {
+ strcpy(b,"{}"); b += strlen(b);
+ }
+
+
+ STD::sprintf(b, list?"} %i %i %i ":" %i %i %i ",tp,sv,pattr?(pattr->BothExist()?2:1):0); b += strlen(b);
+ }
+
+ strcpy(b, " }\n");
+
+ gfxstub_new((t_pd *)th->thisHdr(), th->thisHdr(), buf);
}
//! Strip the attributes off the object command line
@@ -501,202 +501,202 @@ void flext_base::cb_GfxVis(t_gobj *c, t_glist *gl, int vis)
// show object if it's not a GOP
if(!gl->gl_isgraph || gl->gl_havewindow) {
- t_text *x = (t_text *)c;
- FLEXT_ASSERT(x->te_binbuf);
+ t_text *x = (t_text *)c;
+ FLEXT_ASSERT(x->te_binbuf);
- int argc = binbuf_getnatom(x->te_binbuf);
- t_atom *argv = binbuf_getvec(x->te_binbuf);
- int cnt = CheckAttrib(argc,argv);
+ int argc = binbuf_getnatom(x->te_binbuf);
+ t_atom *argv = binbuf_getvec(x->te_binbuf);
+ int cnt = CheckAttrib(argc,argv);
- if(cnt) {
- t_binbuf *nb = binbuf_new();
- binbuf_restore(nb,cnt,argv);
- binbuf_free(x->te_binbuf);
- x->te_binbuf = nb;
- }
+ if(cnt) {
+ t_binbuf *nb = binbuf_new();
+ binbuf_restore(nb,cnt,argv);
+ binbuf_free(x->te_binbuf);
+ x->te_binbuf = nb;
+ }
- t_rtext *rt = glist_findrtext(gl,x);
- rtext_retext(rt);
+ t_rtext *rt = glist_findrtext(gl,x);
+ rtext_retext(rt);
// now display the changed text with the normal drawing function
#ifdef FLEXT_CLONEWIDGET
- text_widgetbehavior.w_visfn(c,gl,vis);
+ text_widgetbehavior.w_visfn(c,gl,vis);
#else
- ori_vis(c,gl,vis);
+ ori_vis(c,gl,vis);
#endif
}
}
static void BinbufAdd(t_binbuf *b,const t_atom &at)
{
- char tbuf[MAXPDSTRING];
- if(flext::IsString(at))
- binbuf_addv(b,"s",flext::GetSymbol(at));
- else if(flext::IsFloat(at))
- binbuf_addv(b,"f",flext::GetFloat(at));
- else if(flext::IsInt(at))
- binbuf_addv(b,"i",flext::GetInt(at));
- else if(at.a_type == A_DOLLAR) {
- sprintf(tbuf, "$%d", at.a_w.w_index);
- binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
- }
- else if(at.a_type == A_DOLLSYM) {
- sprintf(tbuf, "$%s", at.a_w.w_symbol->s_name);
- binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
- }
- else
- FLEXT_ASSERT(false);
+ char tbuf[MAXPDSTRING];
+ if(flext::IsString(at))
+ binbuf_addv(b,"s",flext::GetSymbol(at));
+ else if(flext::IsFloat(at))
+ binbuf_addv(b,"f",flext::GetFloat(at));
+ else if(flext::IsInt(at))
+ binbuf_addv(b,"i",flext::GetInt(at));
+ else if(at.a_type == A_DOLLAR) {
+ sprintf(tbuf, "$%d", at.a_w.w_index);
+ binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
+ }
+ else if(at.a_type == A_DOLLSYM) {
+ sprintf(tbuf, "$%s", at.a_w.w_symbol->s_name);
+ binbuf_addv(b,"s",flext::MakeSymbol(tbuf));
+ }
+ else
+ FLEXT_ASSERT(false);
}
void flext_base::cb_GfxSave(t_gobj *c, t_binbuf *b)
{
- flext_base *th = thisObject(c);
- t_text *t = (t_text *)c;
- binbuf_addv(b, "ssiis", gensym("#X"),gensym("obj"), t->te_xpix, t->te_ypix,MakeSymbol(th->thisName()));
-
- int argc = binbuf_getnatom(t->te_binbuf);
- t_atom *argv = binbuf_getvec(t->te_binbuf);
- int i,cnt = CheckAttrib(argc,argv);
-
- // process the creation arguments
- for(i = 1; i < cnt; ++i) BinbufAdd(b,argv[i]);
-
- // process the attributes
- AtomList la;
- th->ListAttrib(la);
- cnt = la.Count();
-
- for(i = 0; i < cnt; ++i) {
- const t_symbol *sym = GetSymbol(la[i]);
- AtomList lv;
- const AtomList *lref = NULL;
- AttrDataCont::iterator it = th->attrdata->find(sym);
-
- if(it != th->attrdata->end()) {
- const AttrData &a = *it.data();
- if(a.IsInit() && a.IsInitValue()) {
- lref = &a.GetInitValue();
+ flext_base *th = thisObject(c);
+ t_text *t = (t_text *)c;
+ binbuf_addv(b, "ssiis", gensym("#X"),gensym("obj"), t->te_xpix, t->te_ypix,MakeSymbol(th->thisName()));
+
+ int argc = binbuf_getnatom(t->te_binbuf);
+ t_atom *argv = binbuf_getvec(t->te_binbuf);
+ int i,cnt = CheckAttrib(argc,argv);
+
+ // process the creation arguments
+ for(i = 1; i < cnt; ++i) BinbufAdd(b,argv[i]);
+
+ // process the attributes
+ AtomList la;
+ th->ListAttrib(la);
+ cnt = la.Count();
+
+ for(i = 0; i < cnt; ++i) {
+ const t_symbol *sym = GetSymbol(la[i]);
+ AtomList lv;
+ const AtomList *lref = NULL;
+ AttrDataCont::iterator it = th->attrdata->find(sym);
+
+ if(it != th->attrdata->end()) {
+ const AttrData &a = *it.data();
+ if(a.IsInit() && a.IsInitValue()) {
+ lref = &a.GetInitValue();
/*
- // check for $-parameters
- lv = lref->Count();
- for(int j = 0; j < lref->Count(); ++j) {
- const char *s = IsSymbol((*lref)[j])?GetString((*lref)[j]):NULL;
- if(s && s[0] == '$') { // TODO: More refined checking?
- // prepend a "\"
- char tmp[256]; *tmp = '\\';
- strcpy(tmp+1,s);
- SetString(lv[j],tmp);
- }
- else
- lv[i] = (*lref)[j];
- }
-
- lref = &lv;
+ // check for $-parameters
+ lv = lref->Count();
+ for(int j = 0; j < lref->Count(); ++j) {
+ const char *s = IsSymbol((*lref)[j])?GetString((*lref)[j]):NULL;
+ if(s && s[0] == '$') { // TODO: More refined checking?
+ // prepend a "\"
+ char tmp[256]; *tmp = '\\';
+ strcpy(tmp+1,s);
+ SetString(lv[j],tmp);
+ }
+ else
+ lv[i] = (*lref)[j];
+ }
+
+ lref = &lv;
*/
- }
- else if(a.IsSaved()) {
- AttrItem *attr = th->FindAttrib(sym,true);
-
- // attribute must be gettable (so that the data can be retrieved) and puttable (so that the data can be inited)
- if(attr && attr->BothExist()) {
- th->GetAttrib(sym,attr,lv);
- lref = &lv;
- }
- }
- }
-
- if(lref) {
- char attrname[256]; *attrname= '@';
- // store name
- strcpy(attrname+1,GetString(sym));
- binbuf_addv(b,"s",MakeSymbol(attrname));
-
- // store value
- for(int j = 0; j < lref->Count(); ++j) BinbufAdd(b,(*lref)[j]);
- }
- }
-
- binbuf_addv(b, ";");
+ }
+ else if(a.IsSaved()) {
+ AttrItem *attr = th->FindAttrib(sym,true);
+
+ // attribute must be gettable (so that the data can be retrieved) and puttable (so that the data can be inited)
+ if(attr && attr->BothExist()) {
+ th->GetAttrib(sym,attr,lv);
+ lref = &lv;
+ }
+ }
+ }
+
+ if(lref) {
+ char attrname[256]; *attrname= '@';
+ // store name
+ strcpy(attrname+1,GetString(sym));
+ binbuf_addv(b,"s",MakeSymbol(attrname));
+
+ // store value
+ for(int j = 0; j < lref->Count(); ++j) BinbufAdd(b,(*lref)[j]);
+ }
+ }
+
+ binbuf_addv(b, ";");
}
bool flext_base::cb_AttrDialog(flext_base *th,int argc,const t_atom *argv)
{
- int i = 0;
- if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) ++i;
-
- for(; i < argc; ) {
- FLEXT_ASSERT(IsSymbol(argv[i]));
-
- // get name
- const t_symbol *aname = GetSymbol(argv[i]);
- i++;
-
- // get current value
- int ccnt,coffs;
- if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) {
- i++;
- FLEXT_ASSERT(CanbeInt(argv[i]));
- ccnt = GetAInt(argv[i]);
- coffs = ++i;
- }
- else
- coffs = i,ccnt = 1;
- i += ccnt;
-
- // get init value
- int icnt,ioffs;
- if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) {
- i++;
- FLEXT_ASSERT(CanbeInt(argv[i]));
- icnt = GetAInt(argv[i]);
- ioffs = ++i;
- }
- else
- ioffs = i,icnt = 1;
- i += icnt;
-
- FLEXT_ASSERT(i < argc);
- int sv = GetAInt(argv[i]);
- ++i;
-
- // find puttable attribute
- AttrItem *attr = th->FindAttrib(aname,false);
- if(attr) {
- bool ret = th->SetAttrib(aname,attr,ccnt,argv+coffs);
- FLEXT_ASSERT(ret);
-
- AttrDataCont::iterator it = th->attrdata->find(aname);
-
- if(sv >= 1) {
- // if data not present create it
- if(it == th->attrdata->end()) {
- AttrDataCont::pair pair;
- pair.key() = aname;
- pair.data() = new AttrData;
- it = th->attrdata->insert(th->attrdata->begin(),pair);
- }
-
- AttrData &a = *it.data();
- a.SetSave(sv == 2);
- a.SetInit(true);
- a.SetInitValue(icnt,argv+ioffs);
- }
- else {
- if(it != th->attrdata->end()) {
- AttrData &a = *it.data();
- // if data is present reset flags
- a.SetSave(false);
- a.SetInit(false);
-
- // let init data as is
- }
- }
- }
- else {
- post("%s - Attribute %s can't be set",th->thisName(),GetString(aname));
- }
- }
- return true;
+ int i = 0;
+ if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) ++i;
+
+ for(; i < argc; ) {
+ FLEXT_ASSERT(IsSymbol(argv[i]));
+
+ // get name
+ const t_symbol *aname = GetSymbol(argv[i]);
+ i++;
+
+ // get current value
+ int ccnt,coffs;
+ if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) {
+ i++;
+ FLEXT_ASSERT(CanbeInt(argv[i]));
+ ccnt = GetAInt(argv[i]);
+ coffs = ++i;
+ }
+ else
+ coffs = i,ccnt = 1;
+ i += ccnt;
+
+ // get init value
+ int icnt,ioffs;
+ if(IsSymbol(argv[i]) && GetSymbol(argv[i]) == sym_list) {
+ i++;
+ FLEXT_ASSERT(CanbeInt(argv[i]));
+ icnt = GetAInt(argv[i]);
+ ioffs = ++i;
+ }
+ else
+ ioffs = i,icnt = 1;
+ i += icnt;
+
+ FLEXT_ASSERT(i < argc);
+ int sv = GetAInt(argv[i]);
+ ++i;
+
+ // find puttable attribute
+ AttrItem *attr = th->FindAttrib(aname,false);
+ if(attr) {
+ bool ret = th->SetAttrib(aname,attr,ccnt,argv+coffs);
+ FLEXT_ASSERT(ret);
+
+ AttrDataCont::iterator it = th->attrdata->find(aname);
+
+ if(sv >= 1) {
+ // if data not present create it
+ if(it == th->attrdata->end()) {
+ AttrDataCont::pair pair;
+ pair.key() = aname;
+ pair.data() = new AttrData;
+ it = th->attrdata->insert(th->attrdata->begin(),pair);
+ }
+
+ AttrData &a = *it.data();
+ a.SetSave(sv == 2);
+ a.SetInit(true);
+ a.SetInitValue(icnt,argv+ioffs);
+ }
+ else {
+ if(it != th->attrdata->end()) {
+ AttrData &a = *it.data();
+ // if data is present reset flags
+ a.SetSave(false);
+ a.SetInit(false);
+
+ // let init data as is
+ }
+ }
+ }
+ else {
+ post("%s - Attribute %s can't be set",th->thisName(),GetString(aname));
+ }
+ }
+ return true;
}
#endif // FLEXT_SYS_PD
diff --git a/externals/grill/flext/source/flbase.cpp b/externals/grill/flext/source/flbase.cpp
index 72e07999..04bad89f 100644
--- a/externals/grill/flext/source/flbase.cpp
+++ b/externals/grill/flext/source/flbase.cpp
@@ -11,7 +11,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \file flbase.cpp
\brief Implementation of the internal flext base classes.
- \remark This is all derived from GEM by Mark Danks
+ \remark This is all derived from GEM by Mark Danks
*/
#include "flext.h"
@@ -21,12 +21,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#if FLEXT_SYS == FLEXT_SYS_PD
#ifdef _MSC_VER
- #pragma warning (push)
- #pragma warning (disable:4091)
+ #pragma warning (push)
+ #pragma warning (disable:4091)
#endif
#include <g_canvas.h>
#ifdef _MSC_VER
- #pragma warning (pop)
+ #pragma warning (pop)
#endif
#endif
@@ -52,9 +52,9 @@ void flext_obj::ProcessAttributes(bool attr) { process_attributes = attr; }
/////////////////////////////////////////////////////////
flext_obj :: FLEXT_CLASSDEF(flext_obj)()
: x_obj(m_holder)
- , procattr(m_holdattr)
- , init_ok(true)
- , m_name(m_holdname)
+ , procattr(m_holdattr)
+ , init_ok(true)
+ , m_name(m_holdname)
{
#if FLEXT_SYS == FLEXT_SYS_PD
m_canvas = canvas_getcurrent();
@@ -69,7 +69,7 @@ flext_obj :: FLEXT_CLASSDEF(flext_obj)()
//
/////////////////////////////////////////////////////////
flext_obj :: ~FLEXT_CLASSDEF(flext_obj)() {
- x_obj = NULL;
+ x_obj = NULL;
}
@@ -80,56 +80,56 @@ void flext_obj::Exit() {}
void flext_obj::DefineHelp(t_classid c,const char *ref,const char *dir,bool addtilde)
{
#if FLEXT_SYS == FLEXT_SYS_PD
- char tmp[256];
- if(dir) {
- strcpy(tmp,dir);
- strcat(tmp,"/");
- strcat(tmp,ref);
- }
- else
- strcpy(tmp,ref);
- if(addtilde) strcat(tmp,"~");
+ char tmp[256];
+ if(dir) {
+ strcpy(tmp,dir);
+ strcat(tmp,"/");
+ strcat(tmp,ref);
+ }
+ else
+ strcpy(tmp,ref);
+ if(addtilde) strcat(tmp,"~");
::class_sethelpsymbol(getClass(c),gensym(const_cast<char *>(tmp)));
#else
- // no solution for Max/MSP yet
+ // no solution for Max/MSP yet
#endif
}
bool flext_obj::GetParamSym(t_atom &dst,const t_symbol *sym,t_canvas *c)
{
#if FLEXT_SYS == FLEXT_SYS_PD
- if(!c) c = canvas_getcurrent();
-
- const char *s = GetString(sym);
- if((s[0] == '$' || s[0] == '#') && isdigit(s[1])) {
- const t_symbol *res;
- // patcher parameter detected... get value!
- if(s[0] != '$') {
- char tmp[MAXPDSTRING];
- strcpy(tmp,s);
- tmp[0] = '$';
- res = canvas_realizedollar(c,const_cast<t_symbol *>(MakeSymbol(tmp)));
- }
- else
- res = canvas_realizedollar(c,const_cast<t_symbol *>(sym));
-
- // check for number
- const char *c = GetString(res);
- while(*c && (isdigit(*c) || *c == '.')) ++c;
-
- if(!*c)
- SetFloat(dst,(float)atof(GetString(res)));
- else
- SetSymbol(dst,res);
- return true;
- }
- else
+ if(!c) c = canvas_getcurrent();
+
+ const char *s = GetString(sym);
+ if((s[0] == '$' || s[0] == '#') && isdigit(s[1])) {
+ const t_symbol *res;
+ // patcher parameter detected... get value!
+ if(s[0] != '$') {
+ char tmp[MAXPDSTRING];
+ strcpy(tmp,s);
+ tmp[0] = '$';
+ res = canvas_realizedollar(c,const_cast<t_symbol *>(MakeSymbol(tmp)));
+ }
+ else
+ res = canvas_realizedollar(c,const_cast<t_symbol *>(sym));
+
+ // check for number
+ const char *c = GetString(res);
+ while(*c && (isdigit(*c) || *c == '.')) ++c;
+
+ if(!*c)
+ SetFloat(dst,(float)atof(GetString(res)));
+ else
+ SetSymbol(dst,res);
+ return true;
+ }
+ else
#else
- #pragma message("Not implemented")
+ #pragma message("Not implemented")
#endif
- SetSymbol(dst,sym);
- return true;
+ SetSymbol(dst,sym);
+ return true;
}
@@ -142,13 +142,13 @@ extern "C" void canvas_getargs(int *argcp, t_atom **argvp);
void flext_obj::CanvasArgs(AtomList &args) const
{
#if FLEXT_SYS == FLEXT_SYS_PD
- int argc;
- t_atom *argv;
- canvas_getargs(&argc,&argv);
- args(argc);
- for(int i = 0; i < argc; ++i) args[i] = argv[i];
+ int argc;
+ t_atom *argv;
+ canvas_getargs(&argc,&argv);
+ args(argc);
+ for(int i = 0; i < argc; ++i) args[i] = argv[i];
#else
- #pragma message("Not implemented")
- args(0);
+ #pragma message("Not implemented")
+ args(0);
#endif
}
diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 85633f20..a9a9d8e5 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -443,10 +443,16 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define FLEXTTYPE_int FLEXTTPN_FLOAT
#define FLEXTTYPE_int0 FLEXTTPN_DEFFLOAT
#define CALLBTYPE_int float
+#define FLEXTTYPE_bool FLEXTTPN_FLOAT
+#define FLEXTTYPE_bool0 FLEXTTPN_DEFFLOAT
+#define CALLBTYPE_bool float
#elif FLEXT_SYS == FLEXT_SYS_MAX || FLEXT_SYS == FLEXT_SYS_JMAX
#define FLEXTTYPE_int FLEXTTPN_INT
#define FLEXTTYPE_int0 FLEXTTPN_DEFINT
#define CALLBTYPE_int int
+#define FLEXTTYPE_bool FLEXTTPN_INT
+#define FLEXTTYPE_bool0 FLEXTTPN_DEFINT
+#define CALLBTYPE_bool int
#else
#error
#endif
@@ -464,6 +470,8 @@ fts_module_t __##NAME##_module = {#NAME,#NAME,__##NAME##_initfun,0,0};
#define CALLBTP(TP) CALLBTYPE_ ## TP
+#define ARGMEMBER_bool(a) GetBool(a)
+#define ARGMEMBER_bool0(a) ARGMEMBER_bool(a)
#define ARGMEMBER_int(a) GetInt(a)
#define ARGMEMBER_int0(a) ARGMEMBER_int(a)
#define ARGMEMBER_float(a) GetFloat(a)
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
index 5a8f0743..8eefefb4 100644
--- a/externals/grill/flext/source/flbind.cpp
+++ b/externals/grill/flext/source/flbind.cpp
@@ -27,37 +27,37 @@ t_messlist px_messlist[3];
*/
void flext_base::SetupBindProxy()
{
- // already initialized?
- if(!pxbnd_class) {
+ // already initialized?
+ if(!pxbnd_class) {
#if FLEXT_SYS == FLEXT_SYS_PD
- pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- add_anything(pxbnd_class,pxbnd_object::px_method); // for symbol-bound methods
+ pxbnd_class = class_new(gensym("flext_base bind proxy"),NULL,NULL,sizeof(pxbnd_object),CLASS_PD|CLASS_NOINLET, A_NULL);
+ add_anything(pxbnd_class,pxbnd_object::px_method); // for symbol-bound methods
#elif FLEXT_SYS == FLEXT_SYS_MAX
- pxbnd_class = new t_class;
-
- pxbnd_class->c_sym = gensym("");
- pxbnd_class->c_freelist = &px_freelist;
- pxbnd_class->c_freefun = NULL;
- pxbnd_class->c_size = sizeof(pxbnd_object);
- pxbnd_class->c_tiny = 0;
- pxbnd_class->c_noinlet = 1;
- px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
-
- px_messlist[1].m_sym = gensym("anything");
- px_messlist[1].m_fun = (method)pxbnd_object::px_method;
- px_messlist[1].m_type[0] = A_GIMME;
- px_messlist[1].m_type[1] = 0;
-
- px_messlist[2].m_sym = 0;
+ pxbnd_class = new t_class;
+
+ pxbnd_class->c_sym = gensym("");
+ pxbnd_class->c_freelist = &px_freelist;
+ pxbnd_class->c_freefun = NULL;
+ pxbnd_class->c_size = sizeof(pxbnd_object);
+ pxbnd_class->c_tiny = 0;
+ pxbnd_class->c_noinlet = 1;
+ px_messlist[0].m_sym = (t_symbol *)pxbnd_class;
+
+ px_messlist[1].m_sym = gensym("anything");
+ px_messlist[1].m_fun = (method)pxbnd_object::px_method;
+ px_messlist[1].m_type[0] = A_GIMME;
+ px_messlist[1].m_type[1] = 0;
+
+ px_messlist[2].m_sym = 0;
#else
#pragma warning("Not implemented!")
#endif
- }
+ }
}
flext_base::BindItem::BindItem(bool (*f)(flext_base *,t_symbol *s,int,t_atom *,void *data),pxbnd_object *p):
- Item(NULL),fun(f),px(p)
+ Item(NULL),fun(f),px(p)
{}
flext_base::BindItem::~BindItem()
@@ -122,13 +122,13 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo
#endif
if(px) {
- BindItem *mi = new BindItem(fun,px);
- bindhead->Add(mi,sym);
+ BindItem *mi = new BindItem(fun,px);
+ bindhead->Add(mi,sym);
px->init(this,mi,data);
#if FLEXT_SYS == FLEXT_SYS_PD
- pd_bind(&px->obj.ob_pd,const_cast<t_symbol *>(sym));
+ pd_bind(&px->obj.ob_pd,const_cast<t_symbol *>(sym));
#elif FLEXT_SYS == FLEXT_SYS_MAX
if(!sym->s_thing)
const_cast<t_symbol *>(sym)->s_thing = (t_object *)px;
@@ -205,16 +205,16 @@ bool flext_base::UnbindAll()
for(ItemSet::iterator si = set.begin(); si != set.end(); ++si) {
Item *lst = si.data();
while(lst) {
- Item *nxt = lst->nxt;
+ Item *nxt = lst->nxt;
BindItem *it = (BindItem *)lst;
it->Unbind(si.key());
delete it;
- lst = nxt;
+ lst = nxt;
}
}
set.clear();
}
- return true;
+ return true;
}
void flext_base::pxbnd_object::px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv)
diff --git a/externals/grill/flext/source/flbuf.cpp b/externals/grill/flext/source/flbuf.cpp
index 6d2f651d..4dc0b6e8 100644
--- a/externals/grill/flext/source/flbuf.cpp
+++ b/externals/grill/flext/source/flbuf.cpp
@@ -27,25 +27,25 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// check if PD API supports buffer dirty time
#if defined(PD_DEVEL_VERSION) && defined(PD_MAJOR_VERSION) && defined(PD_MINOR_VERSION)
#if PD_MINOR_VERSION >= 36
- #define FLEXT_PDBUFDIRTYTIME
+ #define FLEXT_PDBUFDIRTYTIME
#endif
#endif
flext::buffer::buffer(const t_symbol *bn,bool delayed):
- sym(NULL),data(NULL),
- chns(0),frames(0)
+ sym(NULL),data(NULL),
+ chns(0),frames(0)
{
#if FLEXT_SYS == FLEXT_SYS_PD
- arr = NULL;
- interval = DIRTY_INTERVAL;
- isdirty = false;
- ticking = false;
+ arr = NULL;
+ interval = DIRTY_INTERVAL;
+ isdirty = false;
+ ticking = false;
tick = clock_new(this,(t_method)cb_tick);
#endif
- if(bn) Set(bn,delayed);
+ if(bn) Set(bn,delayed);
- ClearDirty();
+ ClearDirty();
}
flext::buffer::~buffer()
@@ -57,167 +57,167 @@ flext::buffer::~buffer()
int flext::buffer::Set(const t_symbol *s,bool nameonly)
{
- int ret = 0;
- bool valid = data != NULL; // valid now? (before change)
-
- if(s && sym != s) {
- ret = 1;
- data = NULL;
- frames = 0;
- chns = 0;
- }
-
- if(s && *GetString(s)) sym = s;
-
- if(!sym) {
- if(valid) ret = -1;
- }
- else if(!nameonly) {
+ int ret = 0;
+ bool valid = data != NULL; // valid now? (before change)
+
+ if(s && sym != s) {
+ ret = 1;
+ data = NULL;
+ frames = 0;
+ chns = 0;
+ }
+
+ if(s && *GetString(s)) sym = s;
+
+ if(!sym) {
+ if(valid) ret = -1;
+ }
+ else if(!nameonly) {
#if FLEXT_SYS == FLEXT_SYS_PD
- int frames1;
- t_sample *data1;
+ int frames1;
+ t_sample *data1;
- arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
- if(!arr)
- {
- if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
- sym = NULL;
- if(valid) ret = -1;
- }
- else if(!garray_getfloatarray(arr, &frames1, &data1))
- {
- error("buffer: bad template '%s'",GetString(sym));
- data = NULL;
- frames = 0;
- if(valid) ret = -1;
- }
- else {
+ arr = (t_garray *)pd_findbyclass(const_cast<t_symbol *>(sym), garray_class);
+ if(!arr)
+ {
+ if (*GetString(sym)) FLEXT_LOG1("buffer: no such array '%s'",GetString(sym));
+ sym = NULL;
+ if(valid) ret = -1;
+ }
+ else if(!garray_getfloatarray(arr, &frames1, &data1))
+ {
+ error("buffer: bad template '%s'",GetString(sym));
+ data = NULL;
+ frames = 0;
+ if(valid) ret = -1;
+ }
+ else {
ret = 0;
- garray_usedindsp(arr);
- if(frames != frames1) { frames = frames1; if(!ret) ret = 1; }
- if(data != data1) { data = data1; if(!ret) ret = 1; }
- chns = 1;
- }
+ garray_usedindsp(arr);
+ if(frames != frames1) { frames = frames1; if(!ret) ret = 1; }
+ if(data != data1) { data = data1; if(!ret) ret = 1; }
+ chns = 1;
+ }
#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(sym->s_thing) {
- const _buffer *p = (const _buffer *)sym->s_thing;
-
- if(NOGOOD(p) || !p->b_valid) {
- post("buffer: buffer object '%s' no good",GetString(sym));
- if(valid) ret = -2;
- }
- else {
+ if(sym->s_thing) {
+ const _buffer *p = (const _buffer *)sym->s_thing;
+
+ if(NOGOOD(p) || !p->b_valid) {
+ post("buffer: buffer object '%s' no good",GetString(sym));
+ if(valid) ret = -2;
+ }
+ else {
#ifdef FLEXT_DEBUG
-// post("flext: buffer object '%s' - valid:%i samples:%i channels:%i frames:%i",GetString(sym),p->b_valid,p->b_frames,p->b_nchans,p->b_frames);
+// post("flext: buffer object '%s' - valid:%i samples:%i channels:%i frames:%i",GetString(sym),p->b_valid,p->b_frames,p->b_nchans,p->b_frames);
#endif
- if(data != p->b_samples) { data = p->b_samples; if(!ret) ret = 1; }
- if(chns != p->b_nchans) { chns = p->b_nchans; if(!ret) ret = 1; }
- if(frames != p->b_frames) { frames = p->b_frames; if(!ret) ret = 1; }
- }
- }
- else {
- FLEXT_LOG1("buffer: symbol '%s' not defined", GetString(sym));
- /*if(valid)*/ ret = -1;
- }
+ if(data != p->b_samples) { data = p->b_samples; if(!ret) ret = 1; }
+ if(chns != p->b_nchans) { chns = p->b_nchans; if(!ret) ret = 1; }
+ if(frames != p->b_frames) { frames = p->b_frames; if(!ret) ret = 1; }
+ }
+ }
+ else {
+ FLEXT_LOG1("buffer: symbol '%s' not defined", GetString(sym));
+ /*if(valid)*/ ret = -1;
+ }
#else
#error not implemented
#endif
- }
+ }
- return ret;
+ return ret;
}
bool flext::buffer::Valid() const
{
- if(sym) {
+ if(sym) {
#if FLEXT_SYS == FLEXT_SYS_PD
- int frames1;
- t_sample *data1;
- return arr && garray_getfloatarray(arr, &frames1, &data1) != 0;
+ int frames1;
+ t_sample *data1;
+ return arr && garray_getfloatarray(arr, &frames1, &data1) != 0;
#elif FLEXT_SYS == FLEXT_SYS_MAX
- const _buffer *p = (const _buffer *)sym->s_thing;
- return p && p->b_valid;
+ const _buffer *p = (const _buffer *)sym->s_thing;
+ return p && p->b_valid;
#else
#error
#endif
- }
- else return false;
+ }
+ else return false;
}
bool flext::buffer::Update()
{
- if(!Ok()) return false;
+ if(!Ok()) return false;
- bool ok = false;
+ bool ok = false;
#if FLEXT_SYS == FLEXT_SYS_PD
- int frames1;
- t_sample *data1;
- if(!garray_getfloatarray(arr, &frames1, &data1)) {
- frames = 0;
- data = NULL;
- chns = 0;
- ok = true;
- }
- else if(data != data1 || frames != frames1) {
- frames = frames1;
- data = data1;
- ok = true;
- }
+ int frames1;
+ t_sample *data1;
+ if(!garray_getfloatarray(arr, &frames1, &data1)) {
+ frames = 0;
+ data = NULL;
+ chns = 0;
+ ok = true;
+ }
+ else if(data != data1 || frames != frames1) {
+ frames = frames1;
+ data = data1;
+ ok = true;
+ }
#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(sym->s_thing) {
- const _buffer *p = (const _buffer *)sym->s_thing;
- if(data != p->b_samples || chns != p->b_nchans || frames != p->b_frames) {
- data = p->b_samples;
- chns = p->b_nchans;
- frames = p->b_frames;
- ok = true;
- }
- }
+ if(sym->s_thing) {
+ const _buffer *p = (const _buffer *)sym->s_thing;
+ if(data != p->b_samples || chns != p->b_nchans || frames != p->b_frames) {
+ data = p->b_samples;
+ chns = p->b_nchans;
+ frames = p->b_frames;
+ ok = true;
+ }
+ }
#else
#error not implemented
#endif
- return ok;
+ return ok;
}
void flext::buffer::Frames(int fr,bool keep,bool zero)
{
#if FLEXT_SYS == FLEXT_SYS_PD
// is this function guaranteed to keep memory and set rest to zero?
- ::garray_resize(arr,(float)fr);
- Update();
+ ::garray_resize(arr,(float)fr);
+ Update();
#elif FLEXT_SYS == FLEXT_SYS_MAX
- t_sample *tmp = NULL;
- int sz = frames;
- if(fr < sz) sz = fr;
+ t_sample *tmp = NULL;
+ int sz = frames;
+ if(fr < sz) sz = fr;
- if(keep) {
- // copy buffer data to tmp storage
+ if(keep) {
+ // copy buffer data to tmp storage
tmp = (t_sample *)NewAligned(sz*sizeof(t_sample));
if(tmp)
- CopySamples(tmp,data,sz);
- else
- error("flext::buffer - not enough memory for keeping buffer~ contents");
- }
-
- t_atom msg;
- _buffer *buf = (_buffer *)sym->s_thing;
- // b_msr reflects buffer sample rate... is this what we want?
- // Max bug: adding half a sample to prevent roundoff errors....
- float ms = (fr+0.5)/buf->b_msr;
-
- SetFloat(msg,ms);
- ::typedmess((object *)buf,gensym("size"),1,&msg);
-
- Update();
-
- if(tmp) {
- // copy data back
- CopySamples(data,tmp,sz);
- FreeAligned(tmp);
+ CopySamples(tmp,data,sz);
+ else
+ error("flext::buffer - not enough memory for keeping buffer~ contents");
+ }
+
+ t_atom msg;
+ _buffer *buf = (_buffer *)sym->s_thing;
+ // b_msr reflects buffer sample rate... is this what we want?
+ // Max bug: adding half a sample to prevent roundoff errors....
+ float ms = (fr+0.5)/buf->b_msr;
+
+ SetFloat(msg,ms);
+ ::typedmess((object *)buf,gensym("size"),1,&msg);
+
+ Update();
+
+ if(tmp) {
+ // copy data back
+ CopySamples(data,tmp,sz);
+ FreeAligned(tmp);
if(zero && sz < fr) ZeroSamples(data+sz,fr-sz);
- }
+ }
else
if(zero) ZeroSamples(data,fr);
#else
@@ -229,11 +229,11 @@ void flext::buffer::Frames(int fr,bool keep,bool zero)
#if FLEXT_SYS == FLEXT_SYS_PD
void flext::buffer::SetRefrIntv(float intv)
{
- interval = intv;
- if(interval == 0 && ticking) {
- clock_unset(tick);
- ticking = false;
- }
+ interval = intv;
+ if(interval == 0 && ticking) {
+ clock_unset(tick);
+ ticking = false;
+ }
}
#elif FLEXT_SYS == FLEXT_SYS_MAX
void flext::buffer::SetRefrIntv(float) {}
@@ -244,60 +244,60 @@ void flext::buffer::SetRefrIntv(float) {}
void flext::buffer::Dirty(bool force)
{
- if(sym) {
+ if(sym) {
#if FLEXT_SYS == FLEXT_SYS_PD
- if((!ticking) && (interval || force)) {
- ticking = true;
- cb_tick(this); // immediately redraw
- }
- else {
- if(force) clock_delay(tick,0);
- isdirty = true;
- }
+ if((!ticking) && (interval || force)) {
+ ticking = true;
+ cb_tick(this); // immediately redraw
+ }
+ else {
+ if(force) clock_delay(tick,0);
+ isdirty = true;
+ }
#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(sym->s_thing) {
- _buffer *p = (_buffer *)sym->s_thing;
-
- if(NOGOOD(p)) {
- post("buffer: buffer object '%s' no good",sym->s_name);
- }
- else {
- p->b_modtime = gettime();
- }
- }
- else {
- FLEXT_LOG1("buffer: symbol '%s' not defined",sym->s_name);
- }
+ if(sym->s_thing) {
+ _buffer *p = (_buffer *)sym->s_thing;
+
+ if(NOGOOD(p)) {
+ post("buffer: buffer object '%s' no good",sym->s_name);
+ }
+ else {
+ p->b_modtime = gettime();
+ }
+ }
+ else {
+ FLEXT_LOG1("buffer: symbol '%s' not defined",sym->s_name);
+ }
#else
#error Not implemented
#endif
- }
+ }
}
#if FLEXT_SYS == FLEXT_SYS_PD
void flext::buffer::cb_tick(buffer *b)
{
- if(b->arr) garray_redraw(b->arr);
+ if(b->arr) garray_redraw(b->arr);
#ifdef FLEXT_DEBUG
- else error("buffer: array is NULL");
+ else error("buffer: array is NULL");
#endif
- if(b->isdirty && b->interval) {
- b->isdirty = false;
- b->ticking = true;
- clock_delay(b->tick,b->interval);
- }
- else
- b->ticking = false;
+ if(b->isdirty && b->interval) {
+ b->isdirty = false;
+ b->ticking = true;
+ clock_delay(b->tick,b->interval);
+ }
+ else
+ b->ticking = false;
}
#endif
void flext::buffer::ClearDirty()
{
#if FLEXT_SYS == FLEXT_SYS_PD
- cleantime = clock_getlogicaltime();
+ cleantime = clock_getlogicaltime();
#elif FLEXT_SYS == FLEXT_SYS_MAX
- cleantime = gettime();
+ cleantime = gettime();
#else
#error Not implemented
#endif
@@ -306,24 +306,24 @@ void flext::buffer::ClearDirty()
bool flext::buffer::IsDirty() const
{
#if FLEXT_SYS == FLEXT_SYS_PD
- if(!arr) return false;
- #ifdef FLEXT_PDBUFDIRTYTIME
- return isdirty || garray_updatetime(arr) > cleantime;
- #else
- // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...)
- return true;
- #endif
+ if(!arr) return false;
+ #ifdef FLEXT_PDBUFDIRTYTIME
+ return isdirty || garray_updatetime(arr) > cleantime;
+ #else
+ // Don't know.... (no method in PD judging whether buffer has been changed from outside flext...)
+ return true;
+ #endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
- if(!sym->s_thing) return false;
+ if(!sym->s_thing) return false;
- _buffer *p = (_buffer *)sym->s_thing;
+ _buffer *p = (_buffer *)sym->s_thing;
#ifdef FLEXT_DEBUG
- if(NOGOOD(p)) {
- post("buffer: buffer object '%s' no good",sym->s_name);
- return false;
- }
+ if(NOGOOD(p)) {
+ post("buffer: buffer object '%s' no good",sym->s_name);
+ return false;
+ }
#endif
- return p->b_modtime > cleantime;
+ return p->b_modtime > cleantime;
#else
#error Not implemented
#endif
diff --git a/externals/grill/flext/source/flcwmax-thr.h b/externals/grill/flext/source/flcwmax-thr.h
index 2e883dbe..4167be9f 100755
--- a/externals/grill/flext/source/flcwmax-thr.h
+++ b/externals/grill/flext/source/flcwmax-thr.h
@@ -18,12 +18,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define FLEXT_THREADS
/*
- old CodeWarrior version (<= 6) don't have sigset_t defined which
- is needed for pthreads
+ old CodeWarrior version (<= 6) don't have sigset_t defined which
+ is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
- typedef unsigned int sigset_t;
- #define _CW_NOPRECOMP // no precompiled headers
+ typedef unsigned int sigset_t;
+ #define _CW_NOPRECOMP // no precompiled headers
#endif
#include "flcwmax.h"
diff --git a/externals/grill/flext/source/flcwmax-x-thr.h b/externals/grill/flext/source/flcwmax-x-thr.h
index e737ff19..93b78289 100755
--- a/externals/grill/flext/source/flcwmax-x-thr.h
+++ b/externals/grill/flext/source/flcwmax-x-thr.h
@@ -18,12 +18,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define FLEXT_THREADS
/*
- old CodeWarrior version (<= 6) don't have sigset_t defined which
- is needed for pthreads
+ old CodeWarrior version (<= 6) don't have sigset_t defined which
+ is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ == 1) // read __MWERKS__ numbering starts with CW7
- typedef unsigned int sigset_t;
- #define _CW_NOPRECOMP // no precompiled headers
+ typedef unsigned int sigset_t;
+ #define _CW_NOPRECOMP // no precompiled headers
#endif
#include "flcwmax-x.h"
diff --git a/externals/grill/flext/source/flcwmax.h b/externals/grill/flext/source/flcwmax.h
index 56fe03c3..4d108e2e 100644
--- a/externals/grill/flext/source/flcwmax.h
+++ b/externals/grill/flext/source/flcwmax.h
@@ -16,19 +16,19 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define _FLEXT_CW_MAX_H
#ifndef __MWERKS__
- #error "This header file is for CodeWarrior only."
+ #error "This header file is for CodeWarrior only."
#endif
#define FLEXT_SYS 1
#define FLEXT_USE_SIMD
#ifndef _CW_NOPRECOMP
- #include <MacHeaders.h>
+ #include <MacHeaders.h>
#endif
#if /*__option(sym) ||*/ !__option(opt_dead_code)
- #pragma message("Optimization disabled -> Compiling a debug version (with FLEXT_DEBUG)")
- #define FLEXT_DEBUG
+ #pragma message("Optimization disabled -> Compiling a debug version (with FLEXT_DEBUG)")
+ #define FLEXT_DEBUG
#endif
/* #define _LOG */
diff --git a/externals/grill/flext/source/flcwpd-x-thr.h b/externals/grill/flext/source/flcwpd-x-thr.h
index 56a193ef..d3075069 100755
--- a/externals/grill/flext/source/flcwpd-x-thr.h
+++ b/externals/grill/flext/source/flcwpd-x-thr.h
@@ -17,12 +17,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#if 0
/*
- old CodeWarrior version (<= 6) don't have sigset_t defined which
- is needed for pthreads
+ old CodeWarrior version (<= 6) don't have sigset_t defined which
+ is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ <= 0x6000)
- typedef unsigned int sigset_t;
- #define _CW_NOPRECOMP // no precompiled headers
+ typedef unsigned int sigset_t;
+ #define _CW_NOPRECOMP // no precompiled headers
#endif
#endif
diff --git a/externals/grill/flext/source/flcwpd-x.h b/externals/grill/flext/source/flcwpd-x.h
index 3a5087ae..f6b5192b 100755
--- a/externals/grill/flext/source/flcwpd-x.h
+++ b/externals/grill/flext/source/flcwpd-x.h
@@ -14,7 +14,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define _FLEXT_CW_PD_X_H
#ifndef __MWERKS__
- #error "This header file is for CodeWarrior only."
+ #error "This header file is for CodeWarrior only."
#endif
#define FLEXT_SYS 2
@@ -24,12 +24,12 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define _POSIX_C_SOURCE
#ifndef _CW_NOPRECOMP
-// #include <MacHeadersMach-O.h>
-// #include <MSL MacHeadersMach-O.h>
+// #include <MacHeadersMach-O.h>
+// #include <MSL MacHeadersMach-O.h>
#endif
#if __option(sym) || !__option(opt_dead_code)
- #define FLEXT_DEBUG
+ #define FLEXT_DEBUG
#endif
/* #define _LOG */
diff --git a/externals/grill/flext/source/fldefs.h b/externals/grill/flext/source/fldefs.h
index f0e37ab8..4f8a4264 100644
--- a/externals/grill/flext/source/fldefs.h
+++ b/externals/grill/flext/source/fldefs.h
@@ -15,13 +15,13 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifndef __FLEXT_DEFS_H
#define __FLEXT_DEFS_H
-/*! \defgroup FLEXT_DEFS Definitions for basic flext functionality
- @{
+/*! \defgroup FLEXT_DEFS Definitions for basic flext functionality
+ @{
*/
/*! \brief Switch for compilation of derived virtual classes
- \remark These need dynamic type casts (and RTTI, naturally)
- \ingroup FLEXT_GLOBALS
+ \remark These need dynamic type casts (and RTTI, naturally)
+ \ingroup FLEXT_GLOBALS
*/
#ifdef FLEXT_VIRT
#define FLEXT_CAST dynamic_cast
@@ -29,7 +29,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define FLEXT_CAST static_cast
#endif
-//! @} FLEXT_DEFS
+//! @} FLEXT_DEFS
#include "fldefs_hdr.h"
@@ -38,8 +38,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// ====================================================================================
-/*! \defgroup FLEXT_D_METHOD Declarations for flext methods
- @{
+/*! \defgroup FLEXT_D_METHOD Declarations for flext methods
+ @{
*/
#include "fldefs_methcb.h"
@@ -54,9 +54,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#ifdef FLEXT_ATTRIBUTES
-/*! \defgroup FLEXT_D_ATTRIB Attribute definition
- \note These have to reside inside the class declaration
- @{
+/*! \defgroup FLEXT_D_ATTRIB Attribute definition
+ \note These have to reside inside the class declaration
+ @{
*/
#include "fldefs_attrcb.h"
diff --git a/externals/grill/flext/source/fldefs_attradd.h b/externals/grill/flext/source/fldefs_attradd.h
index 50aef3cb..df2f9407 100644
--- a/externals/grill/flext/source/fldefs_attradd.h
+++ b/externals/grill/flext/source/fldefs_attradd.h
@@ -17,101 +17,101 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define __FLEXT_DEFS_ATTRADD_H
-/*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope
+/*! \defgroup FLEXT_D_CADDATTR Announce object attributes at class scope
\ingroup FLEXT_D_ATTRIB
- \note These can only be used at class construction time
- @{
+ \note These can only be used at class construction time
+ @{
*/
//! Add handler for a gettable attribute
-#define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \
+#define FLEXT_CADDATTR_GET(CL,NAME,GFUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
-#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
+#define FLEXT_CADDATTR_SET(CL,NAME,SFUN) \
\
AddAttrib(CL,NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
-#define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \
+#define FLEXT_CADDATTR_VAR(CL,NAME,GFUN,SFUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
-#define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \
+#define FLEXT_CADDATTR_VAR1(CL,NAME,FUN) \
\
AddAttrib(CL,NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
//! Add handler for a gettable enum attribute
-#define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \
+#define FLEXT_CADDATTR_GET_E(CL,NAME,GFUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable enum attribute
-#define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \
+#define FLEXT_CADDATTR_SET_E(CL,NAME,SFUN) \
\
AddAttrib(CL,NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
-#define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \
+#define FLEXT_CADDATTR_VAR_E(CL,NAME,GFUN,SFUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
-#define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \
+#define FLEXT_CADDATTR_VAR1_E(CL,NAME,FUN) \
\
AddAttrib(CL,NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))
//! @} FLEXT_D_CADDATTR
-/*! \defgroup FLEXT_D_ADDATTR Announce object attributes
+/*! \defgroup FLEXT_D_ADDATTR Announce object attributes
\ingroup FLEXT_D_ATTRIB
- \note These can only be used at object construction time
- \note (in constructor or in Init() function before call to parent's Init())
- @{
+ \note These can only be used at object construction time
+ \note (in constructor or in Init() function before call to parent's Init())
+ @{
*/
//! Add handler for a gettable attribute
-#define FLEXT_ADDATTR_GET(NAME,GFUN) \
+#define FLEXT_ADDATTR_GET(NAME,GFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable attribute
-#define FLEXT_ADDATTR_SET(NAME,SFUN) \
+#define FLEXT_ADDATTR_SET(NAME,SFUN) \
\
AddAttrib(NAME,NULL,(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
-#define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \
+#define FLEXT_ADDATTR_VAR(NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(GFUN)),(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable attribute
-#define FLEXT_ADDATTR_VAR1(NAME,FUN) \
+#define FLEXT_ADDATTR_VAR1(NAME,FUN) \
\
AddAttrib(NAME,(FLEXT_GET_PRE(FUN)),(FLEXT_SET_PRE(FUN)))
//! Add handler for a gettable enum attribute
-#define FLEXT_ADDATTR_GET_E(NAME,GFUN) \
+#define FLEXT_ADDATTR_GET_E(NAME,GFUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),NULL)
//! Add handler for a settable enum attribute
-#define FLEXT_ADDATTR_SET_E(NAME,SFUN) \
+#define FLEXT_ADDATTR_SET_E(NAME,SFUN) \
\
AddAttrib(NAME,NULL,(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
-#define FLEXT_ADDATTR_VAR_E(NAME,GFUN,SFUN) \
+#define FLEXT_ADDATTR_VAR_E(NAME,GFUN,SFUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(GFUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(SFUN)))
//! Add handlers for a both get- and settable enum attribute
-#define FLEXT_ADDATTR_VAR1_E(NAME,FUN) \
+#define FLEXT_ADDATTR_VAR1_E(NAME,FUN) \
\
AddAttrib(NAME,(bool (*)(flext_base *,int &))(FLEXT_GET_PRE(FUN)),(bool (*)(flext_base *,int &))(FLEXT_SET_PRE(FUN)))
diff --git a/externals/grill/flext/source/fldefs_attrcb.h b/externals/grill/flext/source/fldefs_attrcb.h
index cf9aec4c..85625a23 100644
--- a/externals/grill/flext/source/fldefs_attrcb.h
+++ b/externals/grill/flext/source/fldefs_attrcb.h
@@ -19,14 +19,14 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \brief Declare a attribute set function
- \internal
+ \internal
*/
#define FLEXT_CALLSET_(FUN,TP) \
static bool FLEXT_SET_PRE(FUN)(flext_base *c,TP &arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(arg); return true; }
/*! \brief Declare a attribute get function
- \internal
+ \internal
*/
#define FLEXT_CALLGET_(FUN,TP) \
static bool FLEXT_GET_PRE(FUN)(flext_base *c,TP &arg) \
@@ -34,9 +34,9 @@ static bool FLEXT_GET_PRE(FUN)(flext_base *c,TP &arg) \
-/*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers
+/*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers
\ingroup FLEXT_D_ATTRIB
- @{
+ @{
*/
//! Declare a set function for a float attribute
@@ -75,9 +75,9 @@ static bool FLEXT_SET_PRE(FUN)(flext_base *c,AtomList *&arg) \
//! @} FLEXT_DA_CALLSET
-/*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers
+/*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers
\ingroup FLEXT_D_ATTRIB
- @{
+ @{
*/
//! Declare a get function for a float attribute
@@ -117,9 +117,9 @@ static bool FLEXT_GET_PRE(FUN)(flext_base *c,AtomList *&arg) \
//! @} FLEXT_DA_CALLGET
-/*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set)
+/*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set)
\ingroup FLEXT_D_ATTRIB
- @{
+ @{
*/
//! Declare both get and set functions for a float attribute
diff --git a/externals/grill/flext/source/fldefs_attrvar.h b/externals/grill/flext/source/fldefs_attrvar.h
index c63fbb35..7f7db5ef 100644
--- a/externals/grill/flext/source/fldefs_attrvar.h
+++ b/externals/grill/flext/source/fldefs_attrvar.h
@@ -18,14 +18,14 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \brief Declare an implicit attribute set function
- \internal
+ \internal
*/
#define FLEXT_ATTRSET_(VAR,TP) \
static bool FLEXT_SET_PRE(VAR)(flext_base *c,TP &arg) \
{ FLEXT_CAST<thisType *>(c)->VAR = arg; return true; }
/*! \brief Declare an implicit attribute get function
- \internal
+ \internal
*/
#define FLEXT_ATTRGET_(VAR,TP) \
static bool FLEXT_GET_PRE(VAR)(flext_base *c,TP &arg) \
@@ -33,9 +33,9 @@ static bool FLEXT_GET_PRE(VAR)(flext_base *c,TP &arg) \
-/*! \defgroup FLEXT_DA_ATTRSET Definition of implicit attribute set handlers
+/*! \defgroup FLEXT_DA_ATTRSET Definition of implicit attribute set handlers
\ingroup FLEXT_D_ATTRIB
- @{
+ @{
*/
//! Declare an implicit set function for a float attribute
@@ -74,9 +74,9 @@ static bool FLEXT_SET_PRE(VAR)(flext_base *c,AtomList *&arg) \
//! @} FLEXT_DA_ATTRSET
-/*! \defgroup FLEXT_DA_ATTRGET Definition of implicit attribute get handlers
+/*! \defgroup FLEXT_DA_ATTRGET Definition of implicit attribute get handlers
\ingroup FLEXT_D_ATTRIB
- @{
+ @{
*/
//! Declare an implicit get function for a float attribute
@@ -116,9 +116,9 @@ static bool FLEXT_GET_PRE(VAR)(flext_base *c,AtomList *&arg) \
//! @} FLEXT_DA_ATTRGET
-/*! \defgroup FLEXT_DA_ATTRVAR Definition of implicit attribute transfer handlers (both get and set)
+/*! \defgroup FLEXT_DA_ATTRVAR Definition of implicit attribute transfer handlers (both get and set)
\ingroup FLEXT_D_ATTRIB
- @{
+ @{
*/
//! Declare both implicit get and set functions for a float attribute
diff --git a/externals/grill/flext/source/fldefs_methadd.h b/externals/grill/flext/source/fldefs_methadd.h
index e9cb93d4..562b72e3 100644
--- a/externals/grill/flext/source/fldefs_methadd.h
+++ b/externals/grill/flext/source/fldefs_methadd.h
@@ -17,25 +17,25 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define __FLEXT_DEFS_METHADD_H
-/*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope
+/*! \defgroup FLEXT_D_CADDMETHOD Add flext methods within class scope
\ingroup FLEXT_D_METHOD
- \note These can only be used at class construction time
- @{
+ \note These can only be used at class construction time
+ @{
*/
//! Add a method handler for bang
#define FLEXT_CADDBANG(CL,IX,M_FUN) \
\
-AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
+AddMethod(CL,IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with either no, list or anything arguments
#define FLEXT_CADDMETHOD(CL,IX,M_FUN) \
-AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
+AddMethod(CL,IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a method with implicit arguments
#define FLEXT_CADDMETHOD_(CL,IX,M_TAG,M_FUN) \
\
-AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
+AddMethod(CL,IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
#define FLEXT_CADDMETHOD_E(CL,IX,M_TAG,M_FUN) \
@@ -45,7 +45,7 @@ AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
//! Add a handler for a method with 1 argument
#define FLEXT_CADDMETHOD_1(CL,IX,M_TAG,M_FUN,TP1) \
\
-AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
+AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
#define FLEXT_CADDMETHOD_2(CL,IX,M_TAG,M_FUN,TP1,TP2) \
@@ -68,7 +68,7 @@ AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FL
AddMethod(ClMeths(CL),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
-// Shortcuts
+// Shortcuts
//! Add a handler for a method with a boolean argument
#define FLEXT_CADDMETHOD_B(CL,IX,M_TAG,M_FUN) \
@@ -108,11 +108,11 @@ FLEXT_CADDMETHOD_3(CL,IX,M_TAG,M_FUN,int,int,int)
//! @} FLEXT_D_CADDMETHOD
-/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
+/*! \defgroup FLEXT_D_ADDMETHOD Add flext methods
\ingroup FLEXT_D_METHOD
- \note These can only be used at object construction time
- \note (in constructor or in Init() function before call to parent's Init())
- @{
+ \note These can only be used at object construction time
+ \note (in constructor or in Init() function before call to parent's Init())
+ @{
*/
//! Set timer callback
@@ -123,37 +123,37 @@ TMR.SetCallback(*this,FLEXT_CALL_PRE(M_FUN))
//! Enable list element distribution over inlets (if no better handler found)
#define FLEXT_ADDDIST() \
\
-SetDist(true)
+SetDist(true)
//! Add a method handler for bang
#define FLEXT_ADDBANG(IX,M_FUN) \
\
-AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN))
+AddMethod(IX,"bang",FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with either no, list or anything arguments
#define FLEXT_ADDMETHOD(IX,M_FUN) \
-AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
+AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
/*! \brief Add a handler for a method with a (variable argument) list
- \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
- \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
+ \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
+ \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
*/
#define FLEXT_ADDMETHOD_V(IX,M_FUN) \
\
-AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
+AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
/*! \brief Add a handler for a method with an anything argument
- \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
- \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
+ \deprecated This definition obscures that _ indicates the usage of a message tag - use FLEXT_ADDMETHOD instead
+ \note This is already covered by FLEXT_ADDMETHOD, but here for the sake of clarity
*/
#define FLEXT_ADDMETHOD_A(IX,M_FUN) \
\
-AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
+AddMethod(IX,FLEXT_CALL_PRE(M_FUN))
//! Add a a handler for a tagged method with implicit arguments
#define FLEXT_ADDMETHOD_(IX,M_TAG,M_FUN) \
\
-AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
+AddMethod(IX,M_TAG,FLEXT_CALL_PRE(M_FUN))
//! Add a handler for a method with 1 enum type argument
#define FLEXT_ADDMETHOD_E(IX,M_TAG,M_FUN) \
@@ -163,7 +163,7 @@ AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),a_int,a_null)
//! Add a handler for a method with 1 argument
#define FLEXT_ADDMETHOD_1(IX,M_TAG,M_FUN,TP1) \
\
-AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
+AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),a_null)
//! Add a handler for a method with 2 arguments
#define FLEXT_ADDMETHOD_2(IX,M_TAG,M_FUN,TP1,TP2) \
@@ -186,7 +186,7 @@ AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEX
AddMethod(ThMeths(),IX,M_TAG,(methfun)(FLEXT_CALL_PRE(M_FUN)),FLEXTARG(TP1),FLEXTARG(TP2),FLEXTARG(TP3),FLEXTARG(TP4),FLEXTARG(TP5),a_null)
-// Shortcuts
+// Shortcuts
//! Add a handler for a method with a boolean argument
#define FLEXT_ADDMETHOD_B(IX,M_TAG,M_FUN) \
diff --git a/externals/grill/flext/source/fldefs_methcall.h b/externals/grill/flext/source/fldefs_methcall.h
index 8b6e1bde..1c4d30c1 100644
--- a/externals/grill/flext/source/fldefs_methcall.h
+++ b/externals/grill/flext/source/fldefs_methcall.h
@@ -17,9 +17,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define __FLEXT_DEFS_METHCALL_H
-/*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually
+/*! \defgroup FLEXT_D_CALLMETHOD Call flext methods manually
\ingroup FLEXT_D_METHOD
- @{
+ @{
*/
//! Call a (already defined) method with no arguments
diff --git a/externals/grill/flext/source/fldefs_methcb.h b/externals/grill/flext/source/fldefs_methcb.h
index 45763f59..929a7929 100644
--- a/externals/grill/flext/source/fldefs_methcb.h
+++ b/externals/grill/flext/source/fldefs_methcb.h
@@ -17,9 +17,9 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define __FLEXT_DEFS_METHCB_H
-/*! \defgroup FLEXT_D_CALLBACK Declare callbacks for class methods
+/*! \defgroup FLEXT_D_CALLBACK Declare callbacks for class methods
\ingroup FLEXT_D_METHOD
- @{
+ @{
*/
//! Set up a method callback with no arguments
@@ -83,7 +83,7 @@ static bool FLEXT_CALL_PRE(M_FUN)(flext_base *c,TP1 &arg1,TP2 &arg2,TP3 &arg3,TP
{ FLEXT_CAST<thisType *>(c)->M_FUN(arg1,arg2,arg3,arg4,arg5); return true; }
-// Shortcuts
+// Shortcuts
//! Set up a method callback for 1 float argument
#define FLEXT_CALLBACK_F(M_FUN) \
diff --git a/externals/grill/flext/source/fldefs_setup.h b/externals/grill/flext/source/fldefs_setup.h
index 255b18ad..9864c3c9 100644
--- a/externals/grill/flext/source/fldefs_setup.h
+++ b/externals/grill/flext/source/fldefs_setup.h
@@ -18,7 +18,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
// ====================================================================================
-/*! \defgroup FLEXT_D_INSTANCE Class instantiation
+/*! \defgroup FLEXT_D_INSTANCE Class instantiation
\note For stand-alone externals (not part of a library) the name of your class
\note is of importance! It must be the same as the external (excluded an eventual ~ (tilde))
@@ -32,53 +32,53 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
-/*! \defgroup FLEXT_D_NEW Stand-alone class instantiation
- Makes an actual instance of a stand-alone class.
+/*! \defgroup FLEXT_D_NEW Stand-alone class instantiation
+ Makes an actual instance of a stand-alone class.
*/
-/*! \defgroup FLEXT_D_NEW_DSP Dsp class instantiation
- Makes an actual instance of a dsp (aka "tilde") class (with signal processing).
+/*! \defgroup FLEXT_D_NEW_DSP Dsp class instantiation
+ Makes an actual instance of a dsp (aka "tilde") class (with signal processing).
*/
-/*! \defgroup FLEXT_D_LIB Library class instantiation
- Makes an actual instance of a class which is part of an object library (and not stand-alone).
+/*! \defgroup FLEXT_D_LIB Library class instantiation
+ Makes an actual instance of a class which is part of an object library (and not stand-alone).
*/
-/*! \defgroup FLEXT_D_LIB_DSP Dsp library class instantiation
- Makes an actual instance of a dsp (aka "tilde") class with signal processing
- which is part of an object library (and not stand-alone).
+/*! \defgroup FLEXT_D_LIB_DSP Dsp library class instantiation
+ Makes an actual instance of a dsp (aka "tilde") class with signal processing
+ which is part of an object library (and not stand-alone).
*/
// NO ARGUMENTS
// ----------------------------------------
/*! \brief Implementation of a flext class with no arguments
- \ingroup FLEXT_D_NEW
- \param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.)
- \param NEW_CLASS the object's C++ class name
+ \ingroup FLEXT_D_NEW
+ \param NAME the object's actual name(s) as a string (like "*", "trigger", "noise~", etc.)
+ \param NEW_CLASS the object's C++ class name
*/
-#define FLEXT_NEW(NAME,NEW_CLASS) \
+#define FLEXT_NEW(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,0,0)
/*! \brief Implementation of a flext dsp class with no arguments
- \ingroup FLEXT_D_NEW_DSP
+ \ingroup FLEXT_D_NEW_DSP
*/
-#define FLEXT_NEW_DSP(NAME,NEW_CLASS) \
+#define FLEXT_NEW_DSP(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,1,0)
/*! \brief Implementation of a flext class (part of a library) with no arguments
- \ingroup FLEXT_D_LIB
+ \ingroup FLEXT_D_LIB
*/
#define FLEXT_LIB(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,0,1)
/*! \brief Implementation of a flext dsp class (part of a library) with no arguments
- \ingroup FLEXT_D_LIB_DSP
+ \ingroup FLEXT_D_LIB_DSP
*/
-#define FLEXT_LIB_DSP(NAME,NEW_CLASS) \
+#define FLEXT_LIB_DSP(NAME,NEW_CLASS) \
\
REAL_NEW(NAME,NEW_CLASS,1,1)
@@ -87,30 +87,30 @@ REAL_NEW(NAME,NEW_CLASS,1,1)
// ----------------------------------------
/*! \brief Implementation of a flext class with a variable argument list
- \ingroup FLEXT_D_NEW
+ \ingroup FLEXT_D_NEW
*/
-#define FLEXT_NEW_V(NAME,NEW_CLASS) \
+#define FLEXT_NEW_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS,0,0) \
/*! \brief Implementation of a flext dsp class with a variable argument list
- \ingroup FLEXT_D_NEW_DSP
+ \ingroup FLEXT_D_NEW_DSP
*/
-#define FLEXT_NEW_DSP_V(NAME,NEW_CLASS) \
+#define FLEXT_NEW_DSP_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS,1,0) \
/*! \brief Implementation of a flext class (part of a library) with a variable argument list
- \ingroup FLEXT_D_LIB
+ \ingroup FLEXT_D_LIB
*/
-#define FLEXT_LIB_V(NAME,NEW_CLASS) \
+#define FLEXT_LIB_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS, 0,1)
/*! \brief Implementation of a flext dsp class (part of a library) with a variable argument list
- \ingroup FLEXT_D_LIB_DSP
+ \ingroup FLEXT_D_LIB_DSP
*/
-#define FLEXT_LIB_DSP_V(NAME,NEW_CLASS) \
+#define FLEXT_LIB_DSP_V(NAME,NEW_CLASS) \
\
REAL_NEW_V(NAME,NEW_CLASS, 1,1)
@@ -119,30 +119,30 @@ REAL_NEW_V(NAME,NEW_CLASS, 1,1)
// ----------------------------------------
/*! \brief Implementation of a flext class with one argument
- \ingroup FLEXT_D_NEW
+ \ingroup FLEXT_D_NEW
*/
-#define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE) \
+#define FLEXT_NEW_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 0, 0,TYPE) \
/*! \brief Implementation of a flext dsp class with one argument
- \ingroup FLEXT_D_NEW_DSP
+ \ingroup FLEXT_D_NEW_DSP
*/
-#define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE) \
+#define FLEXT_NEW_DSP_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 1, 0,TYPE) \
/*! \brief Implementation of a flext class (part of a library) with one argument
- \ingroup FLEXT_D_LIB
+ \ingroup FLEXT_D_LIB
*/
#define FLEXT_LIB_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 0,1,TYPE)
/*! \brief Implementation of a flext dsp class (part of a library) with one argument
- \ingroup FLEXT_D_LIB_DSP
+ \ingroup FLEXT_D_LIB_DSP
*/
-#define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE) \
+#define FLEXT_LIB_DSP_1(NAME,NEW_CLASS, TYPE) \
\
REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE)
@@ -151,30 +151,30 @@ REAL_NEW_1(NAME,NEW_CLASS, 1,1, TYPE)
// ----------------------------------------
/*! \brief Implementation of a flext class with 2 arguments
- \ingroup FLEXT_D_NEW
+ \ingroup FLEXT_D_NEW
*/
-#define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
+#define FLEXT_NEW_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2) \
/*! \brief Implementation of a flext dsp class with 2 arguments
- \ingroup FLEXT_D_NEW_DSP
+ \ingroup FLEXT_D_NEW_DSP
*/
-#define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
+#define FLEXT_NEW_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2) \
/*! \brief Implementation of a flext class (part of a library) with 2 arguments
- \ingroup FLEXT_D_LIB
+ \ingroup FLEXT_D_LIB
*/
-#define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
+#define FLEXT_LIB_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 0,1, TYPE1, TYPE2)
/*! \brief Implementation of a flext dsp class (part of a library) with 2 arguments
- \ingroup FLEXT_D_LIB_DSP
+ \ingroup FLEXT_D_LIB_DSP
*/
-#define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
+#define FLEXT_LIB_DSP_2(NAME,NEW_CLASS, TYPE1, TYPE2) \
\
REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2)
@@ -183,39 +183,39 @@ REAL_NEW_2(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2)
// ----------------------------------------
/*! \brief Implementation of a flext class with 3 arguments
- \ingroup FLEXT_D_NEW
+ \ingroup FLEXT_D_NEW
*/
#define FLEXT_NEW_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 0,0, TYPE1, TYPE2, TYPE3) \
/*! \brief Implementation of a flext dsp class with 3 arguments
- \ingroup FLEXT_D_NEW_DSP
+ \ingroup FLEXT_D_NEW_DSP
*/
-#define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
+#define FLEXT_NEW_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 1,0, TYPE1, TYPE2, TYPE3) \
/*! \brief Implementation of a flext class (part of a library) with 3 arguments
- \ingroup FLEXT_D_LIB
+ \ingroup FLEXT_D_LIB
*/
-#define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
+#define FLEXT_LIB_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 0,1,TYPE1, TYPE2, TYPE3)
/*! \brief Implementation of a flext dsp class (part of a library) with 3 arguments
- \ingroup FLEXT_D_LIB_DSP
+ \ingroup FLEXT_D_LIB_DSP
*/
-#define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
+#define FLEXT_LIB_DSP_3(NAME,NEW_CLASS, TYPE1, TYPE2, TYPE3) \
\
REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
// deprecated stuff
-/*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions
- \deprecated
- @{
+/*! \defgroup FLEXT_D_DEPRECATED Deprecated definitions
+ \deprecated
+ @{
*/
#define FLEXT_NEW_G FLEXT_NEW_V
@@ -239,22 +239,22 @@ REAL_NEW_3(NAME,NEW_CLASS, 1,1, TYPE1, TYPE2, TYPE3)
//! @} FLEXT_D_DEPRECATED
-/*! \defgroup FLEXT_D_LIBRARY Definitions for library objects
- @{
+/*! \defgroup FLEXT_D_LIBRARY Definitions for library objects
+ @{
*/
/*! \brief Specify that to declare the library itself.
- \note If you have a library this is compulsory (to register all the objects of the library)
+ \note If you have a library this is compulsory (to register all the objects of the library)
*/
#define FLEXT_LIB_SETUP(NAME,SETUPFUN) REAL_LIB_SETUP(NAME,SETUPFUN)
/*! \brief Register an object in the library.
- \note This is used in the library setup function
+ \note This is used in the library setup function
*/
#define FLEXT_SETUP(cl) REAL_SETUP(cl,0)
/*! \brief Register a DSP object in the library.
- \note This is used in the library setup function
+ \note This is used in the library setup function
*/
#define FLEXT_DSP_SETUP(cl) REAL_SETUP(cl,1)
diff --git a/externals/grill/flext/source/fldoxygen.h b/externals/grill/flext/source/fldoxygen.h
index 27b000c0..c55859db 100644
--- a/externals/grill/flext/source/fldoxygen.h
+++ b/externals/grill/flext/source/fldoxygen.h
@@ -2,8 +2,8 @@
#define __FLEXT_DOXYGEN_H
/*! \file fldoxygen.h
- \brief Doxygen definitions
- \remark There is no code in here, just documentation stuff.
+ \brief Doxygen definitions
+ \remark There is no code in here, just documentation stuff.
*/
/*!
@@ -110,9 +110,9 @@ With these lines, all the necessary definitions from the flext package have been
\verbatim
class attr1:
- public flext_base
+ public flext_base
{
- FLEXT_HEADER(attr1,flext_base)
+ FLEXT_HEADER(attr1,flext_base)
\endverbatim
A flext class is simply defined by inheriting from the flext_base (see also \ref FLEXT_CLASS)
@@ -121,18 +121,18 @@ Additionally some information has to be added using FLEXT_HEADER (see \ref FLEXT
\verbatim
public:
- // constructor
- attr1();
+ // constructor
+ attr1();
\endverbatim
Normally the constructor takes the creation arguments of an object. Here there are none.
\verbatim
protected:
- void m_trigger(float f);
-
- // stored argument
- float arg;
+ void m_trigger(float f);
+
+ // stored argument
+ float arg;
\endverbatim
These are methods and data elements for internal class usage. Flext doesn't know about them
@@ -140,11 +140,11 @@ as long as they are not registered.
\verbatim
private:
- // callback for method "m_trigger" (with one float argument)
- FLEXT_CALLBACK_F(m_trigger);
+ // callback for method "m_trigger" (with one float argument)
+ FLEXT_CALLBACK_F(m_trigger);
- // define attribute callbacks for variable "arg" (with GET and SET properties)
- FLEXT_ATTRVAR_F(arg);
+ // define attribute callbacks for variable "arg" (with GET and SET properties)
+ FLEXT_ATTRVAR_F(arg);
};
\endverbatim
@@ -166,23 +166,23 @@ or a DSP object (see \ref FLEXT_D_NEW_DSP) is created and whether it resides in
\verbatim
attr1::attr1():
- arg(0) // initialize argument
+ arg(0) // initialize argument
{
- // define inlets
- AddInAnything(); // first inlet of type anything (index 0)
-
- // define outlets
- AddOutFloat(); // one float outlet (has index 0)
+ // define inlets
+ AddInAnything(); // first inlet of type anything (index 0)
+
+ // define outlets
+ AddOutFloat(); // one float outlet (has index 0)
\endverbatim
-
+
Every inlet and outlet that the object shall have has to be registered.
This is done with the functions in \ref FLEXT_C_IO_ADD.
\verbatim
- // register methods
- FLEXT_ADDMETHOD(0,m_trigger); // register method (for floats) "m_trigger" for inlet 0
+ // register methods
+ FLEXT_ADDMETHOD(0,m_trigger); // register method (for floats) "m_trigger" for inlet 0
- FLEXT_ADDATTR_VAR1("arg",arg); // register attribute "arg" with variable arg
+ FLEXT_ADDATTR_VAR1("arg",arg); // register attribute "arg" with variable arg
}
\endverbatim
@@ -195,10 +195,10 @@ used are known beforehand (see \ref FLEXT_D_CADDMETHOD and \ref FLEXT_D_CADDATTR
\verbatim
void attr1::m_trigger(float f)
{
- float res = arg+f;
-
- // output value to outlet
- ToOutFloat(0,res); // (0 stands for the outlet index 0)
+ float res = arg+f;
+
+ // output value to outlet
+ ToOutFloat(0,res); // (0 stands for the outlet index 0)
}
\endverbatim
diff --git a/externals/grill/flext/source/fldsp.cpp b/externals/grill/flext/source/fldsp.cpp
index b8dce7ca..3344f4a1 100644
--- a/externals/grill/flext/source/fldsp.cpp
+++ b/externals/grill/flext/source/fldsp.cpp
@@ -24,50 +24,50 @@ const t_symbol *flext_dsp::dspsym = MakeSymbol("__flext_dspfun__");
void flext_dsp::Setup(t_classid id)
{
- t_class *c = getClass(id);
+ t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_MAX
-// dsp_initclass();
- dsp_initboxclass();
- add_dsp(c,cb_dsp);
+// 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);
+ 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);
+ 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_CLASSDEF(flext_dsp)():
#if FLEXT_SYS == FLEXT_SYS_JMAX
- srate(fts_dsp_get_sample_rate()), // should we set it?
- blksz(fts_dsp_get_tick_size()),
+ 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()),
+ 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()),
+ chnsin(sys_get_inchannels()),
+ chnsout(sys_get_outchannels()),
#elif FLEXT_SYS == FLEXT_SYS_MAX
- chnsin(sys_getch()),
- chnsout(sys_getch()),
+ chnsin(sys_getch()),
+ chnsout(sys_getch()),
#elif FLEXT_SYS == FLEXT_SYS_JMAX
- #pragma message("not implemented")
- chnsin(0),chnsout(0),
+ #pragma message("not implemented")
+ chnsin(0),chnsout(0),
#else
#error
#endif
#if FLEXT_SYS != FLEXT_SYS_MAX
- dspon(true),
+ dspon(true),
#endif
- invecs(NULL),outvecs(NULL)
+ invecs(NULL),outvecs(NULL)
{
#if FLEXT_SYS == FLEXT_SYS_JMAX
- fts_dsp_object_init(thisHdr());
+ fts_dsp_object_init(thisHdr());
#endif
}
@@ -75,18 +75,18 @@ flext_dsp::FLEXT_CLASSDEF(flext_dsp)():
flext_dsp::~FLEXT_CLASSDEF(flext_dsp)()
{
#if FLEXT_SYS == FLEXT_SYS_JMAX
- fts_dsp_object_delete(thisHdr());
+ fts_dsp_object_delete(thisHdr());
#endif
/*
#if FLEXT_SYS == FLEXT_SYS_MAX
- // switch off dsp as the dsp function might get called afterwards (?!)
- thisHdr()->z_disabled = true;
-
- if(invecs) delete[] invecs;
- if(outvecs) delete[] outvecs;
+ // switch off dsp as the dsp function might get called afterwards (?!)
+ thisHdr()->z_disabled = true;
+
+ if(invecs) delete[] invecs;
+ if(outvecs) delete[] outvecs;
#elif FLEXT_SYS == FLEXT_SYS_PD
- dspon = false;
+ dspon = false;
#endif
*/
}
@@ -98,23 +98,23 @@ void flext_dsp::dspmeth(fts_word_t *w)
#else
t_int *flext_dsp::dspmeth(t_int *w)
{
- flext_dsp *obj = (flext_dsp *)w[1];
+ flext_dsp *obj = (flext_dsp *)w[1];
/*
#ifdef FLEXT_DEBUG
- if(!obj->thisHdr()) {
- // object is already deleted!
- ERRINTERNAL();
- return w+3;
- }
+ if(!obj->thisHdr()) {
+ // object is already deleted!
+ ERRINTERNAL();
+ return w+3;
+ }
#endif
*/
#if FLEXT_SYS == FLEXT_SYS_MAX
- if(!obj->thisHdr()->z_disabled)
+ if(!obj->thisHdr()->z_disabled)
#else
- if(obj->dspon)
+ if(obj->dspon)
#endif
- obj->m_signal(obj->blksz,obj->invecs,obj->outvecs);
- return w+2;
+ obj->m_signal(obj->blksz,obj->invecs,obj->outvecs);
+ return w+2;
}
#endif
@@ -126,72 +126,72 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp,short *count)
void flext_dsp::cb_dsp(t_class *c,t_signal **sp)
#endif
{
- flext_dsp *obj = thisObject(c);
+ flext_dsp *obj = thisObject(c);
- if(obj->CntInSig()+obj->CntOutSig() == 0) return;
+ if(obj->CntInSig()+obj->CntOutSig() == 0) return;
- // store current dsp parameters
+ // 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() ?
+ 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() ?
+ 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();
+ obj->chnsin = sys_get_inchannels();
+ obj->chnsout = sys_get_outchannels();
#elif FLEXT_SYS == FLEXT_SYS_MAX
- obj->chnsin = obj->chnsout = sys_getch();
+ obj->chnsin = obj->chnsout = sys_getch();
#elif FLEXT_SYS == FLEXT_SYS_JMAX
- #pragma message ("How to query the channels?")
+ #pragma message ("How to query the channels?")
#else
#error
#endif
*/
- // store in and out signal vectors
- int i;
- int in = obj->chnsin = obj->CntInSig();
- int out = obj->chnsout = obj->CntOutSig();
+ // store in and out signal vectors
+ int i;
+ int in = obj->chnsin = obj->CntInSig();
+ int out = obj->chnsout = obj->CntOutSig();
#if FLEXT_SYS == FLEXT_SYS_PD
- // min. 1 input channel! (CLASS_MAININLET in pd...)
- if(!in) { obj->chnsin = in = 1; }
+ // min. 1 input channel! (CLASS_MAININLET in pd...)
+ if(!in) { obj->chnsin = 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(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);
+ fts_dsp_get_input_name(dsp,i);
#else
- sp[i]->s_vec;
+ 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(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);
+ fts_dsp_get_output_name(dsp,i);
#else
- sp[in+i]->s_vec;
+ 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);
+ // 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
+ // set the DSP function
#if FLEXT_SYS == FLEXT_SYS_JMAX
- fts_atom_t args;
- fts_set_pointer(args,obj);
- fts_dsp_add_function(dspsym,1,args);
+ fts_atom_t args;
+ fts_set_pointer(args,obj);
+ fts_dsp_add_function(dspsym,1,args);
#else
- dsp_add((t_dspmethod)dspmeth,1,obj);
+ dsp_add((t_dspmethod)dspmeth,1,obj);
#endif
}
@@ -199,12 +199,12 @@ void flext_dsp::cb_dsp(t_class *c,t_signal **sp)
#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);
+ 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);
+ fts_dsp_remove_object(c);
}
#endif
*/
@@ -213,7 +213,7 @@ void flext_dsp::m_dsp(int /*n*/,t_signalvec const * /*insigs*/,t_signalvec const
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);
+ for(int i = 0; i < CntOutSig(); ++i) ZeroSamples(outs[i],n);
}
#if FLEXT_SYS != FLEXT_SYS_MAX
diff --git a/externals/grill/flext/source/flext.cpp b/externals/grill/flext/source/flext.cpp
index b89e464b..eb3f2a35 100644
--- a/externals/grill/flext/source/flext.cpp
+++ b/externals/grill/flext/source/flext.cpp
@@ -21,160 +21,160 @@ WARRANTIES, see the file, "license.txt," in this distribution.
bool flext_base::compatibility = true;
flext_base::FLEXT_CLASSDEF(flext_base)():
- inlist(NULL),outlist(NULL),
- curtag(NULL),
- incnt(0),outcnt(0),
- insigs(0),outsigs(0),
- distmsgs(false)
+ inlist(NULL),outlist(NULL),
+ curtag(NULL),
+ incnt(0),outcnt(0),
+ insigs(0),outsigs(0),
+ distmsgs(false)
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- ,outlets(NULL),inlets(NULL)
+ ,outlets(NULL),inlets(NULL)
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
- ,indesc(NULL),outdesc(NULL)
+ ,indesc(NULL),outdesc(NULL)
#endif
{
- FLEXT_LOG1("%s - flext logging is on",thisName());
-
- t_classid clid = thisClassId();
- clmethhead = ClMeths(clid);
- methhead = new ItemCont;
- bindhead = NULL;
-
- if(procattr) {
- // initialize when attribute processing is enabled
- attrhead = new ItemCont;
- clattrhead = ClAttrs(clid);
- attrdata = new AttrDataCont;
- }
- else {
- attrhead = clattrhead = NULL;
- attrdata = NULL;
- }
+ FLEXT_LOG1("%s - flext logging is on",thisName());
+
+ t_classid clid = thisClassId();
+ clmethhead = ClMeths(clid);
+ methhead = new ItemCont;
+ bindhead = NULL;
+
+ if(procattr) {
+ // initialize when attribute processing is enabled
+ attrhead = new ItemCont;
+ clattrhead = ClAttrs(clid);
+ attrdata = new AttrDataCont;
+ }
+ else {
+ attrhead = clattrhead = NULL;
+ attrdata = NULL;
+ }
}
flext_base::~FLEXT_CLASSDEF(flext_base)()
{
#if FLEXT_SYS == FLEXT_SYS_MAX
// according to David Z. one should do that first...
-// if(insigs) dsp_free(thisHdr());
- if(insigs) dsp_freebox(thisHdr());
+// if(insigs) dsp_free(thisHdr());
+ if(insigs) dsp_freebox(thisHdr());
#endif
#ifdef FLEXT_THREADS
- StopThreads();
+ StopThreads();
#endif
- // send remaining pending messages for this object
- QFlush(this);
+ // send remaining pending messages for this object
+ QFlush(this);
- // delete message lists
- if(methhead) delete methhead;
- if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
- if(attrhead) delete attrhead;
- if(attrdata) delete attrdata;
-
- // destroy inlets and outlets and their proxy objects
- if(inlist) delete inlist;
- if(outlist) delete outlist;
+ // delete message lists
+ if(methhead) delete methhead;
+ if(bindhead) delete bindhead; // ATTENTION: the object must free all memory associated to bindings itself
+ if(attrhead) delete attrhead;
+ if(attrdata) delete attrdata;
+
+ // destroy inlets and outlets and their proxy objects
+ if(inlist) delete inlist;
+ if(outlist) delete outlist;
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- if(outlets) delete[] outlets;
+ if(outlets) delete[] outlets;
- if(inlets) {
- for(int ix = 0; ix < incnt; ++ix)
- if(inlets[ix]) {
- // release proxy object
+ if(inlets) {
+ for(int ix = 0; ix < incnt; ++ix)
+ if(inlets[ix]) {
+ // release proxy object
#if FLEXT_SYS == FLEXT_SYS_PD
- pd_free(&inlets[ix]->obj.ob_pd);
+ pd_free(&inlets[ix]->obj.ob_pd);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- freeobject((object *)inlets[ix]);
+ freeobject((object *)inlets[ix]);
#endif
- }
- delete[] inlets;
- }
+ }
+ delete[] inlets;
+ }
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
- if(indesc) {
- for(int i = 0; i < incnt; ++i) if(indesc[i]) delete[] indesc[i];
- delete[] indesc;
- }
- if(outdesc) {
- for(int i = 0; i < outcnt; ++i) if(outdesc[i]) delete[] outdesc[i];
- delete[] outdesc;
- }
+ if(indesc) {
+ for(int i = 0; i < incnt; ++i) if(indesc[i]) delete[] indesc[i];
+ delete[] indesc;
+ }
+ if(outdesc) {
+ for(int i = 0; i < outcnt; ++i) if(outdesc[i]) delete[] outdesc[i];
+ delete[] outdesc;
+ }
#endif
}
/*! This virtual function is called after the object has been created, that is,
- after the constructor has been processed.
- It creates the inlets and outlets and the message and attribute lists.
- \note You can override it in your own class, but be sure to call it,
- \note otherwise no inlets/outlets will be created
- \note All inlet, outlets, method and attribute declarations must be made before a call to Init!
- \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation
- \remark in reverse.
+ after the constructor has been processed.
+ It creates the inlets and outlets and the message and attribute lists.
+ \note You can override it in your own class, but be sure to call it,
+ \note otherwise no inlets/outlets will be created
+ \note All inlet, outlets, method and attribute declarations must be made before a call to Init!
+ \remark Creation of inlets/outlets can't be done upon declaration, as Max/MSP needs creation
+ \remark in reverse.
*/
bool flext_base::Init()
{
- bool ok = flext_obj::Init();
+ bool ok = flext_obj::Init();
- if(ok) ok = InitInlets() && InitOutlets();
+ if(ok) ok = InitInlets() && InitOutlets();
- if(ok) {
- if(procattr && m_holdaargc && m_holdaargv) {
- // initialize creation attributes
- ok = InitAttrib(m_holdaargc,m_holdaargv);
- }
- }
+ if(ok) {
+ if(procattr && m_holdaargc && m_holdaargv) {
+ // initialize creation attributes
+ ok = InitAttrib(m_holdaargc,m_holdaargv);
+ }
+ }
- return ok;
+ return ok;
}
/*! Set up proxy classes and basic methods at class creation time
- This ensures that they are processed before the registered flext messages
+ This ensures that they are processed before the registered flext messages
*/
void flext_base::Setup(t_classid id)
{
- t_class *c = getClass(id);
+ t_class *c = getClass(id);
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- add_method(c,cb_help,"help");
- add_loadbang(c,cb_loadbang);
+ add_method(c,cb_help,"help");
+ add_loadbang(c,cb_loadbang);
#if FLEXT_SYS == FLEXT_SYS_MAX
- add_assist(c,cb_assist);
+ add_assist(c,cb_assist);
#endif
#else
- fts_class_message_varargs(c,MakeSymbol("help"),cb_help);
- #pragma message ("no implementation of loadbang or assist")
+ fts_class_message_varargs(c,MakeSymbol("help"),cb_help);
+ #pragma message ("no implementation of loadbang or assist")
#endif
- if(process_attributes) {
- AddMethod(id,0,"getattributes",cb_ListAttrib);
- AddMethod(id,0,"getmethods",cb_ListMethods);
+ if(process_attributes) {
+ AddMethod(id,0,"getattributes",cb_ListAttrib);
+ AddMethod(id,0,"getmethods",cb_ListMethods);
#if FLEXT_SYS == FLEXT_SYS_PD && !defined(FLEXT_NOATTREDIT)
- AddMethod(id,0,"attributedialog",cb_AttrDialog);
- SetAttrEditor(id);
+ AddMethod(id,0,"attributedialog",cb_AttrDialog);
+ SetAttrEditor(id);
#endif
- }
+ }
- SetProxies(c);
+ SetProxies(c);
- StartQueue();
+ StartQueue();
}
#if FLEXT_SYS == FLEXT_SYS_JMAX
-void flext_base::cb_help(fts_object_t *c,int, fts_symbol_t, int, const fts_atom_t *) { thisObject(c)->m_help(); }
+void flext_base::cb_help(fts_object_t *c,int, fts_symbol_t, int, const fts_atom_t *) { thisObject(c)->m_help(); }
#else
-void flext_base::cb_help(t_class *c) { thisObject(c)->m_help(); }
-void flext_base::cb_loadbang(t_class *c) { thisObject(c)->m_loadbang(); }
+void flext_base::cb_help(t_class *c) { thisObject(c)->m_help(); }
+void flext_base::cb_loadbang(t_class *c) { thisObject(c)->m_loadbang(); }
#endif
void flext_base::m_help()
{
- // This should better be overloaded
- post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__);
+ // This should better be overloaded
+ post("%s (using flext " FLEXT_VERSTR ") - compiled on %s %s",thisName(),__DATE__,__TIME__);
}
void flext_base::m_loadbang() {}
@@ -186,16 +186,16 @@ void flext_base::cb_assist(t_class *c,void * /*b*/,long msg,long arg,char *s) {
void flext_base::m_assist(long msg,long arg,char *s)
{
#if FLEXT_SYS == FLEXT_SYS_MAX
- switch(msg) {
- case 1: //ASSIST_INLET:
- strcpy(s,arg < incnt && indesc[arg]?indesc[arg]:"");
- break;
- case 2: //ASSIST_OUTLET:
- if(arg < outcnt)
- strcpy(s,outdesc[arg]?outdesc[arg]:"");
- else
- strcpy(s,arg == outcnt && procattr?"Attributes":"");
- break;
- }
+ switch(msg) {
+ case 1: //ASSIST_INLET:
+ strcpy(s,arg < incnt && indesc[arg]?indesc[arg]:"");
+ break;
+ case 2: //ASSIST_OUTLET:
+ if(arg < outcnt)
+ strcpy(s,outdesc[arg]?outdesc[arg]:"");
+ else
+ strcpy(s,arg == outcnt && procattr?"Attributes":"");
+ break;
+ }
#endif
}
diff --git a/externals/grill/flext/source/flext.h b/externals/grill/flext/source/flext.h
index 4f4f166c..41996a0d 100644
--- a/externals/grill/flext/source/flext.h
+++ b/externals/grill/flext/source/flext.h
@@ -23,10 +23,10 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
//! \brief flext version number
-#define FLEXT_VERSION 406
+#define FLEXT_VERSION 407
//! \brief flext version string
-#define FLEXT_VERSTR "0.4.6"
+#define FLEXT_VERSTR "0.4.7pre"
//! @}
diff --git a/externals/grill/flext/source/flinternal.h b/externals/grill/flext/source/flinternal.h
index 29887f8e..0bdc3bf6 100644
--- a/externals/grill/flext/source/flinternal.h
+++ b/externals/grill/flext/source/flinternal.h
@@ -10,10 +10,10 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \file flinternal.h
\brief Definitions for internal flext usage
- \internal
+ \internal
Here, a few shortcuts for common Max/MSP or PD library calls and type definitions
- are declared
+ are declared
*/
#ifndef __FLEXT_INTERNALS_H
@@ -26,7 +26,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define object_new(clss) pd_new(clss)
#define object_free(obj) pd_free(&(obj)->ob_pd)
-
+
#define add_dsp(clss,meth) class_addmethod(clss, (t_method)meth,gensym("dsp"),A_NULL)
diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp
index c8697279..8970e1c3 100755
--- a/externals/grill/flext/source/flitem.cpp
+++ b/externals/grill/flext/source/flitem.cpp
@@ -18,57 +18,57 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext_base::Item::~Item()
{
- if(nxt) delete nxt;
+ if(nxt) delete nxt;
}
flext_base::ItemSet::ItemSet() {}
flext_base::ItemSet::~ItemSet()
{
- for(iterator it = begin(); it != end(); ++it)
- if(it.data()) delete it.data();
+ for(iterator it = begin(); it != end(); ++it)
+ if(it.data()) delete it.data();
}
flext_base::ItemCont::ItemCont():
- memsize(0),size(0),members(0),cont(NULL)
+ memsize(0),size(0),members(0),cont(NULL)
{}
flext_base::ItemCont::~ItemCont()
{
- if(cont) {
- for(int i = 0; i < size; ++i) delete cont[i];
- delete[] cont;
- }
+ if(cont) {
+ for(int i = 0; i < size; ++i) delete cont[i];
+ delete[] cont;
+ }
}
void flext_base::ItemCont::Resize(int nsz)
{
- if(nsz > memsize) {
- int nmemsz = nsz+10; // increment maximum allocation size
- ItemSet **ncont = new ItemSet *[nmemsz]; // make new array
- if(cont) {
- memcpy(ncont,cont,size*sizeof(*cont)); // copy existing entries
- delete[] cont;
- }
- cont = ncont; // set current array
- memsize = nmemsz; // set new allocation size
- }
-
- // make new items
- while(size < nsz) cont[size++] = new ItemSet;
+ if(nsz > memsize) {
+ int nmemsz = nsz+10; // increment maximum allocation size
+ ItemSet **ncont = new ItemSet *[nmemsz]; // make new array
+ if(cont) {
+ memcpy(ncont,cont,size*sizeof(*cont)); // copy existing entries
+ delete[] cont;
+ }
+ cont = ncont; // set current array
+ memsize = nmemsz; // set new allocation size
+ }
+
+ // make new items
+ while(size < nsz) cont[size++] = new ItemSet;
}
void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet)
{
if(!Contained(inlet)) Resize(inlet+2);
ItemSet &set = GetInlet(inlet);
- Item *&lst = set[tag];
- if(!lst)
- lst = item;
- else
- for(;;)
- if(!lst->nxt) { lst->nxt = item; break; }
- else lst = lst->nxt;
+ Item *&lst = set[tag];
+ if(!lst)
+ lst = item;
+ else
+ for(;;)
+ if(!lst->nxt) { lst->nxt = item; break; }
+ else lst = lst->nxt;
members++;
}
@@ -80,9 +80,9 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet)
if(it != set.end()) {
for(Item *lit = it.data(),*prv = NULL; lit; prv = lit,lit = lit->nxt) {
if(lit == item) {
- if(prv) prv->nxt = lit->nxt;
- else it.data() = lit->nxt;
-
+ if(prv) prv->nxt = lit->nxt;
+ else it.data() = lit->nxt;
+
lit->nxt = NULL; delete lit;
return true;
}
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index 203f4aa9..f9d2f84b 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -170,7 +170,19 @@ void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
sizeof(flext_hdr),NULL,A_GIMME,A_NULL);
#endif
process_attributes = attr;
- setupfun();
+
+ try {
+ setupfun();
+ }
+ catch(std::exception &x) {
+ error("%s - Exception at library setup: %s",name,x.what());
+ }
+ catch(const char *txt) {
+ error("%s - Exception at library setup: %s",name,txt);
+ }
+ catch(...) {
+ error("%s - Unknown exception at library setup",name);
+ }
}
#if FLEXT_SYS == FLEXT_SYS_JMAX
@@ -287,8 +299,19 @@ void flext_obj::obj_add(bool lib,bool dsp,bool attr,const char *idname,const cha
#endif
}
- // call class setup function
- setupfun(clid);
+ try {
+ // call class setup function
+ setupfun(clid);
+ }
+ catch(std::exception &x) {
+ error("%s - Exception while initializing class: %s",idname,x.what());
+ }
+ catch(const char *txt) {
+ error("%s - Exception while initializing class: %s",idname,txt);
+ }
+ catch(...) {
+ error("%s - Unknown exception while initializing class",idname);
+ }
}
@@ -370,65 +393,81 @@ flext_hdr *flext_obj::obj_new(const t_symbol *s,int _argc_,t_atom *argv)
error("%s: Creation arguments do not match",GetString(s));
}
+
if(ok) {
- t_classid clid;
+ try {
+ t_classid clid;
#if FLEXT_SYS == FLEXT_SYS_PD
- clid = lo->clss;
- obj = (flext_hdr *)::pd_new(lo->clss);
+ clid = lo->clss;
+ obj = (flext_hdr *)::pd_new(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clid = lo;
- obj = (flext_hdr *)::newobject(lo->clss);
+ clid = lo;
+ obj = (flext_hdr *)::newobject(lo->clss);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
- clid = lo->clss;
+ clid = lo->clss;
#else
#error
#endif
- flext_obj::m_holder = obj;
- flext_obj::m_holdname = s;
- flext_obj::m_holdattr = lo->attr;
-
- // get actual flext object (newfun calls "new flext_obj()")
- if(lo->argc >= 0)
- obj->data = lo->newfun(lo->argc,args);
- else
- obj->data = lo->newfun(argc,argv);
-
- flext_obj::m_holder = NULL;
- flext_obj::m_holdname = NULL;
- flext_obj::m_holdattr = false;
-
- ok = obj->data &&
- // check constructor exit flag
- obj->data->InitOk();
-
- if(ok) {
- if(lo->attr) {
- // DON'T convert eventual patcher args here... this is done by the actual attribute stuff
- // so that the initial $- or #- be preserved!
-
- // store creation args for attribute initialization (inside flext_base::Init())
- flext_obj::m_holdaargc = _argc_-argc;
- flext_obj::m_holdaargv = argv+argc;
- }
- else {
- flext_obj::m_holdaargc = 0;
- flext_obj::m_holdaargv = NULL;
- }
-
- // call virtual init function
- // here, inlets, outlets, methods and attributes can be set up
- ok = obj->data->Init();
-
- // call another virtual init function
- if(ok) ok = obj->data->Finalize();
-
- flext_obj::m_holdaargc = 0;
- flext_obj::m_holdaargv = NULL;
- }
-
- if(!ok) {
+ flext_obj::m_holder = obj;
+ flext_obj::m_holdname = s;
+ flext_obj::m_holdattr = lo->attr;
+
+ // get actual flext object (newfun calls "new flext_obj()")
+ if(lo->argc >= 0)
+ obj->data = lo->newfun(lo->argc,args);
+ else
+ obj->data = lo->newfun(argc,argv);
+
+ flext_obj::m_holder = NULL;
+ flext_obj::m_holdname = NULL;
+ flext_obj::m_holdattr = false;
+
+ ok = obj->data &&
+ // check constructor exit flag
+ obj->data->InitOk();
+
+ if(ok) {
+ if(lo->attr) {
+ // DON'T convert eventual patcher args here... this is done by the actual attribute stuff
+ // so that the initial $- or #- be preserved!
+
+ // store creation args for attribute initialization (inside flext_base::Init())
+ flext_obj::m_holdaargc = _argc_-argc;
+ flext_obj::m_holdaargv = argv+argc;
+ }
+ else {
+ flext_obj::m_holdaargc = 0;
+ flext_obj::m_holdaargv = NULL;
+ }
+
+ // call virtual init function
+ // here, inlets, outlets, methods and attributes can be set up
+ ok = obj->data->Init();
+
+ // call another virtual init function
+ if(ok) ok = obj->data->Finalize();
+
+ flext_obj::m_holdaargc = 0;
+ flext_obj::m_holdaargv = NULL;
+ }
+
+ } //try
+ catch(std::exception &x) {
+ error("%s - Exception while creating object: %s",GetString(s),x.what());
+ ok = false;
+ }
+ catch(const char *txt) {
+ error("%s - Exception while creating object: %s",GetString(s),txt);
+ ok = false;
+ }
+ catch(...) {
+ error("%s - Unknown exception while creating object",GetString(s));
+ ok = false;
+ }
+
+ if(!ok) {
// there was some init error, free object
lo->freefun(obj);
obj = NULL;
@@ -460,11 +499,22 @@ void flext_obj::obj_free(flext_hdr *h)
libclass *lcl = FindName(name);
if(lcl) {
- // call virtual exit function
- hdr->data->Exit();
-
- // now call object destructor and deallocate
- lcl->freefun(hdr);
+ try {
+ // call virtual exit function
+ hdr->data->Exit();
+
+ // now call object destructor and deallocate
+ lcl->freefun(hdr);
+ } //try
+ catch(std::exception &x) {
+ error("%s - Exception while destroying object: %s",GetString(name),x.what());
+ }
+ catch(const char *txt) {
+ error("%s - Exception while destroying object: %s",GetString(name),txt);
+ }
+ catch(...) {
+ error("%s - Unknown exception while destroying object",GetString(name));
+ }
}
#ifdef FLEXT_DEBUG
else
diff --git a/externals/grill/flext/source/flmeth.cpp b/externals/grill/flext/source/flmeth.cpp
index 776461dd..21e15f5c 100755
--- a/externals/grill/flext/source/flmeth.cpp
+++ b/externals/grill/flext/source/flmeth.cpp
@@ -21,125 +21,125 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext_base::MethItem::MethItem(AttrItem *conn):
- Item(conn),index(0),
- argc(0),args(NULL)
- ,fun(NULL)
+ Item(conn),index(0),
+ argc(0),args(NULL)
+ ,fun(NULL)
{}
flext_base::MethItem::~MethItem()
{
- if(args) delete[] args;
+ if(args) delete[] args;
}
void flext_base::MethItem::SetArgs(methfun _fun,int _argc,metharg *_args)
{
- fun = _fun;
- if(args) delete[] args;
- argc = _argc,args = _args;
+ fun = _fun;
+ if(args) delete[] args;
+ argc = _argc,args = _args;
}
void flext_base::AddMethodDef(int inlet,const char *tag)
{
const t_symbol *t = tag?MakeSymbol(tag):NULL;
- methhead->Add(new MethItem,t,inlet);
+ methhead->Add(new MethItem,t,inlet);
}
/*! \brief Add a method to the queue
*/
void flext_base::AddMethod(ItemCont *ma,int inlet,const char *tag,methfun fun,metharg tp,...)
{
- va_list marker;
-
- // at first just count the arg type list (in argc)
- int argc = 0;
- va_start(marker,tp);
- metharg *args = NULL,arg = tp;
- for(; arg != a_null; ++argc) arg = (metharg)va_arg(marker,int); //metharg);
- va_end(marker);
-
- if(argc > 0) {
- if(argc > FLEXT_MAXMETHARGS) {
- error("flext - method %s: only %i arguments are type-checkable: use variable argument list for more",tag?tag:"?",FLEXT_MAXMETHARGS);
- argc = FLEXT_MAXMETHARGS;
- }
-
- args = new metharg[argc];
-
- va_start(marker,tp);
- metharg a = tp;
- for(int ix = 0; ix < argc; ++ix) {
+ va_list marker;
+
+ // at first just count the arg type list (in argc)
+ int argc = 0;
+ va_start(marker,tp);
+ metharg *args = NULL,arg = tp;
+ for(; arg != a_null; ++argc) arg = (metharg)va_arg(marker,int); //metharg);
+ va_end(marker);
+
+ if(argc > 0) {
+ if(argc > FLEXT_MAXMETHARGS) {
+ error("flext - method %s: only %i arguments are type-checkable: use variable argument list for more",tag?tag:"?",FLEXT_MAXMETHARGS);
+ argc = FLEXT_MAXMETHARGS;
+ }
+
+ args = new metharg[argc];
+
+ va_start(marker,tp);
+ metharg a = tp;
+ for(int ix = 0; ix < argc; ++ix) {
#ifdef FLEXT_DEBUG
- if(a == a_list && ix > 0) {
- ERRINTERNAL();
- }
+ if(a == a_list && ix > 0) {
+ ERRINTERNAL();
+ }
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
- if(a == a_pointer && flext_base::compatibility) {
- post("Pointer arguments are not allowed in compatibility mode");
- }
+ if(a == a_pointer && flext_base::compatibility) {
+ post("Pointer arguments are not allowed in compatibility mode");
+ }
#endif
- args[ix] = a;
- a = (metharg)va_arg(marker,int); //metharg);
- }
- va_end(marker);
- }
-
- MethItem *mi = new MethItem;
+ args[ix] = a;
+ a = (metharg)va_arg(marker,int); //metharg);
+ }
+ va_end(marker);
+ }
+
+ MethItem *mi = new MethItem;
mi->index = ma->Members();
- mi->SetArgs(fun,argc,args);
- ma->Add(mi,MakeSymbol(tag),inlet);
+ mi->SetArgs(fun,argc,args);
+ ma->Add(mi,MakeSymbol(tag),inlet);
}
void flext_base::ListMethods(AtomList &la,int inlet) const
{
- typedef DataMap<int,const t_symbol *> MethList;
- MethList list[2];
+ typedef DataMap<int,const t_symbol *> MethList;
+ MethList list[2];
- int i;
- for(i = 0; i <= 1; ++i) {
- ItemCont *a = i?methhead:clmethhead;
- if(a && a->Contained(inlet)) {
+ int i;
+ for(i = 0; i <= 1; ++i) {
+ ItemCont *a = i?methhead:clmethhead;
+ if(a && a->Contained(inlet)) {
ItemSet &ai = a->GetInlet(inlet);
for(ItemSet::iterator as = ai.begin(); as != ai.end(); ++as) {
for(Item *al = as.data(); al; al = al->nxt) {
- MethItem *aa = (MethItem *)al;
+ MethItem *aa = (MethItem *)al;
- // check it's not related to an attribute
+ // check it's not related to an attribute
if(!aa->IsAttr()) {
list[i][aa->index] = as.key();
break;
}
}
- }
- }
- }
-
- la(list[0].size()+list[1].size());
- int ix = 0;
- MethList::iterator it;
- for(i = 0; i <= 1; ++i)
- for(it = list[i].begin(); it != list[i].end(); ++it)
- SetSymbol(la[ix++],it.data());
+ }
+ }
+ }
+
+ la(list[0].size()+list[1].size());
+ int ix = 0;
+ MethList::iterator it;
+ for(i = 0; i <= 1; ++i)
+ for(it = list[i].begin(); it != list[i].end(); ++it)
+ SetSymbol(la[ix++],it.data());
}
bool flext_base::ListMethods(int inlet) const
{
- if(procattr) {
- AtomList la;
- ListMethods(la,inlet);
- ToOutAnything(GetOutAttr(),MakeSymbol("methods"),la.Count(),la.Atoms());
- return true;
- }
- else
- return false;
+ if(procattr) {
+ AtomList la;
+ ListMethods(la,inlet);
+ ToOutAnything(GetOutAttr(),MakeSymbol("methods"),la.Count(),la.Atoms());
+ return true;
+ }
+ else
+ return false;
}
bool flext_base::cb_ListMethods(flext_base *c,int argc,const t_atom *argv)
{
- if(argc == 0 || (argc == 1 && CanbeInt(argv[0])))
- return c->ListMethods(argc?GetAInt(argv[0]):0);
- else
- return false;
+ if(argc == 0 || (argc == 1 && CanbeInt(argv[0])))
+ return c->ListMethods(argc?GetAInt(argv[0]):0);
+ else
+ return false;
}
diff --git a/externals/grill/flext/source/flmsg.cpp b/externals/grill/flext/source/flmsg.cpp
index e586274e..3191edc0 100755
--- a/externals/grill/flext/source/flmsg.cpp
+++ b/externals/grill/flext/source/flmsg.cpp
@@ -16,60 +16,60 @@ WARRANTIES, see the file, "license.txt," in this distribution.
bool flext_base::CallMeth(const MethItem &m,int argc,const t_atom *argv)
{
- bool ret = false;
- int ix;
- t_any aargs[FLEXT_MAXMETHARGS];
- bool ok = true;
- for(ix = 0; ix < argc && ok; ++ix) {
- switch(m.args[ix]) {
- case a_float: {
- if(IsFloat(argv[ix])) aargs[ix].ft = GetFloat(argv[ix]);
- else if(IsInt(argv[ix])) aargs[ix].ft = (float)GetInt(argv[ix]);
- else ok = false;
-
- if(ok) FLEXT_LOG2("int arg %i = %f",ix,aargs[ix].ft);
- break;
- }
- case a_int: {
- if(IsFloat(argv[ix])) aargs[ix].it = (int)GetFloat(argv[ix]);
- else if(IsInt(argv[ix])) aargs[ix].it = GetInt(argv[ix]);
- else ok = false;
-
- if(ok) FLEXT_LOG2("float arg %i = %i",ix,aargs[ix].it);
- break;
- }
- case a_symbol: {
- if(IsSymbol(argv[ix])) aargs[ix].st = GetSymbol(argv[ix]);
- else ok = false;
-
- if(ok) FLEXT_LOG2("symbol arg %i = %s",ix,GetString(aargs[ix].st));
- break;
- }
+ bool ret = false;
+ int ix;
+ t_any aargs[FLEXT_MAXMETHARGS];
+ bool ok = true;
+ for(ix = 0; ix < argc && ok; ++ix) {
+ switch(m.args[ix]) {
+ case a_float: {
+ if(IsFloat(argv[ix])) aargs[ix].ft = GetFloat(argv[ix]);
+ else if(IsInt(argv[ix])) aargs[ix].ft = (float)GetInt(argv[ix]);
+ else ok = false;
+
+ if(ok) FLEXT_LOG2("int arg %i = %f",ix,aargs[ix].ft);
+ break;
+ }
+ case a_int: {
+ if(IsFloat(argv[ix])) aargs[ix].it = (int)GetFloat(argv[ix]);
+ else if(IsInt(argv[ix])) aargs[ix].it = GetInt(argv[ix]);
+ else ok = false;
+
+ if(ok) FLEXT_LOG2("float arg %i = %i",ix,aargs[ix].it);
+ break;
+ }
+ case a_symbol: {
+ if(IsSymbol(argv[ix])) aargs[ix].st = GetSymbol(argv[ix]);
+ else ok = false;
+
+ if(ok) FLEXT_LOG2("symbol arg %i = %s",ix,GetString(aargs[ix].st));
+ break;
+ }
#if FLEXT_SYS == FLEXT_SYS_PD
- case a_pointer: {
- if(IsPointer(argv[ix])) aargs[ix].pt = (t_gpointer *)GetPointer(argv[ix]);
- else ok = false;
- break;
- }
+ case a_pointer: {
+ if(IsPointer(argv[ix])) aargs[ix].pt = (t_gpointer *)GetPointer(argv[ix]);
+ else ok = false;
+ break;
+ }
#endif
- default:
- error("Argument type illegal");
- ok = false;
- }
- }
-
- if(ok && ix == argc) {
- switch(argc) {
- case 0: ret = ((methfun_0)m.fun)(this); break;
- case 1: ret = ((methfun_1)m.fun)(this,aargs[0]); break;
- case 2: ret = ((methfun_2)m.fun)(this,aargs[0],aargs[1]); break;
- case 3: ret = ((methfun_3)m.fun)(this,aargs[0],aargs[1],aargs[2]); break;
- case 4: ret = ((methfun_4)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]); break;
- case 5: ret = ((methfun_5)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]); break;
- }
- }
-
- return ret;
+ default:
+ error("Argument type illegal");
+ ok = false;
+ }
+ }
+
+ if(ok && ix == argc) {
+ switch(argc) {
+ case 0: ret = ((methfun_0)m.fun)(this); break;
+ case 1: ret = ((methfun_1)m.fun)(this,aargs[0]); break;
+ case 2: ret = ((methfun_2)m.fun)(this,aargs[0],aargs[1]); break;
+ case 3: ret = ((methfun_3)m.fun)(this,aargs[0],aargs[1],aargs[2]); break;
+ case 4: ret = ((methfun_4)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3]); break;
+ case 5: ret = ((methfun_5)m.fun)(this,aargs[0],aargs[1],aargs[2],aargs[3],aargs[4]); break;
+ }
+ }
+
+ return ret;
}
bool flext_base::TryMethTag(Item *lst,const t_symbol *tag,int argc,const t_atom *argv)
@@ -78,29 +78,29 @@ bool flext_base::TryMethTag(Item *lst,const t_symbol *tag,int argc,const t_atom
MethItem *m = (MethItem *)lst;
// FLEXT_LOG3("found method tag %s: inlet=%i, argc=%i",GetString(tag),m->inlet,argc);
-
- if(m->attr) {
- // attributes are treated differently
-
- if(m->attr->IsGet())
- return DumpAttrib(tag,m->attr);
- else
- return SetAttrib(tag,m->attr,argc,argv);
- }
- else {
- if(m->argc == 1) {
- // try list
- if(m->args[0] == a_list && ((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv))) return true;
-
- // try anything
- if(m->args[0] == a_any && ((methfun_A)m->fun)(this,tag,argc,const_cast<t_atom *>(argv))) return true;
- }
-
- // try matching number of args
- if(argc == m->argc && CallMeth(*m,argc,argv)) return true;
- }
- }
- return false;
+
+ if(m->attr) {
+ // attributes are treated differently
+
+ if(m->attr->IsGet())
+ return DumpAttrib(tag,m->attr);
+ else
+ return SetAttrib(tag,m->attr,argc,argv);
+ }
+ else {
+ if(m->argc == 1) {
+ // try list
+ if(m->args[0] == a_list && ((methfun_V)m->fun)(this,argc,const_cast<t_atom *>(argv))) return true;
+
+ // try anything
+ if(m->args[0] == a_any && ((methfun_A)m->fun)(this,tag,argc,const_cast<t_atom *>(argv))) return true;
+ }
+
+ // try matching number of args
+ if(argc == m->argc && CallMeth(*m,argc,argv)) return true;
+ }
+ }
+ return false;
}
bool flext_base::TryMethSym(Item *lst,const t_symbol *s)
@@ -108,14 +108,14 @@ bool flext_base::TryMethSym(Item *lst,const t_symbol *s)
for(; lst; lst = lst->nxt) {
MethItem *m = (MethItem *)lst;
- if(!m->IsAttr()) {
-// FLEXT_LOG3("found symbol method for %s: inlet=%i, symbol=%s",GetString(m->tag),m->inlet,GetString(s));
+ if(!m->IsAttr()) {
+// FLEXT_LOG3("found symbol method for %s: inlet=%i, symbol=%s",GetString(m->tag),m->inlet,GetString(s));
- t_any sym; sym.st = const_cast<t_symbol *>(s);
- if(((methfun_1)m->fun)(this,sym)) return true;
- }
- }
- return false;
+ t_any sym; sym.st = const_cast<t_symbol *>(s);
+ if(((methfun_1)m->fun)(this,sym)) return true;
+ }
+ }
+ return false;
}
bool flext_base::TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *argv)
@@ -123,141 +123,153 @@ bool flext_base::TryMethAny(Item *lst,const t_symbol *s,int argc,const t_atom *a
for(; lst; lst = lst->nxt) {
MethItem *m = (MethItem *)lst;
- if(!m->IsAttr() && m->argc == 1 && m->args[0] == a_any) {
-// FLEXT_LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",GetString(m->tag),m->inlet,GetString(s),argc);
+ if(!m->IsAttr() && m->argc == 1 && m->args[0] == a_any) {
+// FLEXT_LOG4("found any method for %s: inlet=%i, symbol=%s, argc=%i",GetString(m->tag),m->inlet,GetString(s),argc);
- if(((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv))) return true;
- }
+ if(((methfun_A)m->fun)(this,s,argc,const_cast<t_atom *>(argv))) return true;
+ }
}
return false;
}
/*! \brief Find a method item for a specific tag and arguments
- \remark All attributes are also stored in the method list and retrieved by a member of the method item
+ \remark All attributes are also stored in the method list and retrieved by a member of the method item
*/
bool flext_base::FindMeth(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
Item *lst;
- // search for exactly matching tag
- if((lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
- if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
-
- // if no list args, then search for pure symbol
- if(!argc) {
- if((lst = methhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
- if((lst = clmethhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
- }
-
- // otherwise search for anything
- if((lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
- if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
-
- // if nothing found try any inlet
- return inlet >= 0 && FindMeth(-1,s,argc,argv);
+ // search for exactly matching tag
+ if((lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
+ if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
+
+ // if no list args, then search for pure symbol
+ if(!argc) {
+ if((lst = methhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
+ if((lst = clmethhead->FindList(sym_symbol,inlet)) != NULL && TryMethSym(lst,s)) return true;
+ }
+
+ // otherwise search for anything
+ if((lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
+ if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
+
+ // if nothing found try any inlet
+ return inlet >= 0 && FindMeth(-1,s,argc,argv);
}
/*! \brief All the message processing
- The messages of all the inlets go here and are promoted to the registered callback functions
+ The messages of all the inlets go here and are promoted to the registered callback functions
*/
bool flext_base::m_methodmain(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
- static bool trap = false;
+ static bool trap = false;
+
+ curtag = s;
+
+// post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
- curtag = s;
+ bool ret = FindMeth(inlet,s,argc,argv);
+ if(ret) goto end;
-// post("methodmain inlet:%i args:%i symbol:%s",inlet,argc,s?GetString(s):"");
-
- bool ret = FindMeth(inlet,s,argc,argv);
- if(ret) goto end;
+ try {
#if FLEXT_SYS == FLEXT_SYS_MAX
- // If float message is not explicitly handled: try int handler instead
- if(argc == 1 && s == sym_float && !trap) {
- t_atom fl;
- SetInt(fl,GetAInt(argv[0]));
- trap = true;
- ret = m_methodmain(inlet,sym_int,1,&fl);
- trap = false;
- }
- if(ret) goto end;
-
- // If int message is not explicitly handled: try float handler instead
- if(argc == 1 && s == sym_int && !trap) {
- t_atom fl;
- SetFloat(fl,GetAFloat(argv[0]));
- trap = true;
- ret = m_methodmain(inlet,sym_float,1,&fl);
- trap = false;
- }
- if(ret) goto end;
+ // If float message is not explicitly handled: try int handler instead
+ if(argc == 1 && s == sym_float && !trap) {
+ t_atom fl;
+ SetInt(fl,GetAInt(argv[0]));
+ trap = true;
+ ret = m_methodmain(inlet,sym_int,1,&fl);
+ trap = false;
+ }
+ if(ret) goto end;
+
+ // If int message is not explicitly handled: try float handler instead
+ if(argc == 1 && s == sym_int && !trap) {
+ t_atom fl;
+ SetFloat(fl,GetAFloat(argv[0]));
+ trap = true;
+ ret = m_methodmain(inlet,sym_float,1,&fl);
+ trap = false;
+ }
+ if(ret) goto end;
#endif
-
- // If float or int message is not explicitly handled: try list handler instead
- if(!trap && argc == 1 && (s == sym_float
+
+ // If float or int message is not explicitly handled: try list handler instead
+ if(!trap && argc == 1 && (s == sym_float
#if FLEXT_SYS == FLEXT_SYS_MAX
- || s == sym_int
+ || s == sym_int
#endif
- )) {
- t_atom list;
- if(s == sym_float)
- SetFloat(list,GetFloat(argv[0]));
+ )) {
+ t_atom list;
+ if(s == sym_float)
+ SetFloat(list,GetFloat(argv[0]));
#if FLEXT_SYS == FLEXT_SYS_MAX
- else if(s == sym_int)
- SetInt(list,GetInt(argv[0]));
+ else if(s == sym_int)
+ SetInt(list,GetInt(argv[0]));
#endif
- trap = true;
- ret = m_methodmain(inlet,sym_list,1,&list);
- trap = false;
- }
- if(ret) goto end;
-
- // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
- if(!trap && argc == 0) {
- t_atom list;
- SetSymbol(list,s);
- trap = true;
- ret = m_methodmain(inlet,sym_list,1,&list);
- trap = false;
- }
- if(ret) goto end;
-
- // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
- if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
- int i = incnt;
- if(i > argc) i = argc;
- for(--i; i >= 0; --i) { // right to left distribution
- const t_symbol *sym = NULL;
- if(IsFloat(argv[i])) sym = sym_float;
- else if(IsInt(argv[i])) sym = sym_int;
- else if(IsSymbol(argv[i])) sym = sym_symbol;
+ trap = true;
+ ret = m_methodmain(inlet,sym_list,1,&list);
+ trap = false;
+ }
+ if(ret) goto end;
+
+ // If symbol message (pure anything without args) is not explicitly handled: try list handler instead
+ if(!trap && argc == 0) {
+ t_atom list;
+ SetSymbol(list,s);
+ trap = true;
+ ret = m_methodmain(inlet,sym_list,1,&list);
+ trap = false;
+ }
+ if(ret) goto end;
+
+ // if distmsgs is switched on then distribute list elements over inlets (Max/MSP behavior)
+ if(distmsgs && !trap && inlet == 0 && s == sym_list && insigs <= 1) {
+ int i = incnt;
+ if(i > argc) i = argc;
+ for(--i; i >= 0; --i) { // right to left distribution
+ const t_symbol *sym = NULL;
+ if(IsFloat(argv[i])) sym = sym_float;
+ else if(IsInt(argv[i])) sym = sym_int;
+ else if(IsSymbol(argv[i])) sym = sym_symbol;
#if FLEXT_SYS == FLEXT_SYS_PD
- else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
+ else if(IsPointer(argv[i])) sym = sym_pointer; // can pointer atoms occur here?
#endif
- if(sym) {
- trap = true;
- m_methodmain(i,sym,1,argv+i);
- trap = false;
- }
- }
-
- ret = true;
- }
-
- if(!ret && !trap) ret = m_method_(inlet,s,argc,argv);
-
+ if(sym) {
+ trap = true;
+ m_methodmain(i,sym,1,argv+i);
+ trap = false;
+ }
+ }
+
+ ret = true;
+ }
+
+ if(!ret && !trap) ret = m_method_(inlet,s,argc,argv);
+ }
+ catch(std::exception &x) {
+ error("%s - Exception while processing method: %s",thisName(),x.what());
+ }
+ catch(const char *txt) {
+ error("%s - Exception while processing method: %s",thisName(),txt);
+ }
+ catch(...) {
+ error("%s - Unknown exception while processing method",thisName());
+ }
+
end:
- curtag = NULL;
+ curtag = NULL;
- return ret; // true if appropriate handler was found and called
+ return ret; // true if appropriate handler was found and called
}
bool flext_base::m_method_(int inlet,const t_symbol *s,int argc,const t_atom *argv)
{
//#ifdef FLEXT_DEBUG
- post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
+ post("%s: message unhandled - inlet:%i args:%i symbol:%s",thisName(),inlet,argc,s?GetString(s):"");
//#endif
- return false;
+ return false;
}
diff --git a/externals/grill/flext/source/flmspbuffer.h b/externals/grill/flext/source/flmspbuffer.h
index c09f690f..88023806 100755
--- a/externals/grill/flext/source/flmspbuffer.h
+++ b/externals/grill/flext/source/flmspbuffer.h
@@ -10,71 +10,71 @@ WARRANTIES, see the file, "license.txt," in this distribution.
/*! \file flmspbuffer.h
\brief Definition of the Max/MSP buffer structure
- \internal
+ \internal
- This file comes from David Zicarellis inofficial package index.sit
- The latter is not easily found so i included the original file buffer.h with flext
+ This file comes from David Zicarellis inofficial package index.sit
+ The latter is not easily found so i included the original file buffer.h with flext
*/
#if (FLEXT_SYS == FLEXT_SYS_MAX) && !defined(__FLEXT_MSPBUFFER_H)
#define __FLEXT_MSPBUFFER_H
enum {
- MAXCHAN = 4
+ MAXCHAN = 4
};
enum {
- bi_basefreq = 0,
- bi_detune,
- bi_lowfreq,
- bi_hifreq,
- bi_lowvel,
- bi_hivel,
- bi_gain,
- bi_numparams
+ bi_basefreq = 0,
+ bi_detune,
+ bi_lowfreq,
+ bi_hifreq,
+ bi_lowvel,
+ bi_hivel,
+ bi_gain,
+ bi_numparams
};
typedef struct _buffer
{
- t_object b_obj; // doesn't have any signals so it doesn't need to be pxobject
- long b_valid; // flag is off during read replacement or editing operation
- float *b_samples; // stored with interleaved channels if multi-channel
- long b_frames; // number of sample frames (each one is sizeof(float) * b_nchans bytes)
- long b_nchans; // number of channels
- long b_size; // size of buffer in floats
- float b_sr; // sampling rate of the buffer
- float b_1oversr; // 1 / sr
- float b_msr; // sr * .001
- // Mac-specific stuff
- float *b_memory; // pointer to where memory starts (initial padding for interp)
- t_symbol *b_name;
- short b_vol;
- short b_space;
- // looping info (from AIFF file)
- long b_susloopstart; // in samples
- long b_susloopend; // in samples
- long b_relloopstart; // in samples
- long b_relloopend; // in samples
- // instrument info (from AIFF file)
- short b_inst[bi_numparams];
- // window stuff
- void *b_wind;
- double b_pixperfr;
- double b_frperpix;
- long b_imagesize;
- Point b_scroll;
- long b_scrollscale;
- long b_selbegin[MAXCHAN];
- long b_selend[MAXCHAN];
- long b_zoom;
- long b_zim[11];
- void *b_mouseout;
- long b_format; // 'AIFF' or 'Sd2f'
- t_symbol *b_filename; // last file read (not written) for readagain message
- long b_oldnchans; // used for resizing window in case of # of channels change
- void *b_doneout;
- long b_outputbytes; // number of bytes used for output sample (1-4)
- long b_modtime; // last modified time ("dirty" method)
+ t_object b_obj; // doesn't have any signals so it doesn't need to be pxobject
+ long b_valid; // flag is off during read replacement or editing operation
+ float *b_samples; // stored with interleaved channels if multi-channel
+ long b_frames; // number of sample frames (each one is sizeof(float) * b_nchans bytes)
+ long b_nchans; // number of channels
+ long b_size; // size of buffer in floats
+ float b_sr; // sampling rate of the buffer
+ float b_1oversr; // 1 / sr
+ float b_msr; // sr * .001
+ // Mac-specific stuff
+ float *b_memory; // pointer to where memory starts (initial padding for interp)
+ t_symbol *b_name;
+ short b_vol;
+ short b_space;
+ // looping info (from AIFF file)
+ long b_susloopstart; // in samples
+ long b_susloopend; // in samples
+ long b_relloopstart; // in samples
+ long b_relloopend; // in samples
+ // instrument info (from AIFF file)
+ short b_inst[bi_numparams];
+ // window stuff
+ void *b_wind;
+ double b_pixperfr;
+ double b_frperpix;
+ long b_imagesize;
+ Point b_scroll;
+ long b_scrollscale;
+ long b_selbegin[MAXCHAN];
+ long b_selend[MAXCHAN];
+ long b_zoom;
+ long b_zim[11];
+ void *b_mouseout;
+ long b_format; // 'AIFF' or 'Sd2f'
+ t_symbol *b_filename; // last file read (not written) for readagain message
+ long b_oldnchans; // used for resizing window in case of # of channels change
+ void *b_doneout;
+ long b_outputbytes; // number of bytes used for output sample (1-4)
+ long b_modtime; // last modified time ("dirty" method)
} t_buffer;
#define BUFWIND(x) ((t_wind *)(x->b_wind))
diff --git a/externals/grill/flext/source/flout.cpp b/externals/grill/flext/source/flout.cpp
index fcfaa6c8..245de189 100644
--- a/externals/grill/flext/source/flout.cpp
+++ b/externals/grill/flext/source/flout.cpp
@@ -58,349 +58,349 @@ void flext_base::ToOutAnything(int n,const t_symbol *s,int argc,const t_atom *ar
bool flext_base::InitInlets()
{
- bool ok = true;
+ bool ok = true;
- // ----------------------------------
- // create inlets
- // ----------------------------------
+ // ----------------------------------
+ // create inlets
+ // ----------------------------------
- incnt = insigs = 0;
+ incnt = insigs = 0;
// digest inlist
{
- xlet *xi;
- incnt = 0;
- for(xi = inlist; xi; xi = xi->nxt) ++incnt;
- xlet::type *list = new xlet::type[incnt];
- int i;
- for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // copy inlet descriptions
- indesc = new char *[incnt];
- for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
- int l = xi->desc?strlen(xi->desc):0;
- if(l) {
- indesc[i] = new char[l+1];
- memcpy(indesc[i],xi->desc,l);
- indesc[i][l] = 0;
- }
- else
- indesc[i] = NULL;
- }
+ xlet *xi;
+ incnt = 0;
+ for(xi = inlist; xi; xi = xi->nxt) ++incnt;
+ xlet::type *list = new xlet::type[incnt];
+ int i;
+ for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // copy inlet descriptions
+ indesc = new char *[incnt];
+ for(xi = inlist,i = 0; xi; xi = xi->nxt,++i) {
+ int l = xi->desc?strlen(xi->desc):0;
+ if(l) {
+ indesc[i] = new char[l+1];
+ memcpy(indesc[i],xi->desc,l);
+ indesc[i][l] = 0;
+ }
+ else
+ indesc[i] = NULL;
+ }
#endif
- delete inlist; inlist = NULL;
-
+ delete inlist; inlist = NULL;
+
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- inlets = new px_object *[incnt];
- for(i = 0; i < incnt; ++i) inlets[i] = NULL;
+ inlets = new px_object *[incnt];
+ for(i = 0; i < incnt; ++i) inlets[i] = NULL;
#endif
-
- // type info is now in list array
+
+ // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
- {
- int cnt = 0;
-
- if(incnt >= 1) {
- switch(list[0]) {
- case xlet::tp_sig:
- ++insigs;
- break;
- default:
- // leftmost inlet is already there...
- break;
- }
- ++cnt;
- }
-
- for(int ix = 1; ix < incnt; ++ix,++cnt) {
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int: {
- char sym[] = "ft??";
- if(ix >= 10) {
- if(compatibility) {
- // Max allows max. 9 inlets
- post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
- ok = false;
- }
- else {
- if(ix > 99)
- post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
- sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
- }
- }
- else
- sym[2] = '0'+ix,sym[3] = 0;
- if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
- break;
- }
- case xlet::tp_sym:
- (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
- break;
- case xlet::tp_list:
- (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
- break;
- case xlet::tp_any:
- (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
- inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
- break;
- case xlet::tp_sig:
- if(compatibility && list[ix-1] != xlet::tp_sig) {
- post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
- ok = false;
- }
- else {
- // pd doesn't seem to be able to handle signals and messages into the same inlet...
-
- inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
- ++insigs;
- }
- break;
- default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
- ok = false;
- }
- }
-
- incnt = cnt;
- }
+ {
+ int cnt = 0;
+
+ if(incnt >= 1) {
+ switch(list[0]) {
+ case xlet::tp_sig:
+ ++insigs;
+ break;
+ default:
+ // leftmost inlet is already there...
+ break;
+ }
+ ++cnt;
+ }
+
+ for(int ix = 1; ix < incnt; ++ix,++cnt) {
+ switch(list[ix]) {
+ case xlet::tp_float:
+ case xlet::tp_int: {
+ char sym[] = "ft??";
+ if(ix >= 10) {
+ if(compatibility) {
+ // Max allows max. 9 inlets
+ post("%s: Only 9 float/int inlets allowed in compatibility mode",thisName());
+ ok = false;
+ }
+ else {
+ if(ix > 99)
+ post("%s: Inlet index > 99 not allowed for float/int inlets",thisName());
+ sym[2] = '0'+ix/10,sym[3] = '0'+ix%10;
+ }
+ }
+ else
+ sym[2] = '0'+ix,sym[3] = 0;
+ if(ok) inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_float, gensym(sym));
+ break;
+ }
+ case xlet::tp_sym:
+ (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
+ inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_symbol, (t_symbol *)sym_symbol);
+ break;
+ case xlet::tp_list:
+ (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
+ inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, (t_symbol *)sym_list, (t_symbol *)sym_list);
+ break;
+ case xlet::tp_any:
+ (inlets[ix] = (px_object *)pd_new(px_class))->init(this,ix); // proxy for 2nd inlet messages
+ inlet_new(&x_obj->obj,&inlets[ix]->obj.ob_pd, 0, 0);
+ break;
+ case xlet::tp_sig:
+ if(compatibility && list[ix-1] != xlet::tp_sig) {
+ post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
+ ok = false;
+ }
+ else {
+ // pd doesn't seem to be able to handle signals and messages into the same inlet...
+
+ inlet_new(&x_obj->obj, &x_obj->obj.ob_pd, (t_symbol *)sym_signal, (t_symbol *)sym_signal);
+ ++insigs;
+ }
+ break;
+ default:
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ ok = false;
+ }
+ }
+
+ incnt = cnt;
+ }
#elif FLEXT_SYS == FLEXT_SYS_MAX
- {
- int ix,cnt;
- // count leftmost signal inlets
- while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
-
- for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
- if(ix == 0) {
- if(list[ix] != xlet::tp_any) {
- error("%s: Leftmost inlet must be of type signal or anything",thisName());
- ok = false;
- }
- }
- else {
- switch(list[ix]) {
- case xlet::tp_sig:
- error("%s: All signal inlets must be left-aligned",thisName());
- ok = false;
- break;
- case xlet::tp_float:
- if(ix >= 10) {
- post("%s: Only 9 float inlets possible",thisName());
- ok = false;
- }
- else
- floatin(x_obj,ix);
- break;
- case xlet::tp_int:
- if(ix >= 10) {
- post("%s: Only 9 int inlets possible",thisName());
- ok = false;
- }
- else
- intin(x_obj,ix);
- break;
- case xlet::tp_any: // non-leftmost
- case xlet::tp_sym:
- case xlet::tp_list:
- inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
- break;
- default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
- ok = false;
- }
- }
- }
-
-// incnt = cnt;
-
- if(insigs)
-// dsp_setup(thisHdr(),insigs); // signal inlets
- dsp_setupbox(thisHdr(),insigs); // signal inlets
- }
+ {
+ int ix,cnt;
+ // count leftmost signal inlets
+ while(insigs < incnt && list[insigs] == xlet::tp_sig) ++insigs;
+
+ for(cnt = 0,ix = incnt-1; ix >= insigs; --ix,++cnt) {
+ if(ix == 0) {
+ if(list[ix] != xlet::tp_any) {
+ error("%s: Leftmost inlet must be of type signal or anything",thisName());
+ ok = false;
+ }
+ }
+ else {
+ switch(list[ix]) {
+ case xlet::tp_sig:
+ error("%s: All signal inlets must be left-aligned",thisName());
+ ok = false;
+ break;
+ case xlet::tp_float:
+ if(ix >= 10) {
+ post("%s: Only 9 float inlets possible",thisName());
+ ok = false;
+ }
+ else
+ floatin(x_obj,ix);
+ break;
+ case xlet::tp_int:
+ if(ix >= 10) {
+ post("%s: Only 9 int inlets possible",thisName());
+ ok = false;
+ }
+ else
+ intin(x_obj,ix);
+ break;
+ case xlet::tp_any: // non-leftmost
+ case xlet::tp_sym:
+ case xlet::tp_list:
+ inlets[ix] = (px_object *)proxy_new(x_obj,ix,&((flext_hdr *)x_obj)->curinlet);
+ break;
+ default:
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ ok = false;
+ }
+ }
+ }
+
+// incnt = cnt;
+
+ if(insigs)
+// dsp_setup(thisHdr(),insigs); // signal inlets
+ dsp_setupbox(thisHdr(),insigs); // signal inlets
+ }
#elif FLEXT_SYS == FLEXT_SYS_JMAX
- {
- t_class *cl = thisClass();
- int cnt = 0;
- for(int ix = 0; ix < incnt; ++ix,++cnt) {
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int:
-// fts_class_inlet_number(cl, ix, jmax_proxy);
- break;
- case xlet::tp_sym:
-// fts_class_inlet_symbol(cl, ix, jmax_proxy);
- break;
- case xlet::tp_sig:
- if(compatibility && list[ix-1] != xlet::tp_sig) {
- post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
- ok = false;
- }
- else {
- if(!insigs) fts_dsp_declare_inlet(cl,0);
- ++insigs;
- }
- // no break -> let a signal inlet also accept any messages
- case xlet::tp_list:
- case xlet::tp_any:
-// fts_class_inlet_varargs(cl,ix, jmax_proxy);
- break;
- default:
- error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
- ok = false;
- }
- }
-
- incnt = cnt;
-
- fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
- }
+ {
+ t_class *cl = thisClass();
+ int cnt = 0;
+ for(int ix = 0; ix < incnt; ++ix,++cnt) {
+ switch(list[ix]) {
+ case xlet::tp_float:
+ case xlet::tp_int:
+// fts_class_inlet_number(cl, ix, jmax_proxy);
+ break;
+ case xlet::tp_sym:
+// fts_class_inlet_symbol(cl, ix, jmax_proxy);
+ break;
+ case xlet::tp_sig:
+ if(compatibility && list[ix-1] != xlet::tp_sig) {
+ post("%s: All signal inlets must be left-aligned in compatibility mode",thisName());
+ ok = false;
+ }
+ else {
+ if(!insigs) fts_dsp_declare_inlet(cl,0);
+ ++insigs;
+ }
+ // no break -> let a signal inlet also accept any messages
+ case xlet::tp_list:
+ case xlet::tp_any:
+// fts_class_inlet_varargs(cl,ix, jmax_proxy);
+ break;
+ default:
+ error("%s: Wrong type for inlet #%i: %i",thisName(),ix,(int)list[ix]);
+ ok = false;
+ }
+ }
+
+ incnt = cnt;
+
+ fts_object_set_inlets_number((fts_object_t *)thisHdr(), incnt);
+ }
#else
#error
#endif
- delete[] list;
- }
+ delete[] list;
+ }
- return ok;
+ return ok;
}
bool flext_base::InitOutlets()
{
- bool ok = true;
+ bool ok = true;
- // ----------------------------------
- // create outlets
- // ----------------------------------
+ // ----------------------------------
+ // create outlets
+ // ----------------------------------
- outcnt = outsigs = 0;
-
+ outcnt = outsigs = 0;
+
#if FLEXT_SYS == FLEXT_SYS_MAX
- // for Max/MSP the rightmost outlet has to be created first
- outlet *attrtmp = NULL;
- if(procattr)
- attrtmp = (outlet *)newout_anything(thisHdr());
+ // for Max/MSP the rightmost outlet has to be created first
+ outlet *attrtmp = NULL;
+ if(procattr)
+ attrtmp = (outlet *)newout_anything(thisHdr());
#endif
// digest outlist
- {
- xlet *xi;
-
- // count outlets
- outcnt = 0;
- for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
-
- xlet::type *list = new xlet::type[outcnt];
- int i;
- for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- // copy outlet descriptions
- outdesc = new char *[outcnt];
- for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) {
- int l = xi->desc?strlen(xi->desc):0;
- if(l) {
- outdesc[i] = new char[l+1];
- memcpy(outdesc[i],xi->desc,l);
- outdesc[i][l] = 0;
- }
- else
- outdesc[i] = NULL;
- }
+ {
+ xlet *xi;
+
+ // count outlets
+ outcnt = 0;
+ for(xi = outlist; xi; xi = xi->nxt) ++outcnt;
+
+ xlet::type *list = new xlet::type[outcnt];
+ int i;
+ for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) list[i] = xi->tp;
+
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ // copy outlet descriptions
+ outdesc = new char *[outcnt];
+ for(xi = outlist,i = 0; xi; xi = xi->nxt,++i) {
+ int l = xi->desc?strlen(xi->desc):0;
+ if(l) {
+ outdesc[i] = new char[l+1];
+ memcpy(outdesc[i],xi->desc,l);
+ outdesc[i][l] = 0;
+ }
+ else
+ outdesc[i] = NULL;
+ }
#endif
- delete outlist; outlist = NULL;
-
+ delete outlist; outlist = NULL;
+
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- outlets = new outlet *[outcnt+(procattr?1:0)];
+ outlets = new outlet *[outcnt+(procattr?1:0)];
- // type info is now in list array
+ // type info is now in list array
#if FLEXT_SYS == FLEXT_SYS_PD
- for(int ix = 0; ix < outcnt; ++ix)
+ for(int ix = 0; ix < outcnt; ++ix)
#elif FLEXT_SYS == FLEXT_SYS_MAX
- for(int ix = outcnt-1; ix >= 0; --ix)
+ for(int ix = outcnt-1; ix >= 0; --ix)
#else
#error
#endif
- {
- switch(list[ix]) {
- case xlet::tp_float:
- outlets[ix] = (outlet *)newout_float(&x_obj->obj);
- break;
- case xlet::tp_int:
- outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
- break;
- case xlet::tp_sig:
- outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
- ++outsigs;
- break;
- case xlet::tp_sym:
- outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
- break;
- case xlet::tp_list:
- outlets[ix] = (outlet *)newout_list(&x_obj->obj);
- break;
- case xlet::tp_any:
- outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
- break;
+ {
+ switch(list[ix]) {
+ case xlet::tp_float:
+ outlets[ix] = (outlet *)newout_float(&x_obj->obj);
+ break;
+ case xlet::tp_int:
+ outlets[ix] = (outlet *)newout_flint(&x_obj->obj);
+ break;
+ case xlet::tp_sig:
+ outlets[ix] = (outlet *)newout_signal(&x_obj->obj);
+ ++outsigs;
+ break;
+ case xlet::tp_sym:
+ outlets[ix] = (outlet *)newout_symbol(&x_obj->obj);
+ break;
+ case xlet::tp_list:
+ outlets[ix] = (outlet *)newout_list(&x_obj->obj);
+ break;
+ case xlet::tp_any:
+ outlets[ix] = (outlet *)newout_anything(&x_obj->obj);
+ break;
#ifdef FLEXT_DEBUG
- default:
- ERRINTERNAL();
- ok = false;
+ default:
+ ERRINTERNAL();
+ ok = false;
#endif
- }
- }
+ }
+ }
#elif FLEXT_SYS == FLEXT_SYS_JMAX
- t_class *cl = thisClass();
- for(int ix = 0; ix < outcnt; ++ix) {
- switch(list[ix]) {
- case xlet::tp_float:
- case xlet::tp_int:
-// fts_class_outlet_number(cl, ix);
- break;
- case xlet::tp_sym:
-// fts_class_outlet_symbol(cl, ix);
- break;
- case xlet::tp_list:
- case xlet::tp_any:
-// fts_class_outlet_anything(cl, ix);
- break;
- case xlet::tp_sig:
- if(!outsigs) fts_dsp_declare_outlet(cl,0);
- ++outsigs;
- break;
+ t_class *cl = thisClass();
+ for(int ix = 0; ix < outcnt; ++ix) {
+ switch(list[ix]) {
+ case xlet::tp_float:
+ case xlet::tp_int:
+// fts_class_outlet_number(cl, ix);
+ break;
+ case xlet::tp_sym:
+// fts_class_outlet_symbol(cl, ix);
+ break;
+ case xlet::tp_list:
+ case xlet::tp_any:
+// fts_class_outlet_anything(cl, ix);
+ break;
+ case xlet::tp_sig:
+ if(!outsigs) fts_dsp_declare_outlet(cl,0);
+ ++outsigs;
+ break;
#ifdef FLEXT_DEBUG
- default:
- ERRINTERNAL();
- ok = false;
+ default:
+ ERRINTERNAL();
+ ok = false;
#endif
- }
- }
+ }
+ }
- fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt+(procattr?1:0));
+ fts_object_set_outlets_number((fts_object_t *)thisHdr(), outcnt+(procattr?1:0));
#endif
- delete[] list;
- }
+ delete[] list;
+ }
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- if(procattr) {
- // attribute dump outlet is the last one
- outlets[outcnt] =
+ if(procattr) {
+ // attribute dump outlet is the last one
+ outlets[outcnt] =
#if FLEXT_SYS == FLEXT_SYS_PD
- // attribute dump outlet is the last one
- (outlet *)newout_anything(&x_obj->obj);
+ // attribute dump outlet is the last one
+ (outlet *)newout_anything(&x_obj->obj);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- attrtmp;
+ attrtmp;
#endif
- }
+ }
#endif
-
- return ok;
+
+ return ok;
}
diff --git a/externals/grill/flext/source/flprefix.h b/externals/grill/flext/source/flprefix.h
index a61ec8d7..626ff70a 100755
--- a/externals/grill/flext/source/flprefix.h
+++ b/externals/grill/flext/source/flprefix.h
@@ -16,44 +16,44 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define __FLEXT_PREFIX_H
// --- definitions for FLEXT_SYS ---------------------
-#define FLEXT_SYS_UNKNOWN 0
+#define FLEXT_SYS_UNKNOWN 0
#ifndef FLEXT_SYS_MAX
- #define FLEXT_SYS_MAX 1
+ #define FLEXT_SYS_MAX 1
#else
- // already defined
- #undef FLEXT_SYS_MAX
- #define FLEXT_SYS_MAX 1
- #define FLEXT_SYS FLEXT_SYS_MAX
+ // already defined
+ #undef FLEXT_SYS_MAX
+ #define FLEXT_SYS_MAX 1
+ #define FLEXT_SYS FLEXT_SYS_MAX
#endif
#ifndef FLEXT_SYS_PD
- #define FLEXT_SYS_PD 2
+ #define FLEXT_SYS_PD 2
#else
- // already defined
- #undef FLEXT_SYS_PD
- #define FLEXT_SYS_PD 2
- #define FLEXT_SYS FLEXT_SYS_PD
+ // already defined
+ #undef FLEXT_SYS_PD
+ #define FLEXT_SYS_PD 2
+ #define FLEXT_SYS FLEXT_SYS_PD
#endif
#ifndef FLEXT_SYS_JMAX
- #define FLEXT_SYS_JMAX 3
+ #define FLEXT_SYS_JMAX 3
#else
- // already defined
- #undef FLEXT_SYS_JMAX
- #define FLEXT_SYS_JMAX 3
- #define FLEXT_SYS FLEXT_SYS_JMAX
+ // already defined
+ #undef FLEXT_SYS_JMAX
+ #define FLEXT_SYS_JMAX 3
+ #define FLEXT_SYS FLEXT_SYS_JMAX
#endif
// --- definitions for FLEXT_OS ----------------------
-#define FLEXT_OS_UNKNOWN 0
-#define FLEXT_OS_WIN 1
-#define FLEXT_OS_MAC 2
-#define FLEXT_OS_LINUX 3
-#define FLEXT_OS_IRIX 4
+#define FLEXT_OS_UNKNOWN 0
+#define FLEXT_OS_WIN 1
+#define FLEXT_OS_MAC 2
+#define FLEXT_OS_LINUX 3
+#define FLEXT_OS_IRIX 4
// --- definitions for FLEXT_OS_API ---------------------
-#define FLEXT_OSAPI_UNKNOWN 0
+#define FLEXT_OSAPI_UNKNOWN 0
#define FLEXT_OSAPI_UNIX_POSIX 1
@@ -62,36 +62,36 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#define FLEXT_OSAPI_MAC_MACH 4
#define FLEXT_OSAPI_WIN_NATIVE 5 // WIN32 Platform
-#define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin)
+#define FLEXT_OSAPI_WIN_POSIX 6 // POSIX API (e.g. cygwin)
// --- definitions for FLEXT_CPU ---------------------
-#define FLEXT_CPU_UNKNOWN 0
+#define FLEXT_CPU_UNKNOWN 0
#define FLEXT_CPU_INTEL 1
-#define FLEXT_CPU_PPC 2
-#define FLEXT_CPU_MIPS 3
-#define FLEXT_CPU_ALPHA 4
+#define FLEXT_CPU_PPC 2
+#define FLEXT_CPU_MIPS 3
+#define FLEXT_CPU_ALPHA 4
// --- definitions for FLEXT_THREADS -----------------
#define FLEXT_THR_POSIX 1 // pthreads
-#define FLEXT_THR_WIN32 2 // Win32 native
-#define FLEXT_THR_MP 3 // MacOS MPThreads
+#define FLEXT_THR_WIN32 2 // Win32 native
+#define FLEXT_THR_MP 3 // MacOS MPThreads
// ---------------------------------------------------
// support old definitions
#ifndef FLEXT_SYS
- #if defined(MAXMSP)
- #define FLEXT_SYS FLEXT_SYS_MAX
- // #undef MAXMSP
- #elif defined(PD)
- #define FLEXT_SYS FLEXT_SYS_PD
- // #undef PD
- // #undef NT
- #endif
+ #if defined(MAXMSP)
+ #define FLEXT_SYS FLEXT_SYS_MAX
+ // #undef MAXMSP
+ #elif defined(PD)
+ #define FLEXT_SYS FLEXT_SYS_PD
+ // #undef PD
+ // #undef NT
+ #endif
#endif
#if defined(_DEBUG) && !defined(FLEXT_DEBUG)
- #define FLEXT_DEBUG
+ #define FLEXT_DEBUG
#endif
// ---------------------------------------------------
@@ -101,268 +101,268 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#elif FLEXT_SYS == FLEXT_SYS_PD
#elif FLEXT_SYS == FLEXT_SYS_JMAX
#else
- #error "System must be defined by either FLEXT_SYS_MAX, FLEXT_SYS_PD or FLEXT_SYS_JMAX"
+ #error "System must be defined by either FLEXT_SYS_MAX, FLEXT_SYS_PD or FLEXT_SYS_JMAX"
#endif
// Definition of OS/CPU
#if defined(_MSC_VER) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_WIN || defined(_WIN32)))
- // Microsoft C++
+ // Microsoft C++
// and Intel C++ (as guessed)
-
- #ifndef FLEXT_CPU
- #if defined(_M_IX86)
- #define FLEXT_CPU FLEXT_CPU_INTEL
- #elif defined(_M_PPC)
- #define FLEXT_CPU FLEXT_CPU_PPC
- #elif defined(_M_MRX000)
- #define FLEXT_CPU FLEXT_CPU_MIPS
- #elif defined(_M_ALPHA)
- #define FLEXT_CPU FLEXT_CPU_ALPHA
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if defined(_WIN32)
- #define FLEXT_OS FLEXT_OS_WIN
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
+
+ #ifndef FLEXT_CPU
+ #if defined(_M_IX86)
+ #define FLEXT_CPU FLEXT_CPU_INTEL
+ #elif defined(_M_PPC)
+ #define FLEXT_CPU FLEXT_CPU_PPC
+ #elif defined(_M_MRX000)
+ #define FLEXT_CPU FLEXT_CPU_MIPS
+ #elif defined(_M_ALPHA)
+ #define FLEXT_CPU FLEXT_CPU_ALPHA
+ #else
+ #define FLEXT_CPU FLEXT_CPU_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OS
+ #if defined(_WIN32)
+ #define FLEXT_OS FLEXT_OS_WIN
+ #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
+ #else
+ #define FLEXT_OS FLEXT_OS_UNKNOWN
+ #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
+ #endif
+ #endif
#elif defined(__BORLANDC__)
- // Borland C++
+ // Borland C++
- #ifndef FLEXT_CPU
- #define FLEXT_CPU FLEXT_CPU_INTEL
- #endif
- #ifndef FLEXT_OS
- #define FLEXT_OS FLEXT_OS_WIN
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
+ #ifndef FLEXT_CPU
+ #define FLEXT_CPU FLEXT_CPU_INTEL
+ #endif
+ #ifndef FLEXT_OS
+ #define FLEXT_OS FLEXT_OS_WIN
+ #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
+ #else
+ #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
+ #endif
#elif defined(__MWERKS__)
- // Metrowerks CodeWarrior
-
- #ifdef __MACH__
- // quick fix for OSX Mach-O
- #define TARGET_CPU_PPC 1
- #define TARGET_OS_MAC 1
- #define TARGET_API_MAC_OSX 1
- #else
- #ifndef __CONDITIONALMACROS__
- #include <ConditionalMacros.h>
- #endif
- #endif
-
- #ifndef FLEXT_CPU
- #if TARGET_CPU_X86
- #define FLEXT_CPU FLEXT_CPU_INTEL
- #elif TARGET_CPU_PPC
- #define FLEXT_CPU FLEXT_CPU_PPC
- #elif TARGET_CPU_MIPS
- #define FLEXT_CPU FLEXT_CPU_MIPS
- #elif TARGET_CPU_ALPHA
- #define FLEXT_CPU FLEXT_CPU_ALPHA
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if TARGET_OS_MAC
- #define FLEXT_OS FLEXT_OS_MAC
- #elif TARGET_OS_WIN32
- // assume Windows
- #define FLEXT_OS FLEXT_OS_WIN
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OSAPI
- #if TARGET_API_MAC_MACH
- // this is for Mach-O
- // this has the precedence (MACH also supports Carbon, of course)
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
- #elif TARGET_API_MAC_CARBON
- // this is for CFM
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CARBON
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
-
- // This is important for method and attribute callbacks
- #pragma enumsalwaysint on
- // This is important for everything
- #pragma bool on
+ // Metrowerks CodeWarrior
+
+ #ifdef __MACH__
+ // quick fix for OSX Mach-O
+ #define TARGET_CPU_PPC 1
+ #define TARGET_OS_MAC 1
+ #define TARGET_API_MAC_OSX 1
+ #else
+ #ifndef __CONDITIONALMACROS__
+ #include <ConditionalMacros.h>
+ #endif
+ #endif
+
+ #ifndef FLEXT_CPU
+ #if TARGET_CPU_X86
+ #define FLEXT_CPU FLEXT_CPU_INTEL
+ #elif TARGET_CPU_PPC
+ #define FLEXT_CPU FLEXT_CPU_PPC
+ #elif TARGET_CPU_MIPS
+ #define FLEXT_CPU FLEXT_CPU_MIPS
+ #elif TARGET_CPU_ALPHA
+ #define FLEXT_CPU FLEXT_CPU_ALPHA
+ #else
+ #define FLEXT_CPU FLEXT_CPU_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OS
+ #if TARGET_OS_MAC
+ #define FLEXT_OS FLEXT_OS_MAC
+ #elif TARGET_OS_WIN32
+ // assume Windows
+ #define FLEXT_OS FLEXT_OS_WIN
+ #else
+ #define FLEXT_OS FLEXT_OS_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OSAPI
+ #if TARGET_API_MAC_MACH
+ // this is for Mach-O
+ // this has the precedence (MACH also supports Carbon, of course)
+ #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
+ #elif TARGET_API_MAC_CARBON
+ // this is for CFM
+ #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CARBON
+ #else
+ #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
+ #endif
+ #endif
+
+ // This is important for method and attribute callbacks
+ #pragma enumsalwaysint on
+ // This is important for everything
+ #pragma bool on
#elif defined(__GNUG__) || (defined(__ICC) && (FLEXT_OS == FLEXT_OS_LINUX || defined(linux) || defined(__linux__)))
- // GNU C++
+ // GNU C++
// and Intel (as suggested by Tim Blechmann)
- #ifndef FLEXT_CPU
- #if defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)
- #define FLEXT_CPU FLEXT_CPU_INTEL
- #elif defined(__POWERPC__)
- #define FLEXT_CPU FLEXT_CPU_PPC
- #elif defined(__MIPS__)
- #define FLEXT_CPU FLEXT_CPU_MIPS
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if defined(linux) || defined(__linux__)
- #define FLEXT_OS FLEXT_OS_LINUX
- #elif defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
- #define FLEXT_OS FLEXT_OS_WIN
- #elif defined(__APPLE__) && defined(__MACH__)
- #define FLEXT_OS FLEXT_OS_MAC
- // how about IRIX??
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OSAPI
- #if FLEXT_OS == FLEXT_OS_MAC
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
- #elif FLEXT_OS == FLEXT_OS_WIN
+ #ifndef FLEXT_CPU
+ #if defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__)
+ #define FLEXT_CPU FLEXT_CPU_INTEL
+ #elif defined(__POWERPC__)
+ #define FLEXT_CPU FLEXT_CPU_PPC
+ #elif defined(__MIPS__)
+ #define FLEXT_CPU FLEXT_CPU_MIPS
+ #else
+ #define FLEXT_CPU FLEXT_CPU_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OS
+ #if defined(linux) || defined(__linux__)
+ #define FLEXT_OS FLEXT_OS_LINUX
+ #elif defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
+ #define FLEXT_OS FLEXT_OS_WIN
+ #elif defined(__APPLE__) && defined(__MACH__)
+ #define FLEXT_OS FLEXT_OS_MAC
+ // how about IRIX??
+ #else
+ #define FLEXT_OS FLEXT_OS_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OSAPI
+ #if FLEXT_OS == FLEXT_OS_MAC
+ #define FLEXT_OSAPI FLEXT_OSAPI_MAC_MACH
+ #elif FLEXT_OS == FLEXT_OS_WIN
#if defined(__MINGW32__)
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
+ #define FLEXT_OSAPI FLEXT_OSAPI_WIN_NATIVE
#else
- #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX
+ #define FLEXT_OSAPI FLEXT_OSAPI_WIN_POSIX
#endif
- #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX
- #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
+ #elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX
+ #define FLEXT_OSAPI FLEXT_OSAPI_UNIX_POSIX
+ #else
+ #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
+ #endif
+ #endif
#elif defined(__MRC__) && defined(MPW_CPLUS)
- // Apple MPW MrCpp
-
- #if __MRC__ < 0x500
- #error Apple MPW MrCpp v.5.0.0 or later compiler required
- #endif
-
- #ifndef FLEXT_CPU
- #if defined(__POWERPC__)
- #define FLEXT_CPU FLEXT_CPU_PPC
- #else
- #define FLEXT_CPU FLEXT_CPU_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OS
- #if defined(macintosh)
- #define FLEXT_OS FLEXT_OS_MAC
- #else
- #define FLEXT_OS FLEXT_OS_UNKNOWN
- #endif
- #endif
-
- #ifndef FLEXT_OSAPI
- #if FLEXT_OS == FLEXT_OS_MAC
- #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC
- #else
- #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
- #endif
- #endif
+ // Apple MPW MrCpp
+
+ #if __MRC__ < 0x500
+ #error Apple MPW MrCpp v.5.0.0 or later compiler required
+ #endif
+
+ #ifndef FLEXT_CPU
+ #if defined(__POWERPC__)
+ #define FLEXT_CPU FLEXT_CPU_PPC
+ #else
+ #define FLEXT_CPU FLEXT_CPU_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OS
+ #if defined(macintosh)
+ #define FLEXT_OS FLEXT_OS_MAC
+ #else
+ #define FLEXT_OS FLEXT_OS_UNKNOWN
+ #endif
+ #endif
+
+ #ifndef FLEXT_OSAPI
+ #if FLEXT_OS == FLEXT_OS_MAC
+ #define FLEXT_OSAPI FLEXT_OSAPI_MAC_CLASSIC
+ #else
+ #define FLEXT_OSAPI FLEXT_OSAPI_UNKNOWN
+ #endif
+ #endif
#endif
#if FLEXT_OS == FLEXT_OS_WIN
-// #pragma message("Compiling for Windows")
-
- #if FLEXT_SYS == FLEXT_SYS_MAX
-// #define WIN_VERSION 1
- #elif FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
-// #define NT
- #endif
+// #pragma message("Compiling for Windows")
+
+ #if FLEXT_SYS == FLEXT_SYS_MAX
+// #define WIN_VERSION 1
+ #elif FLEXT_SYS == FLEXT_SYS_PD
+// #define PD
+// #define NT
+ #endif
#elif FLEXT_OS == FLEXT_OS_LINUX
-// #pragma message("Compiling for Linux")
+// #pragma message("Compiling for Linux")
- #if FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
- #else
- #error "Flext SYS/OS combination unknown"
- #endif
+ #if FLEXT_SYS == FLEXT_SYS_PD
+// #define PD
+ #else
+ #error "Flext SYS/OS combination unknown"
+ #endif
#elif FLEXT_OS == FLEXT_OS_IRIX
-// #pragma message("Compiling for Irix")
+// #pragma message("Compiling for Irix")
- #if FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
- #else
- #error "Flext SYS/OS combination unknown"
- #endif
+ #if FLEXT_SYS == FLEXT_SYS_PD
+// #define PD
+ #else
+ #error "Flext SYS/OS combination unknown"
+ #endif
#elif FLEXT_OS == FLEXT_OS_MAC
-// #pragma message("Compiling for MacOS")
+// #pragma message("Compiling for MacOS")
- #if FLEXT_SYS == FLEXT_SYS_PD
-// #define PD
- #endif
+ #if FLEXT_SYS == FLEXT_SYS_PD
+// #define PD
+ #endif
#else
- #error "Operating system could not be determined"
+ #error "Operating system could not be determined"
#endif
#if FLEXT_SYS == FLEXT_SYS_MAX
-// #pragma message("Compiling for Max/MSP")
+// #pragma message("Compiling for Max/MSP")
#elif FLEXT_SYS == FLEXT_SYS_PD
-// #pragma message("Compiling for PD")
+// #pragma message("Compiling for PD")
#endif
// ----- set threading model -----
// shared builds are always threaded (although this not be so....)
#ifdef FLEXT_SHARED
- #undef FLEXT_THREADS
- #define FLEXT_THREADS
+ #undef FLEXT_THREADS
+ #define FLEXT_THREADS
/*
- // and also enabled for virtual daughter-classes??
- #undef FLEXT_VIRT
- #define FLEXT_VIRT
+ // and also enabled for virtual daughter-classes??
+ #undef FLEXT_VIRT
+ #define FLEXT_VIRT
*/
#endif
#ifdef FLEXT_THREADS
- #undef FLEXT_THREADS
- #if FLEXT_OS == FLEXT_OS_MAC && FLEXT_SYS == FLEXT_SYS_MAX
- // Max crashes with posix threads (because it's in the CFM model)
- #define FLEXT_THREADS FLEXT_THR_MP
- #elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
- // for wmax use native Windows threads
- #define FLEXT_THREADS FLEXT_THR_WIN32
- #else
- #define FLEXT_THREADS FLEXT_THR_POSIX
- #endif
+ #undef FLEXT_THREADS
+ #if FLEXT_OS == FLEXT_OS_MAC && FLEXT_SYS == FLEXT_SYS_MAX
+ // Max crashes with posix threads (because it's in the CFM model)
+ #define FLEXT_THREADS FLEXT_THR_MP
+ #elif FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
+ // for wmax use native Windows threads
+ #define FLEXT_THREADS FLEXT_THR_WIN32
+ #else
+ #define FLEXT_THREADS FLEXT_THR_POSIX
+ #endif
#endif
// ----- macros for class names -----
/*
With linux (flat linker namespace) and more than one flext-based external loaded all calls to static
exported functions refer to the first instance loaded!
- Therefore different class names are used so that the correct type of flext function is called.
+ Therefore different class names are used so that the correct type of flext function is called.
*/
#if defined(FLEXT_SHARED)
- #define FLEXT_CLASSDEF(CL) CL##_shared
+ #define FLEXT_CLASSDEF(CL) CL##_shared
#elif defined(FLEXT_THREADS)
- #define FLEXT_CLASSDEF(CL) CL##_multi
+ #define FLEXT_CLASSDEF(CL) CL##_multi
#else
- #define FLEXT_CLASSDEF(CL) CL##_single
+ #define FLEXT_CLASSDEF(CL) CL##_single
#endif
// std namespace
diff --git a/externals/grill/flext/source/flproxy.cpp b/externals/grill/flext/source/flproxy.cpp
index 4406fd07..c2f906b3 100755
--- a/externals/grill/flext/source/flproxy.cpp
+++ b/externals/grill/flext/source/flproxy.cpp
@@ -24,18 +24,18 @@ t_class *flext_base::px_class = NULL;
void flext_base::px_object::px_method(px_object *obj,const t_symbol *s,int argc,t_atom *argv)
{
- obj->base->m_methodmain(obj->index,s,argc,argv);
+ obj->base->m_methodmain(obj->index,s,argc,argv);
}
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,int argc,t_atom *argv)
{
- thisObject(c)->m_methodmain(0,s,argc,argv);
+ thisObject(c)->m_methodmain(0,s,argc,argv);
}
#define DEF_IN_FT(IX) \
void flext_base::cb_px_ft ## IX(t_class *c,float v) { \
- t_atom atom; SETFLOAT(&atom,v); \
- thisObject(c)->m_methodmain(IX,sym_float,1,&atom); \
+ t_atom atom; SETFLOAT(&atom,v); \
+ thisObject(c)->m_methodmain(IX,sym_float,1,&atom); \
}
#define ADD_IN_FT(IX) \
@@ -45,11 +45,11 @@ add_method1(c,cb_px_ft ## IX,"ft" #IX,A_FLOAT)
void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *argv)
{
- // check if inlet allows anything (or list)
-
- flext_base *o = thisObject(c);
- int ci = ((flext_hdr *)o->x_obj)->curinlet;
- o->m_methodmain(ci,s,argc,argv);
+ // check if inlet allows anything (or list)
+
+ flext_base *o = thisObject(c);
+ int ci = ((flext_hdr *)o->x_obj)->curinlet;
+ o->m_methodmain(ci,s,argc,argv);
}
#if 0 //FLEXT_OS == FLEXT_OS_WIN
@@ -57,45 +57,45 @@ void flext_base::cb_px_anything(t_class *c,const t_symbol *s,short argc,t_atom *
void flext_base::cb_px_int(t_class *c,long v)
{
- flext_base *o = thisObject(c);
- int ci = proxy_getinlet((t_object *)o->x_obj);
- // check if inlet allows int type
- t_atom atom;
- SetInt(atom,v);
- o->m_methodmain(ci,sym_int,1,&atom);
+ flext_base *o = thisObject(c);
+ int ci = proxy_getinlet((t_object *)o->x_obj);
+ // check if inlet allows int type
+ t_atom atom;
+ SetInt(atom,v);
+ o->m_methodmain(ci,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
- flext_base *o = thisObject(c);
- int ci = proxy_getinlet((t_object *)o->x_obj);
- // check if inlet allows float type
- t_atom atom;
- SetFloat(atom,v);
- o->m_methodmain(ci,sym_float,1,&atom);
+ flext_base *o = thisObject(c);
+ int ci = proxy_getinlet((t_object *)o->x_obj);
+ // check if inlet allows float type
+ t_atom atom;
+ SetFloat(atom,v);
+ o->m_methodmain(ci,sym_float,1,&atom);
}
#else
void flext_base::cb_px_int(t_class *c,long v)
{
- // check if inlet allows int type
- t_atom atom;
- SetInt(atom,v);
- cb_px_anything(c,sym_int,1,&atom);
+ // check if inlet allows int type
+ t_atom atom;
+ SetInt(atom,v);
+ cb_px_anything(c,sym_int,1,&atom);
}
void flext_base::cb_px_float(t_class *c,double v)
{
- // check if inlet allows float type
- t_atom atom;
- SetFloat(atom,v);
- cb_px_anything(c,sym_float,1,&atom);
+ // check if inlet allows float type
+ t_atom atom;
+ SetFloat(atom,v);
+ cb_px_anything(c,sym_float,1,&atom);
}
#endif
void flext_base::cb_px_bang(t_class *c)
{
- // check if inlet allows bang
- cb_px_anything(c,sym_bang,0,NULL);
+ // check if inlet allows bang
+ cb_px_anything(c,sym_bang,0,NULL);
}
@@ -123,50 +123,50 @@ DEF_IN_FT(9)
void flext_base::SetProxies(t_class *c)
{
- // proxy for extra inlets
+ // proxy for extra inlets
#if FLEXT_SYS == FLEXT_SYS_PD
- add_anything(c,cb_px_anything); // for leftmost inlet
+ add_anything(c,cb_px_anything); // for leftmost inlet
px_class = class_new(gensym("flext_base proxy"),NULL,NULL,sizeof(px_object),CLASS_PD|CLASS_NOINLET, A_NULL);
- add_anything(px_class,px_object::px_method); // for other inlets
+ add_anything(px_class,px_object::px_method); // for other inlets
#elif FLEXT_SYS == FLEXT_SYS_MAX
- add_bang(c,cb_px_bang);
- add_method1(c,cb_px_int,"int",A_INT);
- add_method1(c,cb_px_float,"float",A_FLOAT);
- add_methodG(c,cb_px_anything,"list");
- add_anything(c,cb_px_anything);
+ add_bang(c,cb_px_bang);
+ add_method1(c,cb_px_int,"int",A_INT);
+ add_method1(c,cb_px_float,"float",A_FLOAT);
+ add_methodG(c,cb_px_anything,"list");
+ add_anything(c,cb_px_anything);
#else
#error Not implemented!
-#endif
+#endif
#if 0 //FLEXT_SYS == FLEXT_SYS_MAX && FLEXT_OS == FLEXT_OS_WIN
- // could also work for OSX!
- addint((method)cb_px_int);
- addfloat((method)cb_px_float);
+ // could also work for OSX!
+ addint((method)cb_px_int);
+ addfloat((method)cb_px_float);
#else
- // setup non-leftmost ints and floats
- ADD_IN_FT(1);
- ADD_IN_FT(2);
- ADD_IN_FT(3);
- ADD_IN_FT(4);
- ADD_IN_FT(5);
- ADD_IN_FT(6);
- ADD_IN_FT(7);
- ADD_IN_FT(8);
- ADD_IN_FT(9);
+ // setup non-leftmost ints and floats
+ ADD_IN_FT(1);
+ ADD_IN_FT(2);
+ ADD_IN_FT(3);
+ ADD_IN_FT(4);
+ ADD_IN_FT(5);
+ ADD_IN_FT(6);
+ ADD_IN_FT(7);
+ ADD_IN_FT(8);
+ ADD_IN_FT(9);
#endif
}
#elif FLEXT_SYS == FLEXT_SYS_JMAX
void flext_base::jmax_proxy(fts_object_t *c, int winlet, fts_symbol_t s, int argc, const fts_atom_t *argv)
{
- flext_base *o = thisObject(c);
- o->m_methodmain(winlet,s,argc,argv);
+ flext_base *o = thisObject(c);
+ o->m_methodmain(winlet,s,argc,argv);
}
void flext_base::SetProxies(t_class *c)
{
- fts_class_set_default_handler(c, jmax_proxy);
+ fts_class_set_default_handler(c, jmax_proxy);
}
#endif
diff --git a/externals/grill/flext/source/flqueue.cpp b/externals/grill/flext/source/flqueue.cpp
index aaf82fef..41941734 100755
--- a/externals/grill/flext/source/flqueue.cpp
+++ b/externals/grill/flext/source/flqueue.cpp
@@ -27,43 +27,43 @@ flext::thrid_t flext::thrmsgid = 0;
class qmsg
{
public:
- qmsg(flext_base *b): nxt(NULL),th(b),tp(tp_none) {}
- ~qmsg();
-
- qmsg *nxt;
-
- void Clear();
-
- void SetBang(int o) { Clear(); out = o; tp = tp_bang; }
- void SetFloat(int o,float f) { Clear(); out = o; tp = tp_float; _float = f; }
- void SetInt(int o,int i) { Clear(); out = o; tp = tp_int; _int = i; }
- void SetSymbol(int o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; }
- void SetList(int o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = flext::CopyList(argc,argv); }
- void SetAny(int o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = flext::CopyList(argc,argv); }
-
- flext_base *th;
- int out;
- enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp;
- union {
- float _float;
- int _int;
- const t_symbol *_sym;
- struct { int argc; t_atom *argv; } _list;
- struct { const t_symbol *s; int argc; t_atom *argv; } _any;
- };
+ qmsg(flext_base *b): nxt(NULL),th(b),tp(tp_none) {}
+ ~qmsg();
+
+ qmsg *nxt;
+
+ void Clear();
+
+ void SetBang(int o) { Clear(); out = o; tp = tp_bang; }
+ void SetFloat(int o,float f) { Clear(); out = o; tp = tp_float; _float = f; }
+ void SetInt(int o,int i) { Clear(); out = o; tp = tp_int; _int = i; }
+ void SetSymbol(int o,const t_symbol *s) { Clear(); out = o; tp = tp_sym; _sym = s; }
+ void SetList(int o,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_list; _list.argc = argc,_list.argv = flext::CopyList(argc,argv); }
+ void SetAny(int o,const t_symbol *s,int argc,const t_atom *argv) { Clear(); out = o; tp = tp_any; _any.s = s,_any.argc = argc,_any.argv = flext::CopyList(argc,argv); }
+
+ flext_base *th;
+ int out;
+ enum { tp_none,tp_bang,tp_float,tp_int,tp_sym,tp_list,tp_any } tp;
+ union {
+ float _float;
+ int _int;
+ const t_symbol *_sym;
+ struct { int argc; t_atom *argv; } _list;
+ struct { const t_symbol *s; int argc; t_atom *argv; } _any;
+ };
};
qmsg::~qmsg()
{
- Clear();
- if(nxt) delete nxt;
+ Clear();
+ if(nxt) delete nxt;
}
void qmsg::Clear()
{
- if(tp == tp_list) { if(_list.argv) delete[] _list.argv; }
- else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; }
- tp = tp_none;
+ if(tp == tp_list) { if(_list.argv) delete[] _list.argv; }
+ else if(tp == tp_any) { if(_any.argv) delete[] _any.argv; }
+ tp = tp_none;
}
static volatile int qcnt = 0;
@@ -83,94 +83,94 @@ static flext::ThrMutex qmutex;
static void QWork(bool qlock,bool syslock)
{
- for(;;) {
- // Since qcnt can only be increased from any other function than QWork
- // qc will be a minimum guaranteed number of present queue elements.
- // On the other hand, if new queue elements are added by the methods called
- // in the loop, these will be sent in the next tick to avoid recursion overflow.
- int qc = qcnt;
- if(!qc) break;
-
- #ifdef FLEXT_QTHR
- if(syslock) sys_lock();
- #endif
-
- for(int i = 0; i < qc && qhead; ++i) {
- #ifdef FLEXT_THREADS
- if(qlock) qmutex.Lock();
- #endif
- qmsg *m = qhead;
- qcnt--;
- qhead = m->nxt;
- if(!qhead) qtail = NULL;
- m->nxt = NULL;
- #ifdef FLEXT_THREADS
- if(qlock) qmutex.Unlock();
- #endif
-
- if(m->out < 0) {
- // message to self
-
- const int n = -1-m->out;
- t_atom tmp;
-
- switch(m->tp) {
- case qmsg::tp_bang:
- m->th->m_methodmain(n,flext::sym_bang,0,&tmp);
- break;
- case qmsg::tp_float:
- flext::SetFloat(tmp,m->_float);
- m->th->m_methodmain(n,flext::sym_float,1,&tmp);
- break;
- case qmsg::tp_int:
- flext::SetInt(tmp,m->_int);
- #if FLEXT_SYS == FLEXT_SYS_PD
- m->th->m_methodmain(n,flext::sym_float,1,&tmp);
- #elif FLEXT_SYS == FLEXT_SYS_MAX
- m->th->m_methodmain(n,flext::sym_int,1,&tmp);
- #else
- #error Not implemented!
- #endif
- case qmsg::tp_sym:
- flext::SetSymbol(tmp,m->_sym);
- m->th->m_methodmain(n,flext::sym_symbol,1,&tmp);
- break;
- case qmsg::tp_list:
- m->th->m_methodmain(n,flext::sym_list,m->_list.argc,m->_list.argv);
- break;
- case qmsg::tp_any:
- m->th->m_methodmain(n,m->_any.s,m->_any.argc,m->_any.argv);
- break;
- #ifdef FLEXT_DEBUG
- default: ERRINTERNAL();
- #endif
- }
- }
- else {
- // message to outlet
-
- switch(m->tp) {
- case qmsg::tp_bang: m->th->ToSysBang(m->out); break;
- case qmsg::tp_float: m->th->ToSysFloat(m->out,m->_float); break;
- case qmsg::tp_int: m->th->ToSysInt(m->out,m->_int); break;
- case qmsg::tp_sym: m->th->ToSysSymbol(m->out,m->_sym); break;
- case qmsg::tp_list: m->th->ToSysList(m->out,m->_list.argc,m->_list.argv); break;
- case qmsg::tp_any: m->th->ToSysAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break;
- #ifdef FLEXT_DEBUG
- default: ERRINTERNAL();
- #endif
- }
- }
-
- // delete processed queue element
- delete m;
- } // inner loop
-
- #ifdef FLEXT_QTHR
- if(syslock) sys_unlock();
- #endif
-
- } // for(;;)
+ for(;;) {
+ // Since qcnt can only be increased from any other function than QWork
+ // qc will be a minimum guaranteed number of present queue elements.
+ // On the other hand, if new queue elements are added by the methods called
+ // in the loop, these will be sent in the next tick to avoid recursion overflow.
+ int qc = qcnt;
+ if(!qc) break;
+
+ #ifdef FLEXT_QTHR
+ if(syslock) sys_lock();
+ #endif
+
+ for(int i = 0; i < qc && qhead; ++i) {
+ #ifdef FLEXT_THREADS
+ if(qlock) qmutex.Lock();
+ #endif
+ qmsg *m = qhead;
+ qcnt--;
+ qhead = m->nxt;
+ if(!qhead) qtail = NULL;
+ m->nxt = NULL;
+ #ifdef FLEXT_THREADS
+ if(qlock) qmutex.Unlock();
+ #endif
+
+ if(m->out < 0) {
+ // message to self
+
+ const int n = -1-m->out;
+ t_atom tmp;
+
+ switch(m->tp) {
+ case qmsg::tp_bang:
+ m->th->m_methodmain(n,flext::sym_bang,0,&tmp);
+ break;
+ case qmsg::tp_float:
+ flext::SetFloat(tmp,m->_float);
+ m->th->m_methodmain(n,flext::sym_float,1,&tmp);
+ break;
+ case qmsg::tp_int:
+ flext::SetInt(tmp,m->_int);
+ #if FLEXT_SYS == FLEXT_SYS_PD
+ m->th->m_methodmain(n,flext::sym_float,1,&tmp);
+ #elif FLEXT_SYS == FLEXT_SYS_MAX
+ m->th->m_methodmain(n,flext::sym_int,1,&tmp);
+ #else
+ #error Not implemented!
+ #endif
+ case qmsg::tp_sym:
+ flext::SetSymbol(tmp,m->_sym);
+ m->th->m_methodmain(n,flext::sym_symbol,1,&tmp);
+ break;
+ case qmsg::tp_list:
+ m->th->m_methodmain(n,flext::sym_list,m->_list.argc,m->_list.argv);
+ break;
+ case qmsg::tp_any:
+ m->th->m_methodmain(n,m->_any.s,m->_any.argc,m->_any.argv);
+ break;
+ #ifdef FLEXT_DEBUG
+ default: ERRINTERNAL();
+ #endif
+ }
+ }
+ else {
+ // message to outlet
+
+ switch(m->tp) {
+ case qmsg::tp_bang: m->th->ToSysBang(m->out); break;
+ case qmsg::tp_float: m->th->ToSysFloat(m->out,m->_float); break;
+ case qmsg::tp_int: m->th->ToSysInt(m->out,m->_int); break;
+ case qmsg::tp_sym: m->th->ToSysSymbol(m->out,m->_sym); break;
+ case qmsg::tp_list: m->th->ToSysList(m->out,m->_list.argc,m->_list.argv); break;
+ case qmsg::tp_any: m->th->ToSysAnything(m->out,m->_any.s,m->_any.argc,m->_any.argv); break;
+ #ifdef FLEXT_DEBUG
+ default: ERRINTERNAL();
+ #endif
+ }
+ }
+
+ // delete processed queue element
+ delete m;
+ } // inner loop
+
+ #ifdef FLEXT_QTHR
+ if(syslock) sys_unlock();
+ #endif
+
+ } // for(;;)
}
#if !defined(FLEXT_QTHR)
@@ -181,11 +181,11 @@ static void QTick(fts_object_t *c,int winlet, fts_symbol_t s, int ac, const fts_
static void QTick(flext_base *c)
{
#endif
-// post("qtick");
+// post("qtick");
#ifdef FLEXT_THREADS
- FLEXT_ASSERT(flext::IsSystemThread());
+ FLEXT_ASSERT(flext::IsSystemThread());
#endif
- QWork(true,false);
+ QWork(true,false);
}
#endif
@@ -196,48 +196,48 @@ But then the order of sent messages is not as intended
void flext_base::QFlush(flext_base *th)
{
#ifdef FLEXT_THREADS
- if(!IsSystemThread()) {
- error("flext - Queue flush called by wrong thread!");
- return;
- }
+ if(!IsSystemThread()) {
+ error("flext - Queue flush called by wrong thread!");
+ return;
+ }
#endif
#ifdef FLEXT_THREADS
- qmutex.Lock();
+ qmutex.Lock();
#endif
- while(qcnt) QWork(false,false);
+ while(qcnt) QWork(false,false);
#ifdef FLEXT_THREADS
- qmutex.Unlock();
+ qmutex.Unlock();
#endif
}
static void Queue(qmsg *m)
{
-// post("Queue");
+// post("Queue");
#ifdef FLEXT_THREADS
- qmutex.Lock();
+ qmutex.Lock();
#endif
- if(qtail) qtail->nxt = m;
- else qhead = m;
- qtail = m;
- qcnt++;
+ if(qtail) qtail->nxt = m;
+ else qhead = m;
+ qtail = m;
+ qcnt++;
#ifdef FLEXT_THREADS
- qmutex.Unlock();
+ qmutex.Unlock();
#endif
#if FLEXT_SYS == FLEXT_SYS_PD
#ifdef FLEXT_QTHR
// wake up a worker thread
// (instead of triggering the clock)
- qthrcond.Signal();
- #else
- clock_delay(qclk,0);
+ qthrcond.Signal();
+ #else
+ clock_delay(qclk,0);
#endif
#elif FLEXT_SYS == FLEXT_SYS_MAX
- qelem_set(qclk);
+ qelem_set(qclk);
#elif FLEXT_SYS == FLEXT_SYS_JMAX
- // this is dangerous because there may be other timers on this object!
- fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0);
+ // this is dangerous because there may be other timers on this object!
+ fts_timebase_add_call(fts_get_timebase(), (fts_object_t *)thisHdr(), QTick, NULL, 0);
#else
#error Not implemented
#endif
@@ -247,28 +247,28 @@ static void Queue(qmsg *m)
void flext_base::QWorker(thr_params *)
{
thrmsgid = GetThreadId();
- for(;;) {
- qthrcond.Wait();
- QWork(true,true);
- }
+ for(;;) {
+ qthrcond.Wait();
+ QWork(true,true);
+ }
}
#endif
void flext_base::StartQueue()
{
- static bool started = false;
- if(started) return;
- else started = true;
+ static bool started = false;
+ if(started) return;
+ else started = true;
- // message queue ticker
- qhead = qtail = NULL;
- qcnt = 0;
+ // message queue ticker
+ qhead = qtail = NULL;
+ qcnt = 0;
#ifdef FLEXT_QTHR
- LaunchThread(QWorker,NULL);
+ LaunchThread(QWorker,NULL);
#else
#if FLEXT_SYS == FLEXT_SYS_PD || FLEXT_SYS == FLEXT_SYS_MAX
- qclk = (t_qelem *)(qelem_new(NULL,(t_method)QTick));
+ qclk = (t_qelem *)(qelem_new(NULL,(t_method)QTick));
#else
#error Not implemented!
#endif
@@ -277,50 +277,50 @@ void flext_base::StartQueue()
void flext_base::ToQueueBang(int o) const
{
- FLEXT_ASSERT(o >= 0);
- qmsg *m = new qmsg(const_cast<flext_base *>(this));
- m->SetBang(o);
- Queue(m);
+ FLEXT_ASSERT(o >= 0);
+ qmsg *m = new qmsg(const_cast<flext_base *>(this));
+ m->SetBang(o);
+ Queue(m);
}
void flext_base::ToQueueFloat(int o,float f) const
{
- FLEXT_ASSERT(o >= 0);
- qmsg *m = new qmsg(const_cast<flext_base *>(this));
- m->SetFloat(o,f);
- Queue(m);
+ FLEXT_ASSERT(o >= 0);
+ qmsg *m = new qmsg(const_cast<flext_base *>(this));
+ m->SetFloat(o,f);
+ Queue(m);
}
void flext_base::ToQueueInt(int o,int f) const
{
- FLEXT_ASSERT(o >= 0);
- qmsg *m = new qmsg(const_cast<flext_base *>(this));
- m->SetInt(o,f);
- Queue(m);
+ FLEXT_ASSERT(o >= 0);
+ qmsg *m = new qmsg(const_cast<flext_base *>(this));
+ m->SetInt(o,f);
+ Queue(m);
}
void flext_base::ToQueueSymbol(int o,const t_symbol *s) const
{
- FLEXT_ASSERT(o >= 0);
- qmsg *m = new qmsg(const_cast<flext_base *>(this));
- m->SetSymbol(o,s);
- Queue(m);
+ FLEXT_ASSERT(o >= 0);
+ qmsg *m = new qmsg(const_cast<flext_base *>(this));
+ m->SetSymbol(o,s);
+ Queue(m);
}
void flext_base::ToQueueList(int o,int argc,const t_atom *argv) const
{
- FLEXT_ASSERT(o >= 0);
- qmsg *m = new qmsg(const_cast<flext_base *>(this));
- m->SetList(o,argc,argv);
- Queue(m);
+ FLEXT_ASSERT(o >= 0);
+ qmsg *m = new qmsg(const_cast<flext_base *>(this));
+ m->SetList(o,argc,argv);
+ Queue(m);
}
void flext_base::ToQueueAnything(int o,const t_symbol *s,int argc,const t_atom *argv) const
{
- FLEXT_ASSERT(o >= 0);
- qmsg *m = new qmsg(const_cast<flext_base *>(this));
- m->SetAny(o,s,argc,argv);
- Queue(m);
+ FLEXT_ASSERT(o >= 0);
+ qmsg *m = new qmsg(const_cast<flext_base *>(this));
+ m->SetAny(o,s,argc,argv);
+ Queue(m);
}
diff --git a/externals/grill/flext/source/flsimd.cpp b/externals/grill/flext/source/flsimd.cpp
index c14bc1b1..d3487790 100755
--- a/externals/grill/flext/source/flsimd.cpp
+++ b/externals/grill/flext/source/flsimd.cpp
@@ -9,7 +9,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file flsimd.cpp
- \brief flext SIMD support functions
+ \brief flext SIMD support functions
If FLEXT_USE_SIMD is defined at compilation, SIMD instructions are used wherever feasible.
If used with MSVC++ the "Processor Pack" must be installed.
@@ -36,20 +36,20 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <emmintrin.h> // SSE2
#include <mm3dnow.h> // 3DNow!
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__MWERKS__) && defined(__ALTIVEC__)
- #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
- #include <sys/sysctl.h>
- #include <vDSP.h>
- #else
- #include <Gestalt.h>
- #endif
+ #if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
+ #include <sys/sysctl.h>
+ #include <vDSP.h>
+ #else
+ #include <Gestalt.h>
+ #endif
- #pragma altivec_model on
+ #pragma altivec_model on
- #include <altivec.h>
- #include <vectorOps.h>
+ #include <altivec.h>
+ #include <vectorOps.h>
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__GNUG__) && defined(__ALTIVEC__)
- #include <sys/sysctl.h>
- #include <vecLib/vecLib.h>
+ #include <sys/sysctl.h>
+ #include <vecLib/vecLib.h>
#endif
#endif // FLEXT_USE_SIMD
@@ -57,7 +57,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
static unsigned long setsimdcaps();
/*! \brief Holds SIMD capability flags
- \internal
+ \internal
*/
unsigned long flext::simdcaps = setsimdcaps();
@@ -259,7 +259,7 @@ static int _cpuid (_p_info *pinfo)
/*! \brief Determine SIMD capabilities
- \internal
+ \internal
*/
static unsigned long setsimdcaps()
{
@@ -275,23 +275,23 @@ static unsigned long setsimdcaps()
#if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
- int selectors[2] = { CTL_HW, HW_VECTORUNIT };
- int hasVectorUnit = 0;
- size_t length = sizeof(hasVectorUnit);
- int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+ int hasVectorUnit = 0;
+ size_t length = sizeof(hasVectorUnit);
+ int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
- if(!error && hasVectorUnit != 0) simdflags += flext::simd_altivec;
-
- #else
+ if(!error && hasVectorUnit != 0) simdflags += flext::simd_altivec;
+
+ #else
- long cpuAttributes;
- Boolean hasAltiVec = false;
- OSErr err = Gestalt( gestaltPowerPCProcessorFeatures, &cpuAttributes );
+ long cpuAttributes;
+ Boolean hasAltiVec = false;
+ OSErr err = Gestalt( gestaltPowerPCProcessorFeatures, &cpuAttributes );
- if( noErr == err )
- if(( 1 << gestaltPowerPCHasVectorInstructions) & cpuAttributes) simdflags += flext::simd_altivec;
+ if( noErr == err )
+ if(( 1 << gestaltPowerPCHasVectorInstructions) & cpuAttributes) simdflags += flext::simd_altivec;
- #endif
+ #endif
#endif
return simdflags;
}
@@ -304,53 +304,53 @@ static unsigned long setsimdcaps()
//! Load a vector from an unaligned location in memory
inline vector unsigned char LoadUnaligned( vector unsigned char *v )
{
- vector unsigned char permuteVector = vec_lvsl( 0, (int*) v );
- vector unsigned char low = vec_ld( 0, v );
- vector unsigned char high = vec_ld( 16, v );
- return vec_perm( low, high, permuteVector );
+ vector unsigned char permuteVector = vec_lvsl( 0, (int*) v );
+ vector unsigned char low = vec_ld( 0, v );
+ vector unsigned char high = vec_ld( 16, v );
+ return vec_perm( low, high, permuteVector );
}
//! Store a vector to an unaligned location in memory
inline void StoreUnaligned( vector unsigned char v, vector unsigned char *where)
{
- // Load the surrounding area
- vector unsigned char low = vec_ld( 0, where );
- vector unsigned char high = vec_ld( 16, where );
- // Prepare the constants that we need
- vector unsigned char permuteVector = vec_lvsr( 0, (int*) where );
-
- vector unsigned char oxFF = (vector unsigned char)vec_splat_s8( -1 );
- vector unsigned char ox00 = (vector unsigned char)vec_splat_s8( 0 );
- // Make a mask for which parts of the vectors to swap out
- vector unsigned char mask = vec_perm( ox00, oxFF, permuteVector );
- // Right rotate our input data
- v = vec_perm( v, v, permuteVector );
- // Insert our data into the low and high vectors
- low = vec_sel( v, low, mask );
- high = vec_sel( high, v, mask );
- // Store the two aligned result vectors
- vec_st( low, 0, where );
- vec_st( high, 16, where );
+ // Load the surrounding area
+ vector unsigned char low = vec_ld( 0, where );
+ vector unsigned char high = vec_ld( 16, where );
+ // Prepare the constants that we need
+ vector unsigned char permuteVector = vec_lvsr( 0, (int*) where );
+
+ vector unsigned char oxFF = (vector unsigned char)vec_splat_s8( -1 );
+ vector unsigned char ox00 = (vector unsigned char)vec_splat_s8( 0 );
+ // Make a mask for which parts of the vectors to swap out
+ vector unsigned char mask = vec_perm( ox00, oxFF, permuteVector );
+ // Right rotate our input data
+ v = vec_perm( v, v, permuteVector );
+ // Insert our data into the low and high vectors
+ low = vec_sel( v, low, mask );
+ high = vec_sel( high, v, mask );
+ // Store the two aligned result vectors
+ vec_st( low, 0, where );
+ vec_st( high, 16, where );
}
inline vector float LoadUnaligned(const float *v )
{
- return (vector float)LoadUnaligned((vector unsigned char *)v);
+ return (vector float)LoadUnaligned((vector unsigned char *)v);
}
inline void StoreUnaligned( vector float v,float *where)
{
- return StoreUnaligned((vector unsigned char)v,(vector unsigned char *)where);
+ return StoreUnaligned((vector unsigned char)v,(vector unsigned char *)where);
}
inline bool IsVectorAligned(const void *where)
{
- return reinterpret_cast<unsigned long>(where)&(sizeof(vector float)-1) == 0;
+ return reinterpret_cast<unsigned long>(where)&(sizeof(vector float)-1) == 0;
}
inline vector float LoadValue(const float &f)
{
- return IsVectorAligned(&f)?vec_splat(vec_ld(0,(vector float *)&f),0):LoadUnaligned(&f);
+ return IsVectorAligned(&f)?vec_splat(vec_ld(0,(vector float *)&f),0):LoadUnaligned(&f);
}
#endif
@@ -375,133 +375,136 @@ void flext::CopySamples(t_sample *dst,const t_sample *src,int cnt)
if(GetSIMDCapabilities()&simd_sse) {
// single precision
- __asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
- }
-
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
- if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0) {
- if((reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0) {
- // aligned src, aligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
+ if(!n) goto zero;
+
+ __asm {
+ mov eax,dword ptr [src]
+ prefetcht0 [eax+0]
+ prefetcht0 [eax+32]
+ }
+
+ if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0) {
+ if((reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0) {
+ // aligned src, aligned dst
+ __asm {
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ecx,[n]
loopaa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movaps xmm0,xmmword ptr[eax]
- movaps xmmword ptr[edx],xmm0
- movaps xmm1,xmmword ptr[eax+4*4]
- movaps xmmword ptr[edx+4*4],xmm1
- movaps xmm2,xmmword ptr[eax+8*4]
- movaps xmmword ptr[edx+8*4],xmm2
- movaps xmm3,xmmword ptr[eax+12*4]
- movaps xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopaa
- }
- }
- else {
- // aligned src, unaligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
+ movaps xmm0,xmmword ptr[eax]
+ movaps xmmword ptr[edx],xmm0
+ movaps xmm1,xmmword ptr[eax+4*4]
+ movaps xmmword ptr[edx+4*4],xmm1
+ movaps xmm2,xmmword ptr[eax+8*4]
+ movaps xmmword ptr[edx+8*4],xmm2
+ movaps xmm3,xmmword ptr[eax+12*4]
+ movaps xmmword ptr[edx+12*4],xmm3
+
+ add eax,16*4
+ add edx,16*4
+ loop loopaa
+ }
+ }
+ else {
+ // aligned src, unaligned dst
+ __asm {
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ecx,[n]
loopau:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movaps xmm0,xmmword ptr[eax]
- movups xmmword ptr[edx],xmm0
- movaps xmm1,xmmword ptr[eax+4*4]
- movups xmmword ptr[edx+4*4],xmm1
- movaps xmm2,xmmword ptr[eax+8*4]
- movups xmmword ptr[edx+8*4],xmm2
- movaps xmm3,xmmword ptr[eax+12*4]
- movups xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopau
- }
- }
- }
- else {
- if((reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0) {
- // unaligned src, aligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
+ movaps xmm0,xmmword ptr[eax]
+ movups xmmword ptr[edx],xmm0
+ movaps xmm1,xmmword ptr[eax+4*4]
+ movups xmmword ptr[edx+4*4],xmm1
+ movaps xmm2,xmmword ptr[eax+8*4]
+ movups xmmword ptr[edx+8*4],xmm2
+ movaps xmm3,xmmword ptr[eax+12*4]
+ movups xmmword ptr[edx+12*4],xmm3
+
+ add eax,16*4
+ add edx,16*4
+ loop loopau
+ }
+ }
+ }
+ else {
+ if((reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0) {
+ // unaligned src, aligned dst
+ __asm {
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ecx,[n]
loopua:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movups xmm0,xmmword ptr[eax]
- movaps xmmword ptr[edx],xmm0
- movups xmm1,xmmword ptr[eax+4*4]
- movaps xmmword ptr[edx+4*4],xmm1
- movups xmm2,xmmword ptr[eax+8*4]
- movaps xmmword ptr[edx+8*4],xmm2
- movups xmm3,xmmword ptr[eax+12*4]
- movaps xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopua
- }
- }
- else {
- // unaligned src, unaligned dst
- __asm {
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ecx,[n]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
+ movups xmm0,xmmword ptr[eax]
+ movaps xmmword ptr[edx],xmm0
+ movups xmm1,xmmword ptr[eax+4*4]
+ movaps xmmword ptr[edx+4*4],xmm1
+ movups xmm2,xmmword ptr[eax+8*4]
+ movaps xmmword ptr[edx+8*4],xmm2
+ movups xmm3,xmmword ptr[eax+12*4]
+ movaps xmmword ptr[edx+12*4],xmm3
+
+ add eax,16*4
+ add edx,16*4
+ loop loopua
+ }
+ }
+ else {
+ // unaligned src, unaligned dst
+ __asm {
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ecx,[n]
loopuu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
- movups xmm0,xmmword ptr[eax]
- movups xmmword ptr[edx],xmm0
- movups xmm1,xmmword ptr[eax+4*4]
- movups xmmword ptr[edx+4*4],xmm1
- movups xmm2,xmmword ptr[eax+8*4]
- movups xmmword ptr[edx+8*4],xmm2
- movups xmm3,xmmword ptr[eax+12*4]
- movups xmmword ptr[edx+12*4],xmm3
-
- add eax,16*4
- add edx,16*4
- loop loopuu
- }
- }
- }
- while(cnt--) *(dst++) = *(src++);
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
+ movups xmm0,xmmword ptr[eax]
+ movups xmmword ptr[edx],xmm0
+ movups xmm1,xmmword ptr[eax+4*4]
+ movups xmmword ptr[edx+4*4],xmm1
+ movups xmm2,xmmword ptr[eax+8*4]
+ movups xmmword ptr[edx+8*4],xmm2
+ movups xmm3,xmmword ptr[eax+12*4]
+ movups xmmword ptr[edx+12*4],xmm3
+
+ add eax,16*4
+ add edx,16*4
+ loop loopuu
+ }
+ }
+ }
+zero:
+ while(cnt--) *(dst++) = *(src++);
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VECTOROPS__)
if(true) {
- int n = cnt>>2,n4 = n<<2;
- vScopy(n4,(vector float *)src,(vector float *)dst);
- cnt -= n4,src += n4,dst += n4;
- while(cnt--) *(dst++) = *(src++);
- }
- else
+ int n = cnt>>2,n4 = n<<2;
+ vScopy(n4,(vector float *)src,(vector float *)dst);
+ cnt -= n4,src += n4,dst += n4;
+ while(cnt--) *(dst++) = *(src++);
+ }
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
- while(n--) {
- dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3];
- dst[4] = src[4]; dst[5] = src[5]; dst[6] = src[6]; dst[7] = src[7];
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++);
+ int n = cnt>>3;
+ cnt -= n<<3;
+ while(n--) {
+ dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3];
+ dst[4] = src[4]; dst[5] = src[5]; dst[6] = src[6]; dst[7] = src[7];
+ src += 8,dst += 8;
+ }
+ while(cnt--) *(dst++) = *(src++);
}
#endif
}
@@ -513,146 +516,146 @@ static const vector float zero = (vector float)(0);
static void SetAltivec(t_sample *dst,int cnt,t_sample s)
{
- vector float svec = LoadValue(s);
- int n = cnt>>4;
+ vector float svec = LoadValue(s);
+ int n = cnt>>4;
cnt -= n<<4;
- while(n--) {
- vec_st(svec,0,dst);
- vec_st(svec,16,dst);
- vec_st(svec,32,dst);
- vec_st(svec,48,dst);
- dst += 16;
- }
+ while(n--) {
+ vec_st(svec,0,dst);
+ vec_st(svec,16,dst);
+ vec_st(svec,32,dst);
+ vec_st(svec,48,dst);
+ dst += 16;
+ }
while(cnt--) *(dst++) = s;
}
static void MulAltivec(t_sample *dst,const t_sample *src,t_sample op,int cnt)
{
- const vector float arg = LoadValue(op);
- int n = cnt>>4;
+ const vector float arg = LoadValue(op);
+ int n = cnt>>4;
cnt -= n<<4;
- for(; n--; src += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src);
- vector float a2 = vec_ld(16,src);
- vector float a3 = vec_ld(32,src);
- vector float a4 = vec_ld(48,src);
-
- a1 = vec_madd(a1,arg,zero);
- a2 = vec_madd(a2,arg,zero);
- a3 = vec_madd(a3,arg,zero);
- a4 = vec_madd(a4,arg,zero);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
+ for(; n--; src += 16,dst += 16) {
+ vector float a1 = vec_ld( 0,src);
+ vector float a2 = vec_ld(16,src);
+ vector float a3 = vec_ld(32,src);
+ vector float a4 = vec_ld(48,src);
+
+ a1 = vec_madd(a1,arg,zero);
+ a2 = vec_madd(a2,arg,zero);
+ a3 = vec_madd(a3,arg,zero);
+ a4 = vec_madd(a4,arg,zero);
+
+ vec_st(a1, 0,dst);
+ vec_st(a2,16,dst);
+ vec_st(a3,32,dst);
+ vec_st(a4,48,dst);
+ }
while(cnt--) *(dst++) = *(src++)*op;
}
static void MulAltivec(t_sample *dst,const t_sample *src,const t_sample *op,int cnt)
{
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
-
- for(; n--; src += 16,op += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
- vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
- vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
- vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
-
- a1 = vec_madd(a1,b1,zero);
- a2 = vec_madd(a2,b2,zero);
- a3 = vec_madd(a3,b3,zero);
- a4 = vec_madd(a4,b4,zero);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
- while(cnt--) *(dst++) = *(src++) * *(op++);
+
+ for(; n--; src += 16,op += 16,dst += 16) {
+ vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
+ vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
+ vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
+ vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
+
+ a1 = vec_madd(a1,b1,zero);
+ a2 = vec_madd(a2,b2,zero);
+ a3 = vec_madd(a3,b3,zero);
+ a4 = vec_madd(a4,b4,zero);
+
+ vec_st(a1, 0,dst);
+ vec_st(a2,16,dst);
+ vec_st(a3,32,dst);
+ vec_st(a4,48,dst);
+ }
+ while(cnt--) *(dst++) = *(src++) * *(op++);
}
static void AddAltivec(t_sample *dst,const t_sample *src,t_sample op,int cnt)
{
- const vector float arg = LoadValue(op);
- int n = cnt>>4;
+ const vector float arg = LoadValue(op);
+ int n = cnt>>4;
cnt -= n<<4;
- for(; n--; src += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src);
- vector float a2 = vec_ld(16,src);
- vector float a3 = vec_ld(32,src);
- vector float a4 = vec_ld(48,src);
-
- a1 = vec_add(a1,arg);
- a2 = vec_add(a2,arg);
- a3 = vec_add(a3,arg);
- a4 = vec_add(a4,arg);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
+ for(; n--; src += 16,dst += 16) {
+ vector float a1 = vec_ld( 0,src);
+ vector float a2 = vec_ld(16,src);
+ vector float a3 = vec_ld(32,src);
+ vector float a4 = vec_ld(48,src);
+
+ a1 = vec_add(a1,arg);
+ a2 = vec_add(a2,arg);
+ a3 = vec_add(a3,arg);
+ a4 = vec_add(a4,arg);
+
+ vec_st(a1, 0,dst);
+ vec_st(a2,16,dst);
+ vec_st(a3,32,dst);
+ vec_st(a4,48,dst);
+ }
while(cnt--) *(dst++) = *(src++)+op;
}
static void AddAltivec(t_sample *dst,const t_sample *src,const t_sample *op,int cnt)
{
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
-
- for(; n--; src += 16,op += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
- vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
- vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
- vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
-
- a1 = vec_add(a1,b1);
- a2 = vec_add(a2,b2);
- a3 = vec_add(a3,b3);
- a4 = vec_add(a4,b4);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
- while(cnt--) *(dst++) = *(src++) + *(op++);
+
+ for(; n--; src += 16,op += 16,dst += 16) {
+ vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
+ vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
+ vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
+ vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
+
+ a1 = vec_add(a1,b1);
+ a2 = vec_add(a2,b2);
+ a3 = vec_add(a3,b3);
+ a4 = vec_add(a4,b4);
+
+ vec_st(a1, 0,dst);
+ vec_st(a2,16,dst);
+ vec_st(a3,32,dst);
+ vec_st(a4,48,dst);
+ }
+ while(cnt--) *(dst++) = *(src++) + *(op++);
}
static void ScaleAltivec(t_sample *dst,const t_sample *src,t_sample opmul,t_sample opadd,int cnt)
{
- const vector float argmul = LoadValue(opmul);
- const vector float argadd = LoadValue(opadd);
- int n = cnt>>4;
+ const vector float argmul = LoadValue(opmul);
+ const vector float argadd = LoadValue(opadd);
+ int n = cnt>>4;
cnt -= n<<4;
- for(; n--; src += 16,dst += 16) {
- vector float a1 = vec_ld( 0,src);
- vector float a2 = vec_ld(16,src);
- vector float a3 = vec_ld(32,src);
- vector float a4 = vec_ld(48,src);
-
- a1 = vec_madd(a1,argmul,argadd);
- a2 = vec_madd(a2,argmul,argadd);
- a3 = vec_madd(a3,argmul,argadd);
- a4 = vec_madd(a4,argmul,argadd);
-
- vec_st(a1, 0,dst);
- vec_st(a2,16,dst);
- vec_st(a3,32,dst);
- vec_st(a4,48,dst);
- }
-
- while(cnt--) *(dst++) = *(src++)*opmul+opadd;
+ for(; n--; src += 16,dst += 16) {
+ vector float a1 = vec_ld( 0,src);
+ vector float a2 = vec_ld(16,src);
+ vector float a3 = vec_ld(32,src);
+ vector float a4 = vec_ld(48,src);
+
+ a1 = vec_madd(a1,argmul,argadd);
+ a2 = vec_madd(a2,argmul,argadd);
+ a3 = vec_madd(a3,argmul,argadd);
+ a4 = vec_madd(a4,argmul,argadd);
+
+ vec_st(a1, 0,dst);
+ vec_st(a2,16,dst);
+ vec_st(a3,32,dst);
+ vec_st(a4,48,dst);
+ }
+
+ while(cnt--) *(dst++) = *(src++)*opmul+opadd;
}
#endif
@@ -671,62 +674,64 @@ void flext::SetSamples(t_sample *dst,int cnt,t_sample s)
if(GetSIMDCapabilities()&simd_sse) {
// single precision
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
+ if(!n) goto zero;
__asm {
- movss xmm0,xmmword ptr [s]
- shufps xmm0,xmm0,0
- }
+ movss xmm0,xmmword ptr [s]
+ shufps xmm0,xmm0,0
+ }
if((reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0) {
// aligned version
- __asm {
- mov ecx,[n]
- mov edx,dword ptr [dst]
+ __asm {
+ mov ecx,[n]
+ mov edx,dword ptr [dst]
loopa:
- movaps xmmword ptr[edx],xmm0
- movaps xmmword ptr[edx+4*4],xmm0
- movaps xmmword ptr[edx+8*4],xmm0
- movaps xmmword ptr[edx+12*4],xmm0
-
- add edx,16*4
- loop loopa
- }
+ movaps xmmword ptr[edx],xmm0
+ movaps xmmword ptr[edx+4*4],xmm0
+ movaps xmmword ptr[edx+8*4],xmm0
+ movaps xmmword ptr[edx+12*4],xmm0
+
+ add edx,16*4
+ loop loopa
+ }
}
else {
// unaligned version
- __asm {
- mov ecx,[n]
- mov edx,dword ptr [dst]
+ __asm {
+ mov ecx,[n]
+ mov edx,dword ptr [dst]
loopu:
- movups xmmword ptr[edx],xmm0
- movups xmmword ptr[edx+4*4],xmm0
- movups xmmword ptr[edx+8*4],xmm0
- movups xmmword ptr[edx+12*4],xmm0
-
- add edx,16*4
- loop loopu
- }
+ movups xmmword ptr[edx],xmm0
+ movups xmmword ptr[edx+4*4],xmm0
+ movups xmmword ptr[edx+8*4],xmm0
+ movups xmmword ptr[edx+12*4],xmm0
+
+ add edx,16*4
+ loop loopu
+ }
}
- while(cnt--) *(dst++) = s;
+zero:
+ while(cnt--) *(dst++) = s;
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(dst))
- SetAltivec(dst,cnt,s);
- else
+ SetAltivec(dst,cnt,s);
+ else
#endif
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
- while(n--) {
- dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = s;
- dst += 8;
- }
-
- while(cnt--) *(dst++) = s;
+ int n = cnt>>3;
+ cnt -= n<<3;
+ while(n--) {
+ dst[0] = dst[1] = dst[2] = dst[3] = dst[4] = dst[5] = dst[6] = dst[7] = s;
+ dst += 8;
+ }
+
+ while(cnt--) *(dst++) = s;
}
#endif
}
@@ -750,118 +755,121 @@ void flext::MulSamples(t_sample *dst,const t_sample *src,t_sample op,int cnt)
// single precision
__m128 a = _mm_load1_ps(&op);
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
+ if(!n) goto zero;
+
__asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
+ mov eax,dword ptr [src]
+ prefetcht0 [eax+0]
+ prefetcht0 [eax+32]
- movss xmm0,xmmword ptr [op]
- shufps xmm0,xmm0,0
- }
+ movss xmm0,xmmword ptr [op]
+ shufps xmm0,xmm0,0
+ }
if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
&& (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
) {
// aligned version
__asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
loopa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
- movaps xmm1,xmmword ptr[eax]
- mulps xmm1,xmm0
- movaps xmmword ptr[edx],xmm1
+ movaps xmm1,xmmword ptr[eax]
+ mulps xmm1,xmm0
+ movaps xmmword ptr[edx],xmm1
- movaps xmm2,xmmword ptr[eax+4*4]
- mulps xmm2,xmm0
- movaps xmmword ptr[edx+4*4],xmm2
+ movaps xmm2,xmmword ptr[eax+4*4]
+ mulps xmm2,xmm0
+ movaps xmmword ptr[edx+4*4],xmm2
- movaps xmm3,xmmword ptr[eax+8*4]
- mulps xmm3,xmm0
- movaps xmmword ptr[edx+8*4],xmm3
+ movaps xmm3,xmmword ptr[eax+8*4]
+ mulps xmm3,xmm0
+ movaps xmmword ptr[edx+8*4],xmm3
- movaps xmm4,xmmword ptr[eax+12*4]
- mulps xmm4,xmm0
- movaps xmmword ptr[edx+12*4],xmm4
+ movaps xmm4,xmmword ptr[eax+12*4]
+ mulps xmm4,xmm0
+ movaps xmmword ptr[edx+12*4],xmm4
- add eax,16*4
- add edx,16*4
- loop loopa
+ add eax,16*4
+ add edx,16*4
+ loop loopa
}
}
else {
// unaligned version
__asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
loopu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
- movups xmm1,xmmword ptr[eax]
- mulps xmm1,xmm0
- movups xmmword ptr[edx],xmm1
+ movups xmm1,xmmword ptr[eax]
+ mulps xmm1,xmm0
+ movups xmmword ptr[edx],xmm1
- movups xmm2,xmmword ptr[eax+4*4]
- mulps xmm2,xmm0
- movups xmmword ptr[edx+4*4],xmm2
+ movups xmm2,xmmword ptr[eax+4*4]
+ mulps xmm2,xmm0
+ movups xmmword ptr[edx+4*4],xmm2
- movups xmm3,xmmword ptr[eax+8*4]
- mulps xmm3,xmm0
- movups xmmword ptr[edx+8*4],xmm3
+ movups xmm3,xmmword ptr[eax+8*4]
+ mulps xmm3,xmm0
+ movups xmmword ptr[edx+8*4],xmm3
- movups xmm4,xmmword ptr[eax+12*4]
- mulps xmm4,xmm0
- movups xmmword ptr[edx+12*4],xmm4
+ movups xmm4,xmmword ptr[eax+12*4]
+ mulps xmm4,xmm0
+ movups xmmword ptr[edx+12*4],xmm4
- add eax,16*4
- add edx,16*4
- loop loopu
- }
+ add eax,16*4
+ add edx,16*4
+ loop loopu
+ }
}
- while(cnt--) *(dst++) = *(src++)*op;
+zero:
+ while(cnt--) *(dst++) = *(src++)*op;
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
if(true) {
- vsmul(src,1,&op,dst,1,cnt);
- }
- else
+ vsmul(src,1,&op,dst,1,cnt);
+ }
+ else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst))
- MulAltivec(dst,src,op,cnt);
- else
+ MulAltivec(dst,src,op,cnt);
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(src == dst) {
- while(n--) {
- dst[0] *= op; dst[1] *= op; dst[2] *= op; dst[3] *= op;
- dst[4] *= op; dst[5] *= op; dst[6] *= op; dst[7] *= op;
- dst += 8;
- }
- while(cnt--) *(dst++) *= op;
- }
- else {
- while(n--) {
- dst[0] = src[0]*op; dst[1] = src[1]*op;
- dst[2] = src[2]*op; dst[3] = src[3]*op;
- dst[4] = src[4]*op; dst[5] = src[5]*op;
- dst[6] = src[6]*op; dst[7] = src[7]*op;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++)*op;
- }
+ int n = cnt>>3;
+ cnt -= n<<3;
+
+ if(src == dst) {
+ while(n--) {
+ dst[0] *= op; dst[1] *= op; dst[2] *= op; dst[3] *= op;
+ dst[4] *= op; dst[5] *= op; dst[6] *= op; dst[7] *= op;
+ dst += 8;
+ }
+ while(cnt--) *(dst++) *= op;
+ }
+ else {
+ while(n--) {
+ dst[0] = src[0]*op; dst[1] = src[1]*op;
+ dst[2] = src[2]*op; dst[3] = src[3]*op;
+ dst[4] = src[4]*op; dst[5] = src[5]*op;
+ dst[6] = src[6]*op; dst[7] = src[7]*op;
+ src += 8,dst += 8;
+ }
+ while(cnt--) *(dst++) = *(src++)*op;
+ }
}
#endif
}
@@ -883,214 +891,217 @@ void flext::MulSamples(t_sample *dst,const t_sample *src,const t_sample *op,int
#ifdef _MSC_VER
if(GetSIMDCapabilities()&simd_sse) {
// single precision
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
- __asm {
- mov eax,[src]
- mov ebx,[op]
- prefetcht0 [eax+0]
- prefetcht0 [ebx+0]
- prefetcht0 [eax+32]
- prefetcht0 [ebx+32]
- }
+ if(!n) goto zero;
+
+ __asm {
+ mov eax,[src]
+ mov ebx,[op]
+ prefetcht0 [eax+0]
+ prefetcht0 [ebx+0]
+ prefetcht0 [eax+32]
+ prefetcht0 [ebx+32]
+ }
if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
&& (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
- ) {
- if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopaa:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopaa
- }
- }
- else {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopau:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopau
- }
- }
- }
+ ) {
+ if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
+ __asm {
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopaa:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movaps xmm0,xmmword ptr[eax]
+ movaps xmm1,xmmword ptr[ebx]
+ mulps xmm0,xmm1
+ movaps xmmword ptr[edx],xmm0
+
+ movaps xmm2,xmmword ptr[eax+4*4]
+ movaps xmm3,xmmword ptr[ebx+4*4]
+ mulps xmm2,xmm3
+ movaps xmmword ptr[edx+4*4],xmm2
+
+ movaps xmm4,xmmword ptr[eax+8*4]
+ movaps xmm5,xmmword ptr[ebx+8*4]
+ mulps xmm4,xmm5
+ movaps xmmword ptr[edx+8*4],xmm4
+
+ movaps xmm6,xmmword ptr[eax+12*4]
+ movaps xmm7,xmmword ptr[ebx+12*4]
+ mulps xmm6,xmm7
+ movaps xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopaa
+ }
+ }
+ else {
+ __asm {
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopau:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movaps xmm0,xmmword ptr[eax]
+ movups xmm1,xmmword ptr[ebx]
+ mulps xmm0,xmm1
+ movaps xmmword ptr[edx],xmm0
+
+ movaps xmm2,xmmword ptr[eax+4*4]
+ movups xmm3,xmmword ptr[ebx+4*4]
+ mulps xmm2,xmm3
+ movaps xmmword ptr[edx+4*4],xmm2
+
+ movaps xmm4,xmmword ptr[eax+8*4]
+ movups xmm5,xmmword ptr[ebx+8*4]
+ mulps xmm4,xmm5
+ movaps xmmword ptr[edx+8*4],xmm4
+
+ movaps xmm6,xmmword ptr[eax+12*4]
+ movups xmm7,xmmword ptr[ebx+12*4]
+ mulps xmm6,xmm7
+ movaps xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopau
+ }
+ }
+ }
else {
- if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopua:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopua
- }
- }
- else {
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
+ if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
+ __asm {
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopua:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movups xmm0,xmmword ptr[eax]
+ movaps xmm1,xmmword ptr[ebx]
+ mulps xmm0,xmm1
+ movups xmmword ptr[edx],xmm0
+
+ movups xmm2,xmmword ptr[eax+4*4]
+ movaps xmm3,xmmword ptr[ebx+4*4]
+ mulps xmm2,xmm3
+ movups xmmword ptr[edx+4*4],xmm2
+
+ movups xmm4,xmmword ptr[eax+8*4]
+ movaps xmm5,xmmword ptr[ebx+8*4]
+ mulps xmm4,xmm5
+ movups xmmword ptr[edx+8*4],xmm4
+
+ movups xmm6,xmmword ptr[eax+12*4]
+ movaps xmm7,xmmword ptr[ebx+12*4]
+ mulps xmm6,xmm7
+ movups xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopua
+ }
+ }
+ else {
+ __asm {
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
loopuu:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- mulps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- mulps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- mulps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- mulps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopuu
- }
- }
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movups xmm0,xmmword ptr[eax]
+ movups xmm1,xmmword ptr[ebx]
+ mulps xmm0,xmm1
+ movups xmmword ptr[edx],xmm0
+
+ movups xmm2,xmmword ptr[eax+4*4]
+ movups xmm3,xmmword ptr[ebx+4*4]
+ mulps xmm2,xmm3
+ movups xmmword ptr[edx+4*4],xmm2
+
+ movups xmm4,xmmword ptr[eax+8*4]
+ movups xmm5,xmmword ptr[ebx+8*4]
+ mulps xmm4,xmm5
+ movups xmmword ptr[edx+8*4],xmm4
+
+ movups xmm6,xmmword ptr[eax+12*4]
+ movups xmm7,xmmword ptr[ebx+12*4]
+ mulps xmm6,xmm7
+ movups xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopuu
+ }
+ }
}
- while(cnt--) *(dst++) = *(src++) * *(op++);
+zero:
+ while(cnt--) *(dst++) = *(src++) * *(op++);
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
if(true) {
- vmul(src,1,op,1,dst,1,cnt);
- }
- else
+ vmul(src,1,op,1,dst,1,cnt);
+ }
+ else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(op) && IsVectorAligned(dst))
- MulAltivec(dst,src,op,cnt);
- else
+ MulAltivec(dst,src,op,cnt);
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(src == dst) {
- while(n--) {
- dst[0] *= op[0]; dst[1] *= op[1];
- dst[2] *= op[2]; dst[3] *= op[3];
- dst[4] *= op[4]; dst[5] *= op[5];
- dst[6] *= op[6]; dst[7] *= op[7];
- dst += 8,op += 8;
- }
- while(cnt--) *(dst++) *= *(op++);
- }
- else {
- while(n--) {
- dst[0] = src[0]*op[0]; dst[1] = src[1]*op[1];
- dst[2] = src[2]*op[2]; dst[3] = src[3]*op[3];
- dst[4] = src[4]*op[4]; dst[5] = src[5]*op[5];
- dst[6] = src[6]*op[6]; dst[7] = src[7]*op[7];
- src += 8,dst += 8,op += 8;
- }
- while(cnt--) *(dst++) = *(src++) * *(op++);
- }
+ int n = cnt>>3;
+ cnt -= n<<3;
+
+ if(src == dst) {
+ while(n--) {
+ dst[0] *= op[0]; dst[1] *= op[1];
+ dst[2] *= op[2]; dst[3] *= op[3];
+ dst[4] *= op[4]; dst[5] *= op[5];
+ dst[6] *= op[6]; dst[7] *= op[7];
+ dst += 8,op += 8;
+ }
+ while(cnt--) *(dst++) *= *(op++);
+ }
+ else {
+ while(n--) {
+ dst[0] = src[0]*op[0]; dst[1] = src[1]*op[1];
+ dst[2] = src[2]*op[2]; dst[3] = src[3]*op[3];
+ dst[4] = src[4]*op[4]; dst[5] = src[5]*op[5];
+ dst[6] = src[6]*op[6]; dst[7] = src[7]*op[7];
+ src += 8,dst += 8,op += 8;
+ }
+ while(cnt--) *(dst++) = *(src++) * *(op++);
+ }
}
#endif
}
@@ -1112,113 +1123,113 @@ void flext::AddSamples(t_sample *dst,const t_sample *src,t_sample op,int cnt)
#ifdef _MSC_VER
if(GetSIMDCapabilities()&simd_sse) {
// single precision
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
__asm {
- mov eax,[src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
+ mov eax,[src]
+ prefetcht0 [eax+0]
+ prefetcht0 [eax+32]
- movss xmm0,xmmword ptr [op]
- shufps xmm0,xmm0,0
- }
+ movss xmm0,xmmword ptr [op]
+ shufps xmm0,xmm0,0
+ }
if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
&& (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
) {
// aligned version
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
+ __asm {
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
loopa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
- movaps xmm1,xmmword ptr[eax]
- addps xmm1,xmm0
- movaps xmmword ptr[edx],xmm1
+ movaps xmm1,xmmword ptr[eax]
+ addps xmm1,xmm0
+ movaps xmmword ptr[edx],xmm1
- movaps xmm2,xmmword ptr[eax+4*4]
- addps xmm2,xmm0
- movaps xmmword ptr[edx+4*4],xmm2
+ movaps xmm2,xmmword ptr[eax+4*4]
+ addps xmm2,xmm0
+ movaps xmmword ptr[edx+4*4],xmm2
- movaps xmm3,xmmword ptr[eax+8*4]
- addps xmm3,xmm0
- movaps xmmword ptr[edx+8*4],xmm3
+ movaps xmm3,xmmword ptr[eax+8*4]
+ addps xmm3,xmm0
+ movaps xmmword ptr[edx+8*4],xmm3
- movaps xmm4,xmmword ptr[eax+12*4]
- addps xmm4,xmm0
- movaps xmmword ptr[edx+12*4],xmm4
+ movaps xmm4,xmmword ptr[eax+12*4]
+ addps xmm4,xmm0
+ movaps xmmword ptr[edx+12*4],xmm4
- add eax,16*4
- add edx,16*4
- loop loopa
+ add eax,16*4
+ add edx,16*4
+ loop loopa
}
}
else {
// unaligned version
- __asm {
- mov ecx,[n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
+ __asm {
+ mov ecx,[n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
loopu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
- movups xmm1,xmmword ptr[eax]
- addps xmm1,xmm0
- movups xmmword ptr[edx],xmm1
+ movups xmm1,xmmword ptr[eax]
+ addps xmm1,xmm0
+ movups xmmword ptr[edx],xmm1
- movups xmm2,xmmword ptr[eax+4*4]
- addps xmm2,xmm0
- movups xmmword ptr[edx+4*4],xmm2
+ movups xmm2,xmmword ptr[eax+4*4]
+ addps xmm2,xmm0
+ movups xmmword ptr[edx+4*4],xmm2
- movups xmm3,xmmword ptr[eax+8*4]
- addps xmm3,xmm0
- movups xmmword ptr[edx+8*4],xmm3
+ movups xmm3,xmmword ptr[eax+8*4]
+ addps xmm3,xmm0
+ movups xmmword ptr[edx+8*4],xmm3
- movups xmm4,xmmword ptr[eax+12*4]
- addps xmm4,xmm0
- movups xmmword ptr[edx+12*4],xmm4
+ movups xmm4,xmmword ptr[eax+12*4]
+ addps xmm4,xmm0
+ movups xmmword ptr[edx+12*4],xmm4
- add eax,16*4
- add edx,16*4
- loop loopu
- }
+ add eax,16*4
+ add edx,16*4
+ loop loopu
+ }
}
- while(cnt--) *(dst++) = *(src++)+op;
+ while(cnt--) *(dst++) = *(src++)+op;
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst))
- AddAltivec(dst,src,op,cnt);
- else
+ AddAltivec(dst,src,op,cnt);
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(src == dst) {
- while(n--) {
- dst[0] += op; dst[1] += op; dst[2] += op; dst[3] += op;
- dst[4] += op; dst[5] += op; dst[6] += op; dst[7] += op;
- dst += 8;
- }
- while(cnt--) *(dst++) += op;
- }
- else {
- while(n--) {
- dst[0] = src[0]+op; dst[1] = src[1]+op;
- dst[2] = src[2]+op; dst[3] = src[3]+op;
- dst[4] = src[4]+op; dst[5] = src[5]+op;
- dst[6] = src[6]+op; dst[7] = src[7]+op;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++)+op;
- }
+ int n = cnt>>3;
+ cnt -= n<<3;
+
+ if(src == dst) {
+ while(n--) {
+ dst[0] += op; dst[1] += op; dst[2] += op; dst[3] += op;
+ dst[4] += op; dst[5] += op; dst[6] += op; dst[7] += op;
+ dst += 8;
+ }
+ while(cnt--) *(dst++) += op;
+ }
+ else {
+ while(n--) {
+ dst[0] = src[0]+op; dst[1] = src[1]+op;
+ dst[2] = src[2]+op; dst[3] = src[3]+op;
+ dst[4] = src[4]+op; dst[5] = src[5]+op;
+ dst[6] = src[6]+op; dst[7] = src[7]+op;
+ src += 8,dst += 8;
+ }
+ while(cnt--) *(dst++) = *(src++)+op;
+ }
}
#endif
}
@@ -1239,216 +1250,216 @@ void flext::AddSamples(t_sample *dst,const t_sample *src,const t_sample *op,int
#ifdef FLEXT_USE_SIMD
#ifdef _MSC_VER
if(GetSIMDCapabilities()&simd_sse) {
- // Prefetch cache
- __asm {
- mov eax,dword ptr [src]
- mov ebx,dword ptr [op]
- prefetcht0 [eax]
- prefetcht0 [ebx]
- prefetcht0 [eax+32]
- prefetcht0 [ebx+32]
- }
+ // Prefetch cache
+ __asm {
+ mov eax,dword ptr [src]
+ mov ebx,dword ptr [op]
+ prefetcht0 [eax]
+ prefetcht0 [ebx]
+ prefetcht0 [eax+32]
+ prefetcht0 [ebx+32]
+ }
// single precision
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
&& (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
- ) {
- if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopaa:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopaa
- }
- }
- else {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopau:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movaps xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movaps xmmword ptr[edx],xmm0
-
- movaps xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movaps xmmword ptr[edx+4*4],xmm2
-
- movaps xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movaps xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopau
- }
- }
+ ) {
+ if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
+ __asm {
+ mov ecx,dword ptr [n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopaa:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movaps xmm0,xmmword ptr[eax]
+ movaps xmm1,xmmword ptr[ebx]
+ addps xmm0,xmm1
+ movaps xmmword ptr[edx],xmm0
+
+ movaps xmm2,xmmword ptr[eax+4*4]
+ movaps xmm3,xmmword ptr[ebx+4*4]
+ addps xmm2,xmm3
+ movaps xmmword ptr[edx+4*4],xmm2
+
+ movaps xmm4,xmmword ptr[eax+8*4]
+ movaps xmm5,xmmword ptr[ebx+8*4]
+ addps xmm4,xmm5
+ movaps xmmword ptr[edx+8*4],xmm4
+
+ movaps xmm6,xmmword ptr[eax+12*4]
+ movaps xmm7,xmmword ptr[ebx+12*4]
+ addps xmm6,xmm7
+ movaps xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopaa
+ }
+ }
+ else {
+ __asm {
+ mov ecx,dword ptr [n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopau:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movaps xmm0,xmmword ptr[eax]
+ movups xmm1,xmmword ptr[ebx]
+ addps xmm0,xmm1
+ movaps xmmword ptr[edx],xmm0
+
+ movaps xmm2,xmmword ptr[eax+4*4]
+ movups xmm3,xmmword ptr[ebx+4*4]
+ addps xmm2,xmm3
+ movaps xmmword ptr[edx+4*4],xmm2
+
+ movaps xmm4,xmmword ptr[eax+8*4]
+ movups xmm5,xmmword ptr[ebx+8*4]
+ addps xmm4,xmm5
+ movaps xmmword ptr[edx+8*4],xmm4
+
+ movaps xmm6,xmmword ptr[eax+12*4]
+ movups xmm7,xmmword ptr[ebx+12*4]
+ addps xmm6,xmm7
+ movaps xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopau
+ }
+ }
}
else {
- if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopua:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movaps xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movaps xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movaps xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movaps xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopua
- }
- }
- else {
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
- mov ebx,dword ptr [op]
- loopuu:
- prefetcht0 [eax+64]
- prefetcht0 [ebx+64]
- prefetcht0 [eax+96]
- prefetcht0 [ebx+96]
-
- movups xmm0,xmmword ptr[eax]
- movups xmm1,xmmword ptr[ebx]
- addps xmm0,xmm1
- movups xmmword ptr[edx],xmm0
-
- movups xmm2,xmmword ptr[eax+4*4]
- movups xmm3,xmmword ptr[ebx+4*4]
- addps xmm2,xmm3
- movups xmmword ptr[edx+4*4],xmm2
-
- movups xmm4,xmmword ptr[eax+8*4]
- movups xmm5,xmmword ptr[ebx+8*4]
- addps xmm4,xmm5
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm6,xmmword ptr[eax+12*4]
- movups xmm7,xmmword ptr[ebx+12*4]
- addps xmm6,xmm7
- movups xmmword ptr[edx+12*4],xmm6
-
- add eax,16*4
- add ebx,16*4
- add edx,16*4
- loop loopuu
- }
- }
+ if((reinterpret_cast<unsigned long>(op)&(__alignof(__m128)-1)) == 0) {
+ __asm {
+ mov ecx,dword ptr [n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopua:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movups xmm0,xmmword ptr[eax]
+ movaps xmm1,xmmword ptr[ebx]
+ addps xmm0,xmm1
+ movups xmmword ptr[edx],xmm0
+
+ movups xmm2,xmmword ptr[eax+4*4]
+ movaps xmm3,xmmword ptr[ebx+4*4]
+ addps xmm2,xmm3
+ movups xmmword ptr[edx+4*4],xmm2
+
+ movups xmm4,xmmword ptr[eax+8*4]
+ movaps xmm5,xmmword ptr[ebx+8*4]
+ addps xmm4,xmm5
+ movups xmmword ptr[edx+8*4],xmm4
+
+ movups xmm6,xmmword ptr[eax+12*4]
+ movaps xmm7,xmmword ptr[ebx+12*4]
+ addps xmm6,xmm7
+ movups xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopua
+ }
+ }
+ else {
+ __asm {
+ mov ecx,dword ptr [n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
+ mov ebx,dword ptr [op]
+ loopuu:
+ prefetcht0 [eax+64]
+ prefetcht0 [ebx+64]
+ prefetcht0 [eax+96]
+ prefetcht0 [ebx+96]
+
+ movups xmm0,xmmword ptr[eax]
+ movups xmm1,xmmword ptr[ebx]
+ addps xmm0,xmm1
+ movups xmmword ptr[edx],xmm0
+
+ movups xmm2,xmmword ptr[eax+4*4]
+ movups xmm3,xmmword ptr[ebx+4*4]
+ addps xmm2,xmm3
+ movups xmmword ptr[edx+4*4],xmm2
+
+ movups xmm4,xmmword ptr[eax+8*4]
+ movups xmm5,xmmword ptr[ebx+8*4]
+ addps xmm4,xmm5
+ movups xmmword ptr[edx+8*4],xmm4
+
+ movups xmm6,xmmword ptr[eax+12*4]
+ movups xmm7,xmmword ptr[ebx+12*4]
+ addps xmm6,xmm7
+ movups xmmword ptr[edx+12*4],xmm6
+
+ add eax,16*4
+ add ebx,16*4
+ add edx,16*4
+ loop loopuu
+ }
+ }
}
- while(cnt--) *(dst++) = *(src++) + *(op++);
+ while(cnt--) *(dst++) = *(src++) + *(op++);
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
if(true) {
- vadd(src,1,op,1,dst,1,cnt);
- }
- else
+ vadd(src,1,op,1,dst,1,cnt);
+ }
+ else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(op) && IsVectorAligned(dst))
- AddAltivec(dst,src,op,cnt);
- else
+ AddAltivec(dst,src,op,cnt);
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
-
- if(dst == src) {
- while(n--) {
- dst[0] += op[0]; dst[1] += op[1];
- dst[2] += op[2]; dst[3] += op[3];
- dst[4] += op[4]; dst[5] += op[5];
- dst[6] += op[6]; dst[7] += op[7];
- dst += 8,op += 8;
- }
- while(cnt--) *(dst++) += *(op++);
- }
- else {
- while(n--) {
- dst[0] = src[0]+op[0]; dst[1] = src[1]+op[1];
- dst[2] = src[2]+op[2]; dst[3] = src[3]+op[3];
- dst[4] = src[4]+op[4]; dst[5] = src[5]+op[5];
- dst[6] = src[6]+op[6]; dst[7] = src[7]+op[7];
- src += 8,dst += 8,op += 8;
- }
- while(cnt--) *(dst++) = *(src++) + *(op++);
- }
+ int n = cnt>>3;
+ cnt -= n<<3;
+
+ if(dst == src) {
+ while(n--) {
+ dst[0] += op[0]; dst[1] += op[1];
+ dst[2] += op[2]; dst[3] += op[3];
+ dst[4] += op[4]; dst[5] += op[5];
+ dst[6] += op[6]; dst[7] += op[7];
+ dst += 8,op += 8;
+ }
+ while(cnt--) *(dst++) += *(op++);
+ }
+ else {
+ while(n--) {
+ dst[0] = src[0]+op[0]; dst[1] = src[1]+op[1];
+ dst[2] = src[2]+op[2]; dst[3] = src[3]+op[3];
+ dst[4] = src[4]+op[4]; dst[5] = src[5]+op[5];
+ dst[6] = src[6]+op[6]; dst[7] = src[7]+op[7];
+ src += 8,dst += 8,op += 8;
+ }
+ while(cnt--) *(dst++) = *(src++) + *(op++);
+ }
}
#endif
}
@@ -1472,112 +1483,112 @@ void flext::ScaleSamples(t_sample *dst,const t_sample *src,t_sample opmul,t_samp
#ifdef _MSC_VER
if(GetSIMDCapabilities()&simd_sse) {
// single precision
- int n = cnt>>4;
+ int n = cnt>>4;
cnt -= n<<4;
__asm {
- mov eax,dword ptr [src]
- prefetcht0 [eax+0]
- prefetcht0 [eax+32]
-
- movss xmm0,xmmword ptr [opadd]
- shufps xmm0,xmm0,0
- movss xmm1,xmmword ptr [opmul]
- shufps xmm1,xmm1,0
- }
+ mov eax,dword ptr [src]
+ prefetcht0 [eax+0]
+ prefetcht0 [eax+32]
+
+ movss xmm0,xmmword ptr [opadd]
+ shufps xmm0,xmm0,0
+ movss xmm1,xmmword ptr [opmul]
+ shufps xmm1,xmm1,0
+ }
if((reinterpret_cast<unsigned long>(src)&(__alignof(__m128)-1)) == 0
&& (reinterpret_cast<unsigned long>(dst)&(__alignof(__m128)-1)) == 0
) {
// aligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
+ __asm {
+ mov ecx,dword ptr [n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
loopa:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movaps xmm2,xmmword ptr[eax]
- mulps xmm2,xmm1
- addps xmm2,xmm0
- movaps xmmword ptr[edx],xmm2
-
- movaps xmm3,xmmword ptr[eax+4*4]
- mulps xmm3,xmm1
- addps xmm3,xmm0
- movaps xmmword ptr[edx+4*4],xmm3
-
- movaps xmm4,xmmword ptr[eax+8*4]
- mulps xmm4,xmm1
- addps xmm4,xmm0
- movaps xmmword ptr[edx+8*4],xmm4
-
- movaps xmm5,xmmword ptr[eax+12*4]
- mulps xmm5,xmm1
- addps xmm5,xmm0
- movaps xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- loop loopa
- }
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
+
+ movaps xmm2,xmmword ptr[eax]
+ mulps xmm2,xmm1
+ addps xmm2,xmm0
+ movaps xmmword ptr[edx],xmm2
+
+ movaps xmm3,xmmword ptr[eax+4*4]
+ mulps xmm3,xmm1
+ addps xmm3,xmm0
+ movaps xmmword ptr[edx+4*4],xmm3
+
+ movaps xmm4,xmmword ptr[eax+8*4]
+ mulps xmm4,xmm1
+ addps xmm4,xmm0
+ movaps xmmword ptr[edx+8*4],xmm4
+
+ movaps xmm5,xmmword ptr[eax+12*4]
+ mulps xmm5,xmm1
+ addps xmm5,xmm0
+ movaps xmmword ptr[edx+12*4],xmm5
+
+ add eax,16*4
+ add edx,16*4
+ loop loopa
+ }
}
else {
// unaligned version
- __asm {
- mov ecx,dword ptr [n]
- mov eax,dword ptr [src]
- mov edx,dword ptr [dst]
+ __asm {
+ mov ecx,dword ptr [n]
+ mov eax,dword ptr [src]
+ mov edx,dword ptr [dst]
loopu:
- prefetcht0 [eax+64]
- prefetcht0 [eax+96]
-
- movups xmm2,xmmword ptr[eax]
- mulps xmm2,xmm1
- addps xmm2,xmm0
- movups xmmword ptr[edx],xmm2
-
- movups xmm3,xmmword ptr[eax+4*4]
- mulps xmm3,xmm1
- addps xmm3,xmm0
- movups xmmword ptr[edx+4*4],xmm3
-
- movups xmm4,xmmword ptr[eax+8*4]
- mulps xmm4,xmm1
- addps xmm4,xmm0
- movups xmmword ptr[edx+8*4],xmm4
-
- movups xmm5,xmmword ptr[eax+12*4]
- mulps xmm5,xmm1
- addps xmm5,xmm0
- movups xmmword ptr[edx+12*4],xmm5
-
- add eax,16*4
- add edx,16*4
- loop loopu
- }
+ prefetcht0 [eax+64]
+ prefetcht0 [eax+96]
+
+ movups xmm2,xmmword ptr[eax]
+ mulps xmm2,xmm1
+ addps xmm2,xmm0
+ movups xmmword ptr[edx],xmm2
+
+ movups xmm3,xmmword ptr[eax+4*4]
+ mulps xmm3,xmm1
+ addps xmm3,xmm0
+ movups xmmword ptr[edx+4*4],xmm3
+
+ movups xmm4,xmmword ptr[eax+8*4]
+ mulps xmm4,xmm1
+ addps xmm4,xmm0
+ movups xmmword ptr[edx+8*4],xmm4
+
+ movups xmm5,xmmword ptr[eax+12*4]
+ mulps xmm5,xmm1
+ addps xmm5,xmm0
+ movups xmmword ptr[edx+12*4],xmm5
+
+ add eax,16*4
+ add edx,16*4
+ loop loopu
+ }
}
- while(cnt--) *(dst++) = *(src++)*opmul+opadd;
+ while(cnt--) *(dst++) = *(src++)*opmul+opadd;
}
else
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst))
- ScaleAltivec(dst,src,opmul,opadd,cnt);
- else
+ ScaleAltivec(dst,src,opmul,opadd,cnt);
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
{
- int n = cnt>>3;
- cnt -= n<<3;
- while(n--) {
- dst[0] = src[0]*opmul+opadd; dst[1] = src[1]*opmul+opadd;
- dst[2] = src[2]*opmul+opadd; dst[3] = src[3]*opmul+opadd;
- dst[4] = src[4]*opmul+opadd; dst[5] = src[5]*opmul+opadd;
- dst[6] = src[6]*opmul+opadd; dst[7] = src[7]*opmul+opadd;
- src += 8,dst += 8;
- }
- while(cnt--) *(dst++) = *(src++)*opmul+opadd;
+ int n = cnt>>3;
+ cnt -= n<<3;
+ while(n--) {
+ dst[0] = src[0]*opmul+opadd; dst[1] = src[1]*opmul+opadd;
+ dst[2] = src[2]*opmul+opadd; dst[3] = src[3]*opmul+opadd;
+ dst[4] = src[4]*opmul+opadd; dst[5] = src[5]*opmul+opadd;
+ dst[6] = src[6]*opmul+opadd; dst[7] = src[7]*opmul+opadd;
+ src += 8,dst += 8;
+ }
+ while(cnt--) *(dst++) = *(src++)*opmul+opadd;
}
#endif
}
diff --git a/externals/grill/flext/source/flsndobj.cpp b/externals/grill/flext/source/flsndobj.cpp
index e5203556..82e6048b 100644
--- a/externals/grill/flext/source/flsndobj.cpp
+++ b/externals/grill/flext/source/flsndobj.cpp
@@ -13,84 +13,84 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext_sndobj::flext_sndobj():
- inobjs(0),outobjs(0),
- inobj(NULL),tmpobj(NULL),outobj(NULL),
- smprt(0),blsz(0)
+ inobjs(0),outobjs(0),
+ inobj(NULL),tmpobj(NULL),outobj(NULL),
+ smprt(0),blsz(0)
{}
bool flext_sndobj::Init()
{
- bool ret = flext_dsp::Init();
- inobjs = CntInSig();
- outobjs = CntOutSig();
- return ret;
+ bool ret = flext_dsp::Init();
+ inobjs = CntInSig();
+ outobjs = CntOutSig();
+ return ret;
}
void flext_sndobj::Exit()
{
- ClearObjs();
- flext_dsp::Exit();
+ ClearObjs();
+ flext_dsp::Exit();
}
void flext_sndobj::ClearObjs()
{
- FreeObjs();
-
- if(inobj) {
- for(int i = 0; i < inobjs; ++i) delete inobj[i];
- delete[] inobj; inobj = NULL;
- }
- if(tmpobj) {
- for(int i = 0; i < inobjs; ++i) delete tmpobj[i];
- delete[] tmpobj; tmpobj = NULL;
- }
- if(outobj) {
- for(int i = 0; i < outobjs; ++i) delete outobj[i];
- delete[] outobj; outobj = NULL;
- }
+ FreeObjs();
+
+ if(inobj) {
+ for(int i = 0; i < inobjs; ++i) delete inobj[i];
+ delete[] inobj; inobj = NULL;
+ }
+ if(tmpobj) {
+ for(int i = 0; i < inobjs; ++i) delete tmpobj[i];
+ delete[] tmpobj; tmpobj = NULL;
+ }
+ if(outobj) {
+ for(int i = 0; i < outobjs; ++i) delete outobj[i];
+ delete[] outobj; outobj = NULL;
+ }
}
void flext_sndobj::m_dsp(int n,t_sample *const *in,t_sample *const *out)
{
- // called on every rebuild of the dsp chain
-
- int i;
- if(Blocksize() != blsz || Samplerate() != smprt) {
- // block size or sample rate has changed... rebuild all objects
-
- ClearObjs();
-
- blsz = Blocksize();
- smprt = Samplerate();
-
- // set up sndobjs for inlets and outlets
- if(inobjs) {
- inobj = new Inlet *[inobjs];
- tmpobj = new SndObj *[inobjs];
- for(i = 0; i < inobjs; ++i) {
- inobj[i] = new Inlet(in[i],blsz,smprt);
- tmpobj[i] = new SndObj(NULL,blsz,smprt);
- }
- }
- if(outobjs) {
- outobj = new Outlet *[outobjs];
- for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],blsz,smprt);
- }
-
- if(!NewObjs()) ClearObjs();
- }
- else {
- // assign changed input/output vectors
-
- for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
- for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
- }
+ // called on every rebuild of the dsp chain
+
+ int i;
+ if(Blocksize() != blsz || Samplerate() != smprt) {
+ // block size or sample rate has changed... rebuild all objects
+
+ ClearObjs();
+
+ blsz = Blocksize();
+ smprt = Samplerate();
+
+ // set up sndobjs for inlets and outlets
+ if(inobjs) {
+ inobj = new Inlet *[inobjs];
+ tmpobj = new SndObj *[inobjs];
+ for(i = 0; i < inobjs; ++i) {
+ inobj[i] = new Inlet(in[i],blsz,smprt);
+ tmpobj[i] = new SndObj(NULL,blsz,smprt);
+ }
+ }
+ if(outobjs) {
+ outobj = new Outlet *[outobjs];
+ for(i = 0; i < outobjs; ++i) outobj[i] = new Outlet(out[i],blsz,smprt);
+ }
+
+ if(!NewObjs()) ClearObjs();
+ }
+ else {
+ // assign changed input/output vectors
+
+ for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
+ for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
+ }
}
void flext_sndobj::m_signal(int n,t_sample *const *in,t_sample *const *out)
{
- for(int i = 0; i < inobjs; ++i) *tmpobj[i] << *inobj[i];
- ProcessObjs();
+ for(int i = 0; i < inobjs; ++i) *tmpobj[i] << *inobj[i];
+ ProcessObjs();
}
@@ -100,12 +100,12 @@ flext_sndobj::Inlet::Inlet(const t_sample *b,int vecsz,float sr):
short flext_sndobj::Inlet::Read()
{
- if(!m_error) {
- for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
- m_output[m_vecpos] = buf[m_vecpos];
- return 1;
- }
- else return 0;
+ if(!m_error) {
+ for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
+ m_output[m_vecpos] = buf[m_vecpos];
+ return 1;
+ }
+ else return 0;
}
short flext_sndobj::Inlet::Write() { return 0; }
@@ -119,13 +119,13 @@ short flext_sndobj::Outlet::Read() { return 0; }
short flext_sndobj::Outlet::Write()
{
- if(!m_error) {
- if(m_IOobjs[0])
- for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
- buf[m_vecpos] = m_IOobjs[0]->Output(m_vecpos);
- return 1;
- }
- else return 0;
+ if(!m_error) {
+ if(m_IOobjs[0])
+ for(m_vecpos = 0; m_vecpos < m_samples; m_vecpos++)
+ buf[m_vecpos] = m_IOobjs[0]->Output(m_vecpos);
+ return 1;
+ }
+ else return 0;
}
diff --git a/externals/grill/flext/source/flsndobj.h b/externals/grill/flext/source/flsndobj.h
index 960267be..f45080d5 100644
--- a/externals/grill/flext/source/flsndobj.h
+++ b/externals/grill/flext/source/flsndobj.h
@@ -21,69 +21,69 @@ WARRANTIES, see the file, "license.txt," in this distribution.
class FLEXT_SHARE flext_sndobj:
- public flext_dsp
+ public flext_dsp
{
- FLEXT_HEADER(flext_sndobj,flext_dsp)
+ FLEXT_HEADER(flext_sndobj,flext_dsp)
public:
- flext_sndobj();
+ flext_sndobj();
- // these have to be overridden in child classes
- virtual bool NewObjs() { return true; }
- virtual void FreeObjs() {}
- virtual void ProcessObjs() {}
+ // these have to be overridden in child classes
+ virtual bool NewObjs() { return true; }
+ virtual void FreeObjs() {}
+ virtual void ProcessObjs() {}
- // inputs and outputs
- SndObj &InObj(int i) { return *tmpobj[i]; }
- SndIO &OutObj(int i) { return *outobj[i]; }
+ // inputs and outputs
+ SndObj &InObj(int i) { return *tmpobj[i]; }
+ SndIO &OutObj(int i) { return *outobj[i]; }
protected:
- virtual bool Init();
- virtual void Exit();
+ virtual bool Init();
+ virtual void Exit();
- virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
- virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
+ virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
+ virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
private:
- //! SndObj for reading from inlet buffer
- class Inlet:
- public SndIO
- {
- public:
- Inlet(const t_sample *b,int vecsz,float sr);
- virtual short Read();
- virtual short Write();
-
- void SetBuf(const t_sample *b) { buf = b; }
-
- private:
- const t_sample *buf;
- };
-
- //! SndObj for writing to outlet buffer
- class Outlet:
- public SndIO
- {
- public:
- Outlet(t_sample *b,int vecsz,float sr);
- virtual short Read();
- virtual short Write();
-
- void SetBuf(t_sample *b) { buf = b; }
-
- private:
- t_sample *buf;
- };
-
- void ClearObjs();
-
- int inobjs,outobjs;
- SndObj **tmpobj;
- Inlet **inobj;
- Outlet **outobj;
-
- float smprt;
- int blsz;
+ //! SndObj for reading from inlet buffer
+ class Inlet:
+ public SndIO
+ {
+ public:
+ Inlet(const t_sample *b,int vecsz,float sr);
+ virtual short Read();
+ virtual short Write();
+
+ void SetBuf(const t_sample *b) { buf = b; }
+
+ private:
+ const t_sample *buf;
+ };
+
+ //! SndObj for writing to outlet buffer
+ class Outlet:
+ public SndIO
+ {
+ public:
+ Outlet(t_sample *b,int vecsz,float sr);
+ virtual short Read();
+ virtual short Write();
+
+ void SetBuf(t_sample *b) { buf = b; }
+
+ private:
+ t_sample *buf;
+ };
+
+ void ClearObjs();
+
+ int inobjs,outobjs;
+ SndObj **tmpobj;
+ Inlet **inobj;
+ Outlet **outobj;
+
+ float smprt;
+ int blsz;
};
#endif
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
index 13ac68b5..19586a4a 100644
--- a/externals/grill/flext/source/flstdc.h
+++ b/externals/grill/flext/source/flstdc.h
@@ -99,10 +99,15 @@ typedef t_clock t_qelem;
#endif
+// necessary for the old OS9 SDK
+extern "C" {
+
#include "ext.h"
#include "ext_user.h"
#include "z_dsp.h"
+} // extern "C"
+
#undef WIN_VERSION
diff --git a/externals/grill/flext/source/flstk.cpp b/externals/grill/flext/source/flstk.cpp
index 42f2fa85..24739b28 100644
--- a/externals/grill/flext/source/flstk.cpp
+++ b/externals/grill/flext/source/flstk.cpp
@@ -12,105 +12,105 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "flstk.h"
flext_stk::flext_stk():
- inobjs(0),outobjs(0),
- inobj(NULL),outobj(NULL),
- smprt(0),blsz(0)
+ inobjs(0),outobjs(0),
+ inobj(NULL),outobj(NULL),
+ smprt(0),blsz(0)
{}
bool flext_stk::Init()
{
- bool ret = flext_dsp::Init();
- inobjs = CntInSig();
- outobjs = CntOutSig();
- return ret;
+ bool ret = flext_dsp::Init();
+ inobjs = CntInSig();
+ outobjs = CntOutSig();
+ return ret;
}
void flext_stk::Exit()
{
- ClearObjs();
- flext_dsp::Exit();
+ ClearObjs();
+ flext_dsp::Exit();
}
void flext_stk::ClearObjs()
{
- FreeObjs();
-
- if(inobj) {
- for(int i = 0; i < inobjs; ++i) delete inobj[i];
- delete[] inobj; inobj = NULL;
- }
- if(outobj) {
- for(int i = 0; i < outobjs; ++i) delete outobj[i];
- delete[] outobj; outobj = NULL;
- }
+ FreeObjs();
+
+ if(inobj) {
+ for(int i = 0; i < inobjs; ++i) delete inobj[i];
+ delete[] inobj; inobj = NULL;
+ }
+ if(outobj) {
+ for(int i = 0; i < outobjs; ++i) delete outobj[i];
+ delete[] outobj; outobj = NULL;
+ }
}
void flext_stk::m_dsp(int n,t_sample *const *in,t_sample *const *out)
{
- // called on every rebuild of the dsp chain
-
- int i;
-
- if(Blocksize() != blsz || Samplerate() != smprt) {
- // block size or sample rate has changed... rebuild all objects
-
- ClearObjs();
-
- smprt = Samplerate();
- blsz = Blocksize();
- Stk::setSampleRate(smprt);
-
- // set up sndobjs for inlets and outlets
- if(inobjs) {
- inobj = new Input *[inobjs];
- for(i = 0; i < inobjs; ++i)
- inobj[i] = new Input(in[i],blsz);
- }
- if(outobjs) {
- outobj = new Output *[outobjs];
- for(i = 0; i < outobjs; ++i)
- outobj[i] = new Output(out[i],blsz);
- }
-
- if(!NewObjs()) ClearObjs();
- }
- else {
- // assign changed input/output vectors
-
- for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
- for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
- }
+ // called on every rebuild of the dsp chain
+
+ int i;
+
+ if(Blocksize() != blsz || Samplerate() != smprt) {
+ // block size or sample rate has changed... rebuild all objects
+
+ ClearObjs();
+
+ smprt = Samplerate();
+ blsz = Blocksize();
+ Stk::setSampleRate(smprt);
+
+ // set up sndobjs for inlets and outlets
+ if(inobjs) {
+ inobj = new Input *[inobjs];
+ for(i = 0; i < inobjs; ++i)
+ inobj[i] = new Input(in[i],blsz);
+ }
+ if(outobjs) {
+ outobj = new Output *[outobjs];
+ for(i = 0; i < outobjs; ++i)
+ outobj[i] = new Output(out[i],blsz);
+ }
+
+ if(!NewObjs()) ClearObjs();
+ }
+ else {
+ // assign changed input/output vectors
+
+ for(i = 0; i < inobjs; ++i) inobj[i]->SetBuf(in[i]);
+ for(i = 0; i < outobjs; ++i) outobj[i]->SetBuf(out[i]);
+ }
}
void flext_stk::m_signal(int n,t_sample *const *in,t_sample *const *out)
{
- if(inobjs || outobjs) ProcessObjs(blsz);
+ if(inobjs || outobjs) ProcessObjs(blsz);
}
// inlet class
flext_stk::Input::Input(const t_sample *b,int v):
- buf(b),vecsz(v),
- index(0)
+ buf(b),vecsz(v),
+ index(0)
{}
MY_FLOAT *flext_stk::Input::tick(MY_FLOAT *vector,unsigned int vectorSize)
{
- for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick();
- return vector;
+ for(unsigned int i = 0; i < vectorSize; i++) vector[i] = tick();
+ return vector;
}
// outlet class
flext_stk::Output::Output(t_sample *b,int v):
- buf(b),vecsz(v),
- index(0)
+ buf(b),vecsz(v),
+ index(0)
{}
void flext_stk::Output::tick(const MY_FLOAT *vector,unsigned int vectorSize)
{
- for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]);
+ for(unsigned int i = 0; i < vectorSize; i++) tick(vector[i]);
}
diff --git a/externals/grill/flext/source/flstk.h b/externals/grill/flext/source/flstk.h
index d6bad079..a610e9c6 100644
--- a/externals/grill/flext/source/flstk.h
+++ b/externals/grill/flext/source/flstk.h
@@ -15,81 +15,81 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <Stk.h>
class FLEXT_SHARE flext_stk:
- public flext_dsp
+ public flext_dsp
{
- FLEXT_HEADER(flext_stk,flext_dsp)
+ FLEXT_HEADER(flext_stk,flext_dsp)
public:
- flext_stk();
+ flext_stk();
- // these have to be overridden in child classes
- virtual bool NewObjs() { return true; }
- virtual void FreeObjs() {}
- virtual void ProcessObjs(int blocksize) {}
+ // these have to be overridden in child classes
+ virtual bool NewObjs() { return true; }
+ virtual void FreeObjs() {}
+ virtual void ProcessObjs(int blocksize) {}
protected:
- virtual bool Init();
- virtual void Exit();
+ virtual bool Init();
+ virtual void Exit();
- //! STK object for reading from inlet buffer
- class Input:
- public Stk
- {
- public:
- Input(const t_sample *b,int vecsz);
+ //! STK object for reading from inlet buffer
+ class Input:
+ public Stk
+ {
+ public:
+ Input(const t_sample *b,int vecsz);
- inline MY_FLOAT lastOut() const { return (MY_FLOAT)buf[index]; }
+ inline MY_FLOAT lastOut() const { return (MY_FLOAT)buf[index]; }
- inline MY_FLOAT tick() {
- if(++index >= vecsz) index = 0;
- return lastOut();
+ inline MY_FLOAT tick() {
+ if(++index >= vecsz) index = 0;
+ return lastOut();
}
- MY_FLOAT *tick(MY_FLOAT *vector,unsigned int vectorSize);
+ MY_FLOAT *tick(MY_FLOAT *vector,unsigned int vectorSize);
- inline void SetBuf(const t_sample *b) { buf = b; }
+ inline void SetBuf(const t_sample *b) { buf = b; }
- private:
- const t_sample *buf;
- int vecsz,index;
- };
+ private:
+ const t_sample *buf;
+ int vecsz,index;
+ };
- //! STK object for writing to outlet buffer
- class Output:
- public Stk
- {
- public:
- Output(t_sample *b,int vecsz);
+ //! STK object for writing to outlet buffer
+ class Output:
+ public Stk
+ {
+ public:
+ Output(t_sample *b,int vecsz);
inline void tick(MY_FLOAT s) {
buf[index] = (t_sample)s;
if(++index >= vecsz) index = 0;
}
- void tick(const MY_FLOAT *vector,unsigned int vectorSize);
+ void tick(const MY_FLOAT *vector,unsigned int vectorSize);
- inline void SetBuf(t_sample *b) { buf = b; }
+ inline void SetBuf(t_sample *b) { buf = b; }
- private:
- t_sample *buf;
- int vecsz,index;
- };
+ private:
+ t_sample *buf;
+ int vecsz,index;
+ };
- Input &Inlet(int ix) { return *inobj[ix]; }
- Output &Outlet(int ix) { return *outobj[ix]; }
+ Input &Inlet(int ix) { return *inobj[ix]; }
+ Output &Outlet(int ix) { return *outobj[ix]; }
private:
- virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
- virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
+ virtual void m_dsp(int n,t_sample *const *in,t_sample *const *out);
+ virtual void m_signal(int n,t_sample *const *in,t_sample *const *out);
- void ClearObjs();
+ void ClearObjs();
- int inobjs,outobjs;
- Input **inobj;
- Output **outobj;
+ int inobjs,outobjs;
+ Input **inobj;
+ Output **outobj;
- float smprt;
- int blsz;
+ float smprt;
+ int blsz;
};
#endif
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index cd92aaa4..14ddad47 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -419,13 +419,6 @@ public:
//! Check whether the atom can be represented as an integer
static bool CanbeInt(const t_atom &a) { return IsFloat(a) || IsInt(a); }
- //! Set the atom to represent a boolean
- static void SetBool(t_atom &a,bool v) { SetInt(a,v?1:0); }
- //! Check whether the atom can be represented as a boolean
- static bool CanbeBool(const t_atom &a) { return CanbeInt(a); }
- //! Check for an boolean and get its value
- static bool GetABool(const t_atom &a) { return GetAInt(a) != 0; }
-
#if FLEXT_SYS == FLEXT_SYS_PD
//! Check for a float and get its value
static float GetAFloat(const t_atom &a,float def = 0) { return IsFloat(a)?GetFloat(a):def; }
@@ -500,6 +493,15 @@ public:
#error "Platform not supported"
#endif
+ //! Set the atom to represent a boolean
+ static void SetBool(t_atom &a,bool v) { SetInt(a,v?1:0); }
+ //! Check whether the atom can be represented as a boolean
+ static bool CanbeBool(const t_atom &a) { return CanbeInt(a); }
+ //! Check for an boolean and get its value
+ static bool GetABool(const t_atom &a) { return GetAInt(a) != 0; }
+ //! Check for an boolean and get its value
+ static bool GetBool(const t_atom &a) { return GetInt(a) != 0; }
+
// --- atom list stuff -------------------------------------------
//! Class representing a list of atoms
diff --git a/externals/grill/flext/source/fltimer.cpp b/externals/grill/flext/source/fltimer.cpp
index 3ce05ed9..9cab8e90 100755
--- a/externals/grill/flext/source/fltimer.cpp
+++ b/externals/grill/flext/source/fltimer.cpp
@@ -9,7 +9,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file fltimer.cpp
- \brief flext timer functions and classes
+ \brief flext timer functions and classes
*/
#include "flext.h"
@@ -29,24 +29,24 @@ WARRANTIES, see the file, "license.txt," in this distribution.
double flext::GetTime()
{
#if FLEXT_SYS == FLEXT_SYS_PD
- return clock_gettimesince(0)*0.001;
+ return clock_gettimesince(0)*0.001;
#elif FLEXT_SYS == FLEXT_SYS_MAX
- double tm;
- clock_getftime(&tm);
- return tm*0.001;
+ double tm;
+ clock_getftime(&tm);
+ return tm*0.001;
#else
- #error Not implemented
+ #error Not implemented
#endif
}
double flext::GetTimeGrain()
{
#if FLEXT_SYS == FLEXT_SYS_PD
- return 0;
+ return 0;
#elif FLEXT_SYS == FLEXT_SYS_MAX
- return 0.001;
+ return 0.001;
#else
- #error Not implemented
+ #error Not implemented
#endif
}
@@ -55,13 +55,13 @@ static double starttime = getstarttime();
static double getstarttime()
{
- starttime = 0;
- return flext::GetOSTime();
+ starttime = 0;
+ return flext::GetOSTime();
}
double flext::GetOSTime()
{
- double tm;
+ double tm;
#if FLEXT_OS == FLEXT_OS_WIN
LARGE_INTEGER frq,cnt;
@@ -75,37 +75,37 @@ double flext::GetOSTime()
tm = (double)((LARGE_INTEGER *)&fltm)->QuadPart*0.001;
}
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
- timeval tmv;
- gettimeofday(&tmv,NULL);
- tm = tmv.tv_sec+tmv.tv_usec*1.e-6;
+ timeval tmv;
+ gettimeofday(&tmv,NULL);
+ tm = tmv.tv_sec+tmv.tv_usec*1.e-6;
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
- UnsignedWide tick;
- Microseconds(&tick);
- tm = (tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo)*1.e-6;
+ UnsignedWide tick;
+ Microseconds(&tick);
+ tm = (tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo)*1.e-6;
#else
- #error Not implemented
+ #error Not implemented
#endif
- return tm-starttime;
+ return tm-starttime;
}
void flext::Sleep(double s)
{
#if FLEXT_OS == FLEXT_OS_WIN
- ::Sleep((long)(s*1000.));
+ ::Sleep((long)(s*1000.));
#elif FLEXT_OS == FLEXT_OS_LINUX || FLEXT_OS == FLEXT_OS_IRIX || FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH // POSIX
- usleep((long)(s*1000000.));
+ usleep((long)(s*1000000.));
#elif FLEXT_OS == FLEXT_OS_MAC // that's just for OS9 & Carbon!
- UnsignedWide tick;
- Microseconds(&tick);
- double target = tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo+s*1.e6;
- for(;;) {
- // this is just a loop running until the time has passed - stone age (but we yield at least)
- Microseconds(&tick);
- if(target <= tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo) break;
- YieldToAnyThread(); // yielding surely reduces the timing precision (but we're civilized)
- }
+ UnsignedWide tick;
+ Microseconds(&tick);
+ double target = tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo+s*1.e6;
+ for(;;) {
+ // this is just a loop running until the time has passed - stone age (but we yield at least)
+ Microseconds(&tick);
+ if(target <= tick.hi*((double)(1L<<((sizeof tick.lo)*4))*(double)(1L<<((sizeof tick.lo)*4)))+tick.lo) break;
+ YieldToAnyThread(); // yielding surely reduces the timing precision (but we're civilized)
+ }
#else
- #error Not implemented
+ #error Not implemented
#endif
}
@@ -113,134 +113,134 @@ void flext::Sleep(double s)
/* \param qu determines whether timed messages should be queued (low priority - only when supported by the system).
*/
flext::Timer::Timer(bool qu):
- queued(qu),
- clss(NULL),userdata(NULL),
- period(0)
+ queued(qu),
+ clss(NULL),userdata(NULL),
+ period(0)
{
#if FLEXT_SYS == FLEXT_SYS_PD
- clk = (t_clock *)clock_new(this,(t_method)callback);
+ clk = (t_clock *)clock_new(this,(t_method)callback);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clk = (t_clock *)clock_new(this,(t_method)callback);
- if(queued) qelem = (t_qelem *)qelem_new(this,(method)queuefun);
+ clk = (t_clock *)clock_new(this,(t_method)callback);
+ if(queued) qelem = (t_qelem *)qelem_new(this,(method)queuefun);
#else
- #error Not implemented
+ #error Not implemented
#endif
}
flext::Timer::~Timer()
{
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_free(clk);
+ clock_free(clk);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_free(clk);
- if(queued) ::qelem_free(qelem);
+ clock_free(clk);
+ if(queued) ::qelem_free(qelem);
#else
- #error Not implemented
+ #error Not implemented
#endif
}
bool flext::Timer::Reset()
{
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_unset(clk);
+ clock_unset(clk);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_unset(clk);
- if(queued) ::qelem_unset(qelem);
+ clock_unset(clk);
+ if(queued) ::qelem_unset(qelem);
#else
- #error Not implemented
+ #error Not implemented
#endif
- return true;
+ return true;
}
/*! \param tm absolute time (in seconds)
- \param data user data
- \param dopast if set events with times lying in the past will be triggered immediately, if not set they are ignored
- \return true on success
+ \param data user data
+ \param dopast if set events with times lying in the past will be triggered immediately, if not set they are ignored
+ \return true on success
*/
bool flext::Timer::At(double tm,void *data,bool dopast)
{
- userdata = data;
- period = 0;
+ userdata = data;
+ period = 0;
#if FLEXT_SYS == FLEXT_SYS_PD
- const double ms = tm*1000.;
- if(dopast || clock_gettimesince(ms) <= 0)
- clock_set(clk,ms);
+ const double ms = tm*1000.;
+ if(dopast || clock_gettimesince(ms) <= 0)
+ clock_set(clk,ms);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- const double ms = tm*1000.;
- double cur;
- clock_getftime(&cur);
- if(cur <= ms)
- clock_fdelay(clk,ms-cur);
- else if(dopast) // trigger timer is past
- clock_fdelay(clk,0);
+ const double ms = tm*1000.;
+ double cur;
+ clock_getftime(&cur);
+ if(cur <= ms)
+ clock_fdelay(clk,ms-cur);
+ else if(dopast) // trigger timer is past
+ clock_fdelay(clk,0);
#else
- #error Not implemented
+ #error Not implemented
#endif
- return true;
+ return true;
}
/*! \param tm relative time (in seconds)
- \param data user data
- \return true on success
+ \param data user data
+ \return true on success
*/
bool flext::Timer::Delay(double tm,void *data)
{
- userdata = data;
- period = 0;
+ userdata = data;
+ period = 0;
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(clk,tm*1000);
+ clock_delay(clk,tm*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_fdelay(clk,tm*1000.);
+ clock_fdelay(clk,tm*1000.);
#else
- #error Not implemented
+ #error Not implemented
#endif
- return true;
+ return true;
}
/*! \param tm relative time between periodic events (in seconds)
- \param data user data
- \return true on success
- \note the first event will be delayed by tm
+ \param data user data
+ \return true on success
+ \note the first event will be delayed by tm
*/
bool flext::Timer::Periodic(double tm,void *data)
{
- userdata = data;
- period = tm;
+ userdata = data;
+ period = tm;
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(clk,tm*1000);
+ clock_delay(clk,tm*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_fdelay(clk,tm*1000.);
+ clock_fdelay(clk,tm*1000.);
#else
- #error Not implemented
+ #error Not implemented
#endif
- return true;
+ return true;
}
/*! \brief Callback function for system clock.
- \todo Make periodic events scheduled as such.
+ \todo Make periodic events scheduled as such.
*/
void flext::Timer::callback(Timer *tmr)
{
- if(tmr->period) {
- // clearly it would be more precise if the periodic event is scheduled as such
- // and not retriggered every time
+ if(tmr->period) {
+ // clearly it would be more precise if the periodic event is scheduled as such
+ // and not retriggered every time
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(tmr->clk,tmr->period*1000);
+ clock_delay(tmr->clk,tmr->period*1000);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- clock_fdelay(tmr->clk,tmr->period*1000.);
+ clock_fdelay(tmr->clk,tmr->period*1000.);
#else
- #error Not implemented
+ #error Not implemented
#endif
- }
+ }
- if(tmr->cback) {
+ if(tmr->cback) {
#if FLEXT_SYS == FLEXT_SYS_MAX
- if(tmr->queued)
- qelem_set(tmr->qelem);
- else
+ if(tmr->queued)
+ qelem_set(tmr->qelem);
+ else
#endif
- tmr->Work();
- }
+ tmr->Work();
+ }
}
#if FLEXT_SYS == FLEXT_SYS_MAX
@@ -250,13 +250,13 @@ void flext::Timer::queuefun(Timer *tmr) { tmr->Work(); }
#endif
/*! \brief Virtual worker function - by default it calls the user callback function.
- \remark The respective callback parameter format is chosen depending on whether clss is defined or not.
+ \remark The respective callback parameter format is chosen depending on whether clss is defined or not.
*/
void flext::Timer::Work()
{
- if(clss)
- ((bool (*)(flext_base *,void *))cback)(clss,userdata);
- else
- cback(userdata);
+ if(clss)
+ ((bool (*)(flext_base *,void *))cback)(clss,userdata);
+ else
+ cback(userdata);
}
diff --git a/externals/grill/flext/source/flutil.cpp b/externals/grill/flext/source/flutil.cpp
index 3c7c704d..2e80b6e6 100644
--- a/externals/grill/flext/source/flutil.cpp
+++ b/externals/grill/flext/source/flutil.cpp
@@ -18,11 +18,11 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#if FLEXT_OS == FLEXT_OS_WIN
#include <windows.h>
#elif FLEXT_OS == FLEXT_OS_MAC
- #if FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
- #include <MacMemory.h>
- #else
- #include <Carbon/Carbon.h>
- #endif
+ #if FLEXT_OSAPI != FLEXT_OSAPI_MAC_MACH
+ #include <MacMemory.h>
+ #else
+ #include <Carbon/Carbon.h>
+ #endif
#endif
void flext::CopyMem(void *dst,const void *src,int bytes)
@@ -30,9 +30,9 @@ void flext::CopyMem(void *dst,const void *src,int bytes)
#if FLEXT_OS == FLEXT_OS_WIN
MoveMemory(dst,src,bytes);
#elif FLEXT_OS == FLEXT_OS_MAC
- BlockMoveData(src,dst,bytes);
+ BlockMoveData(src,dst,bytes);
#else
- memcpy(dst,src,bytes);
+ memcpy(dst,src,bytes);
#endif
}
@@ -43,22 +43,22 @@ void flext::ZeroMem(void *dst,int bytes)
#elif FLEXT_OS == FLEXT_OS_MAC
BlockZero(dst,bytes);
#else
- memset(dst,0,bytes);
+ memset(dst,0,bytes);
#endif
}
bool flext::Forward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
{
- void *cl = recv->s_thing;
- if(!cl) return false;
+ void *cl = recv->s_thing;
+ if(!cl) return false;
#if FLEXT_SYS == FLEXT_SYS_PD
- pd_typedmess((t_class **)cl,(t_symbol *)s,argc,(t_atom *)argv);
+ pd_typedmess((t_class **)cl,(t_symbol *)s,argc,(t_atom *)argv);
#elif FLEXT_SYS == FLEXT_SYS_MAX
- typedmess(recv->s_thing,(t_symbol *)s,argc,(t_atom *)argv);
+ typedmess(recv->s_thing,(t_symbol *)s,argc,(t_atom *)argv);
#else
#error Not implemented
#endif
- return true;
+ return true;
}
diff --git a/externals/grill/flext/source/flxlet.cpp b/externals/grill/flext/source/flxlet.cpp
index 76c02afb..1d57177c 100755
--- a/externals/grill/flext/source/flxlet.cpp
+++ b/externals/grill/flext/source/flxlet.cpp
@@ -19,78 +19,78 @@ WARRANTIES, see the file, "license.txt," in this distribution.
flext_base::xlet::xlet(type t,const char *d):
- tp(t),nxt(NULL)
+ tp(t),nxt(NULL)
{
- if(d) {
- int ln = strlen(d);
- desc = new char[ln+1];
- memcpy(desc,d,ln);
- desc[ln] = 0;
- }
- else desc = NULL;
+ if(d) {
+ int ln = strlen(d);
+ desc = new char[ln+1];
+ memcpy(desc,d,ln);
+ desc[ln] = 0;
+ }
+ else desc = NULL;
}
flext_base::xlet::~xlet()
{
- if(desc) delete[] desc;
- if(nxt) delete nxt;
+ if(desc) delete[] desc;
+ if(nxt) delete nxt;
}
void flext_base::AddXlet(xlet::type tp,int mult,const char *desc,xlet *&root)
{
- if(!root && mult) { root = new xlet(tp,desc); --mult; }
- if(mult) {
- xlet *xi = root;
- while(xi->nxt) xi = xi->nxt;
- while(mult--) xi = xi->nxt = new xlet(tp,desc);
- }
+ if(!root && mult) { root = new xlet(tp,desc); --mult; }
+ if(mult) {
+ xlet *xi = root;
+ while(xi->nxt) xi = xi->nxt;
+ while(mult--) xi = xi->nxt = new xlet(tp,desc);
+ }
}
void flext_base::DescXlet(int ix,const char *d,xlet *&root)
{
- xlet *xi = root;
- for(int i = 0; xi && i < ix; xi = xi->nxt,++i) {}
-
- if(xi) {
- if(xi->desc) delete[] xi->desc;
- int ln = strlen(d);
- xi->desc = new char[ln+1];
- memcpy(xi->desc,d,ln);
- xi->desc[ln] = 0;
- }
+ xlet *xi = root;
+ for(int i = 0; xi && i < ix; xi = xi->nxt,++i) {}
+
+ if(xi) {
+ if(xi->desc) delete[] xi->desc;
+ int ln = strlen(d);
+ xi->desc = new char[ln+1];
+ memcpy(xi->desc,d,ln);
+ xi->desc[ln] = 0;
+ }
}
unsigned long flext_base::XletCode(xlet::type tp,...)
{
- unsigned long code = 0;
+ unsigned long code = 0;
- va_list marker;
- va_start(marker,tp);
- int cnt = 0;
- xlet::type arg = tp;
- for(; arg; ++cnt) {
+ va_list marker;
+ va_start(marker,tp);
+ int cnt = 0;
+ xlet::type arg = tp;
+ for(; arg; ++cnt) {
#ifdef FLEXT_DEBUG
- if(cnt > 9) {
- error("%s - Too many in/outlets defined - truncated to 9",thisName());
- break;
- }
-#endif
-
- code = code*10+(int)arg;
- arg = (xlet::type)va_arg(marker,int);
- }
- va_end(marker);
-
- return code;
+ if(cnt > 9) {
+ error("%s - Too many in/outlets defined - truncated to 9",thisName());
+ break;
+ }
+#endif
+
+ code = code*10+(int)arg;
+ arg = (xlet::type)va_arg(marker,int);
+ }
+ va_end(marker);
+
+ return code;
}
void flext_base::AddInlets(unsigned long code)
{
- for(; code; code /= 10) AddInlet((xlet::type)(code%10));
+ for(; code; code /= 10) AddInlet((xlet::type)(code%10));
}
void flext_base::AddOutlets(unsigned long code)
{
- for(; code; code /= 10) AddOutlet((xlet::type)(code%10));
+ for(; code; code /= 10) AddOutlet((xlet::type)(code%10));
}