aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/allow.c112
-rw-r--r--src/arbran.c11
-rw-r--r--src/arraycopy.c283
-rw-r--r--src/average.c17
-rw-r--r--src/beat.c18
-rw-r--r--src/beta.c18
-rw-r--r--src/bilex.c14
-rw-r--r--src/borax.c18
-rw-r--r--src/cauchy.c11
-rw-r--r--src/chord.c17
-rw-r--r--src/delta.c18
-rw-r--r--src/deny.c114
-rw-r--r--src/dist.c17
-rw-r--r--src/divide.c17
-rw-r--r--src/divmod.c17
-rw-r--r--src/edge.c17
-rw-r--r--src/expo.c14
-rw-r--r--src/fifo.c17
-rw-r--r--src/gauss.c15
-rw-r--r--src/gestalt.c18
-rw-r--r--src/history.c23
-rw-r--r--src/ignore.c22
-rw-r--r--src/iso.c54
-rw-r--r--src/lifo.c21
-rw-r--r--src/limit.c14
-rw-r--r--src/linear.c14
-rw-r--r--src/listfifo.c109
-rw-r--r--src/listfunnel.c17
-rw-r--r--src/match.c12
-rw-r--r--src/minus.c20
-rw-r--r--src/mlife.c25
-rw-r--r--src/multi.c20
-rw-r--r--src/nchange.c205
-rw-r--r--src/netclient.c24
-rw-r--r--src/netdist.c32
-rw-r--r--src/netrec.c28
-rw-r--r--src/netserver.c33
-rw-r--r--src/nroute.c22
-rw-r--r--src/pitch.c17
-rw-r--r--src/plus.c19
-rw-r--r--src/poisson.c14
-rw-r--r--src/pong.c21
-rw-r--r--src/pulse.c51
-rw-r--r--src/remote.c18
-rw-r--r--src/rewrap.c20
-rw-r--r--src/rhythm.c22
-rw-r--r--src/scale.c15
-rw-r--r--src/score.c26
-rw-r--r--src/speedlim.c14
-rw-r--r--src/split.c18
-rw-r--r--src/step.c19
-rw-r--r--src/subst.c23
-rw-r--r--src/sync.c294
-rw-r--r--src/temperature.c20
-rw-r--r--src/tilt.c22
-rw-r--r--src/timebang.c37
-rw-r--r--src/triang.c13
-rw-r--r--src/unroute.c19
-rw-r--r--src/urn.c12
-rw-r--r--src/velocity.c17
-rw-r--r--src/weibull.c13
-rw-r--r--src/wrap.c17
62 files changed, 2019 insertions, 220 deletions
diff --git a/src/allow.c b/src/allow.c
new file mode 100644
index 0000000..c5d57ac
--- /dev/null
+++ b/src/allow.c
@@ -0,0 +1,112 @@
+/* ---------------------------- allow --------------------------------------- */
+/* */
+/* Lets only floats/symbols through that are allowed to do so. */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#include "m_pd.h"
+#include <string.h>
+
+static char *version = "allow v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>";
+
+typedef struct allow
+{
+ t_object x_obj;
+ t_outlet *x_out;
+ t_atom *x_elem; // list of elemets that are allowed to pass
+ t_int x_numelem; // the number of elemetns in our allow-list
+} t_allow;
+
+ /* we got a symbol... */
+static void allow_symbol(t_allow *x, t_symbol *s)
+{
+ int i;
+ for(i = 0; i < x->x_numelem; i++)
+ {
+ if(x->x_elem[i].a_type == A_SYMBOL) // compare with all symbols in our list
+ if(atom_getsymbolarg(i, x->x_numelem, x->x_elem) == s)
+ {
+ outlet_symbol(x->x_out, s);
+ return;
+ }
+ }
+}
+
+ /* we got a float... */
+static void allow_float(t_allow *x, t_floatarg f)
+{
+ int i;
+ for(i = 0; i < x->x_numelem; i++)
+ {
+ if(x->x_elem[i].a_type == A_FLOAT) // compare with all floats in our list
+ if(atom_getfloatarg(i, x->x_numelem, x->x_elem) == f)
+ {
+ outlet_float(x->x_out, f);
+ return;
+ }
+ }
+}
+
+static t_class *allow_class;
+
+static void allow_free(t_allow *x)
+{
+ freebytes(x->x_elem, x->x_numelem*sizeof(t_atom));
+}
+
+static void *allow_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_allow *x = (t_allow *)pd_new(allow_class);
+
+ x->x_numelem = argc; // get the number of elements
+ x->x_elem = getbytes(argc*sizeof(t_atom));
+ memcpy(x->x_elem, argv, argc*sizeof(t_atom));
+
+ x->x_out = outlet_new(&x->x_obj, gensym("anything"));
+
+ // post("allow: got %d elements", x->x_numelem);
+
+ return (x);
+}
+
+#ifndef MAXLIB
+void allow_setup(void)
+{
+ /* the object's class: */
+ allow_class = class_new(gensym("allow"), (t_newmethod)allow_new,
+ (t_method)allow_free, sizeof(t_allow), 0, A_GIMME, 0);
+#else
+void maxlib_allow_setup(void)
+{
+ /* the object's class: */
+ allow_class = class_new(gensym("maxlib_allow"), (t_newmethod)allow_new,
+ (t_method)allow_free, sizeof(t_allow), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)allow_new, gensym("allow"), A_GIMME, 0);
+#endif
+ class_addsymbol(allow_class, allow_symbol);
+ class_addfloat(allow_class, allow_float);
+#ifndef MAXLIB
+ class_sethelpsymbol(allow_class, gensym("help-allow.pd"));
+ post(version);
+#else
+ class_sethelpsymbol(allow_class, gensym("maxlib/help-allow.pd"));
+#endif
+} \ No newline at end of file
diff --git a/src/arbran.c b/src/arbran.c
index c37dee4..b4e4b2c 100644
--- a/src/arbran.c
+++ b/src/arbran.c
@@ -164,14 +164,25 @@ static void *rand_arbran_new(t_symbol *s1, t_symbol *s2)
return (x);
}
+#ifndef MAXLIB
void arbran_setup(void)
{
rand_arbran_class = class_new(gensym("arbran"), (t_newmethod)rand_arbran_new, 0,
sizeof(t_rand_arbran), 0, A_SYMBOL, A_SYMBOL, 0);
+#else
+void maxlib_arbran_setup(void)
+{
+ rand_arbran_class = class_new(gensym("maxlib_arbran"), (t_newmethod)rand_arbran_new, 0,
+ sizeof(t_rand_arbran), 0, A_SYMBOL, A_SYMBOL, 0);
+#endif
class_addbang(rand_arbran_class, rand_arbran_bang);
class_addmethod(rand_arbran_class, (t_method)rand_arbran_pdfscale, gensym("pdfscale"), 0);
class_addmethod(rand_arbran_class, (t_method)rand_arbran_setarrays, gensym("set"), A_SYMBOL, A_SYMBOL, 0);
#ifndef MAXLIB
+ class_sethelpsymbol(rand_arbran_class, gensym("help-arbran.pd"));
post(version);
+#else
+ class_addcreator((t_newmethod)rand_arbran_new, gensym("arbran"), A_SYMBOL, A_SYMBOL, 0);
+ class_sethelpsymbol(rand_arbran_class, gensym("maxlib/help-arbran.pd"));
#endif
}
diff --git a/src/arraycopy.c b/src/arraycopy.c
new file mode 100644
index 0000000..cc36913
--- /dev/null
+++ b/src/arraycopy.c
@@ -0,0 +1,283 @@
+/* ------------------------- arraycopy --------------------------------------- */
+/* */
+/* Copy data from one array to another . */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#include "m_pd.h"
+#include <stdlib.h>
+
+static char *version = "arraycopy v0.2, written by Olaf Matthes <olaf.matthes@gmx.de>";
+
+typedef struct arraycopy
+{
+ t_object x_obj;
+ t_symbol *x_destarray;
+ t_symbol *x_sourcearray;
+ t_garray *x_destbuf;
+ t_garray *x_sourcebuf;
+ t_int x_start;
+ t_int x_end;
+ t_int x_pos;
+ short x_print;
+} t_arraycopy;
+
+ /* choose the destination array to copy to */
+static void arraycopy_setdestarray(t_arraycopy *x, t_symbol *s)
+{
+ t_garray *b;
+
+ if ((b = (t_garray *)pd_findbyclass(s, garray_class)))
+ {
+ // post("arraycopy: destination array set to \"%s\"", s->s_name);
+ x->x_destbuf = b;
+ } else {
+ post("arraycopy: no array \"%s\" (error %d)", s->s_name, b);
+ x->x_destbuf = 0;
+ }
+}
+
+static void arraycopy_setdest(t_arraycopy *x, t_symbol *s)
+{
+ x->x_destarray = s;
+ arraycopy_setdestarray(x, x->x_destarray);
+}
+
+ /* choose the source array to copy from */
+static void arraycopy_setsourcearray(t_arraycopy *x, t_symbol *s)
+{
+ t_garray *b;
+
+ if ((b = (t_garray *)pd_findbyclass(s, garray_class)))
+ {
+ // post("arraycopy: source array set to \"%s\"", s->s_name);
+ x->x_sourcebuf = b;
+ } else {
+ post("arraycopy: no array \"%s\" (error %d)", s->s_name, b);
+ x->x_sourcebuf = 0;
+ }
+}
+
+ /* this is the routine that actually does the copying */
+ /* get's called directly when we get a 'bang' */
+static void arraycopy_docopy(t_arraycopy *x)
+{
+ t_garray *b; /* make local copy of array */
+ t_float *tab; /* the content itselfe */
+ t_int items, i;
+ t_garray *A;
+ int npoints;
+ t_float *vec;
+
+ if(!x->x_destarray)
+ {
+ post("arraycopy: no destination array specified");
+ return;
+ }
+ if(!x->x_sourcearray)
+ {
+ post("arraycopy: no source array specified");
+ return;
+ }
+
+ A = x->x_destbuf;
+
+ if ((b = (t_garray *)pd_findbyclass(x->x_sourcearray, garray_class)))
+ {
+ // post("arraycopy: source array set to \"%s\"", x->x_sourcearray->s_name);
+ } else {
+ post("arraycopy: no array \"%s\" (error %d)", x->x_sourcearray->s_name, b);
+ return;
+ }
+
+ // read from our array
+ if (!garray_getfloatarray(b, &items, &tab))
+ {
+ post("arraycopy: couldn't read from source array!");
+ return;
+ }
+
+ if (!(A = (t_garray *)pd_findbyclass(x->x_destarray, garray_class)))
+ error("arraycopy: %s: no such array", x->x_destarray->s_name);
+ else if (!garray_getfloatarray(A, &npoints, &vec))
+ error("arraycopy: %s: bad template ", x->x_destarray->s_name);
+ else
+ {
+ if(x->x_start > items) // check start point
+ {
+ post("arraycopy: source start point out of range for the array given");
+ return;
+ }
+ if(x->x_end) // end point is specified
+ {
+ if(x->x_end > items) // check start point
+ {
+ post("arraycopy: source end point out of range for the array given");
+ x->x_end = items;
+ }
+ }
+ else x->x_end = items;
+
+ if(x->x_pos)
+ vec += x->x_pos;
+
+ for(i = x->x_start; i < x->x_end; i++)
+ {
+ *vec++ = tab[i];
+ }
+ garray_redraw(A);
+ if(x->x_print)post("arraycopy: copied %d values from array \"%s\" to array \"%s\"",
+ x->x_end-x->x_start, x->x_sourcearray->s_name, x->x_destarray->s_name);
+ }
+}
+
+static void arraycopy_list(t_arraycopy *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc > 1) {
+ x->x_sourcearray = atom_getsymbolarg(0, argc, argv);
+ x->x_destarray = atom_getsymbolarg(1, argc, argv);
+ }
+}
+
+static void arraycopy_source(t_arraycopy *x, t_symbol *s)
+{
+ x->x_sourcearray = s;
+ x->x_start = x->x_end = x->x_pos = 0;
+ arraycopy_docopy(x);
+}
+
+static void arraycopy_print(t_arraycopy *x, t_floatarg f)
+{
+ if(f)
+ x->x_print = 1;
+ else
+ x->x_print = 0;
+}
+
+static void arraycopy_copy(t_arraycopy *x, t_symbol *s, int argc, t_atom *argv)
+{
+ if(argc == 1) // source array name supplied
+ {
+ x->x_sourcearray = atom_getsymbolarg(0, argc, argv);
+ x->x_start = x->x_end = x->x_pos = 0;
+ }
+ else if(argc == 2) // array name and start point supplied
+ {
+ x->x_sourcearray = atom_getsymbolarg(0, argc, argv);
+ x->x_start = atom_getfloatarg(1, argc, argv);
+ x->x_end = x->x_pos = 0;
+ }
+ else if(argc == 3) // arrayname and start & end point supplied
+ {
+ x->x_sourcearray = atom_getsymbolarg(0, argc, argv);
+ x->x_start = atom_getfloatarg(1, argc, argv);
+ if(argv[2].a_type == A_FLOAT) // real position
+ {
+ x->x_end = atom_getfloatarg(2, argc, argv);
+ }
+ else // offset given
+ {
+ t_symbol *offset = atom_getsymbolarg(2, argc, argv);
+ x->x_end = (t_int)atoi(offset->s_name) + x->x_start;
+ }
+ x->x_pos = 0;
+ }
+ else if(argc == 4) // as above & dest. array
+ {
+ x->x_sourcearray = atom_getsymbolarg(0, argc, argv);
+ x->x_start = atom_getfloatarg(1, argc, argv);
+ if(argv[2].a_type == A_FLOAT) // real position
+ {
+ x->x_end = atom_getfloatarg(2, argc, argv);
+ }
+ else // offset given
+ {
+ t_symbol *offset = atom_getsymbolarg(2, argc, argv);
+ x->x_end = (t_int)atoi(offset->s_name) + x->x_start;
+ }
+ x->x_destarray = atom_getsymbolarg(3, argc, argv);
+ arraycopy_setdestarray(x, x->x_destarray);
+ x->x_pos = 0;
+ }
+ else if(argc == 5) // as above & dest. array & pos. in dest.
+ {
+ x->x_sourcearray = atom_getsymbolarg(0, argc, argv);
+ x->x_start = atom_getfloatarg(1, argc, argv);
+ if(argv[2].a_type == A_FLOAT) // real position
+ {
+ x->x_end = atom_getfloatarg(2, argc, argv);
+ }
+ else // offset given
+ {
+ t_symbol *offset = atom_getsymbolarg(2, argc, argv);
+ x->x_end = (t_int)atoi(offset->s_name) + x->x_start;
+ }
+ x->x_destarray = atom_getsymbolarg(3, argc, argv);
+ arraycopy_setdestarray(x, x->x_destarray);
+ x->x_pos = atom_getfloatarg(4, argc, argv);
+ }
+ else post("arraycopy: copy: wrong number of arguments");
+
+ arraycopy_docopy(x);
+}
+
+static t_class *arraycopy_class;
+
+static void *arraycopy_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_arraycopy *x = (t_arraycopy *)pd_new(arraycopy_class);
+
+ if (argc > 0) {
+ x->x_destarray = atom_getsymbolarg(0, argc, argv);
+ arraycopy_setdestarray(x, x->x_destarray);
+ }
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym("dest"));
+ x->x_start = x->x_end = x->x_pos = x->x_print = 0;
+ return (x);
+}
+
+#ifndef MAXLIB
+void arraycopy_setup(void)
+{
+ /* the object's class: */
+ arraycopy_class = class_new(gensym("arraycopy"), (t_newmethod)arraycopy_new,
+ 0, sizeof(t_arraycopy), 0, A_GIMME, 0);
+#else
+void maxlib_arraycopy_setup(void)
+{
+ /* the object's class: */
+ arraycopy_class = class_new(gensym("maxlib_arraycopy"), (t_newmethod)arraycopy_new,
+ 0, sizeof(t_arraycopy), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)arraycopy_new, gensym("arraycopy"), A_GIMME, 0);
+#endif
+ class_addmethod(arraycopy_class, (t_method)arraycopy_copy, gensym("copy"), A_GIMME, 0);
+ class_addmethod(arraycopy_class, (t_method)arraycopy_print, gensym("print"), A_FLOAT, 0);
+ class_addmethod(arraycopy_class, (t_method)arraycopy_setdest, gensym("dest"), A_SYMBOL, 0);
+ class_addsymbol(arraycopy_class, arraycopy_source);
+ class_addbang(arraycopy_class, arraycopy_docopy);
+ // class_addlist(arraycopy_class, arraycopy_list);
+#ifndef MAXLIB
+ class_sethelpsymbol(arraycopy_class, gensym("help-arraycopy.pd"));
+ post(version);
+#else
+ class_sethelpsymbol(arraycopy_class, gensym("maxlib/help-arraycopy.pd"));
+#endif
+} \ No newline at end of file
diff --git a/src/average.c b/src/average.c
index f38772c..781f9d5 100644
--- a/src/average.c
+++ b/src/average.c
@@ -171,21 +171,32 @@ static void *average_new(t_floatarg f)
x->x_inpointer = 0;
x->x_average = 0;
x->x_mode = 0;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void average_setup(void)
{
average_class = class_new(gensym("average"), (t_newmethod)average_new,
(t_method)average_free, sizeof(t_average), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_average_setup(void)
+{
+ average_class = class_new(gensym("maxlib_average"), (t_newmethod)average_new,
+ (t_method)average_free, sizeof(t_average), 0, A_DEFFLOAT, 0);
+#endif
class_addmethod(average_class, (t_method)average_reset, gensym("reset"), 0);
class_addmethod(average_class, (t_method)average_linear, gensym("linear"), 0);
class_addmethod(average_class, (t_method)average_geometric, gensym("geometric"), 0);
class_addmethod(average_class, (t_method)average_weight, gensym("weight"), 0);
class_addfloat(average_class, average_float);
class_addmethod(average_class, (t_method)average_index, gensym("index"), A_FLOAT, 0);
+#ifndef MAXLIB
+ post(version);
+ class_sethelpsymbol(average_class, gensym("help-average.pd"));
+#else
+ class_addcreator((t_newmethod)average_new, gensym("average"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(average_class, gensym("maxlib/help-average.pd"));
+#endif
}
diff --git a/src/beat.c b/src/beat.c
index 8a225e6..3ca552c 100644
--- a/src/beat.c
+++ b/src/beat.c
@@ -372,22 +372,32 @@ static void *beat_new(t_floatarg f)
x->x_band_percent = 4; /* allow 4% 'jitter' by default */
if(f)x->x_band_percent = (t_int)f;
-#ifndef MAXLIB
- post(version);
-#endif
post("beat: band percentage set to %d", x->x_band_percent);
return (void *)x;
}
+#ifndef MAXLIB
void beat_setup(void)
{
beat_class = class_new(gensym("beat"), (t_newmethod)beat_new,
(t_method)beat_free, sizeof(t_beat), 0, A_DEFFLOAT, 0);
- class_addcreator((t_newmethod)beat_new, gensym("max.beat"), A_DEFFLOAT, 0);
+#else
+void maxlib_beat_setup(void)
+{
+ beat_class = class_new(gensym("maxlib_beat"), (t_newmethod)beat_new,
+ (t_method)beat_free, sizeof(t_beat), 0, A_DEFFLOAT, 0);
+#endif
class_addfloat(beat_class, beat_float);
class_addmethod(beat_class, (t_method)beat_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(beat_class, (t_method)beat_reset, gensym("reset"), 0);
class_addmethod(beat_class, (t_method)beat_print, gensym("print"), 0);
+#ifndef MAXLIB
+ class_sethelpsymbol(beat_class, gensym("help-beat.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)beat_new, gensym("beat"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(beat_class, gensym("maxlib/help-beat.pd"));
+#endif
}
diff --git a/src/beta.c b/src/beta.c
index bb965aa..ebc7a14 100644
--- a/src/beta.c
+++ b/src/beta.c
@@ -1,6 +1,6 @@
-/* ---------------------------- rand_beta ----------------------------------- */
+/* ---------------------------- rand_beta ------------------------------------- */
/* */
-/* rand_beta generates a beta distributed random variable. */
+/* rand_beta generates a beta distributed random variable. */
/* Written by Olaf Matthes (olaf.matthes@gmx.de) */
/* Based on code found in Dodge/Jerse "Computer Music" */
/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
@@ -86,12 +86,22 @@ static void rand_beta_bang(t_rand_beta *x)
outlet_float(x->x_obj.ob_outlet, y1/sum);
}
+#ifndef MAXLIB
void beta_setup(void)
{
rand_beta_class = class_new(gensym("beta"), (t_newmethod)rand_beta_new, 0,
sizeof(t_rand_beta), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addbang(rand_beta_class, rand_beta_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_beta_class, gensym("help-beta.pd"));
post(version);
-#endif
}
+#else
+void maxlib_beta_setup(void)
+{
+ rand_beta_class = class_new(gensym("maxlib_beta"), (t_newmethod)rand_beta_new, 0,
+ sizeof(t_rand_beta), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(rand_beta_class, rand_beta_bang);
+ class_addcreator((t_newmethod)rand_beta_new, gensym("beta"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_sethelpsymbol(rand_beta_class, gensym("maxlib/help-beta.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/bilex.c b/src/bilex.c
index ca2afd3..ed7484f 100644
--- a/src/bilex.c
+++ b/src/bilex.c
@@ -70,12 +70,22 @@ static void rand_bilex_bang(t_rand_bilex *x)
outlet_float(x->x_obj.ob_outlet, s*log(u)/l);
}
+#ifndef MAXLIB
void bilex_setup(void)
{
rand_bilex_class = class_new(gensym("bilex"), (t_newmethod)rand_bilex_new, 0,
sizeof(t_rand_bilex), 0, A_DEFFLOAT, 0);
class_addbang(rand_bilex_class, rand_bilex_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_bilex_class, gensym("help-bilex.pd"));
post(version);
-#endif
}
+#else
+void maxlib_bilex_setup(void)
+{
+ rand_bilex_class = class_new(gensym("maxlib_bilex"), (t_newmethod)rand_bilex_new, 0,
+ sizeof(t_rand_bilex), 0, A_DEFFLOAT, 0);
+ class_addbang(rand_bilex_class, rand_bilex_bang);
+ class_addcreator((t_newmethod)rand_bilex_new, gensym("bilex"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(rand_bilex_class, gensym("maxlib/help-bilex.pd"));
+}
+#endif
diff --git a/src/borax.c b/src/borax.c
index 151f269..a5143a9 100644
--- a/src/borax.c
+++ b/src/borax.c
@@ -209,20 +209,30 @@ static void *borax_new(void)
x->x_timecount = 0;
x->x_timeval = 0;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void borax_setup(void)
{
borax_class = class_new(gensym("borax"), (t_newmethod)borax_new,
0, sizeof(t_borax), 0, 0);
+#else
+void maxlib_borax_setup(void)
+{
+ borax_class = class_new(gensym("maxlib_borax"), (t_newmethod)borax_new,
+ 0, sizeof(t_borax), 0, 0);
+#endif
class_addmethod(borax_class, (t_method)borax_reset, gensym("reset"), 0);
class_addmethod(borax_class, (t_method)borax_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(borax_class, (t_method)borax_reset, gensym("ft2"), A_GIMME, 0);
class_addfloat(borax_class, borax_float);
-
+#ifndef MAXLIB
+ class_sethelpsymbol(borax_class, gensym("help-borax.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)borax_new, gensym("borax"), 0);
+ class_sethelpsymbol(borax_class, gensym("maxlib/help-borax.pd"));
+#endif
}
diff --git a/src/cauchy.c b/src/cauchy.c
index 82592e3..7d85321 100644
--- a/src/cauchy.c
+++ b/src/cauchy.c
@@ -69,12 +69,21 @@ static void rand_cauchy_bang(t_rand_cauchy *x)
outlet_float(x->x_obj.ob_outlet, x->x_alpha*tan(u));
}
+#ifndef MAXLIB
void cauchy_setup(void)
{
rand_cauchy_class = class_new(gensym("cauchy"), (t_newmethod)rand_cauchy_new, 0,
sizeof(t_rand_cauchy), 0, A_DEFFLOAT, 0);
class_addbang(rand_cauchy_class, rand_cauchy_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_cauchy_class, gensym("help-cauchy.pd"));
post(version);
+#else
+void maxlib_cauchy_setup(void)
+{
+ rand_cauchy_class = class_new(gensym("maxlib_cauchy"), (t_newmethod)rand_cauchy_new, 0,
+ sizeof(t_rand_cauchy), 0, A_DEFFLOAT, 0);
+ class_addbang(rand_cauchy_class, rand_cauchy_bang);
+ class_addcreator((t_newmethod)rand_cauchy_new, gensym("cauchy"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(rand_cauchy_class, gensym("maxlib/help-cauchy.pd"));
#endif
}
diff --git a/src/chord.c b/src/chord.c
index 3244686..f0dc4a3 100644
--- a/src/chord.c
+++ b/src/chord.c
@@ -1785,17 +1785,28 @@ static void *chord_new(t_floatarg f)
if(x->x_split == 0)x->x_split = 128;
for(i = 0; i < MAX_POLY; i++)x->x_alloctable[i] = -1;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void chord_setup(void)
{
chord_class = class_new(gensym("chord"), (t_newmethod)chord_new,
0, sizeof(t_chord), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_chord_setup(void)
+{
+ chord_class = class_new(gensym("maxlib_chord"), (t_newmethod)chord_new,
+ 0, sizeof(t_chord), 0, A_DEFFLOAT, 0);
+#endif
class_addfloat(chord_class, chord_float);
class_addmethod(chord_class, (t_method)chord_ft1, gensym("ft1"), A_FLOAT, 0);
+#ifndef MAXLIB
+ class_sethelpsymbol(chord_class, gensym("help-chord.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)chord_new, gensym("chord"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(chord_class, gensym("maxlib/help-chord.pd"));
+#endif
}
diff --git a/src/delta.c b/src/delta.c
index 2a509e5..7bbe19f 100644
--- a/src/delta.c
+++ b/src/delta.c
@@ -110,18 +110,30 @@ static void *delta_new(t_floatarg f)
x->x_clearflag = 1;
x->x_delta = 0;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void delta_setup(void)
{
delta_class = class_new(gensym("delta"), (t_newmethod)delta_new,
0, sizeof(t_delta), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_delta_setup(void)
+{
+ delta_class = class_new(gensym("maxlib_delta"), (t_newmethod)delta_new,
+ 0, sizeof(t_delta), 0, A_DEFFLOAT, 0);
+#endif
class_addfloat(delta_class, delta_float);
class_addbang(delta_class, (t_method)delta_bang);
class_addmethod(delta_class, (t_method)delta_clear, gensym("clear"), 0);
+ class_sethelpsymbol(delta_class, gensym("maxlib/help-delta.pd"));
+#ifndef MAXLIB
+ class_sethelpsymbol(delta_class, gensym("help-delta.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)delta_new, gensym("delta"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(delta_class, gensym("maxlib/help-delta.pd"));
+#endif
}
diff --git a/src/deny.c b/src/deny.c
new file mode 100644
index 0000000..9d0ef35
--- /dev/null
+++ b/src/deny.c
@@ -0,0 +1,114 @@
+/* ---------------------------- deny --------------------------------------- */
+/* */
+/* Lets only floats/symbols through that are denyed to do so. */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#include "m_pd.h"
+#include <string.h>
+
+static char *version = "deny v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>";
+
+typedef struct deny
+{
+ t_object x_obj;
+ t_outlet *x_out;
+ t_atom *x_elem; // list of elemets that are denyed to pass
+ t_int x_numelem; // the number of elemetns in our deny-list
+} t_deny;
+
+ /* we got a symbol... */
+static void deny_symbol(t_deny *x, t_symbol *s)
+{
+ int i, deny = 0;
+ for(i = 0; i < x->x_numelem; i++)
+ {
+ if(x->x_elem[i].a_type == A_SYMBOL) // compare with all symbols in our list
+ if(atom_getsymbolarg(i, x->x_numelem, x->x_elem) == s)
+ {
+ deny = 1;
+ return;
+ }
+ }
+ if(!deny)outlet_symbol(x->x_out, s);
+}
+
+ /* we got a float... */
+static void deny_float(t_deny *x, t_floatarg f)
+{
+ int i, deny = 0;
+ for(i = 0; i < x->x_numelem; i++)
+ {
+ if(x->x_elem[i].a_type == A_FLOAT) // compare with all floats in our list
+ if(atom_getfloatarg(i, x->x_numelem, x->x_elem) == f)
+ {
+ deny = 1; // input is in deny-list
+ return;
+ }
+ }
+ if(!deny)outlet_float(x->x_out, f);
+}
+
+static t_class *deny_class;
+
+static void deny_free(t_deny *x)
+{
+ freebytes(x->x_elem, x->x_numelem*sizeof(t_atom));
+}
+
+static void *deny_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_deny *x = (t_deny *)pd_new(deny_class);
+
+ x->x_numelem = argc; // get the number of elements
+ x->x_elem = getbytes(argc*sizeof(t_atom));
+ memcpy(x->x_elem, argv, argc*sizeof(t_atom));
+
+ x->x_out = outlet_new(&x->x_obj, gensym("anything"));
+
+ // post("deny: got %d elements", x->x_numelem);
+
+ return (x);
+}
+
+#ifndef MAXLIB
+void deny_setup(void)
+{
+ /* the object's class: */
+ deny_class = class_new(gensym("deny"), (t_newmethod)deny_new,
+ (t_method)deny_free, sizeof(t_deny), 0, A_GIMME, 0);
+#else
+void maxlib_deny_setup(void)
+{
+ /* the object's class: */
+ deny_class = class_new(gensym("maxlib_deny"), (t_newmethod)deny_new,
+ (t_method)deny_free, sizeof(t_deny), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)deny_new, gensym("deny"), A_GIMME, 0);
+#endif
+ class_addsymbol(deny_class, deny_symbol);
+ class_addfloat(deny_class, deny_float);
+#ifndef MAXLIB
+ class_sethelpsymbol(deny_class, gensym("help-deny.pd"));
+ post(version);
+#else
+ class_sethelpsymbol(deny_class, gensym("maxlib/help-deny.pd"));
+#endif
+} \ No newline at end of file
diff --git a/src/dist.c b/src/dist.c
index da62d1f..e04e317 100644
--- a/src/dist.c
+++ b/src/dist.c
@@ -243,16 +243,20 @@ static void *dist_new(t_symbol *s, int argc, t_atom *argv)
x->x_sym[i] = atom_getsymbolarg(i, argc, argv);
x->x_rec++;
}
-#ifndef MAXLIB
- post(version);
-#endif
return (x);
}
+#ifndef MAXLIB
void dist_setup(void)
{
dist_class = class_new(gensym("dist"), (t_newmethod)dist_new, 0,
sizeof(t_dist), 0, A_GIMME, 0);
+#else
+void maxlib_dist_setup(void)
+{
+ dist_class = class_new(gensym("maxlib_dist"), (t_newmethod)dist_new, 0,
+ sizeof(t_dist), 0, A_GIMME, 0);
+#endif
class_addcreator((t_newmethod)dist_new, gensym("d"), A_GIMME, 0);
class_addbang(dist_class, dist_bang);
class_addfloat(dist_class, dist_float);
@@ -265,4 +269,11 @@ void dist_setup(void)
class_addmethod(dist_class, (t_method)dist_print, gensym("print"), 0);
class_addmethod(dist_class, (t_method)dist_send, gensym("send"), A_GIMME, 0);
class_addanything(dist_class, dist_anything);
+#ifndef MAXLIB
+ class_sethelpsymbol(dist_class, gensym("help-dist.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)dist_new, gensym("dist"), A_GIMME, 0);
+ class_sethelpsymbol(dist_class, gensym("maxlib/help-dist.pd"));
+#endif
}
diff --git a/src/divide.c b/src/divide.c
index 40e5360..2a3bf10 100644
--- a/src/divide.c
+++ b/src/divide.c
@@ -82,18 +82,29 @@ static void *divide_new(t_symbol *s, t_int argc, t_atom* argv)
}
x->x_numvalues = i;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void divide_setup(void)
{
divide_class = class_new(gensym("divide"), (t_newmethod)divide_new,
0, sizeof(t_divide), 0, A_GIMME, 0);
+#else
+void maxlib_divide_setup(void)
+{
+ divide_class = class_new(gensym("maxlib_divide"), (t_newmethod)divide_new,
+ 0, sizeof(t_divide), 0, A_GIMME, 0);
+#endif
class_addfloat(divide_class, divide_float);
class_addmethod(divide_class, (t_method)divide_ft1, gensym("ft1"), A_FLOAT, 0);
class_addbang(divide_class, (t_method)divide_bang);
+#ifndef MAXLIB
+ class_sethelpsymbol(divide_class, gensym("help-divide.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)divide_new, gensym("divide"), A_GIMME, 0);
+ class_sethelpsymbol(divide_class, gensym("maxlib/help-divide.pd"));
+#endif
}
diff --git a/src/divmod.c b/src/divmod.c
index f84862c..ee552e7 100644
--- a/src/divmod.c
+++ b/src/divmod.c
@@ -72,18 +72,29 @@ static void *divmod_new(t_floatarg fl, t_floatarg fr)
x->x_rightvalue = fr;
x->x_leftvalue = fl;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void divmod_setup(void)
{
divmod_class = class_new(gensym("divmod"), (t_newmethod)divmod_new,
0, sizeof(t_divmod), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+#else
+void maxlib_divmod_setup(void)
+{
+ divmod_class = class_new(gensym("maxlib_divmod"), (t_newmethod)divmod_new,
+ 0, sizeof(t_divmod), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+#endif
class_addfloat(divmod_class, divmod_float);
class_addmethod(divmod_class, (t_method)divmod_ft1, gensym("ft1"), A_FLOAT, 0);
class_addbang(divmod_class, (t_method)divmod_bang);
+#ifndef MAXLIB
+ class_sethelpsymbol(divmod_class, gensym("help-divmod.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)divmod_new, gensym("divmod"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_sethelpsymbol(divmod_class, gensym("maxlib/help-divmod.pd"));
+#endif
}
diff --git a/src/edge.c b/src/edge.c
index 308ee59..0f067a8 100644
--- a/src/edge.c
+++ b/src/edge.c
@@ -57,19 +57,26 @@ static void *edge_new(t_floatarg f)
x->x_lastval = f;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void edge_setup(void)
{
edge_class = class_new(gensym("edge"), (t_newmethod)edge_new,
0, sizeof(t_edge), 0, A_DEFFLOAT, 0);
class_addfloat(edge_class, edge_float);
-#ifndef MAXLIB
+ class_sethelpsymbol(edge_class, gensym("help-edge.pd"));
+ post(version);
+}
#else
-#endif
+void maxlib_edge_setup(void)
+{
+ edge_class = class_new(gensym("maxlib_edge"), (t_newmethod)edge_new,
+ 0, sizeof(t_edge), 0, A_DEFFLOAT, 0);
+ class_addfloat(edge_class, edge_float);
+ class_addcreator((t_newmethod)edge_new, gensym("edge"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(edge_class, gensym("maxlib/help-edge.pd"));
}
+#endif
diff --git a/src/expo.c b/src/expo.c
index f9c7844..7100417 100644
--- a/src/expo.c
+++ b/src/expo.c
@@ -65,12 +65,22 @@ static void rand_expo_bang(t_rand_expo *x)
outlet_float(x->x_obj.ob_outlet, -log(u)/l);
}
+#ifndef MAXLIB
void expo_setup(void)
{
rand_expo_class = class_new(gensym("expo"), (t_newmethod)rand_expo_new, 0,
sizeof(t_rand_expo), 0, A_DEFFLOAT, 0);
class_addbang(rand_expo_class, rand_expo_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_expo_class, gensym("help-expo.pd"));
post(version);
-#endif
}
+#else
+void maxlib_expo_setup(void)
+{
+ rand_expo_class = class_new(gensym("maxlib_expo"), (t_newmethod)rand_expo_new, 0,
+ sizeof(t_rand_expo), 0, A_DEFFLOAT, 0);
+ class_addbang(rand_expo_class, rand_expo_bang);
+ class_addcreator((t_newmethod)rand_expo_new, gensym("expo"), A_DEFFLOAT, 0);
+ class_sethelpsymbol(rand_expo_class, gensym("maxlib/help-expo.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/fifo.c b/src/fifo.c
index 5cfab84..c0f73be 100644
--- a/src/fifo.c
+++ b/src/fifo.c
@@ -70,16 +70,27 @@ static void *fifo_new(t_floatarg n)
x->getal = (t_float *)getbytes(x->size * sizeof(t_float));
x->out = outlet_new(&x->d_ob, gensym("float"));
-#ifndef MAXLIB
- post(version);
-#endif
return (x);
}
+#ifndef MAXLIB
void fifo_setup(void)
{
fifo_class = class_new(gensym("fifo"), (t_newmethod)fifo_new,
(t_method)fifo_free, sizeof(t_fifo), 0, A_DEFFLOAT, 0);
class_addfloat(fifo_class, fifo_int);
class_addbang(fifo_class, fifo_bang);
+ class_sethelpsymbol(fifo_class, gensym("help-fifo.pd"));
+ post(version);
+}
+#else
+void maxlib_fifo_setup(void)
+{
+ fifo_class = class_new(gensym("maxlib_fifo"), (t_newmethod)fifo_new,
+ (t_method)fifo_free, sizeof(t_fifo), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)fifo_new, gensym("fifo"), A_DEFFLOAT, 0);
+ class_addfloat(fifo_class, fifo_int);
+ class_addbang(fifo_class, fifo_bang);
+ class_sethelpsymbol(fifo_class, gensym("maxlib/help-fifo.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/gauss.c b/src/gauss.c
index ec81e70..2a441c4 100644
--- a/src/gauss.c
+++ b/src/gauss.c
@@ -66,12 +66,23 @@ static void rand_gauss_bang(t_rand_gauss *x)
outlet_float(x->x_obj.ob_outlet, x->x_sigma*scale*(sum-halfN)+x->x_mu);
}
+#ifndef MAXLIB
void gauss_setup(void)
{
rand_gauss_class = class_new(gensym("gauss"), (t_newmethod)rand_gauss_new, 0,
sizeof(t_rand_gauss), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addbang(rand_gauss_class, rand_gauss_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_gauss_class, gensym("help-gauss.pd"));
post(version);
-#endif
}
+#else
+void maxlib_gauss_setup(void)
+{
+ rand_gauss_class = class_new(gensym("maxlib_gauss"), (t_newmethod)rand_gauss_new, 0,
+ sizeof(t_rand_gauss), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rand_gauss_new, gensym("gauss"), A_DEFFLOAT, 0);
+ class_addbang(rand_gauss_class, rand_gauss_bang);
+ class_sethelpsymbol(rand_gauss_class, gensym("maxlib/help-gauss.pd"));
+}
+#endif
+
diff --git a/src/gestalt.c b/src/gestalt.c
index cd07969..650efdb 100644
--- a/src/gestalt.c
+++ b/src/gestalt.c
@@ -91,12 +91,10 @@ static void *gestalt_new(t_floatarg f)
x->x_reftime = f;
if(x->x_reftime < 1) x->x_reftime = 1;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void gestalt_setup(void)
{
gestalt_class = class_new(gensym("gestalt"), (t_newmethod)gestalt_new,
@@ -104,5 +102,19 @@ void gestalt_setup(void)
class_addfloat(gestalt_class, gestalt_float);
class_addmethod(gestalt_class, (t_method)gestalt_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(gestalt_class, (t_method)gestalt_ft2, gensym("ft2"), A_FLOAT, 0);
+ class_sethelpsymbol(gestalt_class, gensym("help-gestalt.pd"));
+ post(version);
+}
+#else
+void maxlib_gestalt_setup(void)
+{
+ gestalt_class = class_new(gensym("maxlib_gestalt"), (t_newmethod)gestalt_new,
+ 0, sizeof(t_gestalt), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)gestalt_new, gensym("gestalt"), A_DEFFLOAT, 0);
+ class_addfloat(gestalt_class, gestalt_float);
+ class_addmethod(gestalt_class, (t_method)gestalt_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addmethod(gestalt_class, (t_method)gestalt_ft2, gensym("ft2"), A_FLOAT, 0);
+ class_sethelpsymbol(gestalt_class, gensym("maxlib/help-gestalt.pd"));
}
+#endif
diff --git a/src/history.c b/src/history.c
index 8221ad3..4f93b89 100644
--- a/src/history.c
+++ b/src/history.c
@@ -236,12 +236,11 @@ static void *history_new(t_floatarg f)
x->x_average = 0;
x->x_mode = 0;
clock_delay(x->x_clock, 0);
-#ifndef MAXLIB
- post(version);
-#endif
+
return (void *)x;
}
+#ifndef MAXLIB
void history_setup(void)
{
history_class = class_new(gensym("history"), (t_newmethod)history_new,
@@ -252,5 +251,21 @@ void history_setup(void)
class_addmethod(history_class, (t_method)history_weight, gensym("weight"), 0);
class_addfloat(history_class, history_float);
class_addmethod(history_class, (t_method)history_time, gensym("time"), A_FLOAT, 0);
+ class_sethelpsymbol(history_class, gensym("help-history.pd"));
+ post(version);
}
-
+#else
+void maxlib_history_setup(void)
+{
+ history_class = class_new(gensym("maxlib_history"), (t_newmethod)history_new,
+ (t_method)history_free, sizeof(t_history), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)history_new, gensym("history"), A_DEFFLOAT, 0);
+ class_addmethod(history_class, (t_method)history_reset, gensym("reset"), 0);
+ class_addmethod(history_class, (t_method)history_linear, gensym("linear"), 0);
+ class_addmethod(history_class, (t_method)history_geometric, gensym("geometric"), 0);
+ class_addmethod(history_class, (t_method)history_weight, gensym("weight"), 0);
+ class_addfloat(history_class, history_float);
+ class_addmethod(history_class, (t_method)history_time, gensym("time"), A_FLOAT, 0);
+ class_sethelpsymbol(history_class, gensym("maxlib/help-history.pd"));
+}
+#endif
diff --git a/src/ignore.c b/src/ignore.c
index d428e50..3e3c0e7 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -24,9 +24,6 @@
#include "m_pd.h"
-#define MAX_ARG 16 /* maximum number of items to ignore */
-#define IN_SIZE 32 /* size of array that stores the incoming values */
-
static char *version = "ignore v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>";
typedef struct ignore
@@ -90,16 +87,13 @@ static void *ignore_new(t_floatarg f)
x->x_outfloat = outlet_new(&x->x_ob, gensym("float"));
x->x_clock = clock_new(x, (t_method)ignore_tick);
-#ifndef MAXLIB
- post(version);
-#endif
-
x->x_time = (t_int)f;
x->x_lastinput = 0;
return (void *)x;
}
+#ifndef MAXLIB
void ignore_setup(void)
{
ignore_class = class_new(gensym("ignore"), (t_newmethod)ignore_new,
@@ -107,5 +101,19 @@ void ignore_setup(void)
class_addmethod(ignore_class, (t_method)ignore_reset, gensym("reset"), 0);
class_addmethod(ignore_class, (t_method)ignore_time, gensym("time"), A_FLOAT, 0);
class_addfloat(ignore_class, ignore_float);
+ class_sethelpsymbol(ignore_class, gensym("help-ignore.pd"));
+ post(version);
+}
+#else
+void maxlib_ignore_setup(void)
+{
+ ignore_class = class_new(gensym("maxlib_ignore"), (t_newmethod)ignore_new,
+ (t_method)ignore_free, sizeof(t_ignore), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)ignore_new, gensym("ignore"), A_DEFFLOAT, 0);
+ class_addmethod(ignore_class, (t_method)ignore_reset, gensym("reset"), 0);
+ class_addmethod(ignore_class, (t_method)ignore_time, gensym("time"), A_FLOAT, 0);
+ class_addfloat(ignore_class, ignore_float);
+ class_sethelpsymbol(ignore_class, gensym("maxlib/help-ignore.pd"));
}
+#endif
diff --git a/src/iso.c b/src/iso.c
index f335c63..b206bb4 100644
--- a/src/iso.c
+++ b/src/iso.c
@@ -1,6 +1,27 @@
-/* iso.c ---- queue up pitch and attack point series */
-/* by Charlie Baker (baker@foxtrot.ccmrc.ucsb.edu) */
-/* Pd port by Olaf Matthes <olaf.matthes@gmx.de> */
+/* ---------------------------- iso ------------------------------------------- */
+/* */
+/* Queue up pitch and attack point series. */
+/* Written by Olaf Matthes (olaf.matthes@gmx.de) */
+/* Based on iso for Max by Charlie Baker (baker@foxtrot.ccmrc.ucsb.edu). */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
#include "m_pd.h"
#include <stdio.h>
@@ -148,9 +169,7 @@ static void *iso_new(void) {
x->pitches[0] = 60;
x->atks[0] = 500;
x->duty = 1.0;
-#ifndef MAXLIB
- post(version);
-#endif
+
return (x); /* always return a copy of the created object */
}
@@ -159,6 +178,7 @@ static void iso_free(t_iso *x) {
clock_free(x->iso_clock);
}
+#ifndef MAXLIB
void iso_setup(void) {
iso_class = class_new(gensym("iso"), (t_newmethod)iso_new,
@@ -174,4 +194,26 @@ void iso_setup(void) {
class_addmethod(iso_class, (t_method)iso_hook, gensym("hook"), A_FLOAT, 0);
class_addbang(iso_class, iso_bang);
class_addlist(iso_class, iso_pitch);
+ class_sethelpsymbol(iso_class, gensym("help-iso.pd"));
+ post(version);
}
+#else
+void maxlib_iso_setup(void) {
+
+ iso_class = class_new(gensym("maxlib_iso"), (t_newmethod)iso_new,
+ (t_method)iso_free, sizeof(t_iso), 0, 0);
+ class_addcreator((t_newmethod)iso_new, gensym("iso"), 0);
+ class_addmethod(iso_class, (t_method)iso_duty, gensym("duty"), A_FLOAT, 0);
+ class_addmethod(iso_class, (t_method)iso_list, gensym("attack"), A_GIMME, 0);
+ class_addmethod(iso_class, (t_method)iso_start, gensym("start"), A_GIMME, 0);
+ class_addmethod(iso_class, (t_method)iso_stop, gensym("stop"), 0);
+ class_addmethod(iso_class, (t_method)iso_pause, gensym("pause"), 0);
+ class_addmethod(iso_class, (t_method)iso_loop, gensym("loop"), 0);
+ class_addmethod(iso_class, (t_method)iso_unloop, gensym("unloop"), 0);
+ class_addmethod(iso_class, (t_method)iso_resume, gensym("resume"), 0);
+ class_addmethod(iso_class, (t_method)iso_hook, gensym("hook"), A_FLOAT, 0);
+ class_addbang(iso_class, iso_bang);
+ class_addlist(iso_class, iso_pitch);
+ class_sethelpsymbol(iso_class, gensym("maxlib/help-iso.pd"));
+}
+#endif
diff --git a/src/lifo.c b/src/lifo.c
index b219fed..d2983e4 100644
--- a/src/lifo.c
+++ b/src/lifo.c
@@ -20,7 +20,7 @@
/* */
/* Based on PureData by Miller Puckette and others. */
/* */
-/* Fifi-code based St. Rainstick fifi.c for Max, */
+/* Fifi-code based St. Rainstick fifo.c for Max, */
/* copyright St. Rainstick, Amsterdam 1995 */
/* */
/* ---------------------------------------------------------------------------- */
@@ -78,12 +78,11 @@ static void *lifo_new(t_floatarg n)
x->count = 0;
x->getal = (t_float *)getbytes(x->size * sizeof(t_float));
x->out = outlet_new(&x->d_ob, gensym("float"));
-#ifndef MAXLIB
- post(version);
-#endif
+
return (x);
}
+#ifndef MAXLIB
void lifo_setup(void)
{
lifo_class = class_new(gensym("lifo"), (t_newmethod)lifo_new,
@@ -91,4 +90,18 @@ void lifo_setup(void)
class_addfloat(lifo_class, lifo_int);
class_addbang(lifo_class, lifo_bang);
class_addmethod(lifo_class, (t_method)lifo_clear, gensym("clear"), 0);
+ class_sethelpsymbol(lifo_class, gensym("help-lifo.pd"));
+ post(version);
+}
+#else
+void maxlib_lifo_setup(void)
+{
+ lifo_class = class_new(gensym("maxlib_lifo"), (t_newmethod)lifo_new,
+ (t_method)lifo_free, sizeof(t_lifo), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)lifo_new, gensym("lifo"), A_DEFFLOAT, 0);
+ class_addfloat(lifo_class, lifo_int);
+ class_addbang(lifo_class, lifo_bang);
+ class_addmethod(lifo_class, (t_method)lifo_clear, gensym("clear"), 0);
+ class_sethelpsymbol(lifo_class, gensym("maxlib/help-lifo.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/limit.c b/src/limit.c
index e4d22e2..9d14f1d 100644
--- a/src/limit.c
+++ b/src/limit.c
@@ -98,20 +98,28 @@ static void *limit_new(t_floatarg fol, t_floatarg foh, t_floatarg fr)
x->x_ratio = fr;
x->x_f = 0;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void limit_setup(void)
{
limit_class = class_new(gensym("limit"), (t_newmethod)limit_new,
0, sizeof(t_limit), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+#else
+void maxlib_limit_setup(void)
+{
+ limit_class = class_new(gensym("maxlib_limit"), (t_newmethod)limit_new,
+ 0, sizeof(t_limit), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)limit_new, gensym("limit"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+#endif
class_addfloat(limit_class, limit_float);
class_addbang(limit_class, limit_bang);
#ifndef MAXLIB
+ class_sethelpsymbol(limit_class, gensym("help-limit.pd"));
+ post(version);
#else
+ class_sethelpsymbol(limit_class, gensym("maxlib/help-limit.pd"));
#endif
}
diff --git a/src/linear.c b/src/linear.c
index 1f86c7d..a5869a2 100644
--- a/src/linear.c
+++ b/src/linear.c
@@ -60,12 +60,22 @@ static void rand_linear_bang(t_rand_linear *x)
outlet_float(x->x_obj.ob_outlet, u1);
}
+#ifndef MAXLIB
void linear_setup(void)
{
rand_linear_class = class_new(gensym("linear"), (t_newmethod)rand_linear_new, 0,
sizeof(t_rand_linear), 0, A_DEFFLOAT, 0);
class_addbang(rand_linear_class, rand_linear_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_linear_class, gensym("help-linear.pd"));
post(version);
-#endif
}
+#else
+void maxlib_linear_setup(void)
+{
+ rand_linear_class = class_new(gensym("maxlib_linear"), (t_newmethod)rand_linear_new, 0,
+ sizeof(t_rand_linear), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rand_linear_new, gensym("linear"), A_DEFFLOAT, 0);
+ class_addbang(rand_linear_class, rand_linear_bang);
+ class_sethelpsymbol(rand_linear_class, gensym("maxlib/help-linear.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/listfifo.c b/src/listfifo.c
new file mode 100644
index 0000000..dda9eeb
--- /dev/null
+++ b/src/listfifo.c
@@ -0,0 +1,109 @@
+/* ---------------------------- listfifo -------------------------------------- */
+/* */
+/* Fifo buffer of lists, empties itselfe on every bang (in order of coming in) */
+/* Written by Olaf Matthes (olaf.matthes@gmx.de) */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#include "m_pd.h"
+
+#define MAX_ELEM 256 /* maximum number of list elements to pass on */
+
+static char *version = "listfifo v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>";
+
+typedef struct listfifo
+{
+ t_object d_ob;
+ t_atom *getal; /* stores the list values */
+ t_int *getsize; /* stores the number of elements in list */
+ t_int count, end, size;
+ t_outlet *out;
+
+}t_listfifo;
+
+static t_class *listfifo_class;
+
+static void listfifo_list(t_listfifo *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int i;
+ if(argc > MAX_ELEM)
+ {
+ post("listfifo: to many arguments in list, ignored");
+ return;
+ }
+ for(i = 0; i < argc; i++)
+ x->getal[(x->count * MAX_ELEM) + i] = argv[i];
+ x->getsize[x->count] = argc;
+ x->count = (x->count + 1) % x->size;
+ // post("got %d elements", argc);
+}
+
+static void listfifo_bang(t_listfifo *x)
+{
+ // post("count = %d, end = %d", x->count, x->end);
+ if (x->end != x->count){
+ outlet_list(x->out, NULL, x->getsize[x->end], x->getal+(x->end * MAX_ELEM));
+ x->end = (x->end + 1) % x->size;
+ }
+}
+
+static void listfifo_free(t_listfifo *x)
+{
+ freebytes(x->getsize, x->size * sizeof(t_int));
+ freebytes(x->getal, x->size * sizeof(t_float) * MAX_ELEM);
+}
+
+static void *listfifo_new(t_floatarg n)
+{
+ int i;
+
+ t_listfifo *x = (t_listfifo *)pd_new(listfifo_class);
+ if (n<10) n = 10;
+ x->size = (t_int)n;
+ x->end = 0;
+ x->count = 0;
+ x->getsize = (t_int *)getbytes(x->size * sizeof(t_int));
+ x->getal = (t_atom *)getbytes(x->size * sizeof(t_atom) * MAX_ELEM);
+ x->out = outlet_new(&x->d_ob, gensym("list"));
+
+ return (x);
+}
+
+#ifndef MAXLIB
+void listfifo_setup(void)
+{
+ listfifo_class = class_new(gensym("listfifo"), (t_newmethod)listfifo_new,
+ (t_method)listfifo_free, sizeof(t_listfifo), 0, A_DEFFLOAT, 0);
+ class_addbang(listfifo_class, listfifo_bang);
+ class_addlist(listfifo_class, listfifo_list);
+ class_sethelpsymbol(listfifo_class, gensym("help-listfifo.pd"));
+ post(version);
+}
+#else
+void maxlib_listfifo_setup(void)
+{
+ listfifo_class = class_new(gensym("maxlib_listfifo"), (t_newmethod)listfifo_new,
+ (t_method)listfifo_free, sizeof(t_listfifo), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)listfifo_new, gensym("listfifo"), A_DEFFLOAT, 0);
+ class_addbang(listfifo_class, listfifo_bang);
+ class_addlist(listfifo_class, listfifo_list);
+ class_sethelpsymbol(listfifo_class, gensym("maxlib/help-listfifo.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/listfunnel.c b/src/listfunnel.c
index a31b4ee..d9ba656 100644
--- a/src/listfunnel.c
+++ b/src/listfunnel.c
@@ -65,17 +65,28 @@ static void *listfunnel_new(void)
t_listfunnel *x = (t_listfunnel *)pd_new(listfunnel_class);
x->x_outlet = outlet_new(&x->x_ob, gensym("float"));
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void listfunnel_setup(void)
{
listfunnel_class = class_new(gensym("listfunnel"), (t_newmethod)listfunnel_new,
0, sizeof(t_listfunnel), 0, 0, 0);
class_addfloat(listfunnel_class, listfunnel_float);
class_addlist(listfunnel_class, listfunnel_list);
+ class_sethelpsymbol(listfunnel_class, gensym("help-listfunnel.pd"));
+ post(version);
}
+#else
+void maxlib_listfunnel_setup(void)
+{
+ listfunnel_class = class_new(gensym("maxlib_listfunnel"), (t_newmethod)listfunnel_new,
+ 0, sizeof(t_listfunnel), 0, 0, 0);
+ class_addcreator((t_newmethod)listfunnel_new, gensym("listfunnel"), 0);
+ class_addfloat(listfunnel_class, listfunnel_float);
+ class_addlist(listfunnel_class, listfunnel_list);
+ class_sethelpsymbol(listfunnel_class, gensym("maxlib/help-listfunnel.pd"));
+}
+#endif
diff --git a/src/match.c b/src/match.c
index 6fb7933..623ca87 100644
--- a/src/match.c
+++ b/src/match.c
@@ -29,11 +29,9 @@
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-/* LATER compare with match.c from max sdk */
#include <string.h>
#include "m_pd.h"
-// #include "hammer.h"
#define MATCH_INISIZE 16 /* LATER rethink */
@@ -250,10 +248,18 @@ static void *match_new(t_symbol *s, int ac, t_atom *av)
return (x);
}
+#ifndef MAXLIB
void match_setup(void)
{
match_class = class_new(gensym("match"), (t_newmethod)match_new,
(t_method)match_free, sizeof(t_match), 0, A_GIMME, 0);
+#else
+void maxlib_match_setup(void)
+{
+ match_class = class_new(gensym("maxlib_match"), (t_newmethod)match_new,
+ (t_method)match_free, sizeof(t_match), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)match_new, gensym("match"), A_GIMME, 0);
+#endif
class_addfloat(match_class, match_float);
class_addsymbol(match_class, match_symbol);
class_addlist(match_class, match_list);
@@ -261,6 +267,8 @@ void match_setup(void)
class_addmethod(match_class, (t_method)match_set, gensym("set"), A_GIMME, 0);
class_addmethod(match_class, (t_method)match_clear, gensym("clear"), 0);
#ifndef MAXLIB
+ class_sethelpsymbol(match_class, gensym("help-match.pd"));
#else
+ class_sethelpsymbol(match_class, gensym("maxlib/help-match.pd"));
#endif
}
diff --git a/src/minus.c b/src/minus.c
index 17db861..596ee10 100644
--- a/src/minus.c
+++ b/src/minus.c
@@ -82,12 +82,11 @@ static void *minus_new(t_symbol *s, t_int argc, t_atom* argv)
x->x_minusvalue[i] = atom_getfloatarg(i, argc, argv);
}
x->x_numvalues = i;
-#ifndef MAXLIB
- post(version);
-#endif
+
return (void *)x;
}
+#ifndef MAXLIB
void minus_setup(void)
{
minus_class = class_new(gensym("minus"), (t_newmethod)minus_new,
@@ -95,5 +94,18 @@ void minus_setup(void)
class_addfloat(minus_class, minus_float);
class_addmethod(minus_class, (t_method)minus_ft1, gensym("ft1"), A_FLOAT, 0);
class_addbang(minus_class, (t_method)minus_bang);
+ class_sethelpsymbol(minus_class, gensym("help-minus.pd"));
+ post(version);
}
-
+#else
+void maxlib_minus_setup(void)
+{
+ minus_class = class_new(gensym("maxlib_minus"), (t_newmethod)minus_new,
+ 0, sizeof(t_minus), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)minus_new, gensym("minus"), A_GIMME, 0);
+ class_addfloat(minus_class, minus_float);
+ class_addmethod(minus_class, (t_method)minus_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addbang(minus_class, (t_method)minus_bang);
+ class_sethelpsymbol(minus_class, gensym("maxlib/help-minus.pd"));
+}
+#endif
diff --git a/src/mlife.c b/src/mlife.c
index 66243ef..47960dd 100644
--- a/src/mlife.c
+++ b/src/mlife.c
@@ -460,9 +460,6 @@ static void *ml_new(t_floatarg size, t_floatarg view_start, t_floatarg view_size
post("mlife: INTSIZE=%ld, LONGSIZE=%ld", (long)INTSIZE, (long)LONGSIZE);
#endif
-#ifndef MAXLIB
- post(version);
-#endif
post("mlife: defaults are: lo=%ld, hi=%ld, nset=%ld", (long)DEFAULT_DIE_LO, (long)DEFAULT_DIE_HI, DEFAULT_N_SIZE);
return(mlp); // always return a copy of the created object
@@ -479,6 +476,7 @@ static void ml_free(t_maxlife *mlp)
freeobject(mlp->out[i]); */
}
+#ifndef MAXLIB
void mlife_setup(void)
{
mlife_class = class_new(gensym("mlife"), (t_newmethod)ml_new,
@@ -493,4 +491,25 @@ void mlife_setup(void)
class_addmethod(mlife_class, (t_method)ml_display, gensym("display"), 0);
class_addfloat(mlife_class, ml_int);
class_addbang(mlife_class, ml_bang);
+ class_sethelpsymbol(mlife_class, gensym("help-mlife.pd"));
+ post(version);
+}
+#else
+void maxlib_mlife_setup(void)
+{
+ mlife_class = class_new(gensym("maxlib_mlife"), (t_newmethod)ml_new,
+ (t_method)ml_free, sizeof(t_maxlife), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)ml_new, gensym("mlife"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_randfill, gensym("randfill"), 0);
+ class_addmethod(mlife_class, (t_method)ml_fill, gensym("fill"), A_FLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_set_die_lo, gensym("lo"), A_FLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_set_die_hi, gensym("hi"), A_FLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_set_neighbourhood, gensym("nset"), A_FLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_randseed, gensym("randseed"), A_FLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_seed, gensym("seed"), A_FLOAT, A_FLOAT, 0);
+ class_addmethod(mlife_class, (t_method)ml_display, gensym("display"), 0);
+ class_addfloat(mlife_class, ml_int);
+ class_addbang(mlife_class, ml_bang);
+ class_sethelpsymbol(mlife_class, gensym("maxlib/help-mlife.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/multi.c b/src/multi.c
index 543ffa3..2f5db67 100644
--- a/src/multi.c
+++ b/src/multi.c
@@ -81,12 +81,11 @@ static void *multi_new(t_symbol *s, t_int argc, t_atom* argv)
x->x_multivalue[i] = atom_getfloatarg(i, argc, argv);;
}
x->x_numvalues = i;
-#ifndef MAXLIB
- post(version);
-#endif
+
return (void *)x;
}
+#ifndef MAXLIB
void multi_setup(void)
{
multi_class = class_new(gensym("multi"), (t_newmethod)multi_new,
@@ -94,5 +93,18 @@ void multi_setup(void)
class_addfloat(multi_class, multi_float);
class_addmethod(multi_class, (t_method)multi_ft1, gensym("ft1"), A_FLOAT, 0);
class_addbang(multi_class, (t_method)multi_bang);
+ class_sethelpsymbol(multi_class, gensym("help-multi.pd"));
+ post(version);
}
-
+#else
+void maxlib_multi_setup(void)
+{
+ multi_class = class_new(gensym("maxlib_multi"), (t_newmethod)multi_new,
+ 0, sizeof(t_multi), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)multi_new, gensym("multi"), A_GIMME, 0);
+ class_addfloat(multi_class, multi_float);
+ class_addmethod(multi_class, (t_method)multi_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addbang(multi_class, (t_method)multi_bang);
+ class_sethelpsymbol(multi_class, gensym("maxlib/help-multi.pd"));
+}
+#endif
diff --git a/src/nchange.c b/src/nchange.c
new file mode 100644
index 0000000..a7e7eb5
--- /dev/null
+++ b/src/nchange.c
@@ -0,0 +1,205 @@
+/* ------------------------- ignore ------------------------------------------- */
+/* */
+/* A 'new' change object for more than just floats. */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#define A_LIST 254;
+#define A_ANYTHING 255;
+
+#include "m_pd.h"
+
+// #include <string.h>
+// #include <stdio.h>
+
+/* -------------------------- nchange ------------------------------ */
+static char *version = "nchange v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>";
+
+static t_class *nchange_class;
+
+typedef struct _nchange
+{
+ t_object x_obj;
+ t_atom x_a[256];
+ int x_c;
+ int x_type;
+} t_nchange;
+
+static void *nchange_new(t_symbol *s)
+{
+ int i;
+
+ t_nchange *x = (t_nchange *)pd_new(nchange_class);
+
+ if(s == gensym("s"))
+ {
+ x->x_type = A_SYMBOL;
+ outlet_new(&x->x_obj, &s_symbol);
+ }
+ else if(s == gensym("f"))
+ {
+ x->x_type = A_FLOAT;
+ outlet_new(&x->x_obj, &s_float);
+ }
+ else if(s == gensym("l"))
+ {
+ x->x_type = A_LIST;
+ outlet_new(&x->x_obj, &s_list);
+ }
+ else
+ {
+ x->x_type = A_ANYTHING;
+ outlet_new(&x->x_obj, &s_anything);
+ }
+
+ return (x);
+}
+
+static void nchange_bang(t_nchange *x)
+{
+ if (x->x_type == A_FLOAT)
+ outlet_float(x->x_obj.ob_outlet, x->x_a->a_w.w_float);
+ else if (x->x_type == A_SYMBOL)
+ outlet_symbol(x->x_obj.ob_outlet, x->x_a->a_w.w_symbol);
+ else
+ outlet_list(x->x_obj.ob_outlet, NULL, x->x_c, x->x_a);
+}
+
+static void nchange_float(t_nchange *x, t_float f)
+{
+ if (x->x_type == A_FLOAT)
+ {
+ if (f != x->x_a->a_w.w_float)
+ {
+ // x->x_f = f;
+ SETFLOAT(x->x_a, f);
+ outlet_float(x->x_obj.ob_outlet, x->x_a->a_w.w_float);
+ }
+ }
+}
+
+static void nchange_symbol(t_nchange *x, t_symbol *s)
+{
+ if (x->x_type == A_SYMBOL)
+ {
+ if (s != x->x_a->a_w.w_symbol)
+ {
+ // x->x_s = s;
+ SETSYMBOL(x->x_a, s);
+ outlet_symbol(x->x_obj.ob_outlet, x->x_a->a_w.w_symbol);
+ }
+ }
+}
+
+static void nchange_list(t_nchange *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int i, change = 0;
+ int c = argc;
+
+ if(c == x->x_c) // same number of elements
+ for (i = 0; i < c; i++)
+ {
+ /* if(x->x_a[i].a_type != argv[i].a_type)
+ {
+ change = 1;
+ break;
+ } */
+ if (x->x_a[i].a_type == A_FLOAT)
+ {
+ if (argv[i].a_type != A_FLOAT || x->x_a[i].a_w.w_float != argv[i].a_w.w_float)
+ {
+ change = 1;
+ break;
+ }
+ }
+ else if (x->x_a[i].a_type == A_SYMBOL)
+ {
+ if (argv[i].a_type != A_SYMBOL || x->x_a[i].a_w.w_symbol != argv[i].a_w.w_symbol)
+ {
+ change = 1;
+ break;
+ }
+ }
+ }
+ else change = 1; // different number of elems.
+
+ if (change)
+ {
+ x->x_c = c;
+ for (i = 0; i < c; i++) // same new list
+ {
+ x->x_a[i] = argv[i];
+ }
+ outlet_list(x->x_obj.ob_outlet, s, argc, argv);
+ }
+}
+
+static void nchange_set(t_nchange *x, t_symbol *s, int argc, t_atom *argv)
+{
+ int i;
+
+ if (x->x_type == A_SYMBOL)
+ {
+ SETSYMBOL(x->x_a, argv->a_w.w_symbol);
+ }
+ else if (x->x_type == A_FLOAT)
+ {
+ SETFLOAT(x->x_a, argv->a_w.w_float);
+ }
+ else // list or anything
+ {
+ x->x_c = argc;
+ for (i = 0; i < argc; i++)
+ {
+ x->x_a[i] = argv[i];
+ }
+ }
+}
+
+#ifndef MAXLIB
+void nchange_setup(void)
+{
+ nchange_class = class_new(gensym("nchange"), (t_newmethod)nchange_new, 0,
+ sizeof(t_nchange), 0, A_SYMBOL, 0);
+ class_addbang(nchange_class, nchange_bang);
+ class_addfloat(nchange_class, nchange_float);
+ class_addsymbol(nchange_class, nchange_symbol);
+ class_addlist(nchange_class, nchange_list);
+ class_addanything(nchange_class, nchange_list);
+ class_addmethod(nchange_class, (t_method)nchange_set, gensym("set"), A_GIMME, 0);
+ class_sethelpsymbol(nchange_class, gensym("help-nchange.pd"));
+ post(version);
+}
+#else
+void maxlib_nchange_setup(void)
+{
+ nchange_class = class_new(gensym("maxlib_nchange"), (t_newmethod)nchange_new, 0,
+ sizeof(t_nchange), 0, A_SYMBOL, 0);
+ class_addcreator((t_newmethod)nchange_new, gensym("nchange"), A_SYMBOL, 0);
+ class_addbang(nchange_class, nchange_bang);
+ class_addfloat(nchange_class, nchange_float);
+ class_addsymbol(nchange_class, nchange_symbol);
+ class_addlist(nchange_class, nchange_list);
+ class_addanything(nchange_class, nchange_list);
+ class_addmethod(nchange_class, (t_method)nchange_set, gensym("set"), A_GIMME, 0);
+ class_sethelpsymbol(nchange_class, gensym("maxlib/help-nchange.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/netclient.c b/src/netclient.c
index 6e71e59..406ae19 100644
--- a/src/netclient.c
+++ b/src/netclient.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
#include <string.h>
#include <pthread.h>
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/in.h>
@@ -71,7 +71,7 @@ static void sys_sockerror(char *s)
int err = WSAGetLastError();
if (err == 10054) return;
#endif
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
int err = errno;
#endif
post("%s: %s (%d)\n", s, strerror(err), err);
@@ -79,7 +79,7 @@ static void sys_sockerror(char *s)
static void sys_closesocket(int fd) {
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
close(fd);
#endif
#ifdef NT
@@ -334,6 +334,7 @@ static void netclient_free(t_netclient *x)
clock_free(x->x_clock);
}
+#ifndef MAXLIB
void netclient_setup(void)
{
netclient_class = class_new(gensym("netclient"), (t_newmethod)netclient_new,
@@ -344,4 +345,21 @@ void netclient_setup(void)
class_addmethod(netclient_class, (t_method)netclient_send, gensym("send"), A_GIMME, 0);
class_addmethod(netclient_class, (t_method)netclient_rcv, gensym("receive"), 0);
class_addmethod(netclient_class, (t_method)netclient_rcv, gensym("rcv"), 0);
+ class_sethelpsymbol(netclient_class, gensym("help-netclient.pd"));
+ post(version);
}
+#else
+void maxlib_netclient_setup(void)
+{
+ netclient_class = class_new(gensym("maxlib_netclient"), (t_newmethod)netclient_new,
+ (t_method)netclient_free,
+ sizeof(t_netclient), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)netclient_new, gensym("netclient"), A_DEFFLOAT, 0);
+ class_addmethod(netclient_class, (t_method)netclient_connect, gensym("connect"), A_SYMBOL, A_FLOAT, 0);
+ class_addmethod(netclient_class, (t_method)netclient_disconnect, gensym("disconnect"), 0);
+ class_addmethod(netclient_class, (t_method)netclient_send, gensym("send"), A_GIMME, 0);
+ class_addmethod(netclient_class, (t_method)netclient_rcv, gensym("receive"), 0);
+ class_addmethod(netclient_class, (t_method)netclient_rcv, gensym("rcv"), 0);
+ class_sethelpsymbol(netclient_class, gensym("maxlib/help-netclient.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/netdist.c b/src/netdist.c
index 0c7e55c..a585734 100644
--- a/src/netdist.c
+++ b/src/netdist.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
#include <string.h>
#include <pthread.h>
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/in.h>
@@ -67,7 +67,7 @@ static void sys_sockerror(char *s)
int err = WSAGetLastError();
if (err == 10054) return;
#endif
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
int err = errno;
#endif
post("%s: %s (%d)\n", s, strerror(err), err);
@@ -75,7 +75,7 @@ static void sys_sockerror(char *s)
static void sys_closesocket(int fd) {
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
close(fd);
#endif
#ifdef NT
@@ -98,10 +98,8 @@ static void *netdist_new(t_floatarg udpflag)
for(i = 0; i < MAX_REC; i++)x->x_fd[i] = -1;
x->x_numconnect = -1;
x->x_protocol = (udpflag != 0 ? SOCK_DGRAM : SOCK_STREAM);
-#ifndef MAXLIB
- post(version);
-#endif
- /* prepare child thread */
+
+ /* prepare child thread */
if(pthread_attr_init(&x->x_threadattr) < 0)
post("netdist: warning: could not prepare child thread" );
if(pthread_attr_setdetachstate(&x->x_threadattr, PTHREAD_CREATE_DETACHED) < 0)
@@ -288,6 +286,7 @@ static void netdist_free(t_netdist *x)
clock_free(x->x_clock);
}
+#ifndef MAXLIB
void netdist_setup(void)
{
netdist_class = class_new(gensym("netdist"), (t_newmethod)netdist_new,
@@ -297,7 +296,20 @@ void netdist_setup(void)
class_addmethod(netdist_class, (t_method)netdist_send, gensym("send"), A_GIMME, 0);
class_addmethod(netdist_class, (t_method)netdist_clear, gensym("clear"), 0);
class_addmethod(netdist_class, (t_method)netdist_print, gensym("print"), 0);
+ class_sethelpsymbol(netdist_class, gensym("help-netdist.pd"));
+ post(version);
}
-
-
-
+#else
+void maxlib_netdist_setup(void)
+{
+ netdist_class = class_new(gensym("maxlib_netdist"), (t_newmethod)netdist_new,
+ (t_method)netdist_free, sizeof(t_netdist), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)netdist_new, gensym("netdist"), A_DEFFLOAT, 0);
+ class_addmethod(netdist_class, (t_method)netdist_connect, gensym("connect"), A_SYMBOL, A_FLOAT, 0);
+ class_addmethod(netdist_class, (t_method)netdist_disconnect, gensym("disconnect"), A_SYMBOL, A_FLOAT, 0);
+ class_addmethod(netdist_class, (t_method)netdist_send, gensym("send"), A_GIMME, 0);
+ class_addmethod(netdist_class, (t_method)netdist_clear, gensym("clear"), 0);
+ class_addmethod(netdist_class, (t_method)netdist_print, gensym("print"), 0);
+ class_sethelpsymbol(netdist_class, gensym("maxlib/help-netdist.pd"));
+}
+#endif
diff --git a/src/netrec.c b/src/netrec.c
index d409140..c747736 100644
--- a/src/netrec.c
+++ b/src/netrec.c
@@ -22,14 +22,11 @@
/* */
/* ---------------------------------------------------------------------------- */
+#ifndef PD_0_36
#include "m_pd.h"
-
-#if defined(PD_VERSION) && (PD_MAJOR_VERSION >= 0 && PD_MINOR_VERSION > 36)
-#include <m_imp.h>
-#include <s_stuff.h>
-#else
-#include "m_imp.h"
+#include "s_stuff.h"
#endif
+#include "m_imp.h"
#include <sys/types.h>
#include <stdarg.h>
@@ -38,7 +35,7 @@
#include <errno.h>
#include <string.h>
#include <stdio.h>
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -416,9 +413,7 @@ static void *netrec_new(t_symbol *compatflag,
x->x_nconnections = 0;
x->x_udp = udp;
for(i = 0; i < MAX_CONNECT; i++)x->x_fd[i] = -1;
-#ifndef MAXLIB
- post(version);
-#endif
+
return (x);
}
@@ -433,9 +428,22 @@ static void netrec_free(t_netrec *x)
binbuf_free(inbinbuf);
}
+#ifndef MAXLIB
void netrec_setup(void)
{
netrec_class = class_new(gensym("netrec"),(t_newmethod)netrec_new, (t_method)netrec_free,
sizeof(t_netrec), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFSYM, 0);
class_addmethod(netrec_class, (t_method)netrec_print, gensym("print"), 0);
+ class_sethelpsymbol(netrec_class, gensym("help-netrec.pd"));
+ post(version);
+}
+#else
+void maxlib_netrec_setup(void)
+{
+ netrec_class = class_new(gensym("maxlib_netrec"),(t_newmethod)netrec_new, (t_method)netrec_free,
+ sizeof(t_netrec), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFSYM, 0);
+ class_addcreator((t_newmethod)netrec_new, gensym("netrec"), A_DEFFLOAT, A_DEFFLOAT, A_DEFSYM, 0);
+ class_addmethod(netrec_class, (t_method)netrec_print, gensym("print"), 0);
+ class_sethelpsymbol(netrec_class, gensym("maxlib/help-netrec.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/netserver.c b/src/netserver.c
index 71447b4..c8e22f6 100644
--- a/src/netserver.c
+++ b/src/netserver.c
@@ -23,14 +23,11 @@
/* */
/* ---------------------------------------------------------------------------- */
-#include <m_pd.h>
-#if defined(PD_VERSION) && (PD_MAJOR_VERSION >= 0 && PD_MINOR_VERSION > 36)
-#include <m_imp.h>
-#include <s_stuff.h>
-#else
-#include <m_imp.h>
+#ifndef PD_0_36
+#include "m_pd.h"
+#include "s_stuff.h"
#endif
-
+#include "m_imp.h"
#include <sys/types.h>
#include <stdarg.h>
@@ -40,7 +37,7 @@
#include <string.h>
#include <stdio.h>
#include <pthread.h>
-#if defined(UNIX) || defined(unix)
+#ifdef UNIX
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -541,9 +538,7 @@ static void *netserver_new(t_floatarg fportno)
x->x_connectsocket = sockfd;
x->x_nconnections = 0;
for(i = 0; i < MAX_CONNECT; i++)x->x_fd[i] = -1;
-#ifndef MAXLIB
- post(version);
-#endif
+
return (x);
}
@@ -563,6 +558,7 @@ static void netserver_free(t_netserver *x)
binbuf_free(inbinbuf);
}
+#ifndef MAXLIB
void netserver_setup(void)
{
netserver_class = class_new(gensym("netserver"),(t_newmethod)netserver_new, (t_method)netserver_free,
@@ -571,4 +567,19 @@ void netserver_setup(void)
class_addmethod(netserver_class, (t_method)netserver_send, gensym("send"), A_GIMME, 0);
class_addmethod(netserver_class, (t_method)netserver_client_send, gensym("client"), A_GIMME, 0);
class_addmethod(netserver_class, (t_method)netserver_broadcast, gensym("broadcast"), A_GIMME, 0);
+ class_sethelpsymbol(netserver_class, gensym("help-netserver.pd"));
+ post(version);
+}
+#else
+void maxlib_netserver_setup(void)
+{
+ netserver_class = class_new(gensym("maxlib_netserver"),(t_newmethod)netserver_new, (t_method)netserver_free,
+ sizeof(t_netserver), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)netserver_new, gensym("netserver"), A_DEFFLOAT, 0);
+ class_addmethod(netserver_class, (t_method)netserver_print, gensym("print"), 0);
+ class_addmethod(netserver_class, (t_method)netserver_send, gensym("send"), A_GIMME, 0);
+ class_addmethod(netserver_class, (t_method)netserver_client_send, gensym("client"), A_GIMME, 0);
+ class_addmethod(netserver_class, (t_method)netserver_broadcast, gensym("broadcast"), A_GIMME, 0);
+ class_sethelpsymbol(netserver_class, gensym("maxlib/help-netserver.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/nroute.c b/src/nroute.c
index 5836ed7..c8c94c5 100644
--- a/src/nroute.c
+++ b/src/nroute.c
@@ -124,10 +124,6 @@ static void *nroute_new(t_symbol *s, int argc, t_atom *argv)
t_nroute *x = (t_nroute *)pd_new(nroute_class);
t_proxy *inlet = (t_proxy *)pd_new(proxy_class); /* for the proxy inlet */
-#ifndef MAXLIB
- post(version);
-#endif
-
inlet->x = x; /* make x visible to the proxy inlets */
x->pos = 1;
@@ -150,14 +146,23 @@ static void *nroute_new(t_symbol *s, int argc, t_atom *argv)
x->out2 = outlet_new(&x->x_obj, gensym("list"));
return (x);
}
-
+
+#ifndef MAXLIB
void nroute_setup(void)
{
/* the object's class: */
nroute_class = class_new(gensym("nroute"), (t_newmethod)nroute_new,
0, sizeof(t_nroute), 0, A_GIMME, 0);
+#else
+void maxlib_nroute_setup(void)
+{
+ /* the object's class: */
+ nroute_class = class_new(gensym("maxlib_nroute"), (t_newmethod)nroute_new,
+ 0, sizeof(t_nroute), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)nroute_new, gensym("nroute"), A_GIMME, 0);
+#endif
/* a class for the proxy inlet: */
- proxy_class = class_new(gensym("proxy"), NULL, NULL, sizeof(t_proxy),
+ proxy_class = class_new(gensym("maxlib_nroute_proxy"), NULL, NULL, sizeof(t_proxy),
CLASS_PD|CLASS_NOINLET, A_NULL);
class_addmethod(nroute_class, (t_method)nroute_setpos, gensym("right"), A_FLOAT, 0);
@@ -166,6 +171,9 @@ void nroute_setup(void)
class_addanything(nroute_class, nroute_any);
class_addanything(proxy_class, nroute_setmatch);
#ifndef MAXLIB
+ class_sethelpsymbol(nroute_class, gensym("help-nroute.pd"));
+ post(version);
#else
+ class_sethelpsymbol(nroute_class, gensym("maxlib/help-nroute.pd"));
#endif
-}
+} \ No newline at end of file
diff --git a/src/pitch.c b/src/pitch.c
index bd95e1e..95fac90 100644
--- a/src/pitch.c
+++ b/src/pitch.c
@@ -90,16 +90,25 @@ static void *pitch_new(t_floatarg f)
x->x_lastpitch = f;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void pitch_setup(void)
{
pitch_class = class_new(gensym("pitch"), (t_newmethod)pitch_new,
0, sizeof(t_pitch), 0, A_DEFFLOAT, 0);
class_addfloat(pitch_class, pitch_float);
+ class_sethelpsymbol(pitch_class, gensym("help-pitch.pd"));
+ post(version);
}
-
+#else
+void maxlib_pitch_setup(void)
+{
+ pitch_class = class_new(gensym("maxlib_pitch"), (t_newmethod)pitch_new,
+ 0, sizeof(t_pitch), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)pitch_new, gensym("pitch"), A_DEFFLOAT, 0);
+ class_addfloat(pitch_class, pitch_float);
+ class_sethelpsymbol(pitch_class, gensym("maxlib/help-pitch.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/plus.c b/src/plus.c
index 3fdf93b..b34ffbf 100644
--- a/src/plus.c
+++ b/src/plus.c
@@ -82,12 +82,10 @@ static void *plus_new(t_symbol *s, t_int argc, t_atom* argv)
}
x->x_numvalues = i;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void plus_setup(void)
{
plus_class = class_new(gensym("plus"), (t_newmethod)plus_new,
@@ -95,5 +93,18 @@ void plus_setup(void)
class_addfloat(plus_class, plus_float);
class_addmethod(plus_class, (t_method)plus_ft1, gensym("ft1"), A_FLOAT, 0);
class_addbang(plus_class, (t_method)plus_bang);
+ class_sethelpsymbol(plus_class, gensym("help-plus.pd"));
+ post(version);
}
-
+#else
+void maxlib_plus_setup(void)
+{
+ plus_class = class_new(gensym("maxlib_plus"), (t_newmethod)plus_new,
+ 0, sizeof(t_plus), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)plus_new, gensym("plus"), A_GIMME, 0);
+ class_addfloat(plus_class, plus_float);
+ class_addmethod(plus_class, (t_method)plus_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addbang(plus_class, (t_method)plus_bang);
+ class_sethelpsymbol(plus_class, gensym("maxlib/help-plus.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/poisson.c b/src/poisson.c
index ce4e7bc..d7164ef 100644
--- a/src/poisson.c
+++ b/src/poisson.c
@@ -70,12 +70,22 @@ static void rand_poisson_bang(t_rand_poisson *x)
outlet_float(x->x_obj.ob_outlet, n);
}
+#ifndef MAXLIB
void poisson_setup(void)
{
rand_poisson_class = class_new(gensym("poisson"), (t_newmethod)rand_poisson_new, 0,
sizeof(t_rand_poisson), 0, A_DEFFLOAT, 0);
class_addbang(rand_poisson_class, rand_poisson_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(rand_poisson_class, gensym("help-poisson.pd"));
post(version);
-#endif
}
+#else
+void maxlib_poisson_setup(void)
+{
+ rand_poisson_class = class_new(gensym("maxlib_poisson"), (t_newmethod)rand_poisson_new, 0,
+ sizeof(t_rand_poisson), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rand_poisson_new, gensym("poisson"), A_DEFFLOAT, 0);
+ class_addbang(rand_poisson_class, rand_poisson_bang);
+ class_sethelpsymbol(rand_poisson_class, gensym("maxlib/help-poisson.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/pong.c b/src/pong.c
index 2ff3109..c2deb50 100644
--- a/src/pong.c
+++ b/src/pong.c
@@ -1,6 +1,6 @@
/* --------------------------- pong ------------------------------------------ */
/* */
-/* Route input according to Nth element. */
+/* A virtual bouncing ball. */
/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
/* Based on pong (for Max) version 1.5 written by Richard Dudas. */
/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
@@ -253,10 +253,6 @@ static void *pong_new(t_floatarg n)
{
t_pong *x = (t_pong *)pd_new(pong_class);
-#ifndef MAXLIB
- post(version);
-#endif
-
x->p_klok = clock_new(x, (t_method)pong_tick);
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("dist")); // distance
@@ -299,11 +295,19 @@ static void *pong_new(t_floatarg n)
return (x);
}
-
+
+#ifndef MAXLIB
void pong_setup(void)
{
pong_class = class_new(gensym("pong"), (t_newmethod)pong_new,
0, sizeof(t_pong), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_pong_setup(void)
+{
+ pong_class = class_new(gensym("maxlib_pong"), (t_newmethod)pong_new,
+ 0, sizeof(t_pong), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)pong_new, gensym("pong"), A_DEFFLOAT, 0);
+#endif
/* method handlers for inlets */
class_addmethod(pong_class, (t_method)pong_initdist, gensym("dist"), A_FLOAT, 0);
class_addmethod(pong_class, (t_method)pong_initvel, gensym("velo"), A_FLOAT, 0);
@@ -320,6 +324,9 @@ void pong_setup(void)
class_addfloat(pong_class, pong_onoff);
class_addbang(pong_class, pong_bang);
#ifndef MAXLIB
+ class_sethelpsymbol(pong_class, gensym("help-pong.pd"));
+ post(version);
#else
+ class_sethelpsymbol(pong_class, gensym("maxlib/help-pong.pd"));
#endif
-}
+} \ No newline at end of file
diff --git a/src/pulse.c b/src/pulse.c
index fc5ca96..afa133c 100644
--- a/src/pulse.c
+++ b/src/pulse.c
@@ -1,13 +1,35 @@
+/* --------------------------- pong ------------------------------------------ */
+/* */
+/* A more accurate replacement for the tempo object. */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Based on pulse for Max written by James McCartney. */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
/* pulse.c ---- a more accurate replacement for the tempo object */
/* updated for CW 68K / PPC summer 96 -RD */
/* written for Max by James McCartney */
-/* ported to Pd by Olaf Matthes <olaf.matthes@gmx.de> */
#include "m_pd.h"
#include <stdio.h>
-#define MAXSIZE 32
-
static char *version = "pulse v0.1b, written by James McCartney for Max <james@clyde.as.utexas.edu>\n"
" ported to Pd by Olaf Matthes <olaf.matthes@gmx.de>";
@@ -244,12 +266,11 @@ static void *pulse_new(t_floatarg t, t_floatarg n, t_floatarg d, t_floatarg b)
x->p_changenumer = 0;
x->p_changedenom = 0;
x->p_onoff = 0;
-#ifndef MAXLIB
- post(version);
-#endif
+
return (x); /* always return a copy of the created object */
}
+#ifndef MAXLIB
void pulse_setup(void)
{
pulse_class = class_new(gensym("pulse"), (t_newmethod)pulse_new,
@@ -260,5 +281,21 @@ void pulse_setup(void)
class_addmethod(pulse_class, (t_method)pulse_tempo, gensym("tempo"), A_FLOAT, 0);
class_addfloat(pulse_class, pulse_onoff);
class_addbang(pulse_class, pulse_bang);
+ class_sethelpsymbol(pulse_class, gensym("help-pulse.pd"));
+ post(version);
}
-
+#else
+void maxlib_pulse_setup(void)
+{
+ pulse_class = class_new(gensym("maxlib_pulse"), (t_newmethod)pulse_new,
+ (t_method)pulse_free, sizeof(Pulse), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)pulse_new, gensym("pulse"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(pulse_class, (t_method)pulse_beat, gensym("beat"), A_FLOAT, 0);
+ class_addmethod(pulse_class, (t_method)pulse_denom, gensym("denom"), A_FLOAT, 0);
+ class_addmethod(pulse_class, (t_method)pulse_numer, gensym("numer"), A_FLOAT, 0);
+ class_addmethod(pulse_class, (t_method)pulse_tempo, gensym("tempo"), A_FLOAT, 0);
+ class_addfloat(pulse_class, pulse_onoff);
+ class_addbang(pulse_class, pulse_bang);
+ class_sethelpsymbol(pulse_class, gensym("maxlib/help-pulse.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/remote.c b/src/remote.c
index 85a38b6..d4c5771 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#define MAX_REC 64 /* maximum number of receive objects */
-#define MAX_ARG 32 /* maximum number of arguments to pass on */
+#define MAX_ARG 64 /* maximum number of arguments to pass on */
static char *version = "remote v0.2, written by Olaf Matthes <olaf.matthes@gmx.de>";
@@ -84,15 +84,25 @@ static void *remote_new(t_symbol *s)
if(x->x_prefix) x->x_prepend = 1;
else x->x_prepend = 0;
-#ifndef MAXLIB
- post(version);
-#endif
return (x);
}
+#ifndef MAXLIB
void remote_setup(void)
{
remote_class = class_new(gensym("remote"), (t_newmethod)remote_new, 0,
sizeof(t_remote), 0, A_DEFSYM, 0);
class_addanything(remote_class, remote_anything);
+ class_sethelpsymbol(remote_class, gensym("help-remote.pd"));
+ post(version);
+}
+#else
+void maxlib_remote_setup(void)
+{
+ remote_class = class_new(gensym("maxlib_remote"), (t_newmethod)remote_new, 0,
+ sizeof(t_remote), 0, A_DEFSYM, 0);
+ class_addcreator((t_newmethod)remote_new, gensym("remote"), A_DEFSYM, 0);
+ class_addanything(remote_class, remote_anything);
+ class_sethelpsymbol(remote_class, gensym("maxlib/help-remote.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/rewrap.c b/src/rewrap.c
index f15b8dc..b8d3242 100644
--- a/src/rewrap.c
+++ b/src/rewrap.c
@@ -127,12 +127,10 @@ static void *rewrap_new(t_floatarg fmin, t_floatarg fmax)
x->x_min = fmin;
rewrap_b(x, fmax);
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void rewrap_setup(void)
{
rewrap_class = class_new(gensym("rewrap"), (t_newmethod)rewrap_new,
@@ -140,8 +138,18 @@ void rewrap_setup(void)
class_addfloat(rewrap_class, rewrap_float);
class_addmethod(rewrap_class, (t_method)rewrap_a, gensym("a"), A_FLOAT, 0);
class_addmethod(rewrap_class, (t_method)rewrap_b, gensym("b"), A_FLOAT, 0);
-#ifndef MAXLIB
+ class_sethelpsymbol(rewrap_class, gensym("help-rewrap.pd"));
+ post(version);
+}
#else
-#endif
+void maxlib_rewrap_setup(void)
+{
+ rewrap_class = class_new(gensym("maxlib_rewrap"), (t_newmethod)rewrap_new,
+ 0, sizeof(t_rewrap), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rewrap_new, gensym("rewrap"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addfloat(rewrap_class, rewrap_float);
+ class_addmethod(rewrap_class, (t_method)rewrap_a, gensym("a"), A_FLOAT, 0);
+ class_addmethod(rewrap_class, (t_method)rewrap_b, gensym("b"), A_FLOAT, 0);
+ class_sethelpsymbol(rewrap_class, gensym("maxlib/help-rewrap.pd"));
}
-
+#endif \ No newline at end of file
diff --git a/src/rhythm.c b/src/rhythm.c
index cd9d6e2..7796a61 100644
--- a/src/rhythm.c
+++ b/src/rhythm.c
@@ -297,9 +297,6 @@ static void *rhythm_new(t_floatarg f)
rhythm_reset(x);
-#ifndef MAXLIB
- post(version);
-#endif
if(f == 1)
{
x->x_model = 1; /* Toiviainen model */
@@ -314,15 +311,30 @@ static void *rhythm_new(t_floatarg f)
return (void *)x;
}
+#ifndef MAXLIB
void rhythm_setup(void)
{
rhythm_class = class_new(gensym("rhythm"), (t_newmethod)rhythm_new,
(t_method)rhythm_free, sizeof(t_rhythm), 0, A_DEFFLOAT, 0);
- class_addcreator((t_newmethod)rhythm_new, gensym("max.rhythm"), A_DEFFLOAT, 0);
class_addfloat(rhythm_class, rhythm_float);
class_addmethod(rhythm_class, (t_method)rhythm_ft1, gensym("ft1"), A_FLOAT, 0);
class_addmethod(rhythm_class, (t_method)rhythm_model, gensym("model"), A_FLOAT, 0);
class_addmethod(rhythm_class, (t_method)rhythm_reset, gensym("reset"), 0);
class_addmethod(rhythm_class, (t_method)rhythm_print, gensym("print"), 0);
+ class_sethelpsymbol(rhythm_class, gensym("help-rhythm.pd"));
+ post(version);
}
-
+#else
+void maxlib_rhythm_setup(void)
+{
+ rhythm_class = class_new(gensym("maxlib_rhythm"), (t_newmethod)rhythm_new,
+ (t_method)rhythm_free, sizeof(t_rhythm), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rhythm_new, gensym("rhythm"), A_DEFFLOAT, 0);
+ class_addfloat(rhythm_class, rhythm_float);
+ class_addmethod(rhythm_class, (t_method)rhythm_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addmethod(rhythm_class, (t_method)rhythm_model, gensym("model"), A_FLOAT, 0);
+ class_addmethod(rhythm_class, (t_method)rhythm_reset, gensym("reset"), 0);
+ class_addmethod(rhythm_class, (t_method)rhythm_print, gensym("print"), 0);
+ class_sethelpsymbol(rhythm_class, gensym("maxlib/help-rhythm.pd"));
+}
+#endif
diff --git a/src/scale.c b/src/scale.c
index 4fbfaec..4d72485 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -112,20 +112,27 @@ static void *scale_new(t_floatarg fil, t_floatarg fih, t_floatarg fol, t_floatar
x->x_logcoeff = flc;
x->x_f = 0;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void scale_setup(void)
{
scale_class = class_new(gensym("scale"), (t_newmethod)scale_new,
0, sizeof(t_scale), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addfloat(scale_class, scale_float);
class_addbang(scale_class, scale_bang);
-#ifndef MAXLIB
+ class_sethelpsymbol(scale_class, gensym("help-scale.pd"));
+ post(version);
#else
+void maxlib_scale_setup(void)
+{
+ scale_class = class_new(gensym("maxlib_scale"), (t_newmethod)scale_new,
+ 0, sizeof(t_scale), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)scale_new, gensym("scale"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addfloat(scale_class, scale_float);
+ class_addbang(scale_class, scale_bang);
+ class_sethelpsymbol(scale_class, gensym("maxlib/help-scale.pd"));
#endif
}
diff --git a/src/score.c b/src/score.c
index 80722ac..0f96229 100644
--- a/src/score.c
+++ b/src/score.c
@@ -255,9 +255,7 @@ static void *score_new(t_symbol *s, t_floatarg fskipindex, t_floatarg fskiptime)
x->x_inreset = inlet_new(&x->x_ob, &x->x_ob.ob_pd, gensym("bang"), gensym("reset"));
x->x_outindex = outlet_new(&x->x_ob, gensym("float"));
x->x_outerror = outlet_new(&x->x_ob, gensym("float"));
-#ifndef MAXLIB
- post(version);
-#endif
+
x->x_sym = s; /* get name of array */
score_set(x,x->x_sym); /* set array */
if(!fskipindex)fskipindex = 2;
@@ -276,6 +274,7 @@ static void *score_new(t_symbol *s, t_floatarg fskipindex, t_floatarg fskiptime)
return (void *)x;
}
+#ifndef MAXLIB
void score_setup(void)
{
score_class = class_new(gensym("score"), (t_newmethod)score_new,
@@ -288,6 +287,23 @@ void score_setup(void)
class_addmethod(score_class, (t_method)score_reset, gensym("reset"), A_GIMME, 0);
class_addmethod(score_class, (t_method)score_set, gensym("set"), A_SYMBOL, 0);
class_addfloat(score_class, score_float);
-
+ class_sethelpsymbol(score_class, gensym("help-score.pd"));
+ post(version);
}
-
+#else
+void maxlib_score_setup(void)
+{
+ score_class = class_new(gensym("maxlib_score"), (t_newmethod)score_new,
+ (t_method)score_free, sizeof(t_score), 0, A_SYMBOL, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)score_new, gensym("score"), A_SYMBOL, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(score_class, (t_method)score_reset, gensym("reset"), 0);
+ class_addmethod(score_class, (t_method)score_resume, gensym("resume"), 0);
+ class_addmethod(score_class, (t_method)score_start, gensym("start"), A_GIMME, 0);
+ class_addmethod(score_class, (t_method)score_stop, gensym("stop"), 0);
+ class_addmethod(score_class, (t_method)score_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addmethod(score_class, (t_method)score_reset, gensym("reset"), A_GIMME, 0);
+ class_addmethod(score_class, (t_method)score_set, gensym("set"), A_SYMBOL, 0);
+ class_addfloat(score_class, score_float);
+ class_sethelpsymbol(score_class, gensym("maxlib/help-score.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/speedlim.c b/src/speedlim.c
index 3055166..c4a4385 100644
--- a/src/speedlim.c
+++ b/src/speedlim.c
@@ -27,16 +27,16 @@
/* Based on PureData by Miller Puckette and others. */
/* */
/* ---------------------------------------------------------------------------- */
+
/* this is the original copyright notice: */
+
/* Copyright (c) 1997-2002 Miller Puckette and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-/* LATER 'clock' method */
#include <string.h>
#include "m_pd.h"
-// #include "hammer.h"
#define SPEEDLIM_INISIZE 32 /* LATER rethink */
#define SPEEDLIM_MAXSIZE 256 /* not used */
@@ -209,10 +209,18 @@ static void *speedlim_new(t_floatarg f)
return (x);
}
+#ifndef MAXLIB
void speedlim_setup(void)
{
speedlim_class = class_new(gensym("speedlim"), (t_newmethod)speedlim_new,
(t_method)speedlim_free, sizeof(t_speedlim), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_speedlim_setup(void)
+{
+ speedlim_class = class_new(gensym("maxlib_speedlim"), (t_newmethod)speedlim_new,
+ (t_method)speedlim_free, sizeof(t_speedlim), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)speedlim_new, gensym("speedlim"), A_DEFFLOAT, 0);
+#endif
class_addbang(speedlim_class, speedlim_bang);
class_addfloat(speedlim_class, speedlim_float);
class_addsymbol(speedlim_class, speedlim_symbol);
@@ -220,6 +228,8 @@ void speedlim_setup(void)
class_addanything(speedlim_class, speedlim_anything);
class_addmethod(speedlim_class, (t_method)speedlim_ft1, gensym("ft1"), A_FLOAT, 0);
#ifndef MAXLIB
+ class_sethelpsymbol(speedlim_class, gensym("help-speedlim.pd"));
#else
+ class_sethelpsymbol(speedlim_class, gensym("maxlib/help-speedlim.pd"));
#endif
}
diff --git a/src/split.c b/src/split.c
index 3a0d822..93f3a3d 100644
--- a/src/split.c
+++ b/src/split.c
@@ -71,19 +71,25 @@ static void *split_new(t_floatarg fmin, t_floatarg fmax)
x->x_min = fmin;
x->x_max = fmax;
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void split_setup(void)
{
split_class = class_new(gensym("split"), (t_newmethod)split_new,
0, sizeof(t_split), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addfloat(split_class, split_float);
-#ifndef MAXLIB
+ class_sethelpsymbol(split_class, gensym("help-split.pd"));
+ post(version);
+}
#else
-#endif
+void maxlib_split_setup(void)
+{
+ split_class = class_new(gensym("maxlib_split"), (t_newmethod)split_new,
+ 0, sizeof(t_split), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)split_new, gensym("split"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addfloat(split_class, split_float);
+ class_sethelpsymbol(split_class, gensym("maxlib/help-split.pd"));
}
-
+#endif
diff --git a/src/step.c b/src/step.c
index 8886ecb..819a157 100644
--- a/src/step.c
+++ b/src/step.c
@@ -149,12 +149,10 @@ static void *step_new(t_floatarg f, t_floatarg step, t_floatarg grain)
outlet_new(&x->x_obj, gensym("float"));
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1"));
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft2"));
-#ifndef MAXLIB
- post(version);
-#endif
return (x);
}
+#ifndef MAXLIB
void step_setup(void)
{
step_class = class_new(gensym("step"), (t_newmethod)step_new,
@@ -163,4 +161,19 @@ void step_setup(void)
class_addmethod(step_class, (t_method)step_ft2, gensym("ft2"), A_FLOAT, 0);
class_addmethod(step_class, (t_method)step_stop, gensym("stop"), 0);
class_addfloat(step_class, (t_method)step_float);
+ class_sethelpsymbol(step_class, gensym("help-step.pd"));
+ post(version);
+}
+#else
+void maxlib_step_setup(void)
+{
+ step_class = class_new(gensym("maxlib_step"), (t_newmethod)step_new,
+ (t_method)step_free, sizeof(t_step), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)step_new, gensym("step"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(step_class, (t_method)step_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addmethod(step_class, (t_method)step_ft2, gensym("ft2"), A_FLOAT, 0);
+ class_addmethod(step_class, (t_method)step_stop, gensym("stop"), 0);
+ class_addfloat(step_class, (t_method)step_float);
+ class_sethelpsymbol(step_class, gensym("maxlib/help-step.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/subst.c b/src/subst.c
index 0a4acf4..f473d53 100644
--- a/src/subst.c
+++ b/src/subst.c
@@ -366,9 +366,6 @@ static void *subst_new(t_symbol *s, int argc, t_atom *argv)
long i;
t_symbol *sym;
t_subst *x = (t_subst *)pd_new(subst_class);
-#ifndef MAXLIB
- post(version);
-#endif
// read in order...
x->x_order = 3;
if(argc == 1)
@@ -391,8 +388,10 @@ static void *subst_new(t_symbol *s, int argc, t_atom *argv)
static void subst_free(t_subst *x)
{
+ /* nothing to do */
}
+#ifndef MAXLIB
void subst_setup(void)
{
subst_class = class_new(gensym("subst"), (t_newmethod)subst_new,
@@ -404,4 +403,22 @@ void subst_setup(void)
class_addmethod(subst_class, (t_method)subst_display, gensym("display"), 0);
class_addlist(subst_class, subst_list);
class_addbang(subst_class, subst_bang);
+ class_sethelpsymbol(subst_class, gensym("help-subst.pd"));
+ post(version);
+}
+#else
+void maxlib_subst_setup(void)
+{
+ subst_class = class_new(gensym("maxlib_subst"), (t_newmethod)subst_new,
+ (t_method)subst_free, sizeof(t_subst), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)subst_new, gensym("subst"), A_GIMME, 0);
+ class_addmethod(subst_class, (t_method)subst_set_order, gensym("order"), A_FLOAT, 0);
+ class_addmethod(subst_class, (t_method)subst_intv, gensym("interval"), A_FLOAT, 0);
+ class_addmethod(subst_class, (t_method)subst_set, gensym("set"), A_SYMBOL, 0);
+ class_addmethod(subst_class, (t_method)subst_load, gensym("load"), A_SYMBOL, 0);
+ class_addmethod(subst_class, (t_method)subst_display, gensym("display"), 0);
+ class_addlist(subst_class, subst_list);
+ class_addbang(subst_class, subst_bang);
+ class_sethelpsymbol(subst_class, gensym("maxlib/help-subst.pd"));
}
+#endif \ No newline at end of file
diff --git a/src/sync.c b/src/sync.c
new file mode 100644
index 0000000..21e05f9
--- /dev/null
+++ b/src/sync.c
@@ -0,0 +1,294 @@
+/* ------------------------- sync ------------------------------------------- */
+/* */
+/* syncronises outputs depending on inputs. */
+/* Written by Olaf Matthes <olaf.matthes@gmx.de> */
+/* Based on 'sync' from jMax. */
+/* Get source at http://www.akustische-kunst.org/puredata/maxlib/ */
+/* */
+/* This program is free software; you can redistribute it and/or */
+/* modify it under the terms of the GNU General Public License */
+/* as published by the Free Software Foundation; either version 2 */
+/* of the License, or (at your option) any later version. */
+/* */
+/* This program is distributed in the hope that it will be useful, */
+/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
+/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
+/* GNU General Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, write to the Free Software */
+/* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+#include "m_pd.h"
+#include <stdio.h>
+#include <math.h>
+
+#define SYNC_MAX_SIZE (sizeof(unsigned int) * 8)
+
+static char *version = "sync v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>\n"
+ " based on sync from jMax";
+
+typedef struct sync
+{
+ t_object x_ob;
+ t_float x_min; /* low border of input range */
+ t_float x_max; /* high border of input range */
+ t_outlet *x_outlet[SYNC_MAX_SIZE];
+
+ t_int x_n;
+ unsigned int x_trigger; /* control bits: trigger on input at given inlets */
+ unsigned int x_require; /* control bits: require input on given inlets */
+ unsigned int x_reset; /* control bits: reset memory of given inputs after on each input */
+ unsigned int x_wait; /* status bits: wait for input at given inlet before output */
+ t_atom x_a[SYNC_MAX_SIZE];
+ enum {mode_all, mode_select} mode;
+} t_sync;
+
+typedef struct proxy
+{
+ t_object obj;
+ t_int index; /* number of proxy inlet(s) */
+ t_sync *x; /* we'll put the other struct in here */
+} t_proxy;
+
+static void sync_output(t_sync *x)
+{
+ int i;
+
+ for(i=x->x_n-1; i>=0; i--)
+ if(x->x_a[i].a_type != A_SEMI)
+ outlet_list(x->x_outlet[i], NULL, 1, x->x_a + i);
+}
+
+static void sync_input(t_proxy *p, t_symbol *s, int ac, t_atom *at)
+{
+ t_sync *x = (t_sync *)(p->x);
+ int winlet = p->index;
+
+ if(ac)
+ {
+ unsigned int bit = 1 << winlet;
+
+ x->x_a[winlet] = at[0];
+
+ x->x_wait &= ~bit;
+
+ if(!x->x_wait && (x->x_trigger & bit))
+ {
+ sync_output(x);
+ x->x_wait |= x->x_reset & x->x_require;
+ }
+ }
+}
+
+static void sync_float_input(t_proxy *p, t_floatarg f)
+{
+ t_sync *x = (t_sync *)(p->x);
+ int winlet = p->index;
+
+ {
+ unsigned int bit = 1 << winlet;
+
+ SETFLOAT(x->x_a + winlet, f);
+
+ x->x_wait &= ~bit;
+
+ if(!x->x_wait && (x->x_trigger & bit))
+ {
+ sync_output(x);
+ x->x_wait |= x->x_reset & x->x_require;
+ }
+ }
+}
+
+static void sync_set_bits(unsigned int *bits, int n, t_atom *at, int sign)
+{
+ if(at->a_type == A_SYMBOL)
+ {
+ t_symbol *mode = atom_getsymbol(at);
+
+ if(mode == gensym("all"))
+ *bits = (1 << n) - 1;
+ else if(mode == gensym("none"))
+ *bits = 0;
+ }
+ else if(at->a_type == A_FLOAT)
+ {
+ int in = (int)atom_getfloat(at) * sign;
+
+ if(in >= 0 && in < n)
+ *bits = 1 << in;
+ }
+ else if(at->a_type == A_GIMME)
+ {
+ int size = n;
+ int i;
+
+ *bits = 0;
+
+ for(i=0; i<size; i++)
+ {
+ if(at[i].a_type == A_FLOAT)
+ {
+ int in = atom_getfloatarg(i, size, at) * sign;
+
+ if(in >= 0 && in < n)
+ *bits |= 1 << in;
+ }
+ }
+ }
+}
+
+static void sync_set_trigger(t_sync *x, t_symbol *s, int ac, t_atom *at)
+{
+ sync_set_bits(&x->x_trigger, x->x_n, at, 1);
+}
+
+static void sync_set_require(t_sync *x, t_symbol *s, int ac, t_atom *at)
+{
+ unsigned int once = 0;
+
+ sync_set_bits(&x->x_require, x->x_n, at, 1);
+ sync_set_bits(&once, x->x_n, at, -1);
+
+ x->x_reset = ~once;
+ x->x_wait = x->x_require | once;
+}
+
+static void sync_set_mode(t_sync *x, t_symbol *mode)
+{
+ if(mode == gensym("any"))
+ {
+ x->x_trigger = (1 << x->x_n) - 1;
+ x->x_reset = 0;
+ x->x_require = 0;
+ }
+ else if(mode == gensym("all"))
+ x->x_trigger = x->x_require = x->x_reset = x->x_wait = (1 << x->x_n) - 1;
+ else if(mode == gensym("left"))
+ {
+ x->x_trigger = 1;
+ x->x_reset = 0;
+ x->x_require = 0;
+ }
+ else if(mode == gensym("right"))
+ {
+ x->x_trigger = (1 << (x->x_n - 1));
+ x->x_reset = 0;
+ x->x_require = 0;
+ }
+
+ x->x_wait = x->x_require;
+}
+
+static void sync_float(t_sync *x, t_floatarg f)
+{
+ unsigned int bit = 1 << 0;
+
+ SETFLOAT(x->x_a, f);
+
+ x->x_wait &= ~bit;
+
+ if(!x->x_wait && (x->x_trigger & bit))
+ {
+ sync_output(x);
+ x->x_wait |= x->x_reset & x->x_require;
+ }
+}
+
+static t_class *sync_class;
+static t_class *proxy_class;
+
+static void *sync_new(t_symbol *s, int ac, t_atom *at)
+{
+ int n = 0;
+ int i;
+ t_sync *x = (t_sync *)pd_new(sync_class);
+ t_proxy *inlet[SYNC_MAX_SIZE];
+
+ /* void state - we fill with SEMI and treat this as 'void' */
+ for(i=0; i<SYNC_MAX_SIZE; i++)
+ SETSEMI(x->x_a + i);
+
+ if(ac == 1)
+ {
+ if(at->a_type == A_FLOAT)
+ {
+ n = atom_getfloat(at);
+
+ if(n < 2)
+ n = 2;
+ else if(n > SYNC_MAX_SIZE)
+ n = SYNC_MAX_SIZE;
+ }
+ else
+ {
+ post("sync: wrong argument");
+ return (0);
+ }
+ }
+ else if(ac > 1)
+ {
+ if(ac > SYNC_MAX_SIZE)
+ ac = SYNC_MAX_SIZE;
+
+ n = ac;
+
+ for(i=0; i<n; i++)
+ x->x_a[i] = at[i];
+ }
+
+ x->x_n = n;
+ x->x_trigger = x->x_require = x->x_reset = x->x_wait = (1 << n) - 1;
+
+ x->x_outlet[0] = outlet_new(&x->x_ob, gensym("list"));
+
+ for(i=1; i<n; i++)
+ {
+ inlet[i] = (t_proxy *)pd_new(proxy_class); /* create the proxy inlet */
+ inlet[i]->x = x; /* make t_sync *x visible to the proxy inlets */
+ inlet[i]->index = i; /* remember it's number */
+ /* it belongs to the object t_sync but the destination is t_proxy */
+ inlet_new(&x->x_ob, &inlet[i]->obj.ob_pd, 0,0);
+
+ x->x_outlet[i] = outlet_new(&x->x_ob, gensym("list"));
+ }
+
+ return (void *)x;
+}
+
+#ifndef MAXLIB
+void sync_setup(void)
+{
+ sync_class = class_new(gensym("sync"), (t_newmethod)sync_new,
+ 0, sizeof(t_sync), 0, A_GIMME, 0);
+#else
+void maxlib_sync_setup(void)
+{
+ sync_class = class_new(gensym("maxlib_sync"), (t_newmethod)sync_new,
+ 0, sizeof(t_sync), 0, A_GIMME, 0);
+#endif
+ /* a class for the proxy inlet: */
+ proxy_class = class_new(gensym("maxlib_sync_proxy"), NULL, NULL, sizeof(t_proxy),
+ CLASS_PD|CLASS_NOINLET, A_NULL);
+
+ class_addfloat(proxy_class, sync_float_input);
+ class_addanything(proxy_class, sync_input);
+
+ class_addfloat(sync_class, sync_float);
+ class_addmethod(sync_class, (t_method)sync_set_trigger, gensym("trigger"), A_GIMME, 0);
+ class_addmethod(sync_class, (t_method)sync_set_require, gensym("require"), A_GIMME, 0);
+ class_addmethod(sync_class, (t_method)sync_set_mode, gensym("mode"), A_SYMBOL, 0);
+#ifndef MAXLIB
+ class_sethelpsymbol(sync_class, gensym("help-sync.pd"));
+ post(version);
+#else
+ class_addcreator((t_newmethod)sync_new, gensym("sync"), A_GIMME, 0);
+ class_sethelpsymbol(sync_class, gensym("maxlib/help-sync.pd"));
+#endif
+}
+
diff --git a/src/temperature.c b/src/temperature.c
index 28a9352..509db76 100644
--- a/src/temperature.c
+++ b/src/temperature.c
@@ -90,12 +90,10 @@ static void *temperature_new(t_floatarg f)
}
x->x_index = 0;
clock_delay(x->x_clock, x->x_time);
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void temperature_setup(void)
{
temperature_class = class_new(gensym("temperature"), (t_newmethod)temperature_new,
@@ -104,5 +102,19 @@ void temperature_setup(void)
class_addfloat(temperature_class, temperature_float);
class_addmethod(temperature_class, (t_method)temperature_time, gensym("time"), A_FLOAT, 0);
class_addanything(temperature_class, temperature_anything);
+ class_sethelpsymbol(temperature_class, gensym("help-temperature.pd"));
+ post(version);
}
-
+#else
+void maxlib_temperature_setup(void)
+{
+ temperature_class = class_new(gensym("maxlib_temperature"), (t_newmethod)temperature_new,
+ (t_method)temperature_free, sizeof(t_temperature), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)temperature_new, gensym("temperature"), A_DEFFLOAT, 0);
+ class_addmethod(temperature_class, (t_method)temperature_reset, gensym("reset"), 0);
+ class_addfloat(temperature_class, temperature_float);
+ class_addmethod(temperature_class, (t_method)temperature_time, gensym("time"), A_FLOAT, 0);
+ class_addanything(temperature_class, temperature_anything);
+ class_sethelpsymbol(temperature_class, gensym("maxlib/help-temperature.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/tilt.c b/src/tilt.c
index 048022e..ca67914 100644
--- a/src/tilt.c
+++ b/src/tilt.c
@@ -154,13 +154,11 @@ static void *tilt_new(t_floatarg f, t_floatarg f2)
x->x_hi_limit = x->x_low_limit = x->x_trip_point = 0;
clock_delay(x->x_clock, x->x_wait); /* wait 4 sec and start calculation */
-#ifndef MAXLIB
- post(version);
-#endif
post("tilt: set interval to %g msec", x->x_wait);
return (void *)x;
}
+#ifndef MAXLIB
void tilt_setup(void)
{
tilt_class = class_new(gensym("tilt"), (t_newmethod)tilt_new,
@@ -171,5 +169,21 @@ void tilt_setup(void)
class_addmethod(tilt_class, (t_method)tilt_hi_limit, gensym("hi"), A_FLOAT, 0);
class_addmethod(tilt_class, (t_method)tilt_low_limit, gensym("low"), A_FLOAT, 0);
class_addmethod(tilt_class, (t_method)tilt_trip_point, gensym("trip"), A_FLOAT, 0);
+ class_sethelpsymbol(tilt_class, gensym("help-tilt.pd"));
+ post(version);
}
-
+#else
+void maxlib_tilt_setup(void)
+{
+ tilt_class = class_new(gensym("maxlib_tilt"), (t_newmethod)tilt_new,
+ (t_method)tilt_free, sizeof(t_tilt), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)tilt_new, gensym("tilt"), A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addfloat(tilt_class, tilt_float);
+ class_addmethod(tilt_class, (t_method)tilt_intv, gensym("intv"), A_FLOAT, 0);
+ class_addmethod(tilt_class, (t_method)tilt_tilt, gensym("tilt"), A_FLOAT, 0);
+ class_addmethod(tilt_class, (t_method)tilt_hi_limit, gensym("hi"), A_FLOAT, 0);
+ class_addmethod(tilt_class, (t_method)tilt_low_limit, gensym("low"), A_FLOAT, 0);
+ class_addmethod(tilt_class, (t_method)tilt_trip_point, gensym("trip"), A_FLOAT, 0);
+ class_sethelpsymbol(tilt_class, gensym("maxlib/help-tilt.pd"));
+}
+#endif \ No newline at end of file
diff --git a/src/timebang.c b/src/timebang.c
index e1f9b9c..3a679b1 100644
--- a/src/timebang.c
+++ b/src/timebang.c
@@ -29,7 +29,7 @@
#define MAX_TIMES 256 /* maximum number of times to process */
-static char *version = "timebang v0.1, written by Olaf Matthes <olaf.matthes@gmx.de>";
+static char *version = "timebang v0.2, written by Olaf Matthes <olaf.matthes@gmx.de>";
typedef struct timebang
{
@@ -76,6 +76,27 @@ static void timebang_tick(t_timebang *x)
static void timebang_set(t_timebang *x, t_symbol *s, int ac, t_atom *av)
{
+ int i;
+
+ if(ac == x->x_notimes * 3)
+ {
+ for(i = 0; i < ac; i += 3)
+ {
+ if (av[i].a_type == A_FLOAT) x->x_hour[x->x_notimes] = av[i].a_w.w_float;
+ else { post ("timebang: first argument must be (int) hours"); return; }
+ if (av[i+1].a_type == A_FLOAT) x->x_min[x->x_notimes] = av[i+1].a_w.w_float;
+ else { post ("timebang: second argument must be (int) minutes"); return; }
+ if (av[i+2].a_type == A_FLOAT) x->x_sec[x->x_notimes] = av[i+2].a_w.w_float;
+ else { post ("timebang: third argument must be (int) seconds"); return; }
+ x->x_over[i] = 0;
+ }
+ post("timebang: read in %d times of day:", x->x_notimes);
+ for(i = 0; i < x->x_notimes; i++)
+ {
+ post(" %02d:%02d:%02d", x->x_hour[i], x->x_min[i], x->x_sec[i]);
+ }
+ }
+ else post("timebang: wrong number of parameter");
}
static void timebang_bang(t_timebang *x)
@@ -94,9 +115,6 @@ static void *timebang_new(t_symbol *s, int ac, t_atom *av)
x->x_clock = clock_new(x, (t_method)timebang_tick);
-#ifndef MAXLIB
- post(version);
-#endif
if(ac > MAX_TIMES * 3)
{
post("timebang: too many creation arguments");
@@ -132,14 +150,25 @@ static void timebang_free(t_timebang *x)
clock_free(x->x_clock);
}
+#ifndef MAXLIB
void timebang_setup(void)
{
timebang_class = class_new(gensym("timebang"), (t_newmethod)timebang_new,
(t_method)timebang_free, sizeof(t_timebang), 0, A_GIMME, 0);
+#else
+void maxlib_timebang_setup(void)
+{
+ timebang_class = class_new(gensym("maxlib_timebang"), (t_newmethod)timebang_new,
+ (t_method)timebang_free, sizeof(t_timebang), 0, A_GIMME, 0);
+ class_addcreator((t_newmethod)timebang_new, gensym("timebang"), A_GIMME, 0);
+#endif
class_addmethod(timebang_class, (t_method)timebang_set, gensym("set"), A_GIMME, 0);
class_addbang(timebang_class, (t_method)timebang_bang);
#ifndef MAXLIB
+ class_sethelpsymbol(timebang_class, gensym("help-timebang.pd"));
+ post(version);
#else
+ class_sethelpsymbol(timebang_class, gensym("maxlib/help-timebang.pd"));
#endif
}
diff --git a/src/triang.c b/src/triang.c
index 9ecbf65..832bced 100644
--- a/src/triang.c
+++ b/src/triang.c
@@ -58,12 +58,23 @@ static void rand_triang_bang(t_rand_triang *x)
outlet_float(x->x_obj.ob_outlet, 0.5*(u1+u2));
}
+#ifndef MAXLIB
void triang_setup(void)
{
rand_triang_class = class_new(gensym("triang"), (t_newmethod)rand_triang_new, 0,
sizeof(t_rand_triang), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_triang_setup(void)
+{
+ rand_triang_class = class_new(gensym("maxlib_triang"), (t_newmethod)rand_triang_new, 0,
+ sizeof(t_rand_triang), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rand_triang_new, gensym("triang"), A_DEFFLOAT, 0);
+#endif
class_addbang(rand_triang_class, rand_triang_bang);
#ifndef MAXLIB
+ class_sethelpsymbol(rand_triang_class, gensym("help-triang.pd"));
post(version);
+#else
+ class_sethelpsymbol(rand_triang_class, gensym("maxlib/help-triang.pd"));
#endif
-}
+} \ No newline at end of file
diff --git a/src/unroute.c b/src/unroute.c
index 9a68a61..e6131e4 100644
--- a/src/unroute.c
+++ b/src/unroute.c
@@ -142,19 +142,22 @@ static void *unroute_new(t_symbol *s, int argc, t_atom *argv)
}
x->x_outlet = outlet_new(&x->x_obj, gensym("float"));
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void unroute_setup(void)
{
unroute_class = class_new(gensym("unroute"), (t_newmethod)unroute_new,
0, sizeof(t_unroute), 0, A_GIMME, 0);
-
+#else
+void maxlib_unroute_setup(void)
+{
+ unroute_class = class_new(gensym("maxlib_unroute"), (t_newmethod)unroute_new,
+ 0, sizeof(t_unroute), 0, A_GIMME, 0);
+#endif
/* a class for the proxy inlet: */
- proxy_class = class_new(gensym("proxy"), NULL, NULL, sizeof(t_proxy),
+ proxy_class = class_new(gensym("maxlib_unroute_proxy"), NULL, NULL, sizeof(t_proxy),
CLASS_PD|CLASS_NOINLET, A_NULL);
class_addanything(proxy_class, unroute_input);
@@ -163,6 +166,10 @@ void unroute_setup(void)
class_addlist(unroute_class, unroute_list);
class_addanything(unroute_class, unroute_any);
#ifndef MAXLIB
+ class_sethelpsymbol(unroute_class, gensym("help-unroute.pd"));
+ post(version);
#else
+ class_addcreator((t_newmethod)unroute_new, gensym("unroute"), A_GIMME, 0);
+ class_sethelpsymbol(unroute_class, gensym("maxlib/help-unroute.pd"));
#endif
-}
+} \ No newline at end of file
diff --git a/src/urn.c b/src/urn.c
index 4a09387..a657d42 100644
--- a/src/urn.c
+++ b/src/urn.c
@@ -127,16 +127,26 @@ notify:
outlet_bang(x->x_notify);
}
+#ifndef MAXLIB
void urn_setup(void)
{
urn_class = class_new(gensym("urn"), (t_newmethod)urn_new, 0,
sizeof(t_urn), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_urn_setup(void)
+{
+ urn_class = class_new(gensym("maxlib_urn"), (t_newmethod)urn_new, 0,
+ sizeof(t_urn), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)urn_new, gensym("urn"), A_DEFFLOAT, 0);
+#endif
class_addbang(urn_class, urn_bang);
class_addmethod(urn_class, (t_method)urn_f, gensym("f"), A_FLOAT, 0);
class_addmethod(urn_class, (t_method)urn_clear, gensym("clear"), 0);
class_addmethod(urn_class, (t_method)urn_seed, gensym("seed"), A_FLOAT, 0);
#ifndef MAXLIB
+ class_sethelpsymbol(urn_class, gensym("help-urn.pd"));
post(version);
#else
+ class_sethelpsymbol(urn_class, gensym("maxlib/help-urn.pd"));
#endif
-}
+} \ No newline at end of file
diff --git a/src/velocity.c b/src/velocity.c
index a01aae5..7a003d0 100644
--- a/src/velocity.c
+++ b/src/velocity.c
@@ -83,19 +83,30 @@ static void *velocity_new(t_floatarg f)
{
t_velocity *x = (t_velocity *)pd_new(velocity_class);
x->x_out = outlet_new(&x->x_ob, gensym("float"));
-#ifndef MAXLIB
- post(version);
-#endif
x->x_lasttime = clock_getlogicaltime();
return (void *)x;
}
+#ifndef MAXLIB
void velocity_setup(void)
{
velocity_class = class_new(gensym("velocity"), (t_newmethod)velocity_new,
(t_method)velocity_free, sizeof(t_velocity), 0, A_DEFFLOAT, 0);
+#else
+void maxlib_velocity_setup(void)
+{
+ velocity_class = class_new(gensym("maxlib_velocity"), (t_newmethod)velocity_new,
+ (t_method)velocity_free, sizeof(t_velocity), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)velocity_new, gensym("velocity"), A_DEFFLOAT, 0);
+#endif
class_addfloat(velocity_class, velocity_float);
class_addbang(velocity_class, velocity_bang);
+#ifndef MAXLIB
+ class_sethelpsymbol(velocity_class, gensym("help-velocity.pd"));
+ post(version);
+#else
+ class_sethelpsymbol(velocity_class, gensym("maxlib/help-velocity.pd"));
+#endif
}
diff --git a/src/weibull.c b/src/weibull.c
index 8df527e..1dbf4aa 100644
--- a/src/weibull.c
+++ b/src/weibull.c
@@ -73,12 +73,23 @@ static void rand_weibull_bang(t_rand_weibull *x)
outlet_float(x->x_obj.ob_outlet, x->x_s*pow(log(a), tinv));
}
+#ifndef MAXLIB
void weibull_setup(void)
{
rand_weibull_class = class_new(gensym("weibull"), (t_newmethod)rand_weibull_new, 0,
sizeof(t_rand_weibull), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(rand_weibull_class, rand_weibull_bang);
+#else
+void maxlib_weibull_setup(void)
+{
+ rand_weibull_class = class_new(gensym("maxlib_weibull"), (t_newmethod)rand_weibull_new, 0,
+ sizeof(t_rand_weibull), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)rand_weibull_new, gensym("weibull"), A_DEFFLOAT, A_DEFFLOAT, 0);
+#endif
+ class_addbang(rand_weibull_class, rand_weibull_bang);
#ifndef MAXLIB
+ class_sethelpsymbol(rand_weibull_class, gensym("help-weibull.pd"));
post(version);
+#else
+ class_sethelpsymbol(rand_weibull_class, gensym("maxlib/help-weibull.pd"));
#endif
}
diff --git a/src/wrap.c b/src/wrap.c
index cf94e6c..310772b 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -114,18 +114,29 @@ static void *wrap_new(t_floatarg fmin, t_floatarg fmax)
x->x_min = fmin;
wrap_b(x, fmax);
-#ifndef MAXLIB
- post(version);
-#endif
return (void *)x;
}
+#ifndef MAXLIB
void wrap_setup(void)
{
wrap_class = class_new(gensym("wrap"), (t_newmethod)wrap_new,
0, sizeof(t_wrap), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+#else
+void maxlib_wrap_setup(void)
+{
+ wrap_class = class_new(gensym("maxlib_wrap"), (t_newmethod)wrap_new,
+ 0, sizeof(t_wrap), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)wrap_new, gensym("wrap"), A_DEFFLOAT, A_DEFFLOAT, 0);
+#endif
class_addfloat(wrap_class, wrap_float);
class_addmethod(wrap_class, (t_method)wrap_a, gensym("a"), A_FLOAT, 0);
class_addmethod(wrap_class, (t_method)wrap_b, gensym("b"), A_FLOAT, 0);
+#ifndef MAXLIB
+ class_sethelpsymbol(wrap_class, gensym("help-wrap.pd"));
+ post(version);
+#else
+ class_sethelpsymbol(wrap_class, gensym("maxlib/help-wrap.pd"));
+#endif
}