aboutsummaryrefslogtreecommitdiff
path: root/cyclone
diff options
context:
space:
mode:
authorN.N. <krzyszcz@users.sourceforge.net>2005-01-11 10:33:23 +0000
committerN.N. <krzyszcz@users.sourceforge.net>2005-01-11 10:33:23 +0000
commit6435314717c5fb8fa062eb682c72c8df095b1be3 (patch)
tree484d02446358890397a755fc144d4ecf25b38f2d /cyclone
parentb89456a346e176c4dc536e7de8f14b152cb2b15b (diff)
svf~: args parsing; prepend/Append: bang handling; seq: pause, continue, goto; many maxmode changes
svn path=/trunk/externals/miXed/; revision=2490
Diffstat (limited to 'cyclone')
-rw-r--r--cyclone/Makefile.objects18
-rw-r--r--cyclone/Makefile.sources40
-rw-r--r--cyclone/build_counter4
-rw-r--r--cyclone/cyclone-shared.include10
-rw-r--r--cyclone/hammer/Append.c63
-rw-r--r--cyclone/hammer/Decode.c7
-rw-r--r--cyclone/hammer/Makefile.objects1
-rw-r--r--cyclone/hammer/Table.c4
-rw-r--r--cyclone/hammer/bangbang.c9
-rw-r--r--cyclone/hammer/coll.c54
-rw-r--r--cyclone/hammer/comment.c34
-rw-r--r--cyclone/hammer/counter.c18
-rw-r--r--cyclone/hammer/cycle.c7
-rw-r--r--cyclone/hammer/funbuff.c4
-rw-r--r--cyclone/hammer/gate.c9
-rw-r--r--cyclone/hammer/hammer.c30
-rw-r--r--cyclone/hammer/maximum.c7
-rw-r--r--cyclone/hammer/minimum.c7
-rw-r--r--cyclone/hammer/mtr.c26
-rw-r--r--cyclone/hammer/past.c7
-rw-r--r--cyclone/hammer/prepend.c38
-rw-r--r--cyclone/hammer/prob.c11
-rw-r--r--cyclone/hammer/pv.c18
-rw-r--r--cyclone/hammer/seq.c125
-rw-r--r--cyclone/hammer/sprintf.c14
-rw-r--r--cyclone/hammer/switch.c9
-rw-r--r--cyclone/hammer/tosymbol.c5
-rw-r--r--cyclone/hammer/urn.c9
-rw-r--r--cyclone/hammer/zl.c24
-rw-r--r--cyclone/shadow/Makefile.objects1
-rw-r--r--cyclone/shadow/cyclone.c140
-rw-r--r--cyclone/shadow/dummies.c20
-rw-r--r--cyclone/shadow/maxmode.c175
-rw-r--r--cyclone/sickle/Line.c14
-rw-r--r--cyclone/sickle/Makefile.objects1
-rw-r--r--cyclone/sickle/Scope.c22
-rw-r--r--cyclone/sickle/average.c3
-rw-r--r--cyclone/sickle/bitshift.c9
-rw-r--r--cyclone/sickle/buffir.c16
-rw-r--r--cyclone/sickle/curve.c16
-rw-r--r--cyclone/sickle/cycle.c2
-rw-r--r--cyclone/sickle/pong.c3
-rw-r--r--cyclone/sickle/sickle.c30
-rw-r--r--cyclone/sickle/svf.c45
44 files changed, 726 insertions, 383 deletions
diff --git a/cyclone/Makefile.objects b/cyclone/Makefile.objects
index 5199008..2a076ba 100644
--- a/cyclone/Makefile.objects
+++ b/cyclone/Makefile.objects
@@ -1,11 +1,14 @@
HLOUD_OBJECTS = common/loud.o
+HFITTER_OBJECTS = common/loud.o common/fitter.o
HFORKY_OBJECTS = common/loud.o unstable/forky.o
HFRAGILE_OBJECTS = common/loud.o unstable/fragile.o
HGROW_OBJECTS = common/grow.o common/loud.o
-HFILE_OBJECTS = hammer/file.o common/loud.o unstable/forky.o
+HGROWFITTER_OBJECTS = common/grow.o common/loud.o common/fitter.o
+HFILE_OBJECTS = hammer/file.o common/loud.o common/fitter.o unstable/forky.o
HRAND_OBJECTS = common/rand.o common/loud.o
-HRANDFILE_OBJECTS = common/rand.o hammer/file.o common/loud.o unstable/forky.o
-HRANDGROW_OBJECTS = common/rand.o common/grow.o common/loud.o
+HRANDFILE_OBJECTS = common/rand.o hammer/file.o common/loud.o common/fitter.o \
+ unstable/forky.o
+HRANDGROW_OBJECTS = common/rand.o common/grow.o common/loud.o common/fitter.o
HRANDGROWFILE_OBJECTS = common/rand.o common/grow.o hammer/file.o \
common/loud.o unstable/forky.o
HTREE_OBJECTS = hammer/tree.o common/loud.o
@@ -13,16 +16,19 @@ HTREEFILEVEFL_OBJECTS = hammer/tree.o hammer/file.o \
common/vefl.o common/loud.o unstable/forky.o unstable/fragile.o
HGUI_OBJECTS = hammer/gui.o common/loud.o
HSEQ_OBJECTS = common/mifi.o hammer/file.o \
- common/grow.o common/loud.o unstable/forky.o
+ common/grow.o common/loud.o common/fitter.o unstable/forky.o
SSIC_OBJECTS = sickle/sic.o common/loud.o
SFORKY_OBJECTS = sickle/sic.o common/loud.o unstable/forky.o
SFRAGILE_OBJECTS = sickle/sic.o common/loud.o unstable/fragile.o
SGROW_OBJECTS = common/grow.o sickle/sic.o common/loud.o
SGROWCLC_OBJECTS = common/grow.o common/clc.o sickle/sic.o common/loud.o
-SGROWFORKY_OBJECTS = common/grow.o sickle/sic.o common/loud.o unstable/forky.o
+SGROWFORKY_OBJECTS = common/grow.o sickle/sic.o \
+ common/loud.o common/fitter.o unstable/forky.o
SVEFL_OBJECTS = common/vefl.o sickle/sic.o common/loud.o unstable/fragile.o
SARSIC_OBJECTS = sickle/sic.o sickle/arsic.o common/vefl.o \
common/loud.o unstable/fragile.o
+SARSICFITTER_OBJECTS = sickle/sic.o sickle/arsic.o common/vefl.o \
+ common/loud.o common/fitter.o unstable/fragile.o
SFILE_OBJECTS = hammer/file.o sickle/sic.o common/loud.o unstable/forky.o
-RELEASE_LIBS = cyclone hammer sickle dummies
+RELEASE_LIBS = cyclone hammer sickle dummies maxmode
RELEASE_APPS = cyclist
diff --git a/cyclone/Makefile.sources b/cyclone/Makefile.sources
index 0c338fe..bcadba2 100644
--- a/cyclone/Makefile.sources
+++ b/cyclone/Makefile.sources
@@ -1,7 +1,8 @@
-TYPES = HPLAIN HLOUD HFORKY HFRAGILE HGROW HFILE HRAND HRANDFILE HRANDGROW \
- HRANDGROWFILE HTREE HTREEFILEVEFL HGUI HSEQ \
- SPLAINNOTILDE SPLAIN SSIC SFORKY SFRAGILE SGROW SGROWFORKY \
- SVEFL SARSIC SFILE
+TYPES = HPLAIN HLOUD HFITTER HFORKY HFRAGILE HGROW HGROWFITTER \
+ HFILE HRAND HRANDFILE HRANDGROW HRANDGROWFILE \
+ HTREE HTREEFILEVEFL HGUI HSEQ \
+ SPLAINNOTILDE SPLAIN SSIC SFORKY SFRAGILE SGROW SGROWCLC SGROWFORKY \
+ SVEFL SARSIC SARSICFITTER SFILE
HPLAIN_SOURCES = \
hammer/testmess.c \
@@ -37,22 +38,24 @@ hammer/xnoteout.c
HLOUD_SOURCES = \
hammer/anal.c \
-hammer/bangbang.c \
hammer/Borax.c \
-hammer/counter.c \
-hammer/cycle.c \
hammer/decide.c \
-hammer/Decode.c \
-hammer/gate.c \
hammer/Histo.c \
-hammer/maximum.c \
-hammer/minimum.c \
hammer/spell.c \
hammer/spray.c \
hammer/sprintf.c \
-hammer/switch.c \
hammer/TogEdge.c
+HFITTER_SOURCES = \
+hammer/bangbang.c \
+hammer/counter.c \
+hammer/cycle.c \
+hammer/Decode.c \
+hammer/gate.c \
+hammer/maximum.c \
+hammer/minimum.c \
+hammer/switch.c
+
HFORKY_SOURCES = \
hammer/comment.c
@@ -61,15 +64,12 @@ hammer/grab.c \
hammer/universal.c
HGROW_SOURCES = \
-hammer/Append.c \
hammer/bondo.c \
hammer/buddy.c \
hammer/Clip.c \
hammer/funnel.c \
hammer/iter.c \
hammer/match.c \
-hammer/past.c \
-hammer/prepend.c \
hammer/pv.c \
hammer/speedlim.c \
hammer/substitute.c \
@@ -77,6 +77,11 @@ hammer/thresh.c \
hammer/tosymbol.c \
hammer/zl.c
+HGROWFITTER_SOURCES = \
+hammer/Append.c \
+hammer/past.c \
+hammer/prepend.c
+
HFILE_SOURCES = \
hammer/capture.c \
hammer/coll.c \
@@ -200,7 +205,6 @@ sickle/cycle.c
SARSIC_TILDE = $(TILDE)
SARSIC_SOURCES = \
-sickle/buffir.c \
sickle/index.c \
sickle/lookup.c \
sickle/peek.c \
@@ -209,6 +213,10 @@ sickle/poke.c \
sickle/record.c \
sickle/wave.c
+SARSICFITTER_TILDE = $(TILDE)
+SARSICFITTER_SOURCES = \
+sickle/buffir.c
+
SFILE_TILDE = $(TILDE)
SFILE_SOURCES = \
sickle/capture.c
diff --git a/cyclone/build_counter b/cyclone/build_counter
index acc65a6..10003f3 100644
--- a/cyclone/build_counter
+++ b/cyclone/build_counter
@@ -1,7 +1,7 @@
#define CYCLONE_VERSION "0.1"
#define CYCLONE_RELEASE "alpha"
-#define CYCLONE_BUILD 50
+#define CYCLONE_BUILD 51
#if 0
-CYCLONE_SNAPSHOT = 0.1-alpha50
+CYCLONE_SNAPSHOT = 0.1-alpha51
#endif
diff --git a/cyclone/cyclone-shared.include b/cyclone/cyclone-shared.include
index 26662ac..6b0cce8 100644
--- a/cyclone/cyclone-shared.include
+++ b/cyclone/cyclone-shared.include
@@ -9,10 +9,16 @@ shared/unstable/fringe.h
shared/unstable/loader.c
shared/unstable/loader.h
shared/unstable/pd_imp.h
-shared/common/grow.c
-shared/common/grow.h
+shared/unstable/standalone.c
+shared/unstable/standalone.h
shared/common/loud.c
shared/common/loud.h
+shared/common/grow.c
+shared/common/grow.h
+shared/common/fitter.c
+shared/common/fitter.h
+shared/common/lex.c
+shared/common/lex.h
shared/common/binport.c
shared/common/binport.h
shared/common/port.c
diff --git a/cyclone/hammer/Append.c b/cyclone/hammer/Append.c
index ad615d5..16b65cc 100644
--- a/cyclone/hammer/Append.c
+++ b/cyclone/hammer/Append.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -6,6 +6,7 @@
#include "m_pd.h"
#include "common/loud.h"
#include "common/grow.h"
+#include "common/fitter.h"
#define APPEND_INISIZE 32 /* LATER rethink */
#define APPEND_MAXSIZE 256
@@ -33,6 +34,9 @@ typedef struct _appendxy
static t_class *append_class;
static t_class *appendxy_class;
+static t_symbol *appendps_compatibility = 0;
+static t_symbol *appendps_max;
+
/* Usually a preallocation method is used, except in special cases of:
1) reentrant output request, or 2) an output request which would cause
resizing to more than MAXSIZE (no such limit for a 'set' message).
@@ -42,7 +46,8 @@ static t_class *appendxy_class;
preallocation method is chosen). Instead, self-invoked 'set'
messages are postponed, using an auxiliary buffer. */
-/* Any Append's output goes through outlet_anything() -> typedmess() */
+/* Any Append's output, except bangout, goes through
+ outlet_anything() -> typedmess(), LATER rethink */
static void append_setnatoms(t_append *x, int natoms)
{
@@ -50,6 +55,31 @@ static void append_setnatoms(t_append *x, int natoms)
x->x_natoms = natoms;
}
+static void append_bangout(t_outlet *outp, int ac, t_atom *av)
+{
+ if (ac)
+ {
+ if (av->a_type == A_SYMBOL)
+ outlet_anything(outp, av->a_w.w_symbol, ac-1, av+1);
+ else if (av->a_type == A_POINTER)
+ {
+ if (ac == 1)
+ outlet_pointer(outp, av->a_w.w_gpointer);
+ else
+ outlet_list(outp, &s_list, ac, av);
+ }
+ else if (av->a_type == A_FLOAT)
+ {
+ if (ac == 1)
+ outlet_float(outp, av->a_w.w_float);
+ else
+ outlet_list(outp, &s_list, ac, av);
+ }
+ else loudbug_bug("append_bangout");
+ }
+ else outlet_bang(outp);
+}
+
static void append_anything(t_append *x, t_symbol *s, int ac, t_atom *av)
{
int reentered = x->x_entered;
@@ -77,7 +107,10 @@ static void append_anything(t_append *x, t_symbol *s, int ac, t_atom *av)
buf = x->x_message - ac;
if (ac)
memcpy(buf, av, ac * sizeof(*buf));
- outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf);
+ if (s)
+ outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf);
+ else
+ append_bangout(((t_object *)x)->ob_outlet, ntotal, buf);
}
else
{
@@ -88,7 +121,10 @@ static void append_anything(t_append *x, t_symbol *s, int ac, t_atom *av)
memcpy(buf, av, ac * sizeof(*buf));
if (x->x_natoms)
memcpy(buf + ac, x->x_message, x->x_natoms * sizeof(*buf));
- outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf);
+ if (s)
+ outlet_anything(((t_object *)x)->ob_outlet, s, ntotal, buf);
+ else
+ append_bangout(((t_object *)x)->ob_outlet, ntotal, buf);
freebytes(buf, ntotal * sizeof(*buf));
}
}
@@ -119,7 +155,11 @@ static void append_anything(t_append *x, t_symbol *s, int ac, t_atom *av)
static void append_bang(t_append *x)
{
- /* CHECKED: a nop */
+ if (appendps_compatibility == appendps_max)
+ {
+ /* CHECKED: a nop */
+ }
+ else append_anything(x, 0, 0, 0);
}
static void append_float(t_append *x, t_float f)
@@ -203,10 +243,11 @@ static void append_doset(t_append *x, t_symbol *s, int ac, t_atom *av)
static void append_set(t_append *x, t_symbol *s, int ac, t_atom *av)
{
- if (shared_getmaxcompatibility())
- append_doset(x, 0, ac, av);
- else
+ if (x->x_proxy)
append_anything(x, s, ac, av);
+ else
+ /* LATER (when?) controlled by maxmode */
+ append_doset(x, 0, ac, av);
}
static void appendxy_bang(t_appendxy *xy)
@@ -253,7 +294,7 @@ static void append_free(t_append *x)
freebytes(x->x_messbuf, x->x_size * sizeof(*x->x_messbuf));
if (x->x_auxbuf)
{
- bug("append_free"); /* LATER rethink */
+ loudbug_bug("append_free"); /* LATER rethink */
freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf));
}
if (x->x_proxy)
@@ -269,7 +310,6 @@ static void *append_new(t_symbol *s, int ac, t_atom *av)
x->x_auxbuf = 0;
x->x_entered = 0;
append_setnatoms(x, 0);
- shared_usecompatibility();
if (ac)
{
x->x_proxy = 0;
@@ -307,4 +347,7 @@ void Append_setup(void)
class_addsymbol(appendxy_class, appendxy_symbol);
class_addlist(appendxy_class, appendxy_list);
class_addanything(appendxy_class, appendxy_anything);
+
+ appendps_max = gensym("max");
+ fitter_setup(append_class, &appendps_compatibility, 0);
}
diff --git a/cyclone/hammer/Decode.c b/cyclone/hammer/Decode.c
index 77d8f38..0342594 100644
--- a/cyclone/hammer/Decode.c
+++ b/cyclone/hammer/Decode.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -7,6 +7,7 @@
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define DECODE_C74MAXOUTS 8 /* CHECKED (does it make any sense?) */
#define DECODE_DEFOUTS 1
@@ -78,8 +79,7 @@ static void *Decode_new(t_floatarg val)
nouts = DECODE_DEFOUTS;
if (nouts > DECODE_C74MAXOUTS)
{
- shared_usecompatibility();
- loud_incompatible_max(Decode_class, DECODE_C74MAXOUTS, "outlets");
+ fittermax_rangewarning(Decode_class, DECODE_C74MAXOUTS, "outlets");
if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs))))
return (0);
}
@@ -108,4 +108,5 @@ void Decode_setup(void)
gensym("ft1"), A_FLOAT, 0);
class_addmethod(Decode_class, (t_method)Decode_alloff,
gensym("ft2"), A_FLOAT, 0);
+ fitter_setup(Decode_class, 0, 0);
}
diff --git a/cyclone/hammer/Makefile.objects b/cyclone/hammer/Makefile.objects
index 78bff7e..eb54f17 100644
--- a/cyclone/hammer/Makefile.objects
+++ b/cyclone/hammer/Makefile.objects
@@ -4,6 +4,7 @@ unstable/fragile.o \
unstable/fringe.o \
common/loud.o \
common/grow.o \
+common/fitter.o \
common/rand.o \
common/vefl.o \
common/mifi.o \
diff --git a/cyclone/hammer/Table.c b/cyclone/hammer/Table.c
index 66543e3..a120f13 100644
--- a/cyclone/hammer/Table.c
+++ b/cyclone/hammer/Table.c
@@ -358,7 +358,7 @@ static t_tablecommon *table_checkcommon(t_table *x)
x->x_common != (t_tablecommon *)pd_findbyclass(x->x_name,
tablecommon_class))
{
- bug("table_checkcommon");
+ loudbug_bug("table_checkcommon");
return (0);
}
return (x->x_common);
@@ -796,7 +796,7 @@ static void table_debug(t_table *x, t_floatarg f)
t_table *x1 = cc->c_refs;
int i = 0;
while (x1) i++, x1 = x1->x_next;
- post("refcount %d", i);
+ loudbug_post("refcount %d", i);
}
}
#endif
diff --git a/cyclone/hammer/bangbang.c b/cyclone/hammer/bangbang.c
index d1eb53a..5ae3506 100644
--- a/cyclone/hammer/bangbang.c
+++ b/cyclone/hammer/bangbang.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -7,6 +7,7 @@
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define BANGBANG_MINOUTS 1
#define BANGBANG_C74MAXOUTS 40 /* CHECKED (just clipped without warning) */
@@ -47,10 +48,7 @@ static void *bangbang_new(t_floatarg val)
if (nouts < BANGBANG_MINOUTS)
nouts = BANGBANG_DEFOUTS;
if (nouts > BANGBANG_C74MAXOUTS)
- {
- shared_usecompatibility();
- loud_incompatible_max(bangbang_class, BANGBANG_C74MAXOUTS, "outlets");
- }
+ fittermax_rangewarning(bangbang_class, BANGBANG_C74MAXOUTS, "outlets");
if (nouts > BANGBANG_DEFOUTS)
{
if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs))))
@@ -73,4 +71,5 @@ void bangbang_setup(void)
sizeof(t_bangbang), 0, A_DEFFLOAT, 0);
class_addbang(bangbang_class, bangbang_bang);
class_addanything(bangbang_class, bangbang_anything);
+ fitter_setup(bangbang_class, 0, 0);
}
diff --git a/cyclone/hammer/coll.c b/cyclone/hammer/coll.c
index ee2da0c..a0644c8 100644
--- a/cyclone/hammer/coll.c
+++ b/cyclone/hammer/coll.c
@@ -143,25 +143,6 @@ static int collelem_less(t_collelem *ep1, t_collelem *ep2, int ndx)
}
}
-static void collelem_post(t_collelem *ep)
-{
- if (ep->e_hasnumkey && ep->e_symkey)
- startpost("%d %s:", ep->e_numkey, ep->e_symkey->s_name);
- else if (ep->e_hasnumkey)
- startpost("%d:", ep->e_numkey);
- else if (ep->e_symkey)
- startpost("%s:", ep->e_symkey->s_name);
- else bug("collcommon_post");
- postatom(ep->e_size, ep->e_data);
- endpost();
-}
-
-static void collcommon_post(t_collcommon *cc)
-{
- t_collelem *ep;
- for (ep = cc->c_first; ep; ep = ep->e_next) collelem_post(ep);
-}
-
static t_collelem *collcommon_numkey(t_collcommon *cc, int numkey)
{
t_collelem *ep;
@@ -294,7 +275,7 @@ static void collcommon_putbefore(t_collcommon *cc,
next->e_prev = ep;
}
else if (cc->c_first || cc->c_last)
- bug("collcommon_putbefore");
+ loudbug_bug("collcommon_putbefore");
else
cc->c_first = cc->c_last = ep;
collcommon_modified(cc, 1);
@@ -313,7 +294,7 @@ static void collcommon_putafter(t_collcommon *cc,
prev->e_next = ep;
}
else if (cc->c_first || cc->c_last)
- bug("collcommon_putafter");
+ loudbug_bug("collcommon_putafter");
else
cc->c_first = cc->c_last = ep;
collcommon_modified(cc, 1);
@@ -363,7 +344,7 @@ static void collcommon_swaplinks(t_collcommon *cc,
collcommon_putafter(cc, ep1, prev2);
collcommon_putbefore(cc, ep2, next1);
}
- else bug("collcommon_swaplinks");
+ else loudbug_bug("collcommon_swaplinks");
}
}
@@ -780,7 +761,7 @@ static t_collcommon *coll_checkcommon(t_coll *x)
x->x_common != (t_collcommon *)pd_findbyclass(x->x_name,
collcommon_class))
{
- bug("coll_checkcommon");
+ loudbug_bug("coll_checkcommon");
return (0);
}
return (x->x_common);
@@ -1237,7 +1218,7 @@ static void coll_next(t_coll *x)
if (cc->c_head)
coll_dooutput(x, cc->c_head->e_size, cc->c_head->e_data);
else if (!cc->c_selfmodified)
- bug("coll_next"); /* LATER rethink */
+ loudbug_bug("coll_next"); /* LATER rethink */
}
static void coll_prev(t_coll *x)
@@ -1257,7 +1238,7 @@ static void coll_prev(t_coll *x)
if (cc->c_head)
coll_dooutput(x, cc->c_head->e_size, cc->c_head->e_data);
else if (!cc->c_selfmodified)
- bug("coll_prev"); /* LATER rethink */
+ loudbug_bug("coll_prev"); /* LATER rethink */
}
static void coll_end(t_coll *x)
@@ -1488,6 +1469,25 @@ static void coll_click(t_coll *x, t_floatarg xpos, t_floatarg ypos,
}
#ifdef COLL_DEBUG
+static void collelem_post(t_collelem *ep)
+{
+ if (ep->e_hasnumkey && ep->e_symkey)
+ loudbug_startpost("%d %s:", ep->e_numkey, ep->e_symkey->s_name);
+ else if (ep->e_hasnumkey)
+ loudbug_startpost("%d:", ep->e_numkey);
+ else if (ep->e_symkey)
+ loudbug_startpost("%s:", ep->e_symkey->s_name);
+ else loudbug_bug("collcommon_post");
+ loudbug_postatom(ep->e_size, ep->e_data);
+ loudbug_endpost();
+}
+
+static void collcommon_post(t_collcommon *cc)
+{
+ t_collelem *ep;
+ for (ep = cc->c_first; ep; ep = ep->e_next) collelem_post(ep);
+}
+
static void coll_debug(t_coll *x, t_floatarg f)
{
t_collcommon *cc = coll_checkcommon(x);
@@ -1497,9 +1497,9 @@ static void coll_debug(t_coll *x, t_floatarg f)
t_collelem *ep, *last;
int i = 0;
while (x1) i++, x1 = x1->x_next;
- post("refcount %d", i);
+ loudbug_post("refcount %d", i);
for (ep = cc->c_first, last = 0; ep; ep = ep->e_next) last = ep;
- if (last != cc->c_last) bug("coll_debug: last element");
+ if (last != cc->c_last) loudbug_bug("coll_debug: last element");
collcommon_post(cc);
}
}
diff --git a/cyclone/hammer/comment.c b/cyclone/hammer/comment.c
index 567c5b1..8f885a6 100644
--- a/cyclone/hammer/comment.c
+++ b/cyclone/hammer/comment.c
@@ -81,7 +81,7 @@ static void comment_draw(t_comment *x)
if (reqsize > COMMENT_OUTBUFSIZE)
{
#ifdef COMMENT_DEBUG
- post("allocating %d outbuf bytes", reqsize);
+ loudbug_post("allocating %d outbuf bytes", reqsize);
#endif
if (!(outbuf = getbytes(reqsize)))
return;
@@ -125,7 +125,7 @@ static void comment_update(t_comment *x)
if (reqsize > COMMENT_OUTBUFSIZE)
{
#ifdef COMMENT_DEBUG
- post("allocating %d outbuf bytes", reqsize);
+ loudbug_post("allocating %d outbuf bytes", reqsize);
#endif
if (!(outbuf = getbytes(reqsize)))
return;
@@ -185,14 +185,14 @@ static void comment_validate(t_comment *x, t_glist *glist)
binbuf_gettext(x->x_binbuf, &x->x_textbuf, &x->x_textbufsize);
x->x_ready = 1;
#ifdef COMMENT_DEBUG
- post("validation done");
+ loudbug_post("validation done");
#endif
}
if (glist)
{
if (glist != x->x_glist)
{
- bug("comment_getcanvas");
+ loudbug_bug("comment_getcanvas");
x->x_glist = glist;
}
x->x_canvas = glist_getcanvas(glist);
@@ -203,7 +203,7 @@ static void comment_grabbedkey(void *z, t_floatarg f)
{
/* LATER think about replacing #key binding/comment_float() with grabbing */
#ifdef COMMENT_DEBUG
- post("comment_grabbedkey %g", f);
+ loudbug_post("comment_grabbedkey %g", f);
#endif
}
@@ -221,7 +221,7 @@ static void comment__bboxhook(t_comment *x, t_symbol *bindsym,
t_floatarg x2, t_floatarg y2)
{
#ifdef COMMENT_DEBUG
- post("bbox %g %g %g %g", x1, y1, x2, y2);
+ loudbug_post("bbox %g %g %g %g", x1, y1, x2, y2);
#endif
x->x_x1 = x1;
x->x_y1 = y1;
@@ -249,7 +249,7 @@ static void comment__clickhook(t_comment *x, t_symbol *s, int ac, t_atom *av)
}
else
{
- bug("comment__clickhook");
+ loudbug_bug("comment__clickhook");
return;
}
if (x->x_glist->gl_edit)
@@ -321,7 +321,7 @@ static void commentsink__bboxhook(t_pd *x, t_symbol *bindsym,
{
pd_unbind(x, bindsym); /* if so, no need for this binding anymore */
#ifdef COMMENT_DEBUG
- post("sink: %s unbound", bindsym->s_name);
+ loudbug_post("sink: %s unbound", bindsym->s_name);
#endif
}
}
@@ -368,7 +368,7 @@ static void comment_getrect(t_gobj *z, t_glist *glist,
x2 = x1 + width;
y2 = y1 + height - 2; /* LATER revisit */
#ifdef COMMENT_DEBUG
- post("estimated rectangle: %g %g %g %g", x1, y1, x2, y2);
+ loudbug_post("estimated rectangle: %g %g %g %g", x1, y1, x2, y2);
#endif
*xp1 = x1;
*yp1 = y1;
@@ -465,7 +465,7 @@ static void comment_vis(t_gobj *z, t_glist *glist, int vis)
#endif
/* FIXME should we test for having a window? */
#ifdef COMMENT_DEBUG
- post("deleting...");
+ loudbug_post("deleting...");
#endif
sys_vgui(".x%x.c delete %s\n", x->x_canvas, x->x_tag);
}
@@ -540,7 +540,7 @@ static void comment_float(t_comment *x, t_float f)
if (n == '\n' || !iscntrl(n))
{
#ifdef COMMENT_DEBUG
- post("%d accepted", n);
+ loudbug_post("%d accepted", n);
#endif
newsize = x->x_textbufsize+1;
x->x_textbuf = resizebytes(x->x_textbuf,
@@ -552,7 +552,7 @@ static void comment_float(t_comment *x, t_float f)
x->x_selstart = x->x_selstart + 1;
}
#ifdef COMMENT_DEBUG
- else post("%d rejected", n);
+ else loudbug_post("%d rejected", n);
#endif
x->x_selend = x->x_selstart;
x->x_glist->gl_editor->e_textdirty = 1;
@@ -560,17 +560,17 @@ static void comment_float(t_comment *x, t_float f)
comment_update(x);
}
}
- else bug("comment_float");
+ else loudbug_bug("comment_float");
donefloat:;
#ifdef COMMENT_DEBUG
- post("donefloat");
+ loudbug_post("donefloat");
#endif
}
static void comment_list(t_comment *x, t_symbol *s, int ac, t_atom *av)
{
if (!x->x_active)
- bug("comment_list");
+ loudbug_bug("comment_list");
else if (ac > 1 && av->a_type == A_FLOAT && (int)av->a_w.w_float
&& av[1].a_type == A_SYMBOL)
{
@@ -656,7 +656,7 @@ static void comment_list(t_comment *x, t_symbol *s, int ac, t_atom *av)
}
donelist:;
#ifdef COMMENT_DEBUG
- post("donelist");
+ loudbug_post("donelist");
#endif
}
@@ -664,7 +664,7 @@ static void comment_free(t_comment *x)
{
if (x->x_active)
{
- bug("comment_free");
+ loudbug_bug("comment_free");
pd_unbind((t_pd *)x, gensym("#key"));
pd_unbind((t_pd *)x, gensym("#keyname"));
}
diff --git a/cyclone/hammer/counter.c b/cyclone/hammer/counter.c
index 73cd841..0b29b3f 100644
--- a/cyclone/hammer/counter.c
+++ b/cyclone/hammer/counter.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -12,6 +12,7 @@
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define COUNTER_UP 0
#define COUNTER_DOWN 1
@@ -100,7 +101,7 @@ static void counter_dobang(t_counter *x, int notjam)
if (x->x_inc == 1)
{
/* min has changed, which should imply x->x_count == x->x_min */
- bug("counter_dobang (count < min)");
+ loudbug_bug("counter_dobang (count < min)");
}
else if (x->x_dir == COUNTER_UPDOWN)
{
@@ -316,16 +317,12 @@ static void *counter_new(t_floatarg f1, t_floatarg f2, t_floatarg f3)
int i2 = (int)f2;
int i3 = (int)f3;
int i;
- shared_usecompatibility();
- if (shared_getmaxcompatibility())
+ static int warned = 0;
+ if (fittermax_get() && !warned)
{
- static int warned = 0;
- if (!warned)
- {
- post("warning: counter is not fully compatible,\
+ post("warning: counter is not fully compatible,\
please report differences");
- warned = 1;
- }
+ warned = 1;
}
x->x_dir = COUNTER_UP;
x->x_inc = 1; /* previous value required by counter_dir() */
@@ -401,4 +398,5 @@ void counter_setup(void)
CLASS_PD | CLASS_NOINLET, 0);
class_addbang(counter_proxy_class, counter_proxy_bang);
class_addfloat(counter_proxy_class, counter_proxy_float);
+ fitter_setup(counter_class, 0, 0);
}
diff --git a/cyclone/hammer/cycle.c b/cyclone/hammer/cycle.c
index 244a64d..73f3b80 100644
--- a/cyclone/hammer/cycle.c
+++ b/cyclone/hammer/cycle.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -7,6 +7,7 @@
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
//#define CYCLE_USEEVENTNO
@@ -119,8 +120,7 @@ static void *cycle_new(t_floatarg f1, t_floatarg f2)
nouts = CYCLE_DEFOUTS;
if (nouts > CYCLE_C74MAXOUTS)
{
- shared_usecompatibility();
- loud_incompatible_max(cycle_class, CYCLE_C74MAXOUTS, "outlets");
+ fittermax_rangewarning(cycle_class, CYCLE_C74MAXOUTS, "outlets");
/* CHECKED: max clips with an error:
``perhaps you were trying to make an oscillator?'' */
}
@@ -151,4 +151,5 @@ void cycle_setup(void)
gensym("set"), A_FLOAT, 0); /* CHECKED: arg required */
class_addmethod(cycle_class, (t_method)cycle_thresh,
gensym("thresh"), A_FLOAT, 0);
+ fitter_setup(cycle_class, 0, 0);
}
diff --git a/cyclone/hammer/funbuff.c b/cyclone/hammer/funbuff.c
index ff4773b..cde29f3 100644
--- a/cyclone/hammer/funbuff.c
+++ b/cyclone/hammer/funbuff.c
@@ -349,7 +349,7 @@ static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_float *vec)
float frac = f - np1->n_key;
if (frac < 0 || frac >= delta)
{
- bug("funbuff_dointerp");
+ loudbug_bug("funbuff_dointerp");
return;
}
frac /= delta;
@@ -361,7 +361,7 @@ static void funbuff_dointerp(t_funbuff *x, t_floatarg f, int vsz, t_float *vec)
float vfrac = vpos - vndx;
if (vndx < 0 || vndx >= vsz - 1)
{
- bug("funbuff_dointerp redundant test...");
+ loudbug_bug("funbuff_dointerp redundant test...");
return;
}
vec += vndx;
diff --git a/cyclone/hammer/gate.c b/cyclone/hammer/gate.c
index 80210cb..6fa2ac5 100644
--- a/cyclone/hammer/gate.c
+++ b/cyclone/hammer/gate.c
@@ -1,9 +1,10 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define GATE_MINOUTS 1
#define GATE_C74MAXOUTS 100
@@ -100,10 +101,7 @@ static void *gate_new(t_floatarg f1, t_floatarg f2)
if (nouts < GATE_MINOUTS)
nouts = GATE_DEFOUTS;
if (nouts > GATE_C74MAXOUTS)
- {
- shared_usecompatibility();
- loud_incompatible_max(gate_class, GATE_C74MAXOUTS, "outlets");
- }
+ fittermax_rangewarning(gate_class, GATE_C74MAXOUTS, "outlets");
nouts++; /* for convenience (the cost is one pointer) */
if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs))))
return (0);
@@ -147,4 +145,5 @@ void gate_setup(void)
class_addpointer(gate_proxy_class, gate_proxy_pointer);
class_addlist(gate_proxy_class, gate_proxy_list);
class_addanything(gate_proxy_class, gate_proxy_anything);
+ fitter_setup(gate_class, 0, 0);
}
diff --git a/cyclone/hammer/hammer.c b/cyclone/hammer/hammer.c
index ea4642c..a728ec7 100644
--- a/cyclone/hammer/hammer.c
+++ b/cyclone/hammer/hammer.c
@@ -1,8 +1,7 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-#include <stdio.h>
#include "m_pd.h"
#include "unstable/fragile.h"
#include "common/loud.h"
@@ -15,6 +14,7 @@ typedef struct _hammer
{
t_object x_ob;
t_symbol *x_dir;
+ t_symbol *x_canvasdir;
t_hammerfile *x_filehandle;
} t_hammer;
@@ -29,7 +29,8 @@ static void hammer_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
static void hammer_doimport(t_hammer *x, t_symbol *fn, t_symbol *dir)
{
- if (!dir || dir == &s_) dir = x->x_dir;
+ if (!dir || dir == &s_)
+ dir = x->x_dir;
if (fn && fn != &s_)
import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
else
@@ -47,6 +48,17 @@ static void hammer_import(t_hammer *x, t_symbol *fn)
hammer_doimport(x, fn, 0);
}
+static void hammer_cd(t_hammer *x, t_symbol *dir)
+{
+ /* LATER hammerfile interface for relative jumps, etc. */
+ x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir);
+}
+
+static void hammer_pwd(t_hammer *x)
+{
+ outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir);
+}
+
static void hammer_bang(t_hammer *x)
{
fragile_class_printnames("hammer classes are: ",
@@ -58,11 +70,13 @@ static void hammer_free(t_hammer *x)
hammerfile_free(x->x_filehandle);
}
-static void *hammer_new(t_symbol *s)
+static void *hammer_new(void)
{
t_hammer *x = (t_hammer *)pd_new(hammer_class);
x->x_filehandle = hammerfile_new((t_pd *)x, 0, hammer_readhook, 0, 0);
- x->x_dir = (s && s != &s_ ? s : canvas_getdir(x->x_filehandle->f_canvas));
+ x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas);
+ x->x_dir = x->x_canvasdir;
+ outlet_new((t_object *)x, &s_symbol);
return (x);
}
@@ -87,8 +101,12 @@ void hammer_setup(void)
hammer_class = class_new(gensym("hammer"),
(t_newmethod)hammer_new,
(t_method)hammer_free,
- sizeof(t_hammer), 0, A_DEFSYM, 0);
+ sizeof(t_hammer), 0, 0);
class_addbang(hammer_class, hammer_bang);
+ class_addmethod(hammer_class, (t_method)hammer_cd,
+ gensym("cd"), A_DEFSYM, 0);
+ class_addmethod(hammer_class, (t_method)hammer_pwd,
+ gensym("pwd"), 0);
class_addmethod(hammer_class, (t_method)hammer_import,
gensym("import"), A_DEFSYM, 0);
class_addmethod(hammer_class, (t_method)hammer_click,
diff --git a/cyclone/hammer/maximum.c b/cyclone/hammer/maximum.c
index b5f6069..5f49765 100644
--- a/cyclone/hammer/maximum.c
+++ b/cyclone/hammer/maximum.c
@@ -1,9 +1,10 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define MAXIMUM_C74MAXITEMS 256
@@ -30,7 +31,7 @@ static void maximum_float(t_maximum *x, t_float f)
static void maximum_list(t_maximum *x, t_symbol *s, int ac, t_atom *av)
{
if (ac > MAXIMUM_C74MAXITEMS)
- loud_incompatible_max(*(t_pd *)x, MAXIMUM_C74MAXITEMS, "items");
+ fittermax_rangewarning(*(t_pd *)x, MAXIMUM_C74MAXITEMS, "items");
while (ac && av->a_type != A_FLOAT) ac--, av++; /* CHECKME (a warning?) */
if (ac)
{
@@ -75,7 +76,6 @@ static void *maximum_new(t_floatarg f)
t_maximum *x = (t_maximum *)pd_new(maximum_class);
x->x_last = 0; /* CHECKME */
x->x_test = f;
- shared_usecompatibility();
floatinlet_new((t_object *)x, &x->x_test);
outlet_new((t_object *)x, &s_float);
return (x);
@@ -89,4 +89,5 @@ void maximum_setup(void)
class_addbang(maximum_class, maximum_bang);
class_addfloat(maximum_class, maximum_float);
class_addlist(maximum_class, maximum_list);
+ fitter_setup(maximum_class, 0, 0);
}
diff --git a/cyclone/hammer/minimum.c b/cyclone/hammer/minimum.c
index 71875fc..a1124a5 100644
--- a/cyclone/hammer/minimum.c
+++ b/cyclone/hammer/minimum.c
@@ -1,9 +1,10 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define MINIMUM_C74MAXITEMS 256
@@ -30,7 +31,7 @@ static void minimum_float(t_minimum *x, t_float f)
static void minimum_list(t_minimum *x, t_symbol *s, int ac, t_atom *av)
{
if (ac > MINIMUM_C74MAXITEMS)
- loud_incompatible_max(*(t_pd *)x, MINIMUM_C74MAXITEMS, "items");
+ fittermax_rangewarning(*(t_pd *)x, MINIMUM_C74MAXITEMS, "items");
while (ac && av->a_type != A_FLOAT) ac--, av++; /* CHECKME (a warning?) */
if (ac)
{
@@ -75,7 +76,6 @@ static void *minimum_new(t_floatarg f)
t_minimum *x = (t_minimum *)pd_new(minimum_class);
x->x_last = 0; /* CHECKME */
x->x_test = f;
- shared_usecompatibility();
floatinlet_new((t_object *)x, &x->x_test);
outlet_new((t_object *)x, &s_float);
return (x);
@@ -89,4 +89,5 @@ void minimum_setup(void)
class_addbang(minimum_class, minimum_bang);
class_addfloat(minimum_class, minimum_float);
class_addlist(minimum_class, minimum_list);
+ fitter_setup(minimum_class, 0, 0);
}
diff --git a/cyclone/hammer/mtr.c b/cyclone/hammer/mtr.c
index 8b1b220..cf9927f 100644
--- a/cyclone/hammer/mtr.c
+++ b/cyclone/hammer/mtr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003 krzYszcz and others.
+/* Copyright (c) 2003-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -10,6 +10,7 @@
#include "m_pd.h"
#include "shared.h"
#include "common/loud.h"
+#include "common/fitter.h"
#include "hammer/file.h"
#ifdef KRZYSZCZ
@@ -181,7 +182,7 @@ static void mtrack_setmode(t_mtrack *tp, int newmode)
mtrack_donext(tp);
break;
default:
- bug("mtrack_setmode");
+ loudbug_bug("mtrack_setmode");
}
}
@@ -286,7 +287,7 @@ static t_atom *mtrack_getdelay(t_mtrack *tp)
return (ap);
ap++;
}
- bug("mtrack_getdelay");
+ loudbug_bug("mtrack_getdelay");
}
return (0);
}
@@ -338,14 +339,11 @@ static void mtrack_write(t_mtrack *tp, t_symbol *s)
static void mtrack_tempo(t_mtrack *tp, t_floatarg f)
{
float newtempo;
- if (shared_getmaxcompatibility())
+ static int warned = 0;
+ if (fittermax_get() && !warned)
{
- static int warned = 0;
- if (!warned)
- {
- loud_incompatible(mtr_class, "no 'tempo' control in Max");
- warned = 1;
- }
+ fittermax_warning(mtr_class, "no 'tempo' control in Max");
+ warned = 1;
}
if (f < 1e-20)
f = 1e-20;
@@ -703,8 +701,8 @@ static void mtr_debug(t_mtr *x)
t_mtrack **tpp = x->x_tracks;
while (ntracks--)
{
- post("------- Track %d -------", (*tpp)->tr_id);
- binbuf_print((*tpp++)->tr_binbuf);
+ loudbug_post("------- Track %d -------", (*tpp)->tr_id);
+ loudbug_postbinbuf((*tpp++)->tr_binbuf);
}
}
#endif
@@ -762,9 +760,8 @@ static void *mtr_new(t_floatarg f)
x->x_glist = canvas_getcurrent();
x->x_filehandle = hammerfile_new((t_pd *)x, 0,
mtr_readhook, mtr_writehook, 0);
- shared_usecompatibility();
if (ntracks > MTR_C74MAXTRACKS)
- loud_incompatible_max(mtr_class, MTR_C74MAXTRACKS, "tracks");
+ fittermax_rangewarning(mtr_class, MTR_C74MAXTRACKS, "tracks");
x->x_ntracks = ntracks;
x->x_tracks = tracks;
for (id = 1; id <= ntracks; id++, tracks++) /* CHECKED 1-based */
@@ -863,4 +860,5 @@ void mtr_setup(void)
gensym("debug"), 0);
#endif
hammerfile_setup(mtr_class, 0);
+ fitter_setup(mtr_class, 0, 0);
}
diff --git a/cyclone/hammer/past.c b/cyclone/hammer/past.c
index bf4300c..553ccfa 100644
--- a/cyclone/hammer/past.c
+++ b/cyclone/hammer/past.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -12,6 +12,7 @@
#include "m_pd.h"
#include "common/loud.h"
#include "common/grow.h"
+#include "common/fitter.h"
#define PAST_C74MAXSIZE 8 /* CHECKED */
@@ -112,8 +113,7 @@ static void past_set(t_past *x, t_symbol *s, int ac, t_atom *av)
t_atom *vp = x->x_thresh;
if (ac > x->x_size)
{
- shared_usecompatibility();
- loud_incompatible_max(past_class, PAST_C74MAXSIZE, "guard points");
+ fittermax_rangewarning(past_class, PAST_C74MAXSIZE, "guard points");
x->x_thresh = grow_nodata(&ac, &x->x_size, x->x_thresh,
PAST_C74MAXSIZE, x->x_thrini,
sizeof(*x->x_thresh));
@@ -152,4 +152,5 @@ void past_setup(void)
class_addlist(past_class, past_list);
class_addmethod(past_class, (t_method)past_clear, gensym("clear"), 0);
class_addmethod(past_class, (t_method)past_set, gensym("set"), A_GIMME, 0);
+ fitter_setup(past_class, 0, 0);
}
diff --git a/cyclone/hammer/prepend.c b/cyclone/hammer/prepend.c
index 1b3bd73..2dbe7be 100644
--- a/cyclone/hammer/prepend.c
+++ b/cyclone/hammer/prepend.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -6,6 +6,7 @@
#include "m_pd.h"
#include "common/loud.h"
#include "common/grow.h"
+#include "common/fitter.h"
#define PREPEND_INISIZE 32 /* LATER rethink */
#define PREPEND_MAXSIZE 256
@@ -33,6 +34,9 @@ typedef struct _prependxy
static t_class *prepend_class;
static t_class *prependxy_class;
+static t_symbol *prependps_compatibility = 0;
+static t_symbol *prependps_max;
+
/* Usually a preallocation method is used, except in special cases of:
1) reentrant output request, or 2) an output request which would cause
resizing to more than MAXSIZE (no such limit for a 'set' message).
@@ -149,9 +153,13 @@ static void prepend_bang(t_prepend *x)
{
if (x->x_selector)
{
- t_atom at;
- SETSYMBOL(&at, &s_bang); /* CHECKED */
- prepend_doanything(x, 0, 1, &at);
+ if (prependps_compatibility == prependps_max)
+ {
+ t_atom at;
+ SETSYMBOL(&at, &s_bang); /* CHECKED */
+ prepend_doanything(x, 0, 1, &at);
+ }
+ else prepend_doanything(x, 0, 0, 0);
}
else outlet_bang(((t_object *)x)->ob_outlet);
}
@@ -252,10 +260,11 @@ static void prepend_doset(t_prepend *x, t_symbol *s, int ac, t_atom *av)
static void prepend_set(t_prepend *x, t_symbol *s, int ac, t_atom *av)
{
- if (shared_getmaxcompatibility())
- prepend_doset(x, 0, ac, av);
- else
+ if (x->x_proxy)
prepend_anything(x, s, ac, av);
+ else
+ /* LATER (when?) controlled by maxmode */
+ prepend_doset(x, 0, ac, av);
}
static void prependxy_bang(t_prependxy *xy)
@@ -292,7 +301,7 @@ static void prepend_free(t_prepend *x)
freebytes(x->x_message, x->x_size * sizeof(*x->x_message));
if (x->x_auxbuf)
{
- bug("prepend_free"); /* LATER rethink */
+ loudbug_bug("prepend_free"); /* LATER rethink */
freebytes(x->x_auxbuf, x->x_auxsize * sizeof(*x->x_auxbuf));
}
if (x->x_proxy)
@@ -308,7 +317,6 @@ static void *prepend_new(t_symbol *s, int ac, t_atom *av)
x->x_message = x->x_messini;
x->x_auxbuf = 0;
x->x_entered = 0;
- shared_usecompatibility();
if (ac)
{
x->x_proxy = 0;
@@ -316,11 +324,10 @@ static void *prepend_new(t_symbol *s, int ac, t_atom *av)
}
else
{
- if (shared_getmaxcompatibility())
- /* CHECKED: this is still not compatible -- in max an object
- without an outlet is created, and there is no warning when
- loading from a file. */
- loud_incompatible(prepend_class,
+ if (prependps_compatibility == prependps_max)
+ /* CHECKED in max an object without an outlet is created,
+ and there is no warning when loading from a file. */
+ fittermax_warning(prepend_class,
"creating an object without an argument");
x->x_proxy = pd_new(prependxy_class);
((t_prependxy *)x->x_proxy)->xy_owner = x;
@@ -352,4 +359,7 @@ void prepend_setup(void)
class_addsymbol(prependxy_class, prependxy_symbol);
class_addlist(prependxy_class, prependxy_list);
class_addanything(prependxy_class, prependxy_anything);
+
+ prependps_max = gensym("max");
+ fitter_setup(prepend_class, &prependps_compatibility, 0);
}
diff --git a/cyclone/hammer/prob.c b/cyclone/hammer/prob.c
index 6053808..8772d83 100644
--- a/cyclone/hammer/prob.c
+++ b/cyclone/hammer/prob.c
@@ -1,10 +1,11 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include <stdio.h>
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#include "common/rand.h"
#include "hammer/file.h"
@@ -144,9 +145,9 @@ static void prob_bang(t_prob *x)
nextstate->tr_value);
x->x_state = nextstate;
}
- else bug("prob_bang: void suffix");
+ else loudbug_bug("prob_bang: void suffix");
}
- else bug("prob_bang: search overflow");
+ else loudbug_bug("prob_bang: search overflow");
}
else
{
@@ -238,7 +239,7 @@ static void prob__silent(t_prob *x)
{
if (!x->x_silent)
{
- loud_incompatible(prob_class, "no '_silent' message in max");
+ fittermax_warning(prob_class, "no '_silent' message in max");
x->x_silent = 1;
}
}
@@ -276,7 +277,6 @@ static void *prob_new(void)
x->x_embedmode = 0; /* CHECKED */
x->x_silent = 0;
rand_seed(&x->x_seed, 0);
- shared_usecompatibility();
outlet_new((t_object *)x, &s_float);
x->x_bangout = outlet_new((t_object *)x, &s_bang);
x->x_filehandle = hammerfile_new((t_pd *)x, prob_embedhook, 0, 0, 0);
@@ -307,4 +307,5 @@ void prob_setup(void)
gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
hammerfile_setup(prob_class, 1);
+ fitter_setup(prob_class, 0, 0);
}
diff --git a/cyclone/hammer/pv.c b/cyclone/hammer/pv.c
index 235da2c..a444b51 100644
--- a/cyclone/hammer/pv.c
+++ b/cyclone/hammer/pv.c
@@ -75,7 +75,7 @@ static t_pvlist *pv_getlist(t_symbol *s, int create)
pl->l_pvlist = 0;
pd_bind(&pl->l_pd, s);
}
- else bug("pv_getlist");
+ else loudbug_bug("pv_getlist");
}
return (pl);
}
@@ -193,9 +193,9 @@ static t_pvfamily *pv_getfamily(t_glist *glist, t_symbol *s,
if (pf->f_glist == gl)
{
if (mypf)
- bug("pv_getfamily 1: %s in %s",
- mypf->f_name->s_name,
- mypf->f_glist->gl_name->s_name);
+ loudbug_bug("pv_getfamily 1: %s in %s",
+ mypf->f_name->s_name,
+ mypf->f_glist->gl_name->s_name);
else
return (0);
}
@@ -220,12 +220,12 @@ static t_pvfamily *pv_getfamily(t_glist *glist, t_symbol *s,
break;
}
}
- if (!pf) bug("pv_getfamily 2");
+ if (!pf) loudbug_bug("pv_getfamily 2");
}
pvfamily_free(mypf);
}
}
- else bug("pv_getfamily 3");
+ else loudbug_bug("pv_getfamily 3");
pvlist_decrement(pl);
}
else
@@ -244,10 +244,10 @@ static t_pvfamily *pv_getfamily(t_glist *glist, t_symbol *s,
pv_update(glist, pf);
return (pf);
}
- else bug("pv_getfamily 4");
+ else loudbug_bug("pv_getfamily 4");
}
}
- else bug("pv_getfamily 5");
+ else loudbug_bug("pv_getfamily 5");
return (0);
}
@@ -255,7 +255,7 @@ static t_pvfamily *pv_checkfamily(t_pv *x)
{
if (!x->x_family)
{
- bug("pv_checkfamily");
+ loudbug_bug("pv_checkfamily");
x->x_family = pv_getfamily(x->x_glist, x->x_name, 0, 0);
}
return (x->x_family);
diff --git a/cyclone/hammer/seq.c b/cyclone/hammer/seq.c
index c239478..97fd733 100644
--- a/cyclone/hammer/seq.c
+++ b/cyclone/hammer/seq.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -11,6 +11,7 @@
#include "shared.h"
#include "common/loud.h"
#include "common/grow.h"
+#include "common/fitter.h"
#include "common/mifi.h"
#include "unstable/forky.h"
#include "hammer/file.h"
@@ -101,7 +102,7 @@ static int seq_dogrowing(t_seq *x, int nevents, int ntempi)
{
int nrequested = nevents;
#ifdef SEQ_DEBUG
- post("growing for %d events...", nevents);
+ loudbug_post("growing for %d events...", nevents);
#endif
x->x_sequence =
grow_nodata(&nrequested, &x->x_seqsize, x->x_sequence,
@@ -117,7 +118,7 @@ static int seq_dogrowing(t_seq *x, int nevents, int ntempi)
{
int nrequested = ntempi;
#ifdef SEQ_DEBUG
- post("growing for %d tempi...", ntempi);
+ loudbug_post("growing for %d tempi...", ntempi);
#endif
x->x_tempomap =
grow_nodata(&nrequested, &x->x_tempomapsize, x->x_tempomap,
@@ -157,7 +158,7 @@ static void seq_complete(t_seq *x)
/* store-ahead scheme, LATER consider using x_currevent */
int nrequested = x->x_nevents + 1;
#ifdef SEQ_DEBUG
- post("growing...");
+ loudbug_post("growing...");
#endif
x->x_sequence =
grow_withdata(&nrequested, &nexisting,
@@ -212,7 +213,7 @@ static void seq_addbyte(t_seq *x, unsigned char c, int docomplete)
else if (x->x_evelength == 4)
{
if (x->x_status != 240)
- bug("seq_addbyte");
+ loudbug_bug("seq_addbyte");
/* CHECKED sysex is broken into 4-byte packets marked with
the actual delta time of last byte received in a packet */
seq_complete(x);
@@ -323,7 +324,7 @@ static void seq_setmode(t_seq *x, int newmode)
seq_stopslavery(x);
break;
default:
- bug("seq_setmode (old)");
+ loudbug_bug("seq_setmode (old)");
return;
}
x->x_mode = newmode;
@@ -342,7 +343,7 @@ static void seq_setmode(t_seq *x, int newmode)
seq_startslavery(x, changed);
break;
default:
- bug("seq_setmode (new)");
+ loudbug_bug("seq_setmode (new)");
}
}
@@ -422,13 +423,13 @@ static void seq_tick(t_seq *x)
return;
clock_delay(x->x_slaveclock, elapsed);
seq_settimescale(x, (float)(elapsed * (SEQ_TICKSPERSEC / 1000.)));
- if (x->x_prevtime > 0)
+ if (x->x_prevtime > 0.)
{
x->x_clockdelay -= clock_gettimesince(x->x_prevtime);
x->x_clockdelay *= x->x_newtimescale / x->x_timescale;
}
else x->x_clockdelay =
- x->x_sequence[x->x_playhead].e_delta * x->x_newtimescale;
+ x->x_sequence[x->x_playhead].e_delta * x->x_newtimescale;
if (x->x_clockdelay < 0.)
x->x_clockdelay = 0.;
clock_delay(x->x_clock, x->x_clockdelay);
@@ -547,6 +548,73 @@ static void seq_hook(t_seq *x, t_floatarg f)
}
}
+static void seq_pause(t_seq *x)
+{
+ static int warned = 0;
+ if (fittermax_get() && !warned)
+ {
+ fittermax_warning(*(t_pd *)x, "'pause' not supported in Max");
+ warned = 1;
+ }
+ if (x->x_mode == SEQ_PLAYMODE && x->x_prevtime > 0.)
+ {
+ x->x_clockdelay -= clock_gettimesince(x->x_prevtime);
+ if (x->x_clockdelay < 0.)
+ x->x_clockdelay = 0.;
+ clock_unset(x->x_clock);
+ x->x_prevtime = 0.;
+ }
+}
+
+static void seq_continue(t_seq *x)
+{
+ static int warned = 0;
+ if (fittermax_get() && !warned)
+ {
+ fittermax_warning(*(t_pd *)x, "'continue' not supported in Max");
+ warned = 1;
+ }
+ if (x->x_mode == SEQ_PLAYMODE)
+ {
+ if (x->x_clockdelay < 0.)
+ x->x_clockdelay = 0.;
+ clock_delay(x->x_clock, x->x_clockdelay);
+ x->x_prevtime = clock_getlogicaltime();
+ }
+}
+
+static void seq_goto(t_seq *x, t_floatarg f1, t_floatarg f2)
+{
+ static int warned = 0;
+ if (fittermax_get() && !warned)
+ {
+ fittermax_warning(*(t_pd *)x, "'goto' not supported in Max");
+ warned = 1;
+ }
+ if (x->x_nevents && x->x_mode == SEQ_PLAYMODE)
+ {
+ t_seqevent *ev;
+ int ndx, nevents = x->x_nevents;
+ double ms = f1 * 1000. + f2, sum;
+ if (ms < SEQ_TICKEPSILON)
+ ms = 0.;
+ for (ndx = 0, ev = x->x_sequence, sum = SEQ_TICKEPSILON; ndx < nevents;
+ ndx++, ev++)
+ {
+ if ((sum += ev->e_delta) >= ms)
+ {
+ x->x_playhead = ndx;
+ x->x_clockdelay = sum - SEQ_TICKEPSILON - ms;
+ if (x->x_clockdelay < 0.)
+ x->x_clockdelay = 0.;
+ clock_delay(x->x_clock, x->x_clockdelay);
+ x->x_prevtime = clock_getlogicaltime();
+ break;
+ }
+ }
+ }
+}
+
static int seq_eventcomparehook(const void *e1, const void *e2)
{
return (((t_seqevent *)e1)->e_delta > ((t_seqevent *)e2)->e_delta ? 1 : -1);
@@ -584,7 +652,7 @@ static int seq_mrhook(t_mifiread *mr, void *hookdata, int evtype)
}
else if (x->x_eventreadhead == x->x_nevents)
{
- bug("seq_mrhook 1");
+ loudbug_bug("seq_mrhook 1");
x->x_eventreadhead++;
}
}
@@ -596,12 +664,12 @@ static int seq_mrhook(t_mifiread *mr, void *hookdata, int evtype)
stm->t_scoretime = scoretime;
stm->t_sr = mifiread_gettempo(mr);
#ifdef SEQ_DEBUG
- post("tempo %g at %g", stm->t_sr, scoretime);
+ loudbug_post("tempo %g at %g", stm->t_sr, scoretime);
#endif
}
else if (x->x_temporeadhead == x->x_ntempi)
{
- bug("seq_mrhook 2");
+ loudbug_bug("seq_mrhook 2");
x->x_temporeadhead++;
}
}
@@ -641,13 +709,13 @@ static int seq_mfread(t_seq *x, char *path)
if (!mifiread_open(mr, path, "", 0))
goto mfreadfailed;
#ifdef SEQ_DEBUG
- startpost("midifile (format %d): %d tracks, %d ticks",
- mifiread_getformat(mr), mifiread_gethdtracks(mr),
- mifiread_getbeatticks(mr));
+ loudbug_startpost("midifile (format %d): %d tracks, %d ticks",
+ mifiread_getformat(mr), mifiread_gethdtracks(mr),
+ mifiread_getbeatticks(mr));
if (mifiread_getnframes(mr))
- post(" (%d smpte frames)", mifiread_getnframes(mr));
+ loudbug_post(" (%d smpte frames)", mifiread_getnframes(mr));
else
- post(" per beat");
+ loudbug_post(" per beat");
#endif
if (!seq_dogrowing(x, mifiread_getnevents(mr), mifiread_getntempi(mr)))
goto mfreadfailed;
@@ -657,8 +725,9 @@ static int seq_mfread(t_seq *x, char *path)
goto mfreadfailed;
if (x->x_eventreadhead < x->x_nevents)
{
- bug("seq_mfread 1");
- post("declared %d events, got %d", x->x_nevents, x->x_eventreadhead);
+ loudbug_bug("seq_mfread 1");
+ loudbug_post("declared %d events, got %d",
+ x->x_nevents, x->x_eventreadhead);
x->x_nevents = x->x_eventreadhead;
}
if (x->x_nevents)
@@ -666,8 +735,9 @@ static int seq_mfread(t_seq *x, char *path)
seq_eventcomparehook);
if (x->x_temporeadhead < x->x_ntempi)
{
- bug("seq_mfread 2");
- post("declared %d tempi, got %d", x->x_ntempi, x->x_temporeadhead);
+ loudbug_bug("seq_mfread 2");
+ loudbug_post("declared %d tempi, got %d",
+ x->x_ntempi, x->x_temporeadhead);
x->x_ntempi = x->x_temporeadhead;
}
if (x->x_ntempi)
@@ -675,7 +745,7 @@ static int seq_mfread(t_seq *x, char *path)
seq_tempocomparehook);
seq_foldtime(x, mifiread_getdeftempo(mr));
#ifdef SEQ_DEBUG
- post("seq: got %d events from midi file", x->x_nevents);
+ loudbug_post("seq: got %d events from midi file", x->x_nevents);
#endif
result = 1;
mfreadfailed:
@@ -982,7 +1052,7 @@ static void *seq_new(t_symbol *s)
{
t_seq *x = (t_seq *)pd_new(seq_class);
static int warned = 0;
- if (!warned)
+ if (fittermax_get() && !warned)
{
loud_warning((t_pd *)x, 0, "seq is not ready yet");
warned = 1;
@@ -1046,6 +1116,15 @@ void seq_setup(void)
gensym("write"), A_DEFSYM, 0);
class_addmethod(seq_class, (t_method)seq_print,
gensym("print"), 0);
+
+ class_addmethod(seq_class, (t_method)seq_pause,
+ gensym("pause"), 0);
+ class_addmethod(seq_class, (t_method)seq_continue,
+ gensym("continue"), 0);
+ class_addmethod(seq_class, (t_method)seq_goto,
+ gensym("goto"), A_DEFFLOAT, A_DEFFLOAT, 0);
+
forky_setpropertiesfn(seq_class, seq_properties);
hammerfile_setup(seq_class, 0);
+ fitter_setup(seq_class, 0, 0);
}
diff --git a/cyclone/hammer/sprintf.c b/cyclone/hammer/sprintf.c
index 47d94ec..8c9aefd 100644
--- a/cyclone/hammer/sprintf.c
+++ b/cyclone/hammer/sprintf.c
@@ -121,18 +121,18 @@ static void sprintf_proxy_checkit(t_sprintf_proxy *x, char *buf, int checkin)
}
*pattend = tmp;
}
- else bug("sprintf_proxy_checkit");
+ else loudbug_bug("sprintf_proxy_checkit");
if (x->p_valid = valid)
{
#ifdef SPRINTF_DEBUG
- if (checkin) post("[%d in \"%s\"]", result, buf);
+ if (checkin) loudbug_post("[%d in \"%s\"]", result, buf);
#endif
x->p_size = result;
}
else
{
#ifdef SPRINTF_DEBUG
- if (checkin) post("checkit failed");
+ if (checkin) loudbug_post("checkit failed");
#endif
x->p_size = 0;
}
@@ -553,7 +553,7 @@ static void *sprintf_new(t_symbol *s, int ac, t_atom *av)
return (x);
}
#ifdef SPRINTF_DEBUG
- post("%d slots:", nproxies);
+ loudbug_post("%d slots:", nproxies);
#endif
/* CHECKED: max creates as many inlets, as there are %-signs, no matter
if they are valid, or not -- if not, it prints ``can't convert'' errors
@@ -589,8 +589,8 @@ static void *sprintf_new(t_symbol *s, int ac, t_atom *av)
#ifdef SPRINTF_DEBUG
char tmp = *p1;
*p1 = 0;
- poststring(p2);
- endpost();
+ loudbug_poststring(p2);
+ loudbug_endpost();
*p1 = tmp;
#endif
if (i < nslots)
@@ -615,7 +615,7 @@ static void *sprintf_new(t_symbol *s, int ac, t_atom *av)
}
}
#ifdef SPRINTF_DEBUG
- post("printf(\"%s\", ...)", fstring);
+ loudbug_post("printf(\"%s\", ...)", fstring);
#endif
outlet_new((t_object *)x, &s_anything);
return (x);
diff --git a/cyclone/hammer/switch.c b/cyclone/hammer/switch.c
index 03c9f7f..ce985de 100644
--- a/cyclone/hammer/switch.c
+++ b/cyclone/hammer/switch.c
@@ -1,9 +1,10 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#define SWITCH_MININLETS 2 /* LATER consider using 1 (with a warning) */
#define SWITCH_C74MAXINLETS 100
@@ -103,10 +104,7 @@ static void *switch_new(t_floatarg f1, t_floatarg f2)
if (nproxies < SWITCH_MININLETS)
nproxies = SWITCH_DEFINLETS;
if (nproxies > SWITCH_C74MAXINLETS)
- {
- shared_usecompatibility();
- loud_incompatible_max(switch_class, SWITCH_C74MAXINLETS, "inlets");
- }
+ fittermax_rangewarning(switch_class, SWITCH_C74MAXINLETS, "inlets");
if (!(proxies = (t_pd **)getbytes(nproxies * sizeof(*proxies))))
return (0);
for (ninlets = 0; ninlets < nproxies; ninlets++)
@@ -152,4 +150,5 @@ void switch_setup(void)
class_addpointer(switch_proxy_class, switch_proxy_pointer);
class_addlist(switch_proxy_class, switch_proxy_list);
class_addanything(switch_proxy_class, switch_proxy_anything);
+ fitter_setup(switch_class, 0, 0);
}
diff --git a/cyclone/hammer/tosymbol.c b/cyclone/hammer/tosymbol.c
index 8b45ad0..3b5feff 100644
--- a/cyclone/hammer/tosymbol.c
+++ b/cyclone/hammer/tosymbol.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <string.h>
#include "m_pd.h"
+#include "common/loud.h"
#include "common/grow.h"
#define TOSYMBOL_INISTRING 128 /* LATER rethink */
@@ -99,7 +100,7 @@ static int tosymbol_parse(t_symbol *s, int ac, t_atom *av, t_symbol *separator,
}
if (nleft < 0)
{
- bug("tosymbol_parse");
+ loudbug_bug("tosymbol_parse");
return (bufsize);
}
return (bufsize - nleft);
@@ -111,7 +112,7 @@ static void tosymbol_anything(t_tosymbol *x, t_symbol *s, int ac, t_atom *av)
{
if (tosymbol_bufferlocked)
{
- bug("tosymbol_anything");
+ loudbug_bug("tosymbol_anything");
tosymbol_parse(s, ac, av, x->x_separator,
x->x_bufsize, x->x_buffer);
}
diff --git a/cyclone/hammer/urn.c b/cyclone/hammer/urn.c
index f496616..b02d891 100644
--- a/cyclone/hammer/urn.c
+++ b/cyclone/hammer/urn.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -9,8 +9,9 @@
#include "m_pd.h"
#include "common/loud.h"
-#include "common/rand.h"
#include "common/grow.h"
+#include "common/fitter.h"
+#include "common/rand.h"
#define URN_INISIZE 128 /* LATER rethink */
#define URN_C74MAXSIZE 4096 /* CHECKED */
@@ -56,7 +57,7 @@ static int urn_resize(t_urn *x, t_float f, int init)
range = URN_MAXSIZE;
}
if (range > maxmax)
- loud_incompatible_max(urn_class, maxmax, "elements");
+ fittermax_rangewarning(urn_class, maxmax, "elements");
x->x_range = range;
if (range > x->x_size)
x->x_urn = grow_nodata(&x->x_range, &x->x_size, x->x_urn,
@@ -122,7 +123,6 @@ static void *urn_new(t_floatarg f1, t_floatarg f2)
x->x_urn = x->x_urnini;
urn_resize(x, f1, 1);
urn_seed(x, f2); /* CHECKME */
- shared_usecompatibility();
inlet_new((t_object *)x, (t_pd *)x, &s_float, gensym("ft1"));
outlet_new((t_object *)x, &s_float);
x->x_bangout = outlet_new((t_object *)x, &s_bang);
@@ -146,4 +146,5 @@ void urn_setup(void)
gensym("seed"), A_FLOAT, 0); /* CHECKED arg obligatory */
class_addmethod(urn_class, (t_method)urn_clear,
gensym("clear"), 0);
+ fitter_setup(urn_class, 0, 0);
}
diff --git a/cyclone/hammer/zl.c b/cyclone/hammer/zl.c
index 7a5d471..b263bc8 100644
--- a/cyclone/hammer/zl.c
+++ b/cyclone/hammer/zl.c
@@ -13,7 +13,7 @@
/* LATER test reentrancy, tune speedwise */
#ifdef KRZYSZCZ
-#define ZL_DEBUG
+//#define ZL_DEBUG
#endif
#define ZL_INISIZE 32 /* LATER rethink */
@@ -820,6 +820,8 @@ static void zl_mode(t_zl *x, t_symbol *s, int ac, t_atom *av)
if (i && i < zl_nmodes)
{
x->x_mode = i;
+ /* CHECKED incompatible (LATER warn):
+ c74 rejects creation args, if not a single int */
zl_setmodearg(x, 0, ac - 1, av + 1);
}
}
@@ -882,19 +884,19 @@ static void zlproxy_anything(t_zlproxy *p, t_symbol *s, int ac, t_atom *av)
#ifdef ZL_DEBUG
static void zl_debug(t_zl *x, t_floatarg f)
{
- startpost("mode %s", zl_modesym[x->x_mode]->s_name);
+ loudbug_startpost("mode %s", zl_modesym[x->x_mode]->s_name);
if (zl_intargfn[x->x_mode])
- post(" %d", x->x_modearg);
+ loudbug_post(" %d", x->x_modearg);
else
- endpost();
+ loudbug_endpost();
if ((int)f)
{
- startpost("first:");
- postatom(x->x_inbuf1.d_natoms, x->x_inbuf1.d_buf);
- endpost();
- startpost("second:");
- postatom(x->x_inbuf2.d_natoms, x->x_inbuf2.d_buf);
- endpost();
+ loudbug_startpost("first:");
+ loudbug_postatom(x->x_inbuf1.d_natoms, x->x_inbuf1.d_buf);
+ loudbug_endpost();
+ loudbug_startpost("second:");
+ loudbug_postatom(x->x_inbuf2.d_natoms, x->x_inbuf2.d_buf);
+ loudbug_endpost();
}
}
#endif
@@ -940,7 +942,7 @@ static void zl_setupmode(char *id, int flags,
zl_doitfn[zl_nmodes] = dfn;
zl_nmodes++;
}
- else bug("zl_setupmode");
+ else loudbug_bug("zl_setupmode");
}
static void zl_setupallmodes(void)
diff --git a/cyclone/shadow/Makefile.objects b/cyclone/shadow/Makefile.objects
index dd8fb57..66aea0d 100644
--- a/cyclone/shadow/Makefile.objects
+++ b/cyclone/shadow/Makefile.objects
@@ -1,6 +1,7 @@
SHARED_OBJECTS = \
common/loud.o \
common/grow.o \
+common/fitter.o \
common/lex.o \
common/binport.o \
common/port.o \
diff --git a/cyclone/shadow/cyclone.c b/cyclone/shadow/cyclone.c
index a702074..30f1c84 100644
--- a/cyclone/shadow/cyclone.c
+++ b/cyclone/shadow/cyclone.c
@@ -1,14 +1,12 @@
-/* Copyright (c) 2003-2004 krzYszcz and others.
+/* Copyright (c) 2003-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* Never use forked calls in shadow code... */
-/* LATER support multi-atom dir (creation args), and fn ('import' message)
- (same in hammer and sickle) */
+/* LATER support multi-atom dir ('cd' message), and fn ('import' message)
+ (same in maxmode, hammer and sickle) */
-#include <stdio.h>
-#include <string.h>
#include "m_pd.h"
#include "common/loud.h"
#include "common/port.h"
@@ -22,6 +20,7 @@ typedef struct _cyclone
{
t_object x_ob;
t_symbol *x_dir;
+ t_symbol *x_canvasdir;
t_hammerfile *x_filehandle;
} t_cyclone;
@@ -29,11 +28,8 @@ static t_class *cyclone_class;
static int cyclone_hammerndx;
static int cyclone_sicklendx;
static int cyclone_nettlesndx;
-static int cyclone_dummiesndx;
static int cyclone_lastndx;
-static t_pd *cyclone_dproxy = 0;
-
static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
{
import_max(fn->s_name, "");
@@ -41,7 +37,8 @@ static void cyclone_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
static void cyclone_doimport(t_cyclone *x, t_symbol *fn, t_symbol *dir)
{
- if (!dir || dir == &s_) dir = x->x_dir;
+ if (!dir || dir == &s_)
+ dir = x->x_dir;
if (fn && fn != &s_)
import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
else
@@ -59,42 +56,28 @@ static void cyclone_import(t_cyclone *x, t_symbol *fn)
cyclone_doimport(x, fn, 0);
}
-static void cyclone_bang(t_cyclone *x)
+static void cyclone_cd(t_cyclone *x, t_symbol *dir)
{
- int i;
- fragile_class_printnames("hammer classes are: ",
- cyclone_hammerndx, cyclone_sicklendx - 1);
- fragile_class_printnames("sickle classes are: ",
- cyclone_sicklendx, cyclone_nettlesndx - 1);
- fragile_class_printnames("nettles are: ",
- cyclone_nettlesndx, cyclone_dummiesndx - 1);
- if (cyclone_dproxy)
- pd_bang(cyclone_dproxy);
- else
- post("no replacement abstractions");
- if (cyclone_lastndx > cyclone_dummiesndx)
- post("send 'dummies' message to see the list of %d dummy classes",
- /* cyclone_lastndx points to the "_dummy" sentinel class */
- cyclone_lastndx - cyclone_dummiesndx);
- else
- post("no dummies");
+ /* LATER hammerfile interface for relative jumps, etc. */
+ x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir);
}
-static void cyclone_reps(t_cyclone *x)
+static void cyclone_pwd(t_cyclone *x)
{
- if (cyclone_dproxy)
- typedmess(cyclone_dproxy, gensym("reps"), 0, 0);
- else
- post("no replacement abstractions");
+ outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir);
}
-static void cyclone_dummies(t_cyclone *x)
+static void cyclone_bang(t_cyclone *x)
{
- if (cyclone_lastndx > cyclone_dummiesndx)
- fragile_class_printnames("dummies are: ",
- cyclone_dummiesndx, cyclone_lastndx);
- else
- post("no dummies");
+ if (cyclone_hammerndx && cyclone_sicklendx)
+ {
+ fragile_class_printnames("hammer classes are: ",
+ cyclone_hammerndx, cyclone_sicklendx - 1);
+ fragile_class_printnames("sickle classes are: ",
+ cyclone_sicklendx, cyclone_nettlesndx - 1);
+ }
+ fragile_class_printnames("nettles are: ",
+ cyclone_nettlesndx, cyclone_lastndx - 1);
}
static void cyclone_free(t_cyclone *x)
@@ -102,26 +85,20 @@ static void cyclone_free(t_cyclone *x)
hammerfile_free(x->x_filehandle);
}
-static void *cyclone_new(t_symbol *s)
+static void *cyclone_new(void)
{
t_cyclone *x = (t_cyclone *)pd_new(cyclone_class);
x->x_filehandle = hammerfile_new((t_pd *)x, 0, cyclone_readhook, 0, 0);
- x->x_dir = (s && s != &s_ ? s : canvas_getdir(x->x_filehandle->f_canvas));
+ x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas);
+ x->x_dir = x->x_canvasdir;
+ outlet_new((t_object *)x, &s_symbol);
return (x);
}
void cyclone_setup(void)
{
- int hresult, sresult, dresult;
- hresult = sresult = dresult = LOADER_OK;
- if (canvas_getcurrent())
- {
- /* Loading the library by object creation is banned, because of a danger
- of having some of the classes already loaded. LATER rethink. */
- loud_error(0, "apparently an attempt to create a 'cyclone' object");
- loud_errand(0, "without having cyclone library preloaded");
- return;
- }
+ int hresult, sresult;
+ hresult = sresult = LOADER_OK;
if (zgetfn(&pd_objectmaker, gensym("cyclone")))
{
loud_error(0, "cyclone is already loaded");
@@ -132,12 +109,12 @@ void cyclone_setup(void)
cyclone_class = class_new(gensym("cyclone"),
(t_newmethod)cyclone_new,
(t_method)cyclone_free,
- sizeof(t_cyclone), 0, A_DEFSYM, 0);
+ sizeof(t_cyclone), 0, 0);
class_addbang(cyclone_class, cyclone_bang);
- class_addmethod(cyclone_class, (t_method)cyclone_reps,
- gensym("reps"), 0);
- class_addmethod(cyclone_class, (t_method)cyclone_dummies,
- gensym("dummies"), 0);
+ class_addmethod(cyclone_class, (t_method)cyclone_cd,
+ gensym("cd"), A_DEFSYM, 0);
+ class_addmethod(cyclone_class, (t_method)cyclone_pwd,
+ gensym("pwd"), 0);
class_addmethod(cyclone_class, (t_method)cyclone_import,
gensym("import"), A_DEFSYM, 0);
class_addmethod(cyclone_class, (t_method)cyclone_click,
@@ -145,49 +122,42 @@ void cyclone_setup(void)
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
hammerfile_setup(cyclone_class, 0);
- cyclone_hammerndx = fragile_class_count();
- if (zgetfn(&pd_objectmaker, gensym("hammer")))
- loud_warning(0, "cyclone", "hammer is already loaded");
- else
- hresult = unstable_load_lib("", "hammer");
-
- cyclone_sicklendx = fragile_class_count();
- if (zgetfn(&pd_objectmaker, gensym("sickle")))
- loud_warning(0, "cyclone", "sickle is already loaded");
+ if (canvas_getcurrent())
+ {
+ /* Loading hammer and sickle by cyclone object creation is banned,
+ because of a danger of having some of the classes already loaded. */
+ loud_warning(0, "cyclone",
+ "creating cyclone object without loading cyclone components");
+ cyclone_hammerndx = cyclone_sicklendx = 0;
+ }
else
- sresult = unstable_load_lib("", "sickle");
+ {
+ cyclone_hammerndx = fragile_class_count();
+ if (zgetfn(&pd_objectmaker, gensym("hammer")))
+ loud_warning(0, "cyclone", "hammer is already loaded");
+ else
+ hresult = unstable_load_lib("", "hammer");
+ cyclone_sicklendx = fragile_class_count();
+ if (zgetfn(&pd_objectmaker, gensym("sickle")))
+ loud_warning(0, "cyclone", "sickle is already loaded");
+ else
+ sresult = unstable_load_lib("", "sickle");
+ }
cyclone_nettlesndx = fragile_class_count();
allnettles_setup();
-
- cyclone_dummiesndx = fragile_class_count();
- if (zgetfn(&pd_objectmaker, gensym("dummies")))
- loud_warning(0, "cyclone", "dummies are already loaded");
- else
- dresult = unstable_load_lib("", "dummies");
-
cyclone_lastndx = fragile_class_count() - 1;
if (hresult == LOADER_NOFILE)
loud_error(0, "hammer library is missing");
else if (sresult == LOADER_NOFILE)
loud_error(0, "sickle library is missing");
- else if (!zgetfn(&pd_objectmaker, gensym("hammer")) ||
- !zgetfn(&pd_objectmaker, gensym("sickle")))
+ else if (cyclone_hammerndx &&
+ (!zgetfn(&pd_objectmaker, gensym("hammer")) ||
+ !zgetfn(&pd_objectmaker, gensym("sickle"))))
{
loud_error(0, "version mismatch");
loud_errand(0,
"use a more recent Pd release (or recompile the cyclone).");
}
- else if (dresult == LOADER_NOFILE)
- loud_warning(0, "cyclone", "dummies not found");
- else
- {
- t_symbol *s = gensym("_cc.dummies");
- if (s->s_thing && !s->s_next
- && !strcmp(class_getname(*s->s_thing), "_cc.dummies"))
- cyclone_dproxy = s->s_thing;
- else
- bug("cyclone_setup"); /* FIXME */
- }
}
diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c
index 0a3c218..5ad7cc1 100644
--- a/cyclone/shadow/dummies.c
+++ b/cyclone/shadow/dummies.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003-2004 krzYszcz and others.
+/* Copyright (c) 2003-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -554,7 +554,7 @@ static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp)
x = (t_object *)pd_new(dummy_classes[fnd]);
sl = &dummy_slots[fnd];
if (fnd == dummy_nclasses)
- bug("dummy_newobject"); /* create a "_dummy" in this case */
+ loudbug_bug("dummy_newobject"); /* create a "_dummy" in this case */
else if (!sl->s_warned)
{
loud_warning((t_pd *)x, 0, "dummy substitution");
@@ -567,15 +567,6 @@ static t_object *dummy_newobject(t_symbol *s, t_dummy_slot **slotp)
static void ccdummies_bang(t_pd *x)
{
if (dummy_nreps)
- post("send 'reps' message to see the list of %d \
-replacement abstractions", dummy_nreps);
- else
- post("no replacement abstractions");
-}
-
-static void ccdummies_reps(t_pd *x)
-{
- if (dummy_nreps)
{
char *msg = "replacement abstractions are: ";
int i, len = strlen(msg);
@@ -619,8 +610,9 @@ void dummies_setup(void)
ndoomed++;
else if (ndoomed && i < dummy_nclasses - 1)
{
- bug("dummies_setup");
- post("(\"%s\": clashing or doomed dummy not registered for import)",
+ loudbug_bug("dummies_setup");
+ loudbug_post
+ ("(\"%s\": clashing or doomed dummy not registered for import)",
sl->s_name);
}
if ((fd = open_via_path("", sl->s_name, ".pd",
@@ -643,7 +635,5 @@ void dummies_setup(void)
ccdummies_class = class_new(gensym("_cc.dummies"), 0, 0,
sizeof(t_pd), CLASS_PD | CLASS_NOINLET, 0);
class_addbang(ccdummies_class, ccdummies_bang);
- class_addmethod(ccdummies_class, (t_method)ccdummies_reps,
- gensym("reps"), 0);
pd_bind(pd_new(ccdummies_class), gensym("_cc.dummies")); /* never freed */
}
diff --git a/cyclone/shadow/maxmode.c b/cyclone/shadow/maxmode.c
index f90d990..9cd1055 100644
--- a/cyclone/shadow/maxmode.c
+++ b/cyclone/shadow/maxmode.c
@@ -1,21 +1,180 @@
-/* Copyright (c) 2004 krzYszcz and others.
+/* Copyright (c) 2004-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+#include <stdio.h>
+#include <string.h>
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
+#include "common/port.h"
+#include "hammer/file.h"
+#include "unstable/fragile.h"
#include "unstable/loader.h"
+#include "../build_counter"
+
+typedef struct _maxmode
+{
+ t_object x_ob;
+ t_symbol *x_dir;
+ t_symbol *x_canvasdir;
+ t_hammerfile *x_filehandle;
+} t_maxmode;
+
+static t_class *maxmode_class;
+static int maxmode_dummiesndx;
+static int maxmode_lastndx;
+static t_pd *maxmode_dproxy = 0;
+static int maxmode_withbanner = 0;
+
+static void maxmode_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
+{
+ import_max(fn->s_name, "");
+}
+
+static void maxmode_doimport(t_maxmode *x, t_symbol *fn, t_symbol *dir)
+{
+ if (!dir || dir == &s_)
+ dir = x->x_dir;
+ if (fn && fn != &s_)
+ import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
+ else
+ hammerpanel_open(x->x_filehandle, dir);
+}
+
+static void maxmode_click(t_maxmode *x, t_floatarg xpos, t_floatarg ypos,
+ t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
+{
+ maxmode_doimport(x, 0, 0);
+}
+
+static void maxmode_import(t_maxmode *x, t_symbol *fn)
+{
+ maxmode_doimport(x, fn, 0);
+}
+
+static void maxmode_cd(t_maxmode *x, t_symbol *dir)
+{
+ /* LATER hammerfile interface for relative jumps, etc. */
+ x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir);
+}
+
+static void maxmode_pwd(t_maxmode *x)
+{
+ outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir);
+}
+
+static void maxmode_bang(t_maxmode *x)
+{
+ if (maxmode_dproxy)
+ pd_bang(maxmode_dproxy);
+ else
+ post("no replacement abstractions");
+ if (maxmode_lastndx > maxmode_dummiesndx)
+ fragile_class_printnames("dummies are: ",
+ maxmode_dummiesndx, maxmode_lastndx);
+ else
+ post("no dummies");
+}
+
+static void maxmode_free(t_maxmode *x)
+{
+ hammerfile_free(x->x_filehandle);
+}
+
+static void *maxmode_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_maxmode *x = (t_maxmode *)pd_new(maxmode_class);
+ if (maxmode_withbanner && !ac)
+ {
+ post("this is maxmode %s, %s %s build",
+ CYCLONE_VERSION, loud_ordinal(CYCLONE_BUILD), CYCLONE_RELEASE);
+ loud_warning(0, "maxmode",
+ "creating maxmode object without loading cyclone components");
+ maxmode_withbanner = 0;
+ }
+ if (!fittermax_get())
+ {
+ int selective = 0;
+ if (ac)
+ {
+ while (ac--) if (av->a_type == A_SYMBOL)
+ {
+ /* FIXME register into fitter for per-patch, selective
+ compatibility control */
+ av++;
+ }
+ }
+ if (!selective)
+ fittermax_set();
+ }
+ x->x_filehandle = hammerfile_new((t_pd *)x, 0, maxmode_readhook, 0, 0);
+ x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas);
+ x->x_dir = x->x_canvasdir;
+ outlet_new((t_object *)x, &s_symbol);
+ return (x);
+}
void maxmode_setup(void)
{
- shared_setmaxcompatibility();
- if (zgetfn(&pd_objectmaker, gensym("cyclone")))
- loud_warning(0, "maxmode", "cyclone is already loaded");
+ int dresult = LOADER_OK;
+ if (zgetfn(&pd_objectmaker, gensym("maxmode")))
+ {
+ loud_error(0, "maxmode is already loaded");
+ return;
+ }
+ maxmode_class = class_new(gensym("maxmode"),
+ (t_newmethod)maxmode_new,
+ (t_method)maxmode_free,
+ sizeof(t_maxmode), 0, A_GIMME, 0);
+ class_addbang(maxmode_class, maxmode_bang);
+ class_addmethod(maxmode_class, (t_method)maxmode_cd,
+ gensym("cd"), A_DEFSYM, 0);
+ class_addmethod(maxmode_class, (t_method)maxmode_pwd,
+ gensym("pwd"), 0);
+ class_addmethod(maxmode_class, (t_method)maxmode_import,
+ gensym("import"), A_DEFSYM, 0);
+ class_addmethod(maxmode_class, (t_method)maxmode_click,
+ gensym("click"),
+ A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
+ hammerfile_setup(maxmode_class, 0);
+
+ if (canvas_getcurrent())
+ {
+ fitter_setup(0, 0, 0);
+ if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
+ /* cycloneless maxmode -- banner is posted by the oldest
+ maxmode object with no creation arguments */
+ maxmode_withbanner = 1;
+ }
+ else
+ {
+ fittermax_set();
+ if (zgetfn(&pd_objectmaker, gensym("cyclone")))
+ loud_warning(0, "maxmode", "cyclone is already loaded");
+ else
+ {
+ if (unstable_load_lib("", "cyclone") == LOADER_NOFILE)
+ loud_error(0, "cyclone library is missing");
+ else if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
+ loud_error(0, "miXed/Pd version mismatch");
+ }
+ }
+ maxmode_dummiesndx = fragile_class_count();
+ if (zgetfn(&pd_objectmaker, gensym("dummies")))
+ loud_warning(0, "maxmode", "dummies are already loaded");
+ else
+ dresult = unstable_load_lib("", "dummies");
+ maxmode_lastndx = fragile_class_count() - 1;
+ if (dresult == LOADER_NOFILE)
+ loud_warning(0, "maxmode", "dummies not found");
else
{
- if (unstable_load_lib("", "cyclone") == LOADER_NOFILE)
- loud_error(0, "cyclone library is missing");
- else if (!zgetfn(&pd_objectmaker, gensym("cyclone")))
- loud_error(0, "miXed/Pd version mismatch");
+ t_symbol *s = gensym("_cc.dummies");
+ if (s->s_thing && !s->s_next
+ && !strcmp(class_getname(*s->s_thing), "_cc.dummies"))
+ maxmode_dproxy = s->s_thing;
+ else
+ loudbug_bug("maxmode_setup"); /* FIXME */
}
}
diff --git a/cyclone/sickle/Line.c b/cyclone/sickle/Line.c
index 20a81d2..eb8be26 100644
--- a/cyclone/sickle/Line.c
+++ b/cyclone/sickle/Line.c
@@ -53,10 +53,10 @@ static void line_tick(t_line *x)
{
outlet_bang(x->x_bangout);
#ifdef LINE_DEBUG
- post("exit point %d, after %d retarget calls",
- x->dbg_exitpoint, x->dbg_nretargets);
- post("at value %g, after last %d npoints, with inc %g, biginc %g",
- x->x_value, x->dbg_npoints, x->x_inc, x->x_biginc);
+ loudbug_post("exit point %d, after %d retarget calls",
+ x->dbg_exitpoint, x->dbg_nretargets);
+ loudbug_post("at value %g, after last %d npoints, with inc %g, biginc %g",
+ x->x_value, x->dbg_npoints, x->x_inc, x->x_biginc);
x->dbg_nretargets = x->dbg_exitpoint = x->dbg_npoints = 0;
#endif
}
@@ -221,7 +221,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av)
}
x->x_nsegs = nsegs;
#ifdef LINE_DEBUG
- post("%d segments:", x->x_nsegs);
+ loudbug_post("%d segments:", x->x_nsegs);
#endif
segp = x->x_segs;
if (odd) nsegs--;
@@ -230,7 +230,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av)
segp->s_target = av++->a_w.w_float;
segp->s_delta = av++->a_w.w_float;
#ifdef LINE_DEBUG
- post("%g %g", segp->s_target, segp->s_delta);
+ loudbug_post("%g %g", segp->s_target, segp->s_delta);
#endif
segp++;
}
@@ -239,7 +239,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av)
segp->s_target = av->a_w.w_float;
segp->s_delta = 0;
#ifdef LINE_DEBUG
- post("%g %g", segp->s_target, segp->s_delta);
+ loudbug_post("%g %g", segp->s_target, segp->s_delta);
#endif
}
x->x_deltaset = 0;
diff --git a/cyclone/sickle/Makefile.objects b/cyclone/sickle/Makefile.objects
index 4528d83..1d80296 100644
--- a/cyclone/sickle/Makefile.objects
+++ b/cyclone/sickle/Makefile.objects
@@ -4,6 +4,7 @@ unstable/fragile.o \
unstable/fringe.o \
common/loud.o \
common/grow.o \
+common/fitter.o \
common/vefl.o \
common/clc.o \
common/lex.o \
diff --git a/cyclone/sickle/Scope.c b/cyclone/sickle/Scope.c
index adc4888..8a71cb5 100644
--- a/cyclone/sickle/Scope.c
+++ b/cyclone/sickle/Scope.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2002-2003 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -16,6 +16,7 @@
#include "g_canvas.h"
#include "common/loud.h"
#include "common/grow.h"
+#include "common/fitter.h"
#include "unstable/forky.h"
#include "sickle/sic.h"
@@ -320,7 +321,7 @@ static t_canvas *scope_getcanvas(t_scope *x, t_glist *glist)
{
if (glist != x->x_glist)
{
- bug("scope_getcanvas");
+ loudbug_bug("scope_getcanvas");
x->x_glist = glist;
}
return (x->x_canvas = glist_getcanvas(glist));
@@ -338,8 +339,12 @@ static void scope_period(t_scope *x, t_symbol *s, int ac, t_atom *av)
int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 2), ac, av, &period,
SCOPE_MINPERIOD, SCOPE_MAXPERIOD,
/* LATER rethink warning rules */
- (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN),
- (s ? 0 : LOUD_WARN), "samples per element");
+ (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0,
+ "samples per element");
+ if (!s && result == LOUD_ARGOVER)
+ fittermax_warning(*(t_pd *)x,
+ "more than %g samples per element requested",
+ SCOPE_MAXPERIOD);
if (!s || result == LOUD_ARGOK || result == LOUD_ARGOVER)
{
x->x_period = (int)period;
@@ -360,14 +365,18 @@ static void scope_bufsize(t_scope *x, t_symbol *s, int ac, t_atom *av)
int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize,
SCOPE_MINBUFSIZE, SCOPE_WARNBUFSIZE,
/* LATER rethink warning rules */
- (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN),
- (s ? 0 : LOUD_WARN), "display elements");
+ (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0,
+ "display elements");
if (result == LOUD_ARGOVER)
{
bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE);
result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize,
0, SCOPE_MAXBUFSIZE, 0, LOUD_CLIP | LOUD_WARN,
"display elements");
+ if (!s && result == LOUD_ARGOK)
+ fittermax_warning(*(t_pd *)x,
+ "more than %g display elements requested",
+ SCOPE_WARNBUFSIZE);
}
if (!s)
{
@@ -1042,4 +1051,5 @@ void Scope_tilde_setup(void)
gensym("_click"), A_FLOAT, 0);
class_addmethod(scopehandle_class, (t_method)scopehandle__motionhook,
gensym("_motion"), A_FLOAT, A_FLOAT, 0);
+ fitter_setup(scope_class, 0, 0);
}
diff --git a/cyclone/sickle/average.c b/cyclone/sickle/average.c
index ea330c1..74adfc8 100644
--- a/cyclone/sickle/average.c
+++ b/cyclone/sickle/average.c
@@ -7,6 +7,7 @@
#include <math.h>
#include "m_pd.h"
+#include "common/loud.h"
#include "sickle/sic.h"
#if defined(NT) || defined(MACOSX)
@@ -74,7 +75,7 @@ static void average_setmode(t_average *x, int mode)
x->x_sumfn = average_rmssum;
else
{
- bug("average_setmode");
+ loudbug_bug("average_setmode");
return;
}
x->x_mode = mode;
diff --git a/cyclone/sickle/bitshift.c b/cyclone/sickle/bitshift.c
index 28ee744..707048c 100644
--- a/cyclone/sickle/bitshift.c
+++ b/cyclone/sickle/bitshift.c
@@ -8,6 +8,7 @@
more generic (use long long values?) */
#include "m_pd.h"
+#include "common/loud.h"
#include "sickle/sic.h"
#ifdef KRZYSZCZ
@@ -91,8 +92,8 @@ static void bitshift_shift(t_bitshift *x, t_floatarg f)
if (i > 0)
{
#ifdef BITSHIFT_DEBUG
- post("%.8x << %d == %.8x, %.8x << %d == %.8x",
- 1, i, 1 << i, -1, i, -1 << i);
+ loudbug_post("%.8x << %d == %.8x, %.8x << %d == %.8x",
+ 1, i, 1 << i, -1, i, -1 << i);
#endif
if (i < nbits)
x->x_lshift = i;
@@ -102,8 +103,8 @@ static void bitshift_shift(t_bitshift *x, t_floatarg f)
else if (i < 0)
{
#ifdef BITSHIFT_DEBUG
- post("%.8x >> %d == %.8x, %.8x >> %d == %.8x",
- 0x7fffffff, -i, 0x7fffffff >> -i, -1, -i, -1 >> -i);
+ loudbug_post("%.8x >> %d == %.8x, %.8x >> %d == %.8x",
+ 0x7fffffff, -i, 0x7fffffff >> -i, -1, -i, -1 >> -i);
#endif
x->x_rshift = (i <= -nbits ? nbits - 1 : -i);
}
diff --git a/cyclone/sickle/buffir.c b/cyclone/sickle/buffir.c
index ee42af9..1fd9d23 100644
--- a/cyclone/sickle/buffir.c
+++ b/cyclone/sickle/buffir.c
@@ -1,10 +1,11 @@
-/* Copyright (c) 2003 krzYszcz and others.
+/* Copyright (c) 2003-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include <string.h>
#include "m_pd.h"
#include "common/loud.h"
+#include "common/fitter.h"
#include "sickle/sic.h"
#include "sickle/arsic.h"
@@ -38,14 +39,11 @@ static void buffir_setrange(t_buffir *x, t_floatarg f1, t_floatarg f2)
{
int newsize, pos = x->x_lohead - x->x_histlo;
int oldbytes = x->x_histsize * sizeof(*x->x_histlo);
- if (shared_getmaxcompatibility())
+ static int warned = 0;
+ if (fittermax_get() && !warned)
{
- static int warned = 0;
- if (!warned)
- {
- loud_incompatible(buffir_class, "stretching history buffer");
- warned = 1;
- }
+ fittermax_warning(buffir_class, "stretching history buffer");
+ warned = 1;
}
newsize = x->x_histsize * 2;
while (newsize < siz) newsize *= 2;
@@ -197,7 +195,6 @@ static void *buffir_new(t_symbol *s, t_floatarg f1, t_floatarg f2)
x->x_histlo = x->x_histini;
buffir_clear(x);
buffir_setrange(x, f1, f2);
- shared_usecompatibility();
}
return (x);
}
@@ -214,4 +211,5 @@ void buffir_tilde_setup(void)
gensym("clear"), 0);
class_addmethod(buffir_class, (t_method)buffir_set,
gensym("set"), A_SYMBOL, A_DEFFLOAT, A_DEFFLOAT, 0);
+ fitter_setup(buffir_class, 0, 0);
}
diff --git a/cyclone/sickle/curve.c b/cyclone/sickle/curve.c
index 78f1427..730dd0d 100644
--- a/cyclone/sickle/curve.c
+++ b/cyclone/sickle/curve.c
@@ -71,8 +71,8 @@ static void curve_cc(t_curve *x, t_curveseg *segp, float f)
segp->s_nhops = (nhops > 0 ? nhops : 0);
clccurve_coefs(segp->s_nhops, (double)f, &segp->s_bb, &segp->s_mm);
#ifdef CURVE_DEBUG
- post("%g %g %g %g",
- segp->s_target, segp->s_delta, segp->s_bb, segp->s_mm);
+ loudbug_post("%g %g %g %g",
+ segp->s_target, segp->s_delta, segp->s_bb, segp->s_mm);
#endif
}
@@ -80,10 +80,10 @@ static void curve_tick(t_curve *x)
{
outlet_bang(x->x_bangout);
#ifdef CURVE_DEBUG
- post("exit point %d, after %d retarget calls",
- x->dbg_exitpoint, x->dbg_nretargets);
- post("at value %g, after last %d nhops, with bb %g, mm %g",
- x->x_value, x->dbg_nhops, x->x_bb, x->x_mm);
+ loudbug_post("exit point %d, after %d retarget calls",
+ x->dbg_exitpoint, x->dbg_nretargets);
+ loudbug_post("at value %g, after last %d nhops, with bb %g, mm %g",
+ x->x_value, x->dbg_nhops, x->x_bb, x->x_mm);
x->dbg_nretargets = x->dbg_exitpoint = x->dbg_nhops = 0;
#endif
}
@@ -223,7 +223,7 @@ static void curve_float(t_curve *x, t_float f)
x->x_curseg->s_target = f;
x->x_curseg->s_delta = x->x_delta;
#ifdef CURVE_DEBUG
- startpost("single segment: ");
+ loudbug_startpost("single segment: ");
#endif
curve_cc(x, x->x_curseg, x->x_ccinput);
x->x_retarget = 1;
@@ -278,7 +278,7 @@ static void curve_list(t_curve *x, t_symbol *s, int ac, t_atom *av)
}
x->x_nsegs = nsegs;
#ifdef CURVE_DEBUG
- post("%d segments:", x->x_nsegs);
+ loudbug_post("%d segments:", x->x_nsegs);
#endif
segp = x->x_segs;
if (odd) nsegs--;
diff --git a/cyclone/sickle/cycle.c b/cyclone/sickle/cycle.c
index 01500ba..8daa43e 100644
--- a/cyclone/sickle/cycle.c
+++ b/cyclone/sickle/cycle.c
@@ -135,7 +135,7 @@ static void *cycle_new(t_symbol *s, int ac, t_atom *av)
x->x_costable = sic_makecostable(&tabsize);
if (tabsize != CYCLE_TABSIZE)
{
- bug("cycle_new");
+ loudbug_bug("cycle_new");
pd_free((t_pd *)x);
return (0);
}
diff --git a/cyclone/sickle/pong.c b/cyclone/sickle/pong.c
index 2878842..5c5e143 100644
--- a/cyclone/sickle/pong.c
+++ b/cyclone/sickle/pong.c
@@ -5,6 +5,7 @@
/* CHECKED whatever args, there are always 3 inlets (refman's rubbish) */
#include "m_pd.h"
+#include "common/loud.h"
#include "unstable/forky.h"
#include "sickle/sic.h"
@@ -214,7 +215,7 @@ static void pong_dsp(t_pong *x, t_signal **sp)
else
{
#ifdef PONG_DEBUG
- post("using pong_perform_nofeeders");
+ loudbug_post("using pong_perform_nofeeders");
#endif
dsp_add(pong_perform_nofeeders, 6, x, sp[0]->s_n,
sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec);
diff --git a/cyclone/sickle/sickle.c b/cyclone/sickle/sickle.c
index 807c2ad..1d46050 100644
--- a/cyclone/sickle/sickle.c
+++ b/cyclone/sickle/sickle.c
@@ -1,8 +1,7 @@
-/* Copyright (c) 2002-2004 krzYszcz and others.
+/* Copyright (c) 2002-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-#include <stdio.h>
#include "m_pd.h"
#include "unstable/fragile.h"
#include "common/loud.h"
@@ -15,6 +14,7 @@ typedef struct _sickle
{
t_object x_ob;
t_symbol *x_dir;
+ t_symbol *x_canvasdir;
t_hammerfile *x_filehandle;
} t_sickle;
@@ -29,7 +29,8 @@ static void sickle_readhook(t_pd *z, t_symbol *fn, int ac, t_atom *av)
static void sickle_doimport(t_sickle *x, t_symbol *fn, t_symbol *dir)
{
- if (!dir || dir == &s_) dir = x->x_dir;
+ if (!dir || dir == &s_)
+ dir = x->x_dir;
if (fn && fn != &s_)
import_max(fn->s_name, (dir && dir != &s_) ? dir->s_name : "");
else
@@ -47,6 +48,17 @@ static void sickle_import(t_sickle *x, t_symbol *fn)
sickle_doimport(x, fn, 0);
}
+static void sickle_cd(t_sickle *x, t_symbol *dir)
+{
+ /* LATER hammerfile interface for relative jumps, etc. */
+ x->x_dir = (dir && dir != &s_ ? dir : x->x_canvasdir);
+}
+
+static void sickle_pwd(t_sickle *x)
+{
+ outlet_symbol(((t_object *)x)->ob_outlet, x->x_dir);
+}
+
static void sickle_bang(t_sickle *x)
{
fragile_class_printnames("sickle classes are: ",
@@ -58,11 +70,13 @@ static void sickle_free(t_sickle *x)
hammerfile_free(x->x_filehandle);
}
-static void *sickle_new(t_symbol *s)
+static void *sickle_new(void)
{
t_sickle *x = (t_sickle *)pd_new(sickle_class);
x->x_filehandle = hammerfile_new((t_pd *)x, 0, sickle_readhook, 0, 0);
- x->x_dir = (s && s != &s_ ? s : canvas_getdir(x->x_filehandle->f_canvas));
+ x->x_canvasdir = canvas_getdir(x->x_filehandle->f_canvas);
+ x->x_dir = x->x_canvasdir;
+ outlet_new((t_object *)x, &s_symbol);
return (x);
}
@@ -87,8 +101,12 @@ void sickle_setup(void)
sickle_class = class_new(gensym("sickle"),
(t_newmethod)sickle_new,
(t_method)sickle_free,
- sizeof(t_sickle), 0, A_DEFSYM, 0);
+ sizeof(t_sickle), 0, 0);
class_addbang(sickle_class, sickle_bang);
+ class_addmethod(sickle_class, (t_method)sickle_cd,
+ gensym("cd"), A_DEFSYM, 0);
+ class_addmethod(sickle_class, (t_method)sickle_pwd,
+ gensym("pwd"), 0);
class_addmethod(sickle_class, (t_method)sickle_import,
gensym("import"), A_DEFSYM, 0);
class_addmethod(sickle_class, (t_method)sickle_click,
diff --git a/cyclone/sickle/svf.c b/cyclone/sickle/svf.c
index 0909571..5bc0458 100644
--- a/cyclone/sickle/svf.c
+++ b/cyclone/sickle/svf.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2003 krzYszcz and others.
+/* Copyright (c) 2003-2005 krzYszcz and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
@@ -23,11 +23,13 @@
#define SVF_LINEAR 1
#define SVF_RADIANS 2
#define SVF_DRIVE .0001
-#define SVF_QSTRETCH 1.2 /* CHECKED */
-#define SVF_MINR 0. /* CHECKME */
-#define SVF_MAXR 1.2 /* CHECKME */
-#define SVF_MINOMEGA 0. /* CHECKME */
+#define SVF_QSTRETCH 1.2 /* CHECKED */
+#define SVF_MINR 0. /* CHECKME */
+#define SVF_MAXR 1.2 /* CHECKME */
+#define SVF_MINOMEGA 0. /* CHECKME */
#define SVF_MAXOMEGA (SHARED_PI * .5) /* CHECKME */
+#define SVF_DEFFREQ 0.
+#define SVF_DEFQ .01 /* CHECKME */
typedef struct _svf
{
@@ -125,25 +127,43 @@ static void svf_dsp(t_svf *x, t_signal **sp)
sp[4]->s_vec, sp[5]->s_vec, sp[6]->s_vec);
}
-static void *svf_new(t_symbol *s, t_floatarg f1, t_floatarg f2)
+static void *svf_new(t_symbol *s, int ac, t_atom *av)
{
t_svf *x = (t_svf *)pd_new(svf_class);
+ t_float freq = SVF_DEFFREQ, qcoef = SVF_DEFQ;
+ t_symbol *modesym = 0;
+ int i;
+ for (i = 0; i < ac; i++) if (av[i].a_type == A_SYMBOL)
+ {
+ modesym = av[i].a_w.w_symbol;
+ break;
+ }
+ while (ac && av->a_type != A_FLOAT) ac--, av++;
+ if (ac)
+ {
+ freq = av->a_w.w_float;
+ ac--; av++;
+ while (ac && av->a_type != A_FLOAT) ac--, av++;
+ if (ac)
+ qcoef = av->a_w.w_float;
+ }
x->x_srcoef = SHARED_PI / sys_getsr();
- sic_newinlet((t_sic *)x, f1);
- sic_newinlet((t_sic *)x, f2);
+ sic_newinlet((t_sic *)x, freq);
+ sic_newinlet((t_sic *)x, qcoef);
outlet_new((t_object *)x, &s_signal);
outlet_new((t_object *)x, &s_signal);
outlet_new((t_object *)x, &s_signal);
outlet_new((t_object *)x, &s_signal);
svf_clear(x);
- if (s == ps_linear)
+ if (modesym == ps_linear)
x->x_mode = SVF_LINEAR;
- else if (s == ps_radians)
+ else if (modesym == ps_radians)
x->x_mode = SVF_RADIANS;
else
{
x->x_mode = SVF_HZ;
- if (s && s != &s_ && s != ps_hz && s != gensym("Hz"))
+ if (modesym && modesym != &s_ &&
+ modesym != ps_hz && modesym != gensym("Hz"))
{
/* CHECKED no warning */
}
@@ -158,8 +178,7 @@ void svf_tilde_setup(void)
ps_radians = gensym("radians");
svf_class = class_new(gensym("svf~"),
(t_newmethod)svf_new, 0,
- sizeof(t_svf), 0,
- A_DEFFLOAT, A_DEFFLOAT, A_DEFSYM, 0);
+ sizeof(t_svf), 0, A_GIMME, 0);
sic_setup(svf_class, svf_dsp, SIC_FLOATTOSIGNAL);
class_addmethod(svf_class, (t_method)svf_clear, gensym("clear"), 0);
class_addmethod(svf_class, (t_method)svf_hz, ps_hz, 0);