aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.common56
-rw-r--r--ViCious/cyclone/sources12
-rw-r--r--cyclone/Makefile.sources12
-rw-r--r--cyclone/build_counter2
-rw-r--r--cyclone/cyclone-test.exclude1
-rw-r--r--cyclone/hammer/substitute.c4
-rw-r--r--cyclone/shadow/dummies.c14
-rw-r--r--cyclone/sickle/Line.c20
-rw-r--r--cyclone/sickle/Makefile.sources12
-rw-r--r--cyclone/sickle/allsickles.c40
-rw-r--r--cyclone/sickle/peek.c2
-rw-r--r--shared/common/binport.c5
-rw-r--r--shared/common/mifi.c524
-rw-r--r--shared/common/mifi.h32
-rw-r--r--shared/common/port.c8
-rw-r--r--shared/shared.h5
-rw-r--r--shared/unstable/fragile.c26
-rw-r--r--shared/unstable/fragile.h1
18 files changed, 455 insertions, 321 deletions
diff --git a/Makefile.common b/Makefile.common
index 25ebd88..3aca2e0 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -14,6 +14,7 @@ TILDE = ~
include Makefile.sources
include Makefile.objects
+# FIXME
CC = gcc-2.95
default: define_build all
@@ -27,14 +28,18 @@ BASE_NAME = $(shell basename `pwd` | awk -F - '{print $$1}')
# CX: control external's main file
# AX: audio (tilde) external's main file
-# LX: symlink external's main file
-# (if symlink external is tilde-only, use OTHER_SOURCES and AX_CLASSES)
+# LX: alias external's main file
+# (if alias external is tilde-only, use OTHER_SOURCES and AX_CLASSES)
CX_NAMES = $(notdir $(CX_SOURCES))
AX_NAMES = $(notdir $(AX_SOURCES))
-LX_NAMES = $(notdir $(LX_SOURCES))
TYPES_NAMES = $(notdir $($1_SOURCES))
+ifdef LX_SOURCES
+LX_NAMES = $(notdir $(LX_SOURCES))
+LX_CLASSES = $(subst _,.,$(LX_NAMES))
+endif
+
CX_DIR = $(dir $(firstword $(CX_SOURCES)))
AX_DIR = $(dir $(firstword $(AX_SOURCES)))
TYPES_DIR = $(dir $(firstword $($1_SOURCES)))
@@ -69,7 +74,7 @@ CFLAGS = $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEFINES) $(INCLUDES)
EXTERNS = $(foreach fn,$(CX_NAMES:.c=.$(X_SUFFIX)),$(OUT_DIR)/$(fn)) \
$(foreach fn,$(AX_NAMES:.c=~.$(X_SUFFIX)),$(OUT_DIR)/$(fn)) \
- $(foreach fn,$(LX_SOURCES:.c=.$(X_SUFFIX)),$(OUT_DIR)/$(fn)) \
+ $(foreach fn,$(LX_CLASSES:.c=.$(X_SUFFIX)),$(OUT_DIR)/$(fn)) \
$(foreach fn,$(CX_CLASSES:=.$(X_SUFFIX)),$(OUT_DIR)/$(fn)) \
$(foreach fn,$(AX_CLASSES:=~.$(X_SUFFIX)),$(OUT_DIR)/$(fn)) \
$(foreach type,$(TYPES),\
@@ -107,21 +112,42 @@ $(if $(word 22,$(TYPES)),$(call TYPES_RULE,$(word 22,$(TYPES))))
$(if $(word 23,$(TYPES)),$(call TYPES_RULE,$(word 23,$(TYPES))))
$(if $(word 24,$(TYPES)),$(call TYPES_RULE,$(word 24,$(TYPES))))
+SHOBJECTS = $(foreach fn,$(SHARED_OBJECTS),$(SHARED_DIR)/$(fn))
+
OBJECTS = $(foreach fn,$(OTHER_SOURCES:.c=.o),$(OBJ_DIR)/$(fn)) \
$(foreach fn,$(LX_SOURCES:.c=.o),$(OBJ_DIR)/$(fn)) \
- $(foreach fn,$(SHARED_OBJECTS),$(SHARED_DIR)/$(fn))
+ $(SHOBJECTS)
# lame...
.PRECIOUS: %.o
-# rules for symlink externals must precede generic extern rules
-$(OUT_DIR)/$(BASE_NAME)_%~.$(X_SUFFIX): $(OUT_DIR)/$(BASE_NAME).$(X_SUFFIX)
- -ln -sf $(BASE_NAME).$(X_SUFFIX) $@
-$(OUT_DIR)/$(BASE_NAME)_%.$(X_SUFFIX): $(OUT_DIR)/$(BASE_NAME).$(X_SUFFIX)
- -ln -sf $(BASE_NAME).$(X_SUFFIX) $@
+# rules for aliases must precede generic extern rules
+
+# FIXME
+$(OUT_DIR)/$(BASE_NAME).%~.$(X_SUFFIX): $(BASE_NAME)_loader.c $(SHOBJECTS)
+ $(CC) -o $@ -Xlinker -defsym \
+ -Xlinker $(BASE_NAME).$(*F)_tilde_setup=$(BASE_NAME)_loader_setup \
+ $(CFLAGS) $(LFLAGS) $(SHOBJECTS) $<
+
+$(OUT_DIR)/$(BASE_NAME).%.$(X_SUFFIX): $(BASE_NAME)_loader.c $(SHOBJECTS)
+ $(CC) -o $@ -Xlinker -defsym \
+ -Xlinker $(BASE_NAME).$(*F)_setup=$(BASE_NAME)_loader_setup \
+ $(CFLAGS) $(LFLAGS) $(SHOBJECTS) $<
+
+#$(OUT_DIR)/$(BASE_NAME).%.$(X_SUFFIX): $(BASE_NAME)_%.c $(SHOBJECTS)
+# $(CC) -c $(CFLAGS) $<
+# -ld -o $@ -defsym $(BASE_NAME).$(*F)_setup=$(BASE_NAME)_$(*F)_setup \
+# -L $(OUT_DIR) $(LFLAGS) $(SHOBJECTS) \
+# $(BASE_NAME).$(X_SUFFIX) $(BASE_NAME)_$(*F).o
+
+# $(CC) -o $@ -Xlinker -defsym \
+# -Xlinker $(BASE_NAME).$(*F)_setup=$(BASE_NAME)_$(*F)_setup \
+# -Xlinker -rpath -Xlinker $(OUT_DIR) \
+# $(CFLAGS) $(LFLAGS) $(SHOBJECTS) $(BASE_NAME).$(X_SUFFIX) $<
# library stub
# if not equal BASE_NAME, it has to be declared explicitly in BASE_DIR/Makefile
+# FIXME
$(OUT_DIR)/$(LX_STUB)_%~.$(X_SUFFIX): $(OUT_DIR)/$(BASE_NAME).$(X_SUFFIX)
-ln -sf $(BASE_NAME).$(X_SUFFIX) $@
$(OUT_DIR)/$(LX_STUB)_%.$(X_SUFFIX): $(OUT_DIR)/$(BASE_NAME).$(X_SUFFIX)
@@ -236,6 +262,12 @@ brelease: define_build
cd $(ROOT_DIR); tar zcf \
$(BIN_TAR).gz $(REL_EXTERNS)
+btestrelease: define_build
+ cd $(ROOT_DIR); tar -cf $(BIN_TAR) $(REL_EXTERNS)
+ cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-test.exclude -rf \
+ $(BIN_TAR) test/$(BASE_NAME)/*
+ cd $(ROOT_DIR); gzip -f $(BIN_TAR)
+
rellibs:
cd $(ROOT_DIR); tar zcf \
$(LIB_TAR).gz $(REL_LIBNAMES)
@@ -253,7 +285,7 @@ release: srelease brelease drelease
$(ALL_TAR) doc/examples/$(BASE_NAME)/*
cd $(ROOT_DIR); gzip -f $(ALL_TAR)
-testrelease: stestrelease brelease
+testrelease: stestrelease btestrelease
cd $(ROOT_DIR); tar -X $(BASE_DIR)/$(BASE_NAME)-all.exclude -cf \
$(ALL_TAR) $(BASE_DIR)/* $(REL_ROOTSRC) $(REL_EXTERNS)
cd $(ROOT_DIR); tar -T $(BASE_DIR)/$(BASE_NAME)-shared.include -rf \
@@ -264,7 +296,7 @@ testrelease: stestrelease brelease
$(ALL_TAR) ViCious/$(BASE_DIR)/*
cd $(ROOT_DIR); gzip -f $(ALL_TAR)
-snap: emptyalldeps testrelease rellibs
+snap: emptyalldeps stestrelease btestrelease
depend:
$(CC) $(CFLAGS) -M $(SOURCES) > Makefile.deps
diff --git a/ViCious/cyclone/sources b/ViCious/cyclone/sources
index 92e5f84..df02eb2 100644
--- a/ViCious/cyclone/sources
+++ b/ViCious/cyclone/sources
@@ -146,6 +146,7 @@ ALL_SICKLES = \
sickle\cosh.c \
sickle\cosx.c \
sickle\count.c \
+ sickle\curve.c \
sickle\cycle.c \
sickle\delay.c \
sickle\delta.c \
@@ -159,30 +160,39 @@ ALL_SICKLES = \
sickle\linedrive.c \
sickle\log.c \
sickle\lookup.c \
+ sickle\lores.c \
sickle\maximum.c \
sickle\minimum.c \
sickle\minmax.c \
+ sickle\mstosamps.c \
+ sickle\onepole.c \
sickle\peakamp.c \
sickle\peek.c \
sickle\phasewrap.c \
+ sickle\pink.c \
sickle\play.c \
+ sickle\poke.c \
sickle\poltocar.c \
sickle\pong.c \
sickle\pow.c \
sickle\rand.c \
sickle\rampsmooth.c \
sickle\record.c \
+ sickle\reson.c \
sickle\sah.c \
+ sickle\sampstoms.c \
sickle\Scope.c \
sickle\sinh.c \
sickle\sinx.c \
sickle\slide.c \
sickle\Snapshot.c \
sickle\spike.c \
+ sickle\svf.c \
sickle\tanh.c \
sickle\tanx.c \
sickle\train.c \
sickle\trapezoid.c \
sickle\triangle.c \
sickle\vectral.c \
- sickle\wave.c
+ sickle\wave.c \
+ sickle\zerox.c
diff --git a/cyclone/Makefile.sources b/cyclone/Makefile.sources
index 6b7afcc..818d8c8 100644
--- a/cyclone/Makefile.sources
+++ b/cyclone/Makefile.sources
@@ -133,26 +133,34 @@ sickle/deltaclip.c \
sickle/edge.c \
sickle/kink.c \
sickle/log.c \
+sickle/lores.c \
sickle/maximum.c \
sickle/minimum.c \
sickle/minmax.c \
+sickle/mstosamps.c \
+sickle/onepole.c \
sickle/peakamp.c \
sickle/phasewrap.c \
+sickle/pink.c \
sickle/pow.c \
sickle/rampsmooth.c \
sickle/rand.c \
+sickle/reson.c \
sickle/sah.c \
+sickle/sampstoms.c \
sickle/sinh.c \
sickle/sinx.c \
sickle/slide.c \
sickle/Snapshot.c \
sickle/spike.c \
+sickle/svf.c \
sickle/tanh.c \
sickle/tanx.c \
sickle/train.c \
sickle/trapezoid.c \
sickle/triangle.c \
-sickle/vectral.c
+sickle/vectral.c \
+sickle/zerox.c
SFORKY_TILDE = $(TILDE)
SFORKY_SOURCES = \
@@ -169,6 +177,7 @@ sickle/poltocar.c
SGROW_TILDE = $(TILDE)
SGROW_SOURCES = \
sickle/click.c \
+sickle/curve.c \
sickle/frameaccum.c \
sickle/framedelta.c \
sickle/Line.c
@@ -187,6 +196,7 @@ sickle/index.c \
sickle/lookup.c \
sickle/peek.c \
sickle/play.c \
+sickle/poke.c \
sickle/record.c \
sickle/wave.c
diff --git a/cyclone/build_counter b/cyclone/build_counter
index 1e05d4b..bce8105 100644
--- a/cyclone/build_counter
+++ b/cyclone/build_counter
@@ -1,3 +1,3 @@
#define CYCLONE_VERSION "0.1"
#define CYCLONE_RELEASE "alpha"
-#define CYCLONE_BUILD 42
+#define CYCLONE_BUILD 44
diff --git a/cyclone/cyclone-test.exclude b/cyclone/cyclone-test.exclude
index ec84f87..6b3cc43 100644
--- a/cyclone/cyclone-test.exclude
+++ b/cyclone/cyclone-test.exclude
@@ -1,4 +1,5 @@
*~
import-result.pd
+import-debug.pd
temporary
temporary/*
diff --git a/cyclone/hammer/substitute.c b/cyclone/hammer/substitute.c
index 48a9b9d..c68419d 100644
--- a/cyclone/hammer/substitute.c
+++ b/cyclone/hammer/substitute.c
@@ -2,6 +2,10 @@
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+/* CHECKED refman's rubbish: 1st outlet used only if there is a match,
+ unchanged messages go through the 2nd outlet (no bang there),
+ 3rd argument ignored (no single-replacement mode). */
+
#include <string.h>
#include "m_pd.h"
#include "common/grow.h"
diff --git a/cyclone/shadow/dummies.c b/cyclone/shadow/dummies.c
index 3d92894..be9a886 100644
--- a/cyclone/shadow/dummies.c
+++ b/cyclone/shadow/dummies.c
@@ -358,7 +358,6 @@ static t_dummy_slot dummy_slots[] =
{ "clocker", 2, 1, 0, 0 },
{ "closebang", 0, 1, 0, 0 },
{ "colorpicker", 1, 1, 0, 0 },
- { "curve~", 3, 2, 0, 0 },
{ "date", 1, 3, 0, 0 },
{ "defer", 1, 1, 0, 0 }, /* LATER pass anything through */
{ "degrade~", 3, 1, 0, 0 },
@@ -381,7 +380,7 @@ static t_dummy_slot dummy_slots[] =
{ "filein", 3, 3, 0, 0 },
{ "filepath", 1, 1, 0, 0 },
{ "filtergraph~", 8, 6, 0, 0 },
- { "folder", 1, 1, 0, 0 }, /* CHECKME 2nd outlet */
+ { "folder", 1, 2, 0, 0 },
{ "follow", 1, 2, 0, 0 },
{ "fpic", 1, 0, 0, 0 },
{ "frame", 6, 0, 0, 0 },
@@ -407,16 +406,12 @@ static t_dummy_slot dummy_slots[] =
{ "lcd", 1, 4, 0, 0 }, /* CHECKME nouts */
{ "led", 1, 1, 0, 0 },
{ "Line", 3, 2, 0, 0 },
- { "lores~", 3, 1, 0, 0 },
{ "matrixctrl", 1, 1, 0, 0 }, /* CHECKME nins, nouts */
{ "matrix~", -1, -1, 0, (t_newmethod)dummy_matrix_tilde_new },
- { "maximum~", 2, 1, 0, 0 },
{ "menubar", 1, 4, 0, 0 }, /* LATER parse #Xs (additional outs) */
{ "meter~", 1, 1, 0, 0 }, /* LATER consider mapping to the vu */
- { "minimum~", 2, 1, 0, 0 },
{ "movie", 1, 3, 0, 0 },
/* CHECKME msd */
- { "mstosamps~", 1, 2, 0, 0 },
{ "multiSlider", 1, 1, 0, 0 },
{ "mute~", 1, 1, 0, 0 },
{ "normalize~", 2, 1, 0, 0 },
@@ -427,7 +422,6 @@ static t_dummy_slot dummy_slots[] =
{ "omsnotes", 4, 2, 0, 0 }, /* CHECKME osx */
{ "omspatches", 3, 2, 0, 0 }, /* CHECKME osx */
{ "onecopy", 0, 0, 0, 0 }, /* CHECKME */
- { "onepole~", 2, 1, 0, 0 },
{ "opendialog", 1, 2, 0, 0 },
{ "oscbank~", 4, 1, 0, 0 },
{ "oval", 6, 0, 0, 0 },
@@ -442,7 +436,6 @@ static t_dummy_slot dummy_slots[] =
{ "pict", 3, 0, 0, 0 },
{ "pictctrl", 1, 1, 0, 0 },
{ "pictslider", 2, 2, 0, 0 }, /* CHECKME one-dimensional mode */
- { "pink~", 1, 1, 0, 0 }, /* CHECKME inlet */
{ "playbar", 1, 2, 0, 0 }, /* CHECKME */
{ "plugconfig", 1, 0, 0, 0 },
{ "plugin~", 2, 2, 0, 0 },
@@ -457,7 +450,6 @@ static t_dummy_slot dummy_slots[] =
{ "plugsend~", 1, 0, 0, 0 },
{ "plugstore", 1, 1, 0, 0 }, /* CHECKME nouts */
{ "plugsync~", 0, 9, 0, 0 }, /* CHECKME nouts */
- { "poke~", 3, 0, 0, 0 },
{ "Poly", 2, 4, 0, 0 },
{ "polyin", 1, 3, 0, 0 }, /* LATER parse args for nouts */
{ "polyout", 3, 0, 0, 0 }, /* CHECKME nins */
@@ -471,13 +463,11 @@ static t_dummy_slot dummy_slots[] =
/* LATER settable Receive? */
{ "rect", 6, 0, 0, 0 },
{ "relativepath", 1, 1, 0, 0 },
- { "reson~", 4, 1, 0, 0 },
{ "rewire~", 1, -1, 0, (t_newmethod)dummy_rewire_tilde_new },
{ "ring", 6, 0, 0, 0 },
{ "round~", 2, 1, 0, 0 },
{ "rslider", 2, 2, 0, 0 },
{ "rtin", 1, 1, 0, 0 },
- { "sampstoms~", 1, 2, 0, 0 },
{ "savedialog", 1, 3, 0, 0 },
{ "screensize", 1, 2, 0, 0 },
{ "selector~", -1, 1, 0, (t_newmethod)dummy_selector_tilde_new },
@@ -492,7 +482,6 @@ static t_dummy_slot dummy_slots[] =
{ "strippath", 1, 2, 0, 0 },
{ "stutter~", -1, -1, 0, (t_newmethod)dummy_stutter_tilde_new },
{ "suspend", 0, 1, 0, 0 },
- { "svf~", 3, 4, 0, 0 },
{ "swatch", 3, 2, 0, 0 },
{ "sxformat", -1, 1, 0, (t_newmethod)dummy_sxformat_new },
{ "sysexin", 1, 1, 0, 0 },
@@ -523,7 +512,6 @@ static t_dummy_slot dummy_slots[] =
{ "vpicture", 0, 0, 0, 0 },
{ "vst~", -1, -1, 0, (t_newmethod)dummy_vst_tilde_new },
{ "waveform~", 5, 6, 0, 0 }, /* CHECKME */
- { "zerox~", 1, 2, 0, 0 },
{ "zigzag~", 2, 4, 0, 0 },
{ "_dummy", 0, 0, 0, 0 }
};
diff --git a/cyclone/sickle/Line.c b/cyclone/sickle/Line.c
index f1d2b18..1b9e76c 100644
--- a/cyclone/sickle/Line.c
+++ b/cyclone/sickle/Line.c
@@ -3,17 +3,13 @@
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include "m_pd.h"
+#include "shared.h"
#include "common/grow.h"
#include "common/loud.h"
#include "sickle/sic.h"
//#define LINE_DEBUG
-#ifndef PD_BADFLOAT
-#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \
- (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000))
-#endif
-
#define LINE_INISIZE 64 /* LATER rethink */
#define LINE_MAXSIZE 64
@@ -196,9 +192,15 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av)
t_atom *ap;
t_lineseg *segp;
for (natoms = 0, ap = av; natoms < ac; natoms++, ap++)
- if (ap->a_type != A_FLOAT) break; /* CHECKME */
+ {
+ if (ap->a_type != A_FLOAT)
+ {
+ loud_messarg((t_pd *)x, &s_list); /* CHECKED */
+ return; /* CHECKED */
+ }
+ }
if (!natoms)
- return; /* CHECKME */
+ return; /* CHECKED */
odd = natoms % 2;
nsegs = natoms / 2;
if (odd) nsegs++;
@@ -212,6 +214,7 @@ static void line_list(t_line *x, t_symbol *s, int ac, t_atom *av)
{
natoms = ns * 2;
nsegs = ns;
+ odd = 0;
}
}
x->x_nsegs = nsegs;
@@ -289,7 +292,8 @@ static void *line_new(t_floatarg f)
void Line_tilde_setup(void)
{
line_class = class_new(gensym("Line~"),
- (t_newmethod)line_new, 0,
+ (t_newmethod)line_new,
+ (t_method)line_free,
sizeof(t_line), 0, A_DEFFLOAT, 0);
sic_setup(line_class, line_dsp, SIC_NOMAINSIGNALIN);
class_addfloat(line_class, line_float);
diff --git a/cyclone/sickle/Makefile.sources b/cyclone/sickle/Makefile.sources
index b4a5d75..d39cc17 100644
--- a/cyclone/sickle/Makefile.sources
+++ b/cyclone/sickle/Makefile.sources
@@ -28,6 +28,7 @@ comb.c \
cosh.c \
cosx.c \
count.c \
+curve.c \
cycle.c \
delay.c \
delta.c \
@@ -41,30 +42,39 @@ Line.c \
linedrive.c \
log.c \
lookup.c \
+lores.c \
maximum.c \
minimum.c \
minmax.c \
+mstosamps.c \
+onepole.c \
peakamp.c \
peek.c \
phasewrap.c \
+pink.c \
play.c \
+poke.c \
poltocar.c \
pong.c \
pow.c \
rand.c \
rampsmooth.c \
record.c \
+reson.c \
sah.c \
+sampstoms.c \
Scope.c \
sinh.c \
sinx.c \
slide.c \
Snapshot.c \
spike.c \
+svf.c \
tanh.c \
tanx.c \
train.c \
trapezoid.c \
triangle.c \
vectral.c \
-wave.c
+wave.c \
+zerox.c
diff --git a/cyclone/sickle/allsickles.c b/cyclone/sickle/allsickles.c
index f543879..d062c61 100644
--- a/cyclone/sickle/allsickles.c
+++ b/cyclone/sickle/allsickles.c
@@ -4,18 +4,14 @@
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
-void Clip_tilde_setup(void);
-void Line_tilde_setup(void);
-void Scope_tilde_setup(void);
-void Snapshot_tilde_setup(void);
void abs_tilde_setup(void);
void acos_tilde_setup(void);
void acosh_tilde_setup(void);
void allpass_tilde_setup(void);
void asin_tilde_setup(void);
void asinh_tilde_setup(void);
-void atan_tilde_setup(void);
void atan2_tilde_setup(void);
+void atan_tilde_setup(void);
void atanh_tilde_setup(void);
void average_tilde_setup(void);
void avg_tilde_setup(void);
@@ -28,10 +24,12 @@ void capture_tilde_setup(void);
void cartopol_tilde_setup(void);
void change_tilde_setup(void);
void click_tilde_setup(void);
+void Clip_tilde_setup(void);
void comb_tilde_setup(void);
void cosh_tilde_setup(void);
void cosx_tilde_setup(void);
void count_tilde_setup(void);
+void curve_tilde_setup(void);
void cycle_tilde_setup(void);
void delay_tilde_setup(void);
void delta_tilde_setup(void);
@@ -41,27 +39,38 @@ void frameaccum_tilde_setup(void);
void framedelta_tilde_setup(void);
void index_tilde_setup(void);
void kink_tilde_setup(void);
+void Line_tilde_setup(void);
void linedrive_setup(void);
void log_tilde_setup(void);
void lookup_tilde_setup(void);
+void lores_tilde_setup(void);
void maximum_tilde_setup(void);
void minimum_tilde_setup(void);
void minmax_tilde_setup(void);
+void mstosamps_tilde_setup(void);
+void onepole_tilde_setup(void);
void peakamp_tilde_setup(void);
void peek_tilde_setup(void);
void phasewrap_tilde_setup(void);
+void pink_tilde_setup(void);
void play_tilde_setup(void);
+void poke_tilde_setup(void);
void poltocar_tilde_setup(void);
void pong_tilde_setup(void);
void pow_tilde_setup(void);
void rampsmooth_tilde_setup(void);
void rand_tilde_setup(void);
void record_tilde_setup(void);
+void reson_tilde_setup(void);
void sah_tilde_setup(void);
+void sampstoms_tilde_setup(void);
+void Scope_tilde_setup(void);
void sinh_tilde_setup(void);
void sinx_tilde_setup(void);
void slide_tilde_setup(void);
+void Snapshot_tilde_setup(void);
void spike_tilde_setup(void);
+void svf_tilde_setup(void);
void tanh_tilde_setup(void);
void tanx_tilde_setup(void);
void train_tilde_setup(void);
@@ -69,21 +78,18 @@ void trapezoid_tilde_setup(void);
void triangle_tilde_setup(void);
void vectral_tilde_setup(void);
void wave_tilde_setup(void);
+void zerox_tilde_setup(void);
void allsickles_setup(void)
{
- Clip_tilde_setup();
- Line_tilde_setup();
- Scope_tilde_setup();
- Snapshot_tilde_setup();
abs_tilde_setup();
acos_tilde_setup();
acosh_tilde_setup();
allpass_tilde_setup();
asin_tilde_setup();
asinh_tilde_setup();
- atan_tilde_setup();
atan2_tilde_setup();
+ atan_tilde_setup();
atanh_tilde_setup();
average_tilde_setup();
avg_tilde_setup();
@@ -96,10 +102,12 @@ void allsickles_setup(void)
cartopol_tilde_setup();
change_tilde_setup();
click_tilde_setup();
+ Clip_tilde_setup();
comb_tilde_setup();
cosh_tilde_setup();
cosx_tilde_setup();
count_tilde_setup();
+ curve_tilde_setup();
cycle_tilde_setup();
delay_tilde_setup();
delta_tilde_setup();
@@ -109,27 +117,38 @@ void allsickles_setup(void)
framedelta_tilde_setup();
index_tilde_setup();
kink_tilde_setup();
+ Line_tilde_setup();
linedrive_setup();
log_tilde_setup();
lookup_tilde_setup();
+ lores_tilde_setup();
maximum_tilde_setup();
minimum_tilde_setup();
minmax_tilde_setup();
+ mstosamps_tilde_setup();
+ onepole_tilde_setup();
peakamp_tilde_setup();
peek_tilde_setup();
phasewrap_tilde_setup();
+ pink_tilde_setup();
play_tilde_setup();
+ poke_tilde_setup();
poltocar_tilde_setup();
pong_tilde_setup();
pow_tilde_setup();
rampsmooth_tilde_setup();
rand_tilde_setup();
record_tilde_setup();
+ reson_tilde_setup();
sah_tilde_setup();
+ sampstoms_tilde_setup();
+ Scope_tilde_setup();
sinh_tilde_setup();
sinx_tilde_setup();
slide_tilde_setup();
+ Snapshot_tilde_setup();
spike_tilde_setup();
+ svf_tilde_setup();
tanh_tilde_setup();
tanx_tilde_setup();
train_tilde_setup();
@@ -137,4 +156,5 @@ void allsickles_setup(void)
triangle_tilde_setup();
vectral_tilde_setup();
wave_tilde_setup();
+ zerox_tilde_setup();
}
diff --git a/cyclone/sickle/peek.c b/cyclone/sickle/peek.c
index 7397577..534cc49 100644
--- a/cyclone/sickle/peek.c
+++ b/cyclone/sickle/peek.c
@@ -55,7 +55,7 @@ static void peek_float(t_peek *x, t_float f)
if (vp = sic->s_vectors[x->x_effchannel])
{
int ndx = (int)f;
- if (vp && ndx >= 0 && ndx < sic->s_vecsize)
+ if (ndx >= 0 && ndx < sic->s_vecsize)
{
if (x->x_pokemode)
{
diff --git a/shared/common/binport.c b/shared/common/binport.c
index 05cc5df..c886955 100644
--- a/shared/common/binport.c
+++ b/shared/common/binport.c
@@ -452,7 +452,8 @@ int binport_read(t_binbuf *bb, char *filename, char *dirname)
{
t_atom at;
while (binport_nextatom(bp, &at))
- binbuf_add(bb, 1, &at);
+ if (at.a_type != A_NULL)
+ binbuf_add(bb, 1, &at);
binport_free(bp);
return (BINPORT_OK);
}
@@ -534,7 +535,7 @@ int main(int ac, char **av)
fputs(";\n", stdout);
ac = 0;
}
- else
+ else if (at.a_type != A_NULL)
{
if (ac++) fputc(' ', stdout);
binport_atomstring(&at, buf, BINPORT_MAXSTRING);
diff --git a/shared/common/mifi.c b/shared/common/mifi.c
index ad16b3b..b2fea10 100644
--- a/shared/common/mifi.c
+++ b/shared/common/mifi.c
@@ -19,12 +19,8 @@
#include "common/bifi.h"
#include "common/mifi.h"
-#if 1
#define MIFI_VERBOSE
-#if 0
#define MIFI_DEBUG
-#endif
-#endif
#define MIFI_SHORTEST_EVENT 2 /* singlebyte delta and one databyte */
#define MIFI_EVENT_NALLOC 32 /* LATER do some research (average max?) */
@@ -51,56 +47,57 @@ typedef struct _mifi_trackheader
/* reading helpers */
-static void mifi_earlyeof(t_mifi_stream *x)
+static void mifi_earlyeof(t_mifi_stream *sp)
{
- x->s_bytesleft = 0;
- x->s_eof = 1;
+ sp->s_bytesleft = 0;
+ sp->s_eof = 1;
}
/* Get next byte from track data.
- On error: return 0 (which is a valid result) and set x->s_eof.
+ On error: return 0 (which is a valid result) and set sp->s_eof.
*/
-static uchar mifi_getbyte(t_mifi_stream *x)
+static uchar mifi_getbyte(t_mifi_stream *sp)
{
- if (x->s_bytesleft)
+ if (sp->s_bytesleft)
{
int c;
- if ((c = fgetc(x->s_fp)) == EOF)
+ if ((c = fgetc(sp->s_fp)) == EOF)
{
- mifi_earlyeof(x);
+ mifi_earlyeof(sp);
return (0);
}
- else {
- x->s_bytesleft--;
+ else
+ {
+ sp->s_bytesleft--;
return ((uchar)c);
}
}
else return (0);
}
-static uint32 mifi_readbytes(t_mifi_stream *x, uchar *buf, uint32 size)
+static uint32 mifi_readbytes(t_mifi_stream *sp, uchar *buf, uint32 size)
{
size_t res;
- if (size > x->s_bytesleft)
- size = x->s_bytesleft;
- if ((res = fread(buf, 1, (size_t)size, x->s_fp)) == size)
- x->s_bytesleft -= res;
+ if (size > sp->s_bytesleft)
+ size = sp->s_bytesleft;
+ if ((res = fread(buf, 1, (size_t)size, sp->s_fp)) == size)
+ sp->s_bytesleft -= res;
else
- mifi_earlyeof(x);
+ mifi_earlyeof(sp);
return (res);
}
-static int mifi_skipbytes(t_mifi_stream *x, uint32 size)
+static int mifi_skipbytes(t_mifi_stream *sp, uint32 size)
{
- if (size > x->s_bytesleft)
- size = x->s_bytesleft;
+ if (size > sp->s_bytesleft)
+ size = sp->s_bytesleft;
if (size)
{
- int res = fseek(x->s_fp, size, SEEK_CUR);
+ int res = fseek(sp->s_fp, size, SEEK_CUR);
if (res < 0)
- mifi_earlyeof(x);
+ mifi_earlyeof(sp);
else
- x->s_bytesleft -= size;
+ sp->s_bytesleft -= size;
return res;
}
else return (0);
@@ -108,7 +105,7 @@ static int mifi_skipbytes(t_mifi_stream *x, uint32 size)
/* helpers handling variable-length quantities */
-static size_t mifi_writevarlen(t_mifi_stream *x, uint32 n)
+static size_t mifi_writevarlen(t_mifi_stream *sp, uint32 n)
{
uint32 buf = n & 0x7f;
size_t length = 1;
@@ -119,18 +116,18 @@ static size_t mifi_writevarlen(t_mifi_stream *x, uint32 n)
buf += n & 0x7f;
length++;
}
- return ((fwrite(&buf, 1, length, x->s_fp) == length) ? length : 0);
+ return ((fwrite(&buf, 1, length, sp->s_fp) == length) ? length : 0);
}
-static uint32 mifi_readvarlen(t_mifi_stream *x)
+static uint32 mifi_readvarlen(t_mifi_stream *sp)
{
uint32 n = 0;
uchar c;
- uint32 count = x->s_bytesleft;
+ uint32 count = sp->s_bytesleft;
if (count > 4) count = 4;
while (count--)
{
- n = (n << 7) + ((c = mifi_getbyte(x)) & 0x7f);
+ n = (n << 7) + ((c = mifi_getbyte(sp)) & 0x7f);
if ((c & 0x80) == 0)
break;
}
@@ -139,14 +136,14 @@ static uint32 mifi_readvarlen(t_mifi_stream *x)
/* other helpers */
-static int mifi_read_start_track(t_mifi_stream *x)
+static int mifi_read_start_track(t_mifi_stream *sp)
{
t_mifi_trackheader header;
long skip;
int notyet = 1;
do {
if (fread(&header, 1,
- MIFI_TRACKHEADER_SIZE, x->s_fp) < MIFI_TRACKHEADER_SIZE)
+ MIFI_TRACKHEADER_SIZE, sp->s_fp) < MIFI_TRACKHEADER_SIZE)
goto nomoretracks;
header.h_length = bifi_swap4(header.h_length);
if (strncmp(header.h_type, "MTrk", 4))
@@ -154,29 +151,29 @@ static int mifi_read_start_track(t_mifi_stream *x)
char buf[5];
strncpy(buf, header.h_type, 4);
buf[5] = '\0';
- if (x->s_anapass)
+ if (sp->s_anapass)
post("unknown chunk %s in midifile -- skipped", buf);
}
else if (header.h_length < MIFI_SHORTEST_EVENT)
{
- if (x->s_anapass) post("empty track in midifile -- skipped");
+ if (sp->s_anapass) post("empty track in midifile -- skipped");
}
else notyet = 0;
if (notyet && (skip = header.h_length) &&
- fseek(x->s_fp, skip, SEEK_CUR) < 0)
+ fseek(sp->s_fp, skip, SEEK_CUR) < 0)
goto nomoretracks;
} while (notyet);
- x->s_track++;
- x->s_newtrack = 1;
- x->s_status = x->s_channel = 0;
- x->s_bytesleft = header.h_length;
- x->s_time = 0;
+ sp->s_track++;
+ sp->s_newtrack = 1;
+ sp->s_status = sp->s_channel = 0;
+ sp->s_bytesleft = header.h_length;
+ sp->s_time = 0;
return (1);
nomoretracks:
- if (x->s_track == 0)
- if (x->s_anapass) post("no valid miditracks");
+ if (sp->s_track == 0)
+ if (sp->s_anapass) post("no valid miditracks");
return (0);
}
@@ -184,37 +181,48 @@ nomoretracks:
t_mifi_event *mifi_event_new(void)
{
- t_mifi_event *e = getbytes(sizeof(*e));
- if (e && !(e->e_data = getbytes(e->e_bufsize = MIFI_EVENT_NALLOC)))
+ t_mifi_event *ep = getbytes(sizeof(*ep));
+ if (ep && !(ep->e_data = getbytes(ep->e_bufsize = MIFI_EVENT_NALLOC)))
{
- freebytes(e, sizeof(*e));
+ freebytes(ep, sizeof(*ep));
return (0);
}
- return (e);
+ return (ep);
}
-void mifi_event_free(t_mifi_event *e)
+void mifi_event_free(t_mifi_event *ep)
{
- freebytes(e->e_data, e->e_bufsize);
- freebytes(e, sizeof(*e));
+ freebytes(ep->e_data, ep->e_bufsize);
+ freebytes(ep, sizeof(*ep));
}
-int mifi_event_settext(t_mifi_event *e, int type, char *text)
+int mifi_event_settext(t_mifi_event *ep, int type, char *text)
{
- e->e_delay = 0;
- e->e_status = MIFI_EVENT_META;
- e->e_meta = type;
- e->e_length = strlen(text);
- if (squb_checksize(e, e->e_length + 1, 1) <= e->e_length)
+ ep->e_delay = 0;
+ ep->e_status = MIFI_EVENT_META;
+ ep->e_meta = type;
+ ep->e_length = strlen(text);
+ if (squb_checksize(ep, ep->e_length + 1, 1) <= ep->e_length)
{
- e->e_length = 0;
+ ep->e_length = 0;
return (0);
}
- strcpy(e->e_data, text);
+ strcpy(ep->e_data, text);
return (1);
}
-void mifi_event_printmeta(t_mifi_event *e)
+#ifdef MIFI_DEBUG
+static void mifi_event_printsysex(t_mifi_event *ep)
+{
+ int length = ep->e_length;
+ uchar *dp = ep->e_data;
+ startpost("sysex:");
+ while (length--) postfloat((float)*dp++);
+ endpost();
+}
+#endif
+
+void mifi_event_printmeta(t_mifi_event *ep)
{
static int isprintable[MIFI_META_MAXPRINTABLE+1] =
{
@@ -229,67 +237,67 @@ void mifi_event_printmeta(t_mifi_event *e)
"", "text: %s", "copyright: %s", "track name: %s",
"instrument name: %s", "lyric: %s", "marker: %s", "cue point: %s"
};
- if (e->e_meta <= MIFI_META_MAXPRINTABLE)
+ if (ep->e_meta <= MIFI_META_MAXPRINTABLE)
{
- if (isprintable[e->e_meta] && printformat[e->e_meta])
- post(printformat[e->e_meta], e->e_data);
+ if (isprintable[ep->e_meta] && printformat[ep->e_meta])
+ post(printformat[ep->e_meta], ep->e_data);
}
#ifdef MIFI_DEBUG /* in verbose mode tempo printout done only after sorting */
- else if (e->e_meta == MIFI_META_TEMPO)
+ else if (ep->e_meta == MIFI_META_TEMPO)
{
- int tempo = bifi_swap4(*(uint32*)e->e_data);
- post("tempo %d after %d", tempo, e->e_delay);
+ int tempo = bifi_swap4(*(uint32 *)ep->e_data);
+ post("tempo %d after %d", tempo, ep->e_delay);
}
#endif
}
-void mifi_stream_reset(t_mifi_stream *x)
+void mifi_stream_reset(t_mifi_stream *sp)
{
- sq_reset(x);
- x->s_status = x->s_channel = 0;
- x->s_timecoef = sq_msecs2ticks(x, 0);
- x->s_bytesleft = 0;
+ sq_reset(sp);
+ sp->s_status = sp->s_channel = 0;
+ sp->s_timecoef = sq_msecs2ticks(sp, 0);
+ sp->s_bytesleft = 0;
}
t_mifi_stream *mifi_stream_new(void)
{
- t_mifi_stream *x = sq_new();
- if (x)
+ t_mifi_stream *sp = sq_new();
+ if (sp)
{
- if (x->s_auxeve = mifi_event_new())
+ if (sp->s_auxeve = mifi_event_new())
{
- x->s_hdtracks = 1;
- x->s_alltracks = 0;
- mifi_stream_reset(x); /* LATER avoid calling sq_reset() twice */
+ sp->s_hdtracks = 1;
+ sp->s_alltracks = 0;
+ mifi_stream_reset(sp); /* LATER avoid calling sq_reset() twice */
}
else
{
- mifi_stream_free(x);
+ mifi_stream_free(sp);
return (0);
}
}
- return (x);
+ return (sp);
}
-void mifi_stream_free(t_mifi_stream *x)
+void mifi_stream_free(t_mifi_stream *sp)
{
- if (x->s_auxeve)
- mifi_event_free(x->s_auxeve);
- sq_free(x);
+ if (sp->s_auxeve)
+ mifi_event_free(sp->s_auxeve);
+ sq_free(sp);
}
/* Open midifile for reading, parse the header. May be used as t_mifi_stream
- allocator (if x is a null pointer), to be freed by mifi_read_end() or
+ allocator (if sp is a null pointer), to be freed by mifi_read_end() or
explicitly.
- Return value: null on error, else x if passed a valid pointer, else pointer
+ Return value: null on error, else sp if passed a valid pointer, else pointer
to an allocated structure.
*/
-t_mifi_stream *mifi_read_start(t_mifi_stream *x,
+t_mifi_stream *mifi_read_start(t_mifi_stream *sp,
const char *filename, const char *dirname,
int complain)
{
- t_mifi_stream *result = x;
+ t_mifi_stream *result = sp;
t_bifi bifi;
t_bifi *bp = &bifi;
t_mifi_header header;
@@ -315,7 +323,7 @@ t_mifi_stream *mifi_read_start(t_mifi_stream *x,
}
/* since we will tolerate other incompatibilities, now we can allocate */
- if (x) mifi_stream_reset(x);
+ if (sp) mifi_stream_reset(sp);
else
{
if (!(result = mifi_stream_new()))
@@ -340,121 +348,124 @@ badheader:
if (complain)
post("`%s\' is not a valid midifile", filename);
badstart:
- if (result && !x) mifi_stream_free(result);
+ if (result && !sp) mifi_stream_free(result);
bifi_free(bp);
return (0);
}
-int mifi_read_restart(t_mifi_stream *x)
+int mifi_read_restart(t_mifi_stream *sp)
{
- FILE *fp = x->s_fp;
- mifi_stream_reset(x);
- x->s_anapass = 0;
- x->s_fp = fp;
+ FILE *fp = sp->s_fp;
+ mifi_stream_reset(sp);
+ sp->s_anapass = 0;
+ sp->s_fp = fp;
return (fseek(fp, 0, SEEK_SET) ? 0 : 1);
}
/* Close midifile and free t_mifi_stream if it was allocated
by mifi_read_start() */
-void mifi_read_end(t_mifi_stream *x)
+void mifi_read_end(t_mifi_stream *sp)
{
- if (x->s_fp) fclose(x->s_fp);
- if (x->s_autoalloc) mifi_stream_free(x);
+ if (sp->s_fp) fclose(sp->s_fp);
+ if (sp->s_autoalloc) mifi_stream_free(sp);
}
/* Read next event from midifile.
Return value: see #defines in mifi.h.
*/
-int mifi_read_event(t_mifi_stream *x, t_mifi_event *e)
+int mifi_read_event(t_mifi_stream *sp, t_mifi_event *ep)
{
uchar status, channel;
uint32 length;
- x->s_newtrack = 0;
+ sp->s_newtrack = 0;
nextattempt:
- if (x->s_bytesleft < MIFI_SHORTEST_EVENT && !mifi_read_start_track(x))
+ if (sp->s_bytesleft < MIFI_SHORTEST_EVENT && !mifi_read_start_track(sp))
return (MIFI_READ_EOF);
- x->s_time += (e->e_delay = mifi_readvarlen(x));
+ sp->s_time += (ep->e_delay = mifi_readvarlen(sp));
- if ((status = mifi_getbyte(x)) < 0x80)
+ if ((status = mifi_getbyte(sp)) < 0x80)
{
- if (MIFI_IS_CHANNEL(x->s_status))
+ if (MIFI_IS_CHANNEL(sp->s_status))
{
- e->e_data[0] = status;
- e->e_length = 1;
- status = x->s_status;
- e->e_channel = x->s_channel;
+ ep->e_data[0] = status;
+ ep->e_length = 1;
+ status = sp->s_status;
+ ep->e_channel = sp->s_channel;
}
- else {
- if (x->s_anapass)
- post("missing running status in midifile -- skip to end of track");
+ else
+ {
+ if (sp->s_anapass)
+ post("missing running status in midifile -- \
+ skip to end of track");
goto endoftrack;
}
}
- else e->e_length = 0;
+ else ep->e_length = 0;
/* channel message */
if (status < 0xf0)
{
- if (e->e_length == 0)
+ if (ep->e_length == 0)
{
- e->e_data[0] = mifi_getbyte(x);
- e->e_length = 1;
- x->s_status = status & 0xf0;
- x->s_channel = e->e_channel = status & 0x0f;
- status = x->s_status;
+ ep->e_data[0] = mifi_getbyte(sp);
+ ep->e_length = 1;
+ sp->s_status = status & 0xf0;
+ sp->s_channel = ep->e_channel = status & 0x0f;
+ status = sp->s_status;
}
if (!MIFI_ONE_DATABYTE(status))
{
- e->e_data[1] = mifi_getbyte(x);
- e->e_length = 2;
+ ep->e_data[1] = mifi_getbyte(sp);
+ ep->e_length = 2;
}
}
/* system exclusive */
else if (status == MIFI_SYSEX_FIRST || status == MIFI_SYSEX_NEXT)
{
- /* LATER choose the right way --
- do we really need all those huge bulk dumps? */
- length = mifi_readvarlen(x);
- if (squb_checksize(e, length, 1) < length)
+ length = mifi_readvarlen(sp);
+ if (squb_checksize(ep, length, 1) < length)
{
- if (mifi_skipbytes(x, length) < 0)
+ if (mifi_skipbytes(sp, length) < 0)
return (MIFI_READ_FATAL);
goto nextattempt;
}
- if (mifi_readbytes(x, e->e_data, length) != length)
+ /* LATER make the allocation optional */
+ if (mifi_readbytes(sp, ep->e_data, length) != length)
return (MIFI_READ_FATAL);
- e->e_length = length;
-#ifdef MIFI_VERBOSE
- if (x->s_anapass) post("got %d bytes of sysex", length);
+ ep->e_length = length;
+#ifdef MIFI_DEBUG
+ if (sp->s_anapass) mifi_event_printsysex(ep);
+#elif defined MIFI_VERBOSE
+ if (sp->s_anapass) post("got %d bytes of sysex", length);
#endif
}
/* meta-event */
else if (status == MIFI_EVENT_META)
{
- e->e_meta = mifi_getbyte(x);
- length = mifi_readvarlen(x);
- if (e->e_meta > 127)
+ ep->e_meta = mifi_getbyte(sp);
+ length = mifi_readvarlen(sp);
+ if (ep->e_meta > 127)
{
/* try to skip corrupted meta-event (quietly) */
#ifdef MIFI_VERBOSE
- if (x->s_anapass) post("bad meta: %d > 127", e->e_meta);
+ if (sp->s_anapass) post("bad meta: %d > 127", ep->e_meta);
#endif
- if (mifi_skipbytes(x, length) < 0)
+ if (mifi_skipbytes(sp, length) < 0)
return (MIFI_READ_FATAL);
goto nextattempt;
}
- switch (e->e_meta)
+ switch (ep->e_meta)
{
case MIFI_META_EOT:
if (length)
{
/* corrupted eot: ignore and skip to the real end of track */
#ifdef MIFI_VERBOSE
- if (x->s_anapass) post("corrupted eot, length %d", length);
+ if (sp->s_anapass) post("corrupted eot, length %d", length);
#endif
goto endoftrack;
}
@@ -462,39 +473,40 @@ nextattempt:
case MIFI_META_TEMPO:
if (length != 3)
{
- if (x->s_anapass)
+ if (sp->s_anapass)
post("corrupted event in midifile -- skip to end of track");
goto endoftrack;
}
- if (mifi_readbytes(x, e->e_data+1, 3) != 3)
+ if (mifi_readbytes(sp, ep->e_data + 1, 3) != 3)
return (MIFI_READ_FATAL);
- e->e_data[0] = 0;
- x->s_tempo = bifi_swap4(*(uint32*)e->e_data);
+ ep->e_data[0] = 0;
+ sp->s_tempo = bifi_swap4(*(uint32 *)ep->e_data);
break;
default:
- if (squb_checksize(e, length + 1, 1) <= length)
+ if (squb_checksize(ep, length + 1, 1) <= length)
{
- if (mifi_skipbytes(x, length) < 0)
+ if (mifi_skipbytes(sp, length) < 0)
return (MIFI_READ_FATAL);
goto nextattempt;
}
- if (mifi_readbytes(x, e->e_data, length) != length)
+ if (mifi_readbytes(sp, ep->e_data, length) != length)
return (MIFI_READ_FATAL);
- e->e_length = length;
- if (e->e_meta && e->e_meta <= MIFI_META_MAXPRINTABLE)
- e->e_data[length] = '\0'; /* text meta-event nultermination */
+ ep->e_length = length;
+ if (ep->e_meta && ep->e_meta <= MIFI_META_MAXPRINTABLE)
+ ep->e_data[length] = '\0'; /* text meta-event nultermination */
}
}
- else {
- if (x->s_anapass)
+ else
+ {
+ if (sp->s_anapass)
post("unknown event type in midifile -- skip to end of track");
goto endoftrack;
}
- return ((e->e_status = status) == MIFI_EVENT_META ? e->e_meta : status);
+ return ((ep->e_status = status) == MIFI_EVENT_META ? ep->e_meta : status);
endoftrack:
- if (mifi_skipbytes(x, x->s_bytesleft) < 0)
+ if (mifi_skipbytes(sp, sp->s_bytesleft) < 0)
return (MIFI_READ_FATAL);
return (MIFI_READ_SKIP);
}
@@ -503,9 +515,9 @@ endoftrack:
allocate the maps. To be called in the first pass of reading.
*/
/* LATER consider optional reading of nonchannel events */
-int mifi_read_analyse(t_mifi_stream *x)
+int mifi_read_analyse(t_mifi_stream *sp)
{
- t_mifi_event *evp = x->s_auxeve;
+ t_mifi_event *ep = sp->s_auxeve;
int evtype, result = MIFI_READ_FATAL;
int isnewtrack = 0;
int i;
@@ -514,18 +526,18 @@ int mifi_read_analyse(t_mifi_stream *x)
t_squack *trp = 0;
*tnamebuf = '\0';
- x->s_alltracks = x->s_ntracks = 0;
- x->s_nevents = 0;
- x->s_ntempi = 0;
+ sp->s_alltracks = sp->s_ntracks = 0;
+ sp->s_nevents = 0;
+ sp->s_ntempi = 0;
- while ((evtype = mifi_read_event(x, evp)) >= MIFI_READ_SKIP)
+ while ((evtype = mifi_read_event(sp, ep)) >= MIFI_READ_SKIP)
{
if (evtype == MIFI_READ_SKIP)
continue;
- if (x->s_newtrack)
+ if (sp->s_newtrack)
{
#ifdef MIFI_VERBOSE
- post("track %d", x->s_track);
+ post("track %d", sp->s_track);
#endif
isnewtrack = 1;
*tnamebuf = '\0';
@@ -536,8 +548,8 @@ int mifi_read_analyse(t_mifi_stream *x)
if (isnewtrack)
{
isnewtrack = 0;
- x->s_alltracks++;
- if (!(trp = squax_add(x)))
+ sp->s_alltracks++;
+ if (!(trp = squax_add(sp)))
goto anafail;
if (*tnamebuf)
{
@@ -548,23 +560,23 @@ int mifi_read_analyse(t_mifi_stream *x)
}
else tnamesym = trp->tr_name = &s_;
}
- x->s_nevents++;
+ sp->s_nevents++;
}
else if (evtype < 0x80)
{
- mifi_event_printmeta(evp);
+ mifi_event_printmeta(ep);
if (evtype == MIFI_META_TEMPO)
- x->s_ntempi++;
+ sp->s_ntempi++;
else if (evtype == MIFI_META_TRACKNAME)
{
- char *p1 = evp->e_data;
+ char *p1 = ep->e_data;
if (*p1 &&
!*tnamebuf) /* take the first one */
{
while (*p1 == ' ') p1++;
if (*p1)
{
- char *p2 = evp->e_data + evp->e_length - 1;
+ char *p2 = ep->e_data + ep->e_length - 1;
while (p2 > p1 && *p2 == ' ') *p2-- = '\0';
p2 = p1;
do if (*p2 == ' ' || *p2 == ',' || *p2 == ';')
@@ -584,22 +596,22 @@ int mifi_read_analyse(t_mifi_stream *x)
if (evtype != MIFI_READ_EOF)
goto anafail;
- i = x->s_ntracks;
+ i = sp->s_ntracks;
while (--i >= 0)
{
- if (!x->s_track_name(i) || x->s_track_name(i) == &s_)
+ if (!sp->s_track_name(i) || sp->s_track_name(i) == &s_)
{
sprintf(tnamebuf, "%d-track", i);
- x->s_track_name(i) = gensym(tnamebuf);
+ sp->s_track_name(i) = gensym(tnamebuf);
}
}
/* now (re)allocate the buffers */
- if (squb_checksize(x->s_mytempi,
- x->s_ntempi, sizeof(t_squmpo)) < x->s_ntempi)
+ if (squb_checksize(sp->s_mytempi,
+ sp->s_ntempi, sizeof(t_squmpo)) < sp->s_ntempi)
goto anafail;
- x->s_track_nevents(0) = 0;
- x->s_track_nevents(x->s_ntracks) = x->s_nevents; /* guard point */
+ sp->s_track_nevents(0) = 0;
+ sp->s_track_nevents(sp->s_ntracks) = sp->s_nevents; /* guard point */
result = evtype;
anafail:
@@ -608,32 +620,32 @@ anafail:
/* To be called in second pass of reading */
/* LATER do not trust analysis: in case of inconsistency give up or checksize */
-int mifi_read_doit(t_mifi_stream *x)
+int mifi_read_doit(t_mifi_stream *sp)
{
- t_mifi_event *evp = x->s_auxeve;
- t_squiter *it = x->s_myiter;
+ t_mifi_event *ep = sp->s_auxeve;
+ t_squiter *it = sp->s_myiter;
t_squiter_seekhook seekhook = squiter_seekhook(it);
t_squiter_incrhook incrhook = squiter_incrhook(it);
t_squiter_setevehook evehook = squiter_setevehook(it);
t_squiter_settimhook timhook = squiter_settimhook(it);
t_squiter_settarhook tarhook = squiter_settarhook(it);
int evtype, result = MIFI_READ_FATAL;
- int nevents = x->s_nevents; /* three proxies... */
- int ntracks = x->s_ntracks;
- int ntempi = x->s_ntempi;
+ int nevents = sp->s_nevents; /* three proxies... */
+ int ntracks = sp->s_ntracks;
+ int ntempi = sp->s_ntempi;
int trackno = 0;
t_symbol *trackname = 0;
int isnewtrack = 0;
- t_squmpo *tp = x->s_tempomap;
+ t_squmpo *tp = sp->s_tempomap;
if (!it || !seekhook(it, 0))
goto readfailed;
- while ((evtype = mifi_read_event(x, evp)) >= MIFI_READ_SKIP)
+ while ((evtype = mifi_read_event(sp, ep)) >= MIFI_READ_SKIP)
{
if (evtype == MIFI_READ_SKIP)
continue;
- if (x->s_newtrack)
+ if (sp->s_newtrack)
isnewtrack = 1;
if (MIFI_IS_CHANNEL(evtype))
{
@@ -641,7 +653,7 @@ int mifi_read_doit(t_mifi_stream *x)
if (isnewtrack)
{
isnewtrack = 0;
- trackname = x->s_track_name(trackno);
+ trackname = sp->s_track_name(trackno);
trackno++;
if (!trackname || trackname == &s_)
{
@@ -649,17 +661,18 @@ int mifi_read_doit(t_mifi_stream *x)
trackname = gensym("bug-track");
}
}
- x->s_track_nevents(trackno)++;
+ sp->s_track_nevents(trackno)++;
if (ret = squiter_inrange(it))
{
- evehook(it, (t_squeve *)evp, &ret);
+ evehook(it, (t_squeve *)ep, &ret);
/* We store onset times instead of delta times, because:
1) some deltas may represent delays since nonchannel events;
2) we'll need onsets while merging the tracks. */
- if (ret) timhook(it, (t_float)x->s_time, &ret);
+ if (ret) timhook(it, (t_float)sp->s_time, &ret);
if (ret) tarhook(it, trackname, &ret);
}
- if (ret) incrhook(it);
+ if (ret)
+ incrhook(it);
else
goto readfailed;
}
@@ -667,8 +680,8 @@ int mifi_read_doit(t_mifi_stream *x)
{
if (evtype == MIFI_META_TEMPO)
{
- tp->te_onset = x->s_time;
- tp->te_value = x->s_tempo;
+ tp->te_onset = sp->s_time;
+ tp->te_value = sp->s_tempo;
tp++;
}
}
@@ -682,16 +695,16 @@ readfailed:
}
/* Open midifile for saving, write the header. May be used as t_mifi_stream
- allocator (if x is a null pointer), to be freed by mifi_write_end() or
+ allocator (if sp is a null pointer), to be freed by mifi_write_end() or
explicitly.
- Return value: null on error, else x if passed a valid pointer, else pointer
+ Return value: null on error, else sp if passed a valid pointer, else pointer
to allocated structure.
*/
-t_mifi_stream *mifi_write_start(t_mifi_stream *x,
+t_mifi_stream *mifi_write_start(t_mifi_stream *sp,
const char *filename, const char *dirname)
{
- t_mifi_stream *result = x;
+ t_mifi_stream *result = sp;
t_bifi bifi;
t_bifi *bp = &bifi;
t_mifi_header header;
@@ -699,36 +712,38 @@ t_mifi_stream *mifi_write_start(t_mifi_stream *x,
/* this must precede bifi_swap() calls */
bifi_new(bp, (char *)&header, MIFI_HEADER_SIZE);
- if (x->s_format == 0)
+ if (sp->s_format == 0)
{
- if (x->s_ntracks != 1)
+ if (sp->s_ntracks != 1)
goto startfailure; /* LATER replace with a warning only? */
#ifdef MIFI_VERBOSE
post("writing singletrack midifile %s", filename);
#endif
}
#ifdef MIFI_VERBOSE
- else post("writing midifile %s (%d tracks)", filename, x->s_ntracks);
+ else post("writing midifile %s (%d tracks)", filename, sp->s_ntracks);
#endif
strncpy(header.h_type, "MThd", 4);
header.h_length = bifi_swap4(MIFI_HEADERDATA_SIZE);
- if (x)
+ if (sp)
{
- if (!x->s_hdtracks || !x->s_nticks)
+ if (!sp->s_hdtracks || !sp->s_nticks)
goto startfailure;
- header.h_format = bifi_swap2(x->s_format);
- header.h_ntracks = bifi_swap2(x->s_hdtracks);
- if (x->s_nframes)
- header.h_division = ((x->s_nframes << 8) | x->s_nticks) | 0x8000;
+ header.h_format = bifi_swap2(sp->s_format);
+ header.h_ntracks = bifi_swap2(sp->s_hdtracks);
+ if (sp->s_nframes)
+ header.h_division = ((sp->s_nframes << 8) | sp->s_nticks) | 0x8000;
else
- header.h_division = x->s_nticks & 0x7fff;
+ header.h_division = sp->s_nticks & 0x7fff;
header.h_division = bifi_swap2(header.h_division);
}
- else {
+ else
+ {
header.h_format = 0;
header.h_ntracks = bifi_swap2(1);
- header.h_division = bifi_swap2(192); /* LATER parametrize this somehow */
+ /* LATER parametrize this somehow */
+ header.h_division = bifi_swap2(192);
}
if (!bifi_write_start(bp, filename, dirname))
@@ -738,7 +753,7 @@ t_mifi_stream *mifi_write_start(t_mifi_stream *x,
return (0);
}
- if (x) mifi_stream_reset(x);
+ if (sp) mifi_stream_reset(sp);
else
{
if (!(result = mifi_stream_new()))
@@ -750,39 +765,39 @@ t_mifi_stream *mifi_write_start(t_mifi_stream *x,
return (result);
startfailure:
- if (result && !x) mifi_stream_free(result);
+ if (result && !sp) mifi_stream_free(result);
bifi_free(bp);
return (0);
}
/* Close midifile, free t_mifi_stream if it was allocated
by mifi_write_start(). */
-void mifi_write_end(t_mifi_stream *x)
+void mifi_write_end(t_mifi_stream *sp)
{
- if (x->s_autoalloc)
+ if (sp->s_autoalloc)
{
/* LATER adjust ntracks field in a file header, but do so only if
a stream was autoallocated -- number of tracks must be known
before calling mifi_write_start() for a preexisting stream. */
}
- if (x->s_fp) fclose(x->s_fp);
- if (x->s_autoalloc) mifi_stream_free(x);
+ if (sp->s_fp) fclose(sp->s_fp);
+ if (sp->s_autoalloc) mifi_stream_free(sp);
}
-int mifi_write_start_track(t_mifi_stream *x)
+int mifi_write_start_track(t_mifi_stream *sp)
{
t_mifi_trackheader header;
- /* LATER check if (x->s_track < x->s_hdtracks)... after some thinking */
+ /* LATER check if (sp->s_track < sp->s_hdtracks)... after some thinking */
strncpy(header.h_type, "MTrk", 4);
header.h_length = 0;
- x->s_trackid = x->s_track_id(x->s_track);
- x->s_track++;
- x->s_newtrack = 1;
- x->s_status = x->s_channel = 0;
- x->s_bytesleft = 0;
- x->s_time = 0;
+ sp->s_trackid = sp->s_track_id(sp->s_track);
+ sp->s_track++;
+ sp->s_newtrack = 1;
+ sp->s_status = sp->s_channel = 0;
+ sp->s_bytesleft = 0;
+ sp->s_time = 0;
if (fwrite(&header, 1,
- MIFI_TRACKHEADER_SIZE, x->s_fp) != MIFI_TRACKHEADER_SIZE)
+ MIFI_TRACKHEADER_SIZE, sp->s_fp) != MIFI_TRACKHEADER_SIZE)
{
post("unable to write midifile header");
return (0);
@@ -791,77 +806,78 @@ int mifi_write_start_track(t_mifi_stream *x)
}
/* append eot meta and update length field in a track header */
-int mifi_write_adjust_track(t_mifi_stream *x, uint32 eotdelay)
+int mifi_write_adjust_track(t_mifi_stream *sp, uint32 eotdelay)
{
- t_mifi_event *evp = x->s_auxeve;
+ t_mifi_event *ep = sp->s_auxeve;
long skip;
uint32 length;
- evp->e_delay = eotdelay;
- evp->e_status = MIFI_EVENT_META;
- evp->e_meta = MIFI_META_EOT;
- evp->e_length = 0;
- if (!mifi_write_event(x, evp))
+ ep->e_delay = eotdelay;
+ ep->e_status = MIFI_EVENT_META;
+ ep->e_meta = MIFI_META_EOT;
+ ep->e_length = 0;
+ if (!mifi_write_event(sp, ep))
return (0);
- skip = x->s_bytesleft + 4;
- length = bifi_swap4(x->s_bytesleft);
+ skip = sp->s_bytesleft + 4;
+ length = bifi_swap4(sp->s_bytesleft);
#ifdef MIFI_DEBUG
- post("adjusting track size to %d", x->s_bytesleft);
+ post("adjusting track size to %d", sp->s_bytesleft);
#endif
/* LATER add sanity check (compare to saved filepos) */
if (skip > 4 &&
- fseek(x->s_fp, -skip, SEEK_CUR) < 0 ||
- fwrite(&length, 1, 4, x->s_fp) != 4 ||
- fseek(x->s_fp, 0, SEEK_END) < 0)
+ fseek(sp->s_fp, -skip, SEEK_CUR) < 0 ||
+ fwrite(&length, 1, 4, sp->s_fp) != 4 ||
+ fseek(sp->s_fp, 0, SEEK_END) < 0)
{
- post("unable to adjust length field in midifile track header (length %d)",
- x->s_bytesleft);
+ post("unable to adjust length field in midifile track header \
+ (length %d)", sp->s_bytesleft);
return (0);
}
return (1);
}
/* LATER analyse shrinking effect caused by truncation */
-int mifi_write_event(t_mifi_stream *x, t_mifi_event *e)
+int mifi_write_event(t_mifi_stream *sp, t_mifi_event *ep)
{
uchar buf[3], *ptr = buf;
- size_t size = mifi_writevarlen(x, e->e_delay);
+ size_t size = mifi_writevarlen(sp, ep->e_delay);
if (!size)
return (0);
- x->s_bytesleft += size;
- if (MIFI_IS_CHANNEL(e->e_status))
+ sp->s_bytesleft += size;
+ if (MIFI_IS_CHANNEL(ep->e_status))
{
- if ((*ptr = e->e_status | e->e_channel) == x->s_status)
+ if ((*ptr = ep->e_status | ep->e_channel) == sp->s_status)
size = 1;
- else {
- x->s_status = *ptr++;
+ else
+ {
+ sp->s_status = *ptr++;
size = 2;
}
- *ptr++ = e->e_data[0];
- if (!MIFI_ONE_DATABYTE(e->e_status))
+ *ptr++ = ep->e_data[0];
+ if (!MIFI_ONE_DATABYTE(ep->e_status))
{
- *ptr = e->e_data[1];
+ *ptr = ep->e_data[1];
size++;
}
ptr = buf;
}
- else if (e->e_status == MIFI_EVENT_META)
+ else if (ep->e_status == MIFI_EVENT_META)
{
- x->s_status = 0; /* sysex and meta-events cancel any running status */
- buf[0] = e->e_status;
- buf[1] = e->e_meta;
- if (fwrite(buf, 1, 2, x->s_fp) != 2)
+ sp->s_status = 0; /* sysex and meta-events cancel any running status */
+ buf[0] = ep->e_status;
+ buf[1] = ep->e_meta;
+ if (fwrite(buf, 1, 2, sp->s_fp) != 2)
return (0);
- x->s_bytesleft += 2;
- size = mifi_writevarlen(x, (uint32)(e->e_length));
+ sp->s_bytesleft += 2;
+ size = mifi_writevarlen(sp, (uint32)(ep->e_length));
if (!size)
return (0);
- x->s_bytesleft += size;
- size = e->e_length;
- ptr = e->e_data;
+ sp->s_bytesleft += size;
+ size = ep->e_length;
+ ptr = ep->e_data;
}
else return (0);
- if (fwrite(ptr, 1, size, x->s_fp) != size)
+ if (fwrite(ptr, 1, size, sp->s_fp) != size)
return (0);
- x->s_bytesleft += size;
+ sp->s_bytesleft += size;
return (1);
}
diff --git a/shared/common/mifi.h b/shared/common/mifi.h
index 3893616..5524993 100644
--- a/shared/common/mifi.h
+++ b/shared/common/mifi.h
@@ -57,28 +57,28 @@ typedef struct _sq t_mifi_stream;
/* prototypes of public interface routines */
t_mifi_event *mifi_event_new(void);
-void mifi_event_free(t_mifi_event *e);
-int mifi_event_settext(t_mifi_event *e, int type, char *text);
-void mifi_event_printmeta(t_mifi_event *e);
+void mifi_event_free(t_mifi_event *ep);
+int mifi_event_settext(t_mifi_event *ep, int type, char *text);
+void mifi_event_printmeta(t_mifi_event *ep);
t_mifi_stream *mifi_stream_new(void);
-void mifi_stream_reset(t_mifi_stream *x);
-void mifi_stream_free(t_mifi_stream *x);
+void mifi_stream_reset(t_mifi_stream *sp);
+void mifi_stream_free(t_mifi_stream *sp);
-t_mifi_stream *mifi_read_start(t_mifi_stream *x,
+t_mifi_stream *mifi_read_start(t_mifi_stream *sp,
const char *filename, const char *dirname,
int complain);
-int mifi_read_restart(t_mifi_stream *x);
-void mifi_read_end(t_mifi_stream *x);
-int mifi_read_event(t_mifi_stream *x, t_mifi_event *e);
-int mifi_read_analyse(t_mifi_stream *stp);
-int mifi_read_doit(t_mifi_stream *stp);
+int mifi_read_restart(t_mifi_stream *sp);
+void mifi_read_end(t_mifi_stream *sp);
+int mifi_read_event(t_mifi_stream *sp, t_mifi_event *ep);
+int mifi_read_analyse(t_mifi_stream *sp);
+int mifi_read_doit(t_mifi_stream *sp);
-t_mifi_stream *mifi_write_start(t_mifi_stream *x,
+t_mifi_stream *mifi_write_start(t_mifi_stream *sp,
const char *filename, const char *dirname);
-void mifi_write_end(t_mifi_stream *x);
-int mifi_write_start_track(t_mifi_stream *x);
-int mifi_write_adjust_track(t_mifi_stream *x, uint32 eotdelay);
-int mifi_write_event(t_mifi_stream *x, t_mifi_event *e);
+void mifi_write_end(t_mifi_stream *sp);
+int mifi_write_start_track(t_mifi_stream *sp);
+int mifi_write_adjust_track(t_mifi_stream *sp, uint32 eotdelay);
+int mifi_write_event(t_mifi_stream *sp, t_mifi_event *ep);
#endif
diff --git a/shared/common/port.c b/shared/common/port.c
index f1471bf..fb22163 100644
--- a/shared/common/port.c
+++ b/shared/common/port.c
@@ -22,6 +22,9 @@
#include "common/binport.h"
#include "common/port.h"
+//#define PORT_DEBUG
+#define PORT_LOG
+
#define PORT_INISTACK 256 /* LATER rethink */
#define PORT_INISIZE 512 /* LATER rethink */
@@ -591,9 +594,12 @@ void import_max(char *fn, char *dir)
if (ftype == BINPORT_PDFILE) x->x_newbb = x->x_oldbb;
else
{
+#ifdef PORT_DEBUG
+ binbuf_write(x->x_oldbb, "import-debug.pd", "", 0);
+#endif
import_binbuf(x);
binbuf_free(x->x_oldbb);
-#if 1
+#ifdef PORT_LOG
binbuf_write(x->x_newbb, "import-result.pd", "", 0);
#endif
}
diff --git a/shared/shared.h b/shared/shared.h
index a0bd0e6..a812ffe 100644
--- a/shared/shared.h
+++ b/shared/shared.h
@@ -163,4 +163,9 @@ typedef union _shared_floatint
#define SHARED_PI 3.14159265359
#define SHARED_2PI 6.28318530718
+#ifndef PD_BADFLOAT
+#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \
+ (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000))
+#endif
+
#endif
diff --git a/shared/unstable/fragile.c b/shared/unstable/fragile.c
index 3267721..a5c9584 100644
--- a/shared/unstable/fragile.c
+++ b/shared/unstable/fragile.c
@@ -65,3 +65,29 @@ t_outconnect *fragile_outlet_connections(t_outlet *o)
{
return (o ? o->o_connections : 0);
}
+
+/* These are local to m_obj.c. */
+union inletunion
+{
+ t_symbol *iu_symto;
+ t_gpointer *iu_pointerslot;
+ t_float *iu_floatslot;
+ t_symbol **iu_symslot;
+ t_sample iu_floatsignalvalue;
+};
+
+struct _inlet
+{
+ t_pd i_pd;
+ struct _inlet *i_next;
+ t_object *i_owner;
+ t_pd *i_dest;
+ t_symbol *i_symfrom;
+ union inletunion i_un;
+};
+
+/* simplified obj_findsignalscalar(), works for non-left inlets */
+t_sample *fragile_inlet_signalscalar(t_inlet *i)
+{
+ return (&i->i_un.iu_floatsignalvalue);
+}
diff --git a/shared/unstable/fragile.h b/shared/unstable/fragile.h
index c1ba8e3..984fb0a 100644
--- a/shared/unstable/fragile.h
+++ b/shared/unstable/fragile.h
@@ -9,5 +9,6 @@ int fragile_class_count(void);
void fragile_class_printnames(char *msg, int firstndx, int lastndx);
t_glist *fragile_garray_glist(void *arr);
t_outconnect *fragile_outlet_connections(t_outlet *o);
+t_sample *fragile_inlet_signalscalar(t_inlet *i);
#endif