aboutsummaryrefslogtreecommitdiff
path: root/iem_t3_lib
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2006-12-09 02:00:52 +0000
committermusil <tmusil@users.sourceforge.net>2006-12-09 02:00:52 +0000
commitd6b088044e161a27d49df537bbb6d998a8d0e50d (patch)
tree1a1b3a30e994767f4ef97b90194782258f2baa8a /iem_t3_lib
parent32dc0c0deb13ce57f099f616ddc427296970d8a5 (diff)
// class_sethelpsymbol();
changed help-*.pd to *-help.pd chanded file structure to standard 1st step remove old svn path=/trunk/externals/iemlib/; revision=6756
Diffstat (limited to 'iem_t3_lib')
-rw-r--r--iem_t3_lib/src/iem_t3_lib.c42
-rw-r--r--iem_t3_lib/src/iem_t3_lib.dsp85
-rw-r--r--iem_t3_lib/src/iem_t3_lib.dsw29
-rw-r--r--iem_t3_lib/src/iemlib.h108
-rw-r--r--iem_t3_lib/src/makefile4
-rw-r--r--iem_t3_lib/src/makefile_linux51
-rw-r--r--iem_t3_lib/src/makefile_win36
-rw-r--r--iem_t3_lib/src/t3_bpe.c133
-rw-r--r--iem_t3_lib/src/t3_delay.c88
-rw-r--r--iem_t3_lib/src/t3_line~.c272
-rw-r--r--iem_t3_lib/src/t3_metro.c113
-rw-r--r--iem_t3_lib/src/t3_sig~.c192
-rw-r--r--iem_t3_lib/src/t3_timer.c48
-rw-r--r--iem_t3_lib/t3_bpe-help.pd105
-rw-r--r--iem_t3_lib/t3_delay-help.pd79
-rw-r--r--iem_t3_lib/t3_line~-help.pd97
-rw-r--r--iem_t3_lib/t3_metro-help.pd103
-rw-r--r--iem_t3_lib/t3_sig~-help.pd75
-rw-r--r--iem_t3_lib/t3_timer-help.pd27
19 files changed, 1687 insertions, 0 deletions
diff --git a/iem_t3_lib/src/iem_t3_lib.c b/iem_t3_lib/src/iem_t3_lib.c
new file mode 100644
index 0000000..464c330
--- /dev/null
+++ b/iem_t3_lib/src/iem_t3_lib.c
@@ -0,0 +1,42 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+
+static t_class *iem_t3_lib_class;
+
+static void *iem_t3_lib_new(void)
+{
+ t_object *x = (t_object *)pd_new(iem_t3_lib_class);
+
+ return (x);
+}
+
+void t3_bpe_setup(void);
+void t3_delay_setup(void);
+void t3_line_tilde_setup(void);
+void t3_metro_setup(void);
+void t3_sig_tilde_setup(void);
+void t3_timer_setup(void);
+
+/* ------------------------ setup routine ------------------------- */
+
+void iem_t3_lib_setup(void)
+{
+ iem_t3_lib_class = class_new(gensym("iem_t3_lib"), iem_t3_lib_new, 0,
+ sizeof(t_object), CLASS_NOINLET, 0);
+
+ t3_bpe_setup();
+ t3_delay_setup();
+ t3_line_tilde_setup();
+ t3_metro_setup();
+ t3_sig_tilde_setup();
+ t3_timer_setup();
+
+ post("iem_t3_lib (R-1.17) library loaded! (c) Gerhard Eckel, Thomas Musil 11.2006");
+ post(" musil%ciem.at iem KUG Graz Austria", '@');
+}
diff --git a/iem_t3_lib/src/iem_t3_lib.dsp b/iem_t3_lib/src/iem_t3_lib.dsp
new file mode 100644
index 0000000..ab0a094
--- /dev/null
+++ b/iem_t3_lib/src/iem_t3_lib.dsp
@@ -0,0 +1,85 @@
+# Microsoft Developer Studio Project File - Name="iem_t3_lib" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** NICHT BEARBEITEN **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=iem_t3_lib - Win32 Debug
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl
+!MESSAGE
+!MESSAGE NMAKE /f "iem_t3_lib.mak".
+!MESSAGE
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
+!MESSAGE
+!MESSAGE NMAKE /f "iem_t3_lib.mak" CFG="iem_t3_lib - Win32 Debug"
+!MESSAGE
+!MESSAGE Für die Konfiguration stehen zur Auswahl:
+!MESSAGE
+!MESSAGE "iem_t3_lib - Win32 Release" (basierend auf "Win32 (x86) External Target")
+!MESSAGE "iem_t3_lib - Win32 Debug" (basierend auf "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "iem_t3_lib - Win32 Release"
+
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f makefile_win"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile_win.exe"
+# PROP BASE Bsc_Name "makefile_win.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "NMAKE /f makefile_win"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "iem_t3_lib.exe"
+# PROP Bsc_Name "iem_t3_lib.bsc"
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "iem_t3_lib - Win32 Debug"
+
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f makefile_win"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "makefile_win.exe"
+# PROP BASE Bsc_Name "makefile_win.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "NMAKE /f makefile_win"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "iem_t3_lib.exe"
+# PROP Bsc_Name "iem_t3_lib.bsc"
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "iem_t3_lib - Win32 Release"
+# Name "iem_t3_lib - Win32 Debug"
+
+!IF "$(CFG)" == "iem_t3_lib - Win32 Release"
+
+!ELSEIF "$(CFG)" == "iem_t3_lib - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\makefile_win
+# End Source File
+# End Target
+# End Project
diff --git a/iem_t3_lib/src/iem_t3_lib.dsw b/iem_t3_lib/src/iem_t3_lib.dsw
new file mode 100644
index 0000000..6c2a29b
--- /dev/null
+++ b/iem_t3_lib/src/iem_t3_lib.dsw
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!
+
+###############################################################################
+
+Project: "iem_t3_lib"=.\iem_t3_lib.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/iem_t3_lib/src/iemlib.h b/iem_t3_lib/src/iemlib.h
new file mode 100644
index 0000000..6be2de0
--- /dev/null
+++ b/iem_t3_lib/src/iemlib.h
@@ -0,0 +1,108 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
+
+#ifndef __IEMLIB_H__
+#define __IEMLIB_H__
+
+
+#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER)
+#define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT)
+#define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL)
+#define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR)
+#define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
+#define IS_A_SEMI(atom,index) ((atom+index)->a_type == A_SEMI)
+#define IS_A_COMMA(atom,index) ((atom+index)->a_type == A_COMMA)
+
+
+#ifdef NT
+int sys_noloadbang;
+//t_symbol *iemgui_key_sym=0;
+#include <io.h>
+#else
+extern int sys_noloadbang;
+//extern t_symbol *iemgui_key_sym;
+#include <unistd.h>
+#endif
+
+#define DEFDELVS 64
+#define XTRASAMPS 4
+#define SAMPBLK 4
+
+
+#define UNITBIT32 1572864. /* 3*2^19; bit 32 has place value 1 */
+
+/* machine-dependent definitions. These ifdefs really
+should have been by CPU type and not by operating system! */
+#ifdef IRIX
+/* big-endian. Most significant byte is at low address in memory */
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#define int32 long /* a data type that has 32 bits */
+#else
+#ifdef MSW
+/* little-endian; most significant byte is at highest address */
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#define int32 long
+#else
+#ifdef __FreeBSD__
+#include <machine/endian.h>
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#else
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#endif /* BYTE_ORDER */
+#include <sys/types.h>
+#define int32 int32_t
+#endif
+#ifdef __linux__
+
+#include <endian.h>
+
+#if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)
+#error No byte order defined
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define HIOFFSET 1
+#define LOWOFFSET 0
+#else
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#endif /* __BYTE_ORDER */
+
+#include <sys/types.h>
+#define int32 int32_t
+
+#else
+#ifdef __APPLE__
+#define HIOFFSET 0 /* word offset to find MSB */
+#define LOWOFFSET 1 /* word offset to find LSB */
+#define int32 int /* a data type that has 32 bits */
+
+#endif /* __APPLE__ */
+#endif /* __linux__ */
+#endif /* MSW */
+#endif /* SGI */
+
+union tabfudge
+{
+ double tf_d;
+ int32 tf_i[2];
+};
+
+#ifdef __i386__
+#define IEM_DENORMAL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \
+(((*(unsigned int*)&(f))&0x60000000)==0x60000000))
+/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */
+#else
+
+#define IEM_DENORMAL(f) 0
+
+#endif
+
+#endif
diff --git a/iem_t3_lib/src/makefile b/iem_t3_lib/src/makefile
new file mode 100644
index 0000000..597ccdf
--- /dev/null
+++ b/iem_t3_lib/src/makefile
@@ -0,0 +1,4 @@
+TARGET = iem_t3_lib
+
+include ../../Make.include
+
diff --git a/iem_t3_lib/src/makefile_linux b/iem_t3_lib/src/makefile_linux
new file mode 100644
index 0000000..3705f69
--- /dev/null
+++ b/iem_t3_lib/src/makefile_linux
@@ -0,0 +1,51 @@
+current: all
+
+.SUFFIXES: .pd_linux
+
+INCLUDE = -I. -I/usr/local/src/pd/src
+
+LDFLAGS = -export-dynamic -shared
+LIB = -ldl -lm -lpthread
+
+#select either the DBG and OPT compiler flags below:
+
+CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \
+ -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \
+ -DDL_OPEN
+
+SYSTEM = $(shell uname -m)
+
+# the sources
+
+SRC = t3_bpe.c \
+ t3_delay.c \
+ t3_line~.c \
+ t3_metro.c \
+ t3_sig~.c \
+ t3_timer.c \
+ iem_t3_lib.c
+
+TARGET = iem_t3_lib.pd_linux
+
+
+OBJ = $(SRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+clean:
+ rm $(TARGET)
+ rm *.o
+
+all: $(OBJ)
+ @echo :: $(OBJ)
+ $(LD) $(LDFLAGS) -o $(TARGET) *.o $(LIB)
+ strip --strip-unneeded $(TARGET)
+
+$(OBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c
+
+
+
+
diff --git a/iem_t3_lib/src/makefile_win b/iem_t3_lib/src/makefile_win
new file mode 100644
index 0000000..f8856d9
--- /dev/null
+++ b/iem_t3_lib/src/makefile_win
@@ -0,0 +1,36 @@
+all: ..\iem_t3_lib.dll
+
+VIS_CPP_PATH = "C:\Programme\Microsoft Visual Studio\Vc98"
+PD_INST_PATH = "C:\Programme\pd-0.39-2"
+PD_WIN_INCLUDE_PATH = /I. /I$(PD_INST_PATH)\src /I$(VIS_CPP_PATH)\include
+PD_WIN_C_FLAGS = /nologo /W3 /WX /DMSW /DNT /DPD /DWIN32 /DWINDOWS /Ox -DPA_LITTLE_ENDIAN
+PD_WIN_L_FLAGS = /nologo
+
+PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NODEFAULTLIB:uuid \
+ $(VIS_CPP_PATH)\lib\libc.lib \
+ $(VIS_CPP_PATH)\lib\oldnames.lib \
+ $(VIS_CPP_PATH)\lib\kernel32.lib \
+ $(VIS_CPP_PATH)\lib\wsock32.lib \
+ $(VIS_CPP_PATH)\lib\winmm.lib \
+ $(PD_INST_PATH)\bin\pthreadVC.lib \
+ $(PD_INST_PATH)\bin\pd.lib
+
+SRC = t3_bpe.c \
+ t3_delay.c \
+ t3_line~.c \
+ t3_metro.c \
+ t3_sig~.c \
+ t3_timer.c \
+ iem_t3_lib.c
+
+OBJ = $(SRC:.c=.obj)
+
+.c.obj:
+ cl $(PD_WIN_C_FLAGS) $(PD_WIN_INCLUDE_PATH) /c $*.c
+
+..\iem_t3_lib.dll: $(OBJ)
+ link $(PD_WIN_L_FLAGS) /dll /export:iem_t3_lib_setup \
+ /out:..\iem_t3_lib.dll $(OBJ) $(PD_WIN_LIB)
+
+clean:
+ del *.obj
diff --git a/iem_t3_lib/src/t3_bpe.c b/iem_t3_lib/src/t3_bpe.c
new file mode 100644
index 0000000..dbd140a
--- /dev/null
+++ b/iem_t3_lib/src/t3_bpe.c
@@ -0,0 +1,133 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+/* ------------------------ t3_bpe ---------------------------- */
+static t_class *t3_bpe_class;
+
+typedef struct _t3_bpe
+{
+ t_object x_obj;
+ t_atom x_at[2];
+ t_clock *x_clock;
+ int x_maxnum;
+ int x_curnum;
+ int x_curindex;
+ t_atom *x_beg;
+ double x_t3_bang;
+ double x_ticks2ms;
+ int x_hit;
+ void *x_out_val;
+ void *x_out_time;
+ void *x_out_finished;
+} t_t3_bpe;
+
+static void t3_bpe_stop(t_t3_bpe *x)
+{
+ clock_unset(x->x_clock);
+}
+
+static void t3_bpe_tick(t_t3_bpe *x)
+{
+ t_atom *vec = x->x_beg;
+ t_float val;
+ double dticks, time;
+ int iticks;
+
+ if(x->x_curindex >= x->x_curnum)
+ {
+ t3_bpe_stop(x);
+ outlet_float(x->x_out_finished, x->x_t3_bang);
+ }
+ else
+ {
+ x->x_hit = 0;
+ vec += x->x_curindex;
+ val = atom_getfloat(vec++);
+ time = (double)atom_getfloat(vec);
+ outlet_float(x->x_out_time, time);
+ x->x_at[1].a_w.w_float = val;
+ x->x_at[0].a_w.w_float = x->x_t3_bang;
+ outlet_list(x->x_obj.ob_outlet, &s_list, 2, x->x_at);
+ dticks = (time + x->x_t3_bang)/x->x_ticks2ms;
+ iticks = (int)dticks;
+ x->x_t3_bang = (dticks - (double)iticks)*x->x_ticks2ms;
+ if(!x->x_hit)
+ clock_delay(x->x_clock, (double)iticks*x->x_ticks2ms);
+ x->x_curindex += 2;
+ }
+}
+
+static void t3_bpe_float(t_t3_bpe *x, t_floatarg f)
+{
+ double dticks;
+ int iticks;
+
+ if(x->x_curnum)
+ {
+ x->x_curindex = 0;
+ dticks = (double)f/x->x_ticks2ms;
+ iticks = (int)dticks;
+ x->x_t3_bang = (dticks - (double)iticks)*x->x_ticks2ms;
+ clock_delay(x->x_clock, (double)iticks*x->x_ticks2ms);
+ x->x_hit = 1;
+ }
+}
+
+static void t3_bpe_list(t_t3_bpe *x, t_symbol *s, int ac, t_atom *av)
+{
+ int n = ac & 0xfffffffe, i;
+ t_atom *vec = x->x_beg;
+ if(n > x->x_maxnum)
+ {
+ freebytes(x->x_beg, x->x_maxnum*sizeof(t_atom));
+ x->x_maxnum = 2 + n;
+ x->x_beg = (t_atom *)getbytes(x->x_maxnum*sizeof(t_atom));
+ vec = x->x_beg;
+ }
+ x->x_curnum = n;
+ for(i=0; i<n; i++)
+ {
+ *vec++ = *av++;
+ }
+}
+
+static void t3_bpe_free(t_t3_bpe *x)
+{
+ freebytes(x->x_beg, x->x_maxnum*sizeof(t_atom));
+ clock_free(x->x_clock);
+}
+
+static void *t3_bpe_new(void)
+{
+ t_t3_bpe *x = (t_t3_bpe *)pd_new(t3_bpe_class);
+
+ x->x_t3_bang = 0.0;
+ x->x_ticks2ms = 1000.0*(double)sys_getblksize()/(double)sys_getsr();
+ x->x_curindex = 0;
+ x->x_maxnum = 20;
+ x->x_curnum = 0;
+ x->x_hit = 0;
+ x->x_beg = (t_atom *)getbytes(x->x_maxnum*sizeof(t_atom));
+ x->x_clock = clock_new(x, (t_method)t3_bpe_tick);
+ outlet_new(&x->x_obj, &s_list);
+ x->x_out_time = outlet_new(&x->x_obj, &s_float);
+ x->x_out_finished = outlet_new(&x->x_obj, &s_float);
+ x->x_at[0].a_type = A_FLOAT;
+ x->x_at[1].a_type = A_FLOAT;
+ return (x);
+}
+
+void t3_bpe_setup(void)
+{
+ t3_bpe_class = class_new(gensym("t3_bpe"), (t_newmethod)t3_bpe_new,
+ (t_method)t3_bpe_free, sizeof(t_t3_bpe), 0, 0);
+ class_addmethod(t3_bpe_class, (t_method)t3_bpe_stop, gensym("stop"), 0);
+ class_addfloat(t3_bpe_class, (t_method)t3_bpe_float);
+ class_addlist(t3_bpe_class, (t_method)t3_bpe_list);
+// class_sethelpsymbol(t3_bpe_class, gensym("iemhelp/help-t3_bpe"));
+}
diff --git a/iem_t3_lib/src/t3_delay.c b/iem_t3_lib/src/t3_delay.c
new file mode 100644
index 0000000..b468f74
--- /dev/null
+++ b/iem_t3_lib/src/t3_delay.c
@@ -0,0 +1,88 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+/* ------------------------ t3_delay ---------------------------- */
+static t_class *t3_delay_class;
+
+typedef struct _t3_delay
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ double x_deltime;
+ double x_ticks2ms;
+ double x_t3_bang;
+} t_t3_delay;
+
+static void t3_delay_tick(t_t3_delay *x)
+{
+ outlet_float(x->x_obj.ob_outlet, x->x_t3_bang);
+}
+
+static void t3_delay_stop(t_t3_delay *x)
+{
+ clock_unset(x->x_clock);
+}
+
+static void t3_delay_float(t_t3_delay *x, t_floatarg t3_bang)
+{
+ double dticks;
+ int iticks;
+
+ if(t3_bang < 0)
+ t3_bang = 0;
+ dticks = (x->x_deltime + (double)t3_bang)/x->x_ticks2ms;
+ iticks = (int)dticks;
+ x->x_t3_bang = (dticks - (double)iticks)*x->x_ticks2ms;
+ clock_delay(x->x_clock, (double)iticks*x->x_ticks2ms);
+}
+
+static void t3_delay_ft1(t_t3_delay *x, t_floatarg f)
+{
+ if(f < 0)
+ f = 0;
+ x->x_deltime = f;
+}
+
+static void t3_delay_list(t_t3_delay *x, t_symbol *s, int ac, t_atom *av)
+{
+ if((ac == 2)&&IS_A_FLOAT(av,0)&&IS_A_FLOAT(av,1))
+ {
+ t3_delay_ft1(x, atom_getfloatarg(1, ac, av));
+ t3_delay_float(x, atom_getfloatarg(0, ac, av));
+ }
+}
+
+static void t3_delay_free(t_t3_delay *x)
+{
+ clock_free(x->x_clock);
+}
+
+static void *t3_delay_new(t_floatarg f)
+{
+ t_t3_delay *x = (t_t3_delay *)pd_new(t3_delay_class);
+
+ x->x_ticks2ms = 1000.0*(double)sys_getblksize()/(double)sys_getsr();
+ t3_delay_ft1(x, f);
+ x->x_clock = clock_new(x, (t_method)t3_delay_tick);
+ outlet_new(&x->x_obj, &s_float);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1"));
+ return (x);
+}
+
+void t3_delay_setup(void)
+{
+ t3_delay_class = class_new(gensym("t3_delay"), (t_newmethod)t3_delay_new,
+ (t_method)t3_delay_free, sizeof(t_t3_delay), 0, A_DEFFLOAT, 0);
+ class_addcreator((t_newmethod)t3_delay_new, gensym("t3_del"), A_DEFFLOAT, 0);
+ class_addmethod(t3_delay_class, (t_method)t3_delay_stop, gensym("stop"), 0);
+ class_addmethod(t3_delay_class, (t_method)t3_delay_ft1,
+ gensym("ft1"), A_FLOAT, 0);
+ class_addfloat(t3_delay_class, (t_method)t3_delay_float);
+ class_addlist(t3_delay_class, (t_method)t3_delay_list);
+// class_sethelpsymbol(t3_delay_class, gensym("iemhelp/help-t3_delay"));
+}
diff --git a/iem_t3_lib/src/t3_line~.c b/iem_t3_lib/src/t3_line~.c
new file mode 100644
index 0000000..8d386f0
--- /dev/null
+++ b/iem_t3_lib/src/t3_line~.c
@@ -0,0 +1,272 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+/* -------------------------- t3_line~ ------------------------------ */
+static t_class *t3_line_tilde_class;
+
+typedef struct _t3_line_tilde
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ t_float *x_beg;
+ double x_cur_val;
+ double x_dst_val;
+ double x_inlet_val;
+ double x_inc64;
+ double x_inc;
+ double x_ms2samps;
+ double x_ticks2ms;
+ double x_inlet_time;
+ double x_dst_time;
+ int x_cur_samps;
+ int x_dur_samps;
+ int x_n;
+ int x_t3_bang_samps;
+ int x_transient;
+} t_t3_line_tilde;
+
+static void t3_line_tilde_nontransient(t_float *vec, t_t3_line_tilde *x, int n)
+{
+ int cur_samps = x->x_cur_samps, i;
+ double inc = x->x_inc;
+ double cur_val = x->x_cur_val;
+
+ if(cur_samps)
+ {
+ if(cur_samps > n)
+ {
+ x->x_cur_samps -= n;
+ while(n--)
+ {
+ cur_val += inc;
+ *vec++ = (t_float)cur_val;
+ }
+ x->x_cur_val += x->x_inc64;
+ }
+ else if(cur_samps == n)
+ {
+ x->x_cur_samps = 0;
+ while(n--)
+ {
+ cur_val += inc;
+ *vec++ = (t_float)cur_val;
+ }
+ x->x_cur_val = x->x_dst_val;
+ }
+ else
+ {
+ for(i=0; i<cur_samps; i++)
+ {
+ cur_val += inc;
+ *vec++ = (t_float)cur_val;
+ }
+ x->x_cur_val = cur_val = x->x_dst_val;
+ for(i=cur_samps; i<n; i++)
+ *vec++ = (t_float)cur_val;
+ x->x_cur_samps = 0;
+ }
+ }
+ else
+ {
+ while(n--)
+ *vec++ = (t_float)cur_val;
+ }
+}
+
+static t_int *t3_line_tilde_perform(t_int *w)
+{
+ t_float *out = (t_float *)(w[1]);
+ t_t3_line_tilde *x = (t_t3_line_tilde *)(w[2]);
+ int n = (int)(w[3]);
+
+ if(x->x_transient)
+ {
+ t_float *trans = x->x_beg;
+
+ while(n--)
+ *out++ = *trans++;
+ x->x_transient = 0;
+ }
+ else
+ t3_line_tilde_nontransient(out, x, n);
+ return(w+4);
+}
+
+static void t3_line_tilde_tick(t_t3_line_tilde *x)
+{
+ t_float *trans = x->x_beg;
+ int n = x->x_n, t3_bang_samps, cur_samps, i;
+ double inc, cur_val;
+
+ if(!x->x_transient)
+ t3_line_tilde_nontransient(trans, x, n);
+ t3_bang_samps = x->x_t3_bang_samps;
+ x->x_dst_val = x->x_inlet_val;
+ if(x->x_inlet_time <= 0.0)
+ {
+ x->x_inlet_time = 0.0;
+ x->x_dst_time = 0.0;
+ x->x_dur_samps = 0;
+ x->x_cur_samps = 0;
+ cur_val = x->x_cur_val = x->x_dst_val;
+ for(i=t3_bang_samps; i<n; i++)
+ trans[i] = (t_float)cur_val;
+ }
+ else
+ {
+ int diff, end;
+
+ x->x_dst_time = x->x_inlet_time;
+ x->x_inlet_time = 0.0;
+ cur_samps = (int)(x->x_dst_time * x->x_ms2samps);
+ if(!cur_samps)
+ cur_samps = 1;
+ x->x_dur_samps = cur_samps;
+ x->x_cur_samps = cur_samps;
+ cur_val = x->x_cur_val = (double)trans[t3_bang_samps];
+ inc = x->x_inc = (x->x_dst_val - cur_val)/(double)cur_samps;
+ x->x_inc64 = (double)x->x_n * inc;
+ diff = n - t3_bang_samps;
+ if(cur_samps > diff)
+ {
+ for(i=t3_bang_samps; i<n; i++)
+ {
+ cur_val += inc;
+ trans[i] = (t_float)cur_val;
+ }
+ x->x_cur_val += (double)diff * inc;
+ x->x_cur_samps -= diff;
+ }
+ else if(cur_samps == diff)
+ {
+ for(i=t3_bang_samps; i<n; i++)
+ {
+ cur_val += inc;
+ trans[i] = (t_float)cur_val;
+ }
+ x->x_cur_val = x->x_dst_val;
+ x->x_cur_samps = 0;
+ }
+ else
+ {
+ end = t3_bang_samps + cur_samps;
+ for(i=t3_bang_samps; i<end; i++)
+ {
+ cur_val += inc;
+ trans[i] = (t_float)cur_val;
+ }
+ cur_val = x->x_cur_val = x->x_dst_val;
+ x->x_cur_samps = 0;
+ for(i=end; i<n; i++)
+ trans[i] = (t_float)cur_val;
+ }
+ }
+ x->x_transient = 1;
+}
+
+static void t3_line_tilde_list(t_t3_line_tilde *x, t_symbol *s, int ac, t_atom *av)
+{
+ if((ac >= 2)&&IS_A_FLOAT(av,0)&&IS_A_FLOAT(av,1))
+ {
+ int t3_bang_samps, ticks;
+ double time;
+
+ x->x_inlet_val = (double)atom_getfloatarg(1, ac, av);
+ t3_bang_samps = (int)((t_float)atom_getfloatarg(0, ac, av)*x->x_ms2samps);
+ if(t3_bang_samps < 0)
+ t3_bang_samps = 0;
+ ticks = t3_bang_samps / x->x_n;
+ x->x_t3_bang_samps = t3_bang_samps - x->x_n * ticks;
+ if((ac >= 3)&&IS_A_FLOAT(av,2))
+ {
+ time = (double)atom_getfloatarg(2, ac, av);
+ if(time < 0.0)
+ time = 0.0;
+ x->x_inlet_time = time;
+ }
+ if(ticks < 1)
+ t3_line_tilde_tick(x);
+ else
+ clock_delay(x->x_clock, (double)ticks * x->x_ticks2ms);
+ }
+}
+
+static void t3_line_tilde_ft1(t_t3_line_tilde *x, t_float time)
+{
+ if(time < 0.0)
+ time = 0.0;
+ x->x_inlet_time = (double)time;
+}
+
+static void t3_line_tilde_stop(t_t3_line_tilde *x)
+{
+ clock_unset(x->x_clock);
+ x->x_cur_samps = x->x_dur_samps = x->x_transient = 0;
+ x->x_inc = x->x_inc64 = x->x_inlet_time = x->x_dst_time = 0.0;
+}
+
+static void t3_line_tilde_dsp(t_t3_line_tilde *x, t_signal **sp)
+{
+ int i;
+ t_float val, *trans;
+
+ if(sp[0]->s_n > x->x_n)
+ {
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
+ x->x_n = (int)sp[0]->s_n;
+ x->x_beg = (t_float *)getbytes(x->x_n*sizeof(t_float));
+ }
+ else
+ x->x_n = (int)sp[0]->s_n;
+ i = x->x_n;
+ val = x->x_cur_val;
+ trans = x->x_beg;
+ while(i--)
+ *trans++ = val;
+ x->x_ms2samps = 0.001*(double)sp[0]->s_sr;
+ x->x_ticks2ms = (double)x->x_n / x->x_ms2samps;
+ dsp_add(t3_line_tilde_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void t3_line_tilde_free(t_t3_line_tilde *x)
+{
+ if(x->x_beg)
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
+ clock_free(x->x_clock);
+}
+
+static void *t3_line_tilde_new(t_floatarg init_val)
+{
+ t_t3_line_tilde *x = (t_t3_line_tilde *)pd_new(t3_line_tilde_class);
+ int i;
+
+ x->x_n = (int)sys_getblksize();
+ x->x_beg = (t_float *)getbytes(x->x_n*sizeof(t_float));
+ x->x_inlet_val = x->x_cur_val = x->x_dst_val = init_val;
+ x->x_t3_bang_samps = x->x_cur_samps = x->x_dur_samps = x->x_transient = 0;
+ x->x_inlet_time = x->x_dst_time = 0.0;
+ x->x_inc64 = x->x_inc = 0.0;
+ x->x_ms2samps = 0.001 * (double)sys_getsr();
+ x->x_ticks2ms = (double)x->x_n / x->x_ms2samps;
+ x->x_clock = clock_new(x, (t_method)t3_line_tilde_tick);
+ outlet_new(&x->x_obj, &s_signal);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1"));
+ return (x);
+}
+
+void t3_line_tilde_setup(void)
+{
+ t3_line_tilde_class = class_new(gensym("t3_line~"), (t_newmethod)t3_line_tilde_new,
+ (t_method)t3_line_tilde_free, sizeof(t_t3_line_tilde), 0, A_DEFFLOAT, 0);
+ class_addmethod(t3_line_tilde_class, (t_method)t3_line_tilde_dsp, gensym("dsp"), 0);
+ class_addmethod(t3_line_tilde_class, (t_method)t3_line_tilde_stop, gensym("stop"), 0);
+ class_addmethod(t3_line_tilde_class, (t_method)t3_line_tilde_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addlist(t3_line_tilde_class, (t_method)t3_line_tilde_list);
+// class_sethelpsymbol(t3_line_tilde_class, gensym("iemhelp/help-t3_line~"));
+}
diff --git a/iem_t3_lib/src/t3_metro.c b/iem_t3_lib/src/t3_metro.c
new file mode 100644
index 0000000..003d9ef
--- /dev/null
+++ b/iem_t3_lib/src/t3_metro.c
@@ -0,0 +1,113 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+/* ------------------------ t3_metro ---------------------------- */
+static t_class *t3_metro_class;
+
+typedef struct _t3_metro
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ double x_metrotime;
+ double x_ticks2ms;
+ double x_t3_bang;
+ int x_hit;
+ void *x_out_next;
+} t_t3_metro;
+
+static void t3_metro_stop(t_t3_metro *x)
+{
+ clock_unset(x->x_clock);
+}
+
+static void t3_metro_tick(t_t3_metro *x)
+{
+ double dticks;
+ int iticks;
+
+ x->x_hit = 0;
+ outlet_float(x->x_out_next, x->x_metrotime);
+ outlet_float(x->x_obj.ob_outlet, x->x_t3_bang);
+ dticks = (x->x_metrotime + x->x_t3_bang)/x->x_ticks2ms;
+ iticks = (int)dticks;
+ x->x_t3_bang = (dticks - (double)iticks)*x->x_ticks2ms;
+ if(!x->x_hit)
+ clock_delay(x->x_clock, (double)iticks*x->x_ticks2ms);
+}
+
+static void t3_metro_float(t_t3_metro *x, t_floatarg t3_bang)
+{
+ double dticks;
+ int iticks;
+
+ if(t3_bang < 0)
+ t3_bang = 0;
+ dticks = (double)t3_bang/x->x_ticks2ms;
+ iticks = (int)dticks;
+ x->x_t3_bang = (dticks - (double)iticks)*x->x_ticks2ms;
+ clock_delay(x->x_clock, (double)iticks*x->x_ticks2ms);
+ x->x_hit = 1;
+}
+
+static void t3_metro_start(t_t3_metro *x, t_floatarg f)
+{
+ t3_metro_float(x, f);
+ x->x_hit = 1;
+}
+
+static void t3_metro_ft1(t_t3_metro *x, t_floatarg f)
+{
+ if(f < 0.01) f = 0.01;
+ x->x_metrotime = (double)f;
+}
+
+static void t3_metro_list(t_t3_metro *x, t_symbol *s, int ac, t_atom *av)
+{
+ if((ac == 2)&&IS_A_FLOAT(av,0)&&IS_A_FLOAT(av,1))
+ {
+ t3_metro_ft1(x, atom_getfloatarg(1, ac, av));
+ t3_metro_float(x, atom_getfloatarg(0, ac, av));
+ }
+}
+
+static void t3_metro_free(t_t3_metro *x)
+{
+ clock_free(x->x_clock);
+}
+
+static void *t3_metro_new(t_symbol *s, int ac, t_atom *av)
+{
+ t_t3_metro *x = (t_t3_metro *)pd_new(t3_metro_class);
+
+ x->x_metrotime = 10.0;
+ x->x_t3_bang = 0.0;
+ x->x_hit = 0;
+ if((ac == 1)&&IS_A_FLOAT(av,0))
+ {
+ t3_metro_ft1(x, atom_getfloatarg(0, ac, av));
+ }
+ x->x_ticks2ms = 1000.0*(double)sys_getblksize()/(double)sys_getsr();
+ x->x_clock = clock_new(x, (t_method)t3_metro_tick);
+ outlet_new(&x->x_obj, &s_float);
+ x->x_out_next = outlet_new(&x->x_obj, &s_float);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1"));
+ return (x);
+}
+
+void t3_metro_setup(void)
+{
+ t3_metro_class = class_new(gensym("t3_metro"), (t_newmethod)t3_metro_new,
+ (t_method)t3_metro_free, sizeof(t_t3_metro), 0, A_GIMME, 0);
+ class_addmethod(t3_metro_class, (t_method)t3_metro_stop, gensym("stop"), 0);
+ class_addmethod(t3_metro_class, (t_method)t3_metro_start, gensym("start"), A_FLOAT, 0);
+ class_addmethod(t3_metro_class, (t_method)t3_metro_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addfloat(t3_metro_class, (t_method)t3_metro_float);
+ class_addlist(t3_metro_class, (t_method)t3_metro_list);
+// class_sethelpsymbol(t3_metro_class, gensym("iemhelp/help-t3_metro"));
+}
diff --git a/iem_t3_lib/src/t3_sig~.c b/iem_t3_lib/src/t3_sig~.c
new file mode 100644
index 0000000..c2f8eea
--- /dev/null
+++ b/iem_t3_lib/src/t3_sig~.c
@@ -0,0 +1,192 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+/* -------------------------- t3_sig_tilde~ ------------------------------ */
+static t_class *t3_sig_tilde_class;
+
+typedef struct _t3_sig_tilde
+{
+ t_object x_obj;
+ t_clock *x_clock;
+ t_float x_old_val;
+ t_float x_new_val;
+ t_float *x_beg;
+ int x_n;
+ int x_t3_bang_samps;
+ int x_transient;
+ t_float x_ms2samps;
+ t_float x_ticks2ms;
+} t_t3_sig_tilde;
+
+static void t3_sig_tilde_tick(t_t3_sig_tilde *x)
+{
+ t_float *trans = x->x_beg, val;
+ int n = x->x_n, t3_bang_samps, i;
+
+ t3_bang_samps = x->x_t3_bang_samps;
+ if(!x->x_transient)
+ {
+ val = x->x_old_val;
+ for(i=0; i<t3_bang_samps; i++)
+ trans[i] = val;
+ x->x_transient = 1;
+ }
+ val = x->x_old_val = x->x_new_val;
+ for(i=t3_bang_samps; i<n; i++)
+ trans[i] = val;
+}
+
+static void t3_sig_tilde_stop(t_t3_sig_tilde *x)
+{
+ clock_unset(x->x_clock);
+ x->x_new_val = x->x_old_val;
+}
+
+static void t3_sig_tilde_list(t_t3_sig_tilde *x, t_symbol *s, int ac, t_atom *av)
+{
+ if((ac == 2)&&IS_A_FLOAT(av,0)&&IS_A_FLOAT(av,1))
+ {
+ int n = x->x_n, t3_bang_samps, ticks;
+
+ t3_bang_samps = (int)((t_float)atom_getfloatarg(0, ac, av)*x->x_ms2samps);
+ x->x_new_val = (t_float)atom_getfloatarg(1, ac, av);
+ if(t3_bang_samps < 0)
+ t3_bang_samps = 0;
+ ticks = t3_bang_samps / n;
+ x->x_t3_bang_samps = t3_bang_samps - n*ticks;
+ if(ticks < 1)
+ t3_sig_tilde_tick(x);
+ else
+ clock_delay(x->x_clock, (double)ticks * (double)x->x_ticks2ms);
+ }
+}
+
+static t_int *t3_sig_tilde_perform(t_int *w)
+{
+ t_float *out = (t_float *)(w[1]);
+ t_t3_sig_tilde *x = (t_t3_sig_tilde *)(w[2]);
+ int n = (int)(w[3]);
+
+ if(x->x_transient)
+ {
+ t_float *trans = x->x_beg;
+
+ while(n--)
+ *out++ = *trans++;
+ x->x_transient = 0;
+ }
+ else
+ {
+ t_float val = x->x_new_val;
+
+ while(n--)
+ *out++ = val;
+ }
+ return (w+4);
+}
+
+static t_int *t3_sig_tilde_perf8(t_int *w)
+{
+ t_float *out = (t_float *)(w[1]);
+ t_t3_sig_tilde *x = (t_t3_sig_tilde *)(w[2]);
+ int n = (int)(w[3]), i;
+
+ if(x->x_transient)
+ {
+ t_float *trans = x->x_beg;
+
+ for(i=0; i<n; i+=8, out+=8, trans+=8)
+ {
+ out[0] = trans[0];
+ out[1] = trans[1];
+ out[2] = trans[2];
+ out[3] = trans[3];
+ out[4] = trans[4];
+ out[5] = trans[5];
+ out[6] = trans[6];
+ out[7] = trans[7];
+ }
+ x->x_transient = 0;
+ }
+ else
+ {
+ t_float val = x->x_new_val;
+
+ for(i=0; i<n; i+=8, out+=8)
+ {
+ out[0] = val;
+ out[1] = val;
+ out[2] = val;
+ out[3] = val;
+ out[4] = val;
+ out[5] = val;
+ out[6] = val;
+ out[7] = val;
+ }
+ }
+ return (w+4);
+}
+
+static void t3_sig_tilde_dsp(t_t3_sig_tilde *x, t_signal **sp)
+{
+ int i;
+ t_float *trans, val;
+
+ if(sp[0]->s_n > x->x_n)
+ {
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
+ x->x_n = sp[0]->s_n;
+ x->x_beg = (t_float *)getbytes(x->x_n*sizeof(t_float));
+ }
+ else
+ x->x_n = sp[0]->s_n;
+ x->x_ms2samps = 0.001*(t_float)sp[0]->s_sr;
+ x->x_ticks2ms = (t_float)x->x_n / x->x_ms2samps;
+ i = x->x_n;
+ val = x->x_new_val;
+ trans = x->x_beg;
+ while(i--)
+ *trans++ = val;
+
+ if((sp[0]->s_n)&7)
+ dsp_add(t3_sig_tilde_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
+ else
+ dsp_add(t3_sig_tilde_perf8, 3, sp[0]->s_vec, x, sp[0]->s_n);
+}
+
+static void t3_sig_tilde_free(t_t3_sig_tilde *x)
+{
+ if(x->x_beg)
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
+ clock_free(x->x_clock);
+}
+
+static void *t3_sig_tilde_new(t_floatarg init_val)
+{
+ t_t3_sig_tilde *x = (t_t3_sig_tilde *)pd_new(t3_sig_tilde_class);
+
+ x->x_new_val = x->x_old_val = init_val;
+ x->x_n = (int)sys_getblksize();
+ x->x_beg = (t_float *)getbytes(x->x_n*sizeof(t_float));
+ x->x_t3_bang_samps = x->x_transient = 0;
+ x->x_ms2samps = 0.001 * (t_float)sys_getsr();
+ x->x_ticks2ms = (t_float)x->x_n / x->x_ms2samps;
+ x->x_clock = clock_new(x, (t_method)t3_sig_tilde_tick);
+ outlet_new(&x->x_obj, &s_signal);
+ return (x);
+}
+
+void t3_sig_tilde_setup(void)
+{
+ t3_sig_tilde_class = class_new(gensym("t3_sig~"), (t_newmethod)t3_sig_tilde_new,
+ (t_method)t3_sig_tilde_free, sizeof(t_t3_sig_tilde), 0, A_DEFFLOAT, 0);
+ class_addmethod(t3_sig_tilde_class, (t_method)t3_sig_tilde_dsp, gensym("dsp"), 0);
+ class_addmethod(t3_sig_tilde_class, (t_method)t3_sig_tilde_stop, gensym("stop"), 0);
+ class_addlist(t3_sig_tilde_class, (t_method)t3_sig_tilde_list);
+// class_sethelpsymbol(t3_sig_tilde_class, gensym("iemhelp/help-t3_sig~"));
+}
diff --git a/iem_t3_lib/src/t3_timer.c b/iem_t3_lib/src/t3_timer.c
new file mode 100644
index 0000000..c9e9be6
--- /dev/null
+++ b/iem_t3_lib/src/t3_timer.c
@@ -0,0 +1,48 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+/* -------------------------- t3_timer ------------------------------ */
+static t_class *t3_timer_class;
+
+typedef struct _t3_timer
+{
+ t_object x_obj;
+ double x_settime;
+ double x_t3_off;
+} t_t3_timer;
+
+static void t3_timer_float(t_t3_timer *x, t_floatarg t3_bang)
+{
+ x->x_settime = (double)clock_getsystime();
+ x->x_t3_off = (double)t3_bang;
+}
+
+static void t3_timer_ft1(t_t3_timer *x, t_floatarg t3_bang)
+{
+ outlet_float(x->x_obj.ob_outlet, clock_gettimesince(x->x_settime)
+ + (double)t3_bang - x->x_t3_off);
+}
+
+static void *t3_timer_new(void)
+{
+ t_t3_timer *x = (t_t3_timer *)pd_new(t3_timer_class);
+ t3_timer_float(x, 0.0f);
+ outlet_new(&x->x_obj, &s_float);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
+ return (x);
+}
+
+void t3_timer_setup(void)
+{
+ t3_timer_class = class_new(gensym("t3_timer"), (t_newmethod)t3_timer_new, 0,
+ sizeof(t_t3_timer), 0, 0);
+ class_addfloat(t3_timer_class, t3_timer_float);
+ class_addmethod(t3_timer_class, (t_method)t3_timer_ft1, gensym("ft1"), A_FLOAT, 0);
+// class_sethelpsymbol(t3_timer_class, gensym("iemhelp/help-t3_timer"));
+}
diff --git a/iem_t3_lib/t3_bpe-help.pd b/iem_t3_lib/t3_bpe-help.pd
new file mode 100644
index 0000000..80596de
--- /dev/null
+++ b/iem_t3_lib/t3_bpe-help.pd
@@ -0,0 +1,105 @@
+#N canvas 100 17 532 586 10;
+#N canvas 0 0 450 300 graph1 0;
+#X array array99 259 float 0;
+#X coords 0 0 258 1 256 140 1;
+#X restore 96 43 graph;
+#X obj 68 458 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
+-1;
+#X msg 35 355 stop;
+#X obj 68 527 tabwrite~ array99;
+#X obj 7 433 loadbang;
+#X obj 14 38 tgl 15 0 empty empty empty 20 8 0 10 -262144 -1 -1 0 1
+;
+#X floatatom 14 105 5 0 0 0 - - -;
+#X floatatom 30 83 3 0 0 0 - - -;
+#X obj 14 60 dsp;
+#X obj 91 381 t3_bpe;
+#X obj 81 283 bng 25 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
+-1;
+#X obj 91 316 t b b;
+#X obj 91 418 t3_line~ 0;
+#X obj 91 349 f 0.04;
+#X floatatom 128 265 5 0 0 0 - - -;
+#X obj 128 287 / 44.1;
+#X text 171 267 Samples;
+#X obj 91 455 fade~ lin;
+#X obj 147 363 pack 0 0 1 1.5 1 0.5 0 1.5;
+#X text 184 250 pre-delay;
+#X floatatom 256 264 5 0 0 0 - - -;
+#X obj 256 286 / 44.1;
+#X text 299 266 Samples;
+#X text 312 249 attack;
+#X floatatom 364 263 5 0 0 0 - - -;
+#X obj 364 285 / 44.1;
+#X text 407 265 Samples;
+#X text 420 248 sustain;
+#X floatatom 364 344 5 0 0 0 - - -;
+#X obj 364 366 / 44.1;
+#X text 407 346 Samples;
+#X text 420 329 release;
+#X obj 256 242 init 34;
+#X obj 364 241 init 55;
+#X obj 364 322 init 70;
+#X obj 128 243 init 70;
+#X text 12 10 t3_bpe;
+#X text 105 9 time-tagged trigger break point envelope;
+#X msg 239 421 set _lin;
+#X msg 239 442 set _linsqrt;
+#X msg 239 463 set _sqrt;
+#X msg 239 483 set _sin;
+#X msg 240 504 set _sinhann;
+#X msg 240 526 set _hann;
+#X msg 381 70 \; array99 resize 259 \; array99 bounds 0 0 258 1 \;
+array99 xticks 0 64 2 \; array99 yticks 0 0.1 5 \; array99 xlabel -0.08
+0 64 128 192 256 \; array99 ylabel -9.1 0 0.5 1;
+#X obj 381 47 loadbang;
+#X obj 91 477 *~ 0.8;
+#X obj 91 499 +~ 0.1;
+#X text 363 184 Samples;
+#X floatatom 156 387 8 0 0 0 - - -;
+#X text 213 388 t3_bang if finished;
+#X text 405 528 IEM KUG;
+#X text 389 516 musil;
+#X text 419 516 @;
+#X text 425 516 iem.at;
+#X text 340 505 (c) Thomas Musil 2000 - 2005;
+#X text 388 538 Graz \, Austria;
+#X text 340 493 (c) Gerhard Eckel;
+#X connect 1 0 3 0;
+#X connect 2 0 9 0;
+#X connect 4 0 1 0;
+#X connect 5 0 8 0;
+#X connect 8 0 6 0;
+#X connect 8 1 7 0;
+#X connect 9 0 12 0;
+#X connect 9 1 12 1;
+#X connect 9 2 49 0;
+#X connect 10 0 1 0;
+#X connect 10 0 11 0;
+#X connect 11 0 13 0;
+#X connect 11 1 18 0;
+#X connect 12 0 17 0;
+#X connect 13 0 9 0;
+#X connect 14 0 15 0;
+#X connect 15 0 13 1;
+#X connect 17 0 46 0;
+#X connect 18 0 9 0;
+#X connect 20 0 21 0;
+#X connect 21 0 18 3;
+#X connect 24 0 25 0;
+#X connect 25 0 18 5;
+#X connect 28 0 29 0;
+#X connect 29 0 18 7;
+#X connect 32 0 20 0;
+#X connect 33 0 24 0;
+#X connect 34 0 28 0;
+#X connect 35 0 14 0;
+#X connect 38 0 17 0;
+#X connect 39 0 17 0;
+#X connect 40 0 17 0;
+#X connect 41 0 17 0;
+#X connect 42 0 17 0;
+#X connect 43 0 17 0;
+#X connect 45 0 44 0;
+#X connect 46 0 47 0;
+#X connect 47 0 3 0;
diff --git a/iem_t3_lib/t3_delay-help.pd b/iem_t3_lib/t3_delay-help.pd
new file mode 100644
index 0000000..7e5b219
--- /dev/null
+++ b/iem_t3_lib/t3_delay-help.pd
@@ -0,0 +1,79 @@
+#N canvas 100 58 496 565 10;
+#N canvas 0 0 450 300 graph1 0;
+#X array array99 259 float 0;
+#X coords 0 0 258 1 259 140 1;
+#X restore 108 48 graph;
+#X obj 95 238 bng 25 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
+-1;
+#X obj 243 478 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
+-1 -1;
+#X obj 95 400 t3_del 0.5;
+#X obj 28 454 t3_timer;
+#X floatatom 28 502 5 0 0 0 - - -;
+#X msg 154 455 \$1 0.9;
+#X obj 95 303 f 0.04;
+#X floatatom 132 241 5 0 0 0 - - -;
+#X msg 95 455 \$1 0.1;
+#X obj 133 486 t3_sig~ 0.1;
+#X obj 132 263 / 44.1;
+#X text 175 255 Samples;
+#X floatatom 196 352 5 0 0 0 - - -;
+#X obj 196 374 / 44.1;
+#X text 237 362 Samples;
+#X msg 43 327 stop;
+#X obj 243 521 tabwrite~ array99;
+#X obj 132 219 init 80;
+#X obj 196 330 init 30;
+#X obj 401 53 loadbang;
+#X obj 14 38 tgl 15 0 empty empty empty 20 8 0 10 -262144 -1 -1 0 1
+;
+#X floatatom 14 105 5 0 0 0 - - -;
+#X floatatom 30 83 3 0 0 0 - - -;
+#X obj 14 60 dsp;
+#X obj 95 327 t3_del 0;
+#X obj 28 478 * 44.1;
+#X text 71 503 Samples;
+#X text 12 10 t3_delay;
+#X text 106 9 time-tagged trigger delay;
+#X obj 95 355 t f f;
+#X text 379 189 Samples;
+#X msg 401 80 \; array99 resize 259 \; array99 bounds 0 0 258 1 \;
+array99 xticks 0 64 2 \; array99 yticks 0 0.1 5 \; array99 xlabel -0.08
+0 64 128 192 256 \; array99 ylabel -9.1 0 0.5 1;
+#X obj 243 429 loadbang;
+#X text 172 240 pre_delay;
+#X text 238 350 duration;
+#X text 365 418 IEM KUG;
+#X text 349 406 musil;
+#X text 379 406 @;
+#X text 385 406 iem.at;
+#X text 300 395 (c) Thomas Musil 2000 - 2005;
+#X text 348 428 Graz \, Austria;
+#X text 300 383 (c) Gerhard Eckel;
+#X connect 1 0 2 0;
+#X connect 1 0 7 0;
+#X connect 2 0 17 0;
+#X connect 3 0 4 1;
+#X connect 3 0 9 0;
+#X connect 4 0 26 0;
+#X connect 6 0 10 0;
+#X connect 7 0 25 0;
+#X connect 8 0 11 0;
+#X connect 9 0 10 0;
+#X connect 10 0 17 0;
+#X connect 11 0 7 1;
+#X connect 13 0 14 0;
+#X connect 14 0 3 1;
+#X connect 16 0 3 0;
+#X connect 18 0 8 0;
+#X connect 19 0 13 0;
+#X connect 20 0 32 0;
+#X connect 21 0 24 0;
+#X connect 24 0 22 0;
+#X connect 24 1 23 0;
+#X connect 25 0 30 0;
+#X connect 26 0 5 0;
+#X connect 30 0 3 0;
+#X connect 30 0 4 0;
+#X connect 30 1 6 0;
+#X connect 33 0 2 0;
diff --git a/iem_t3_lib/t3_line~-help.pd b/iem_t3_lib/t3_line~-help.pd
new file mode 100644
index 0000000..535a90c
--- /dev/null
+++ b/iem_t3_lib/t3_line~-help.pd
@@ -0,0 +1,97 @@
+#N canvas 124 45 505 584 10;
+#N canvas 0 0 450 300 graph1 0;
+#X array array99 259 float 0;
+#X coords 0 0 258 1 256 140 1;
+#X restore 97 36 graph;
+#X obj 64 239 bng 25 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
+-1;
+#X obj 243 478 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
+-1 -1;
+#X obj 64 401 t3_del 0.5;
+#X obj 64 304 f 0.04;
+#X floatatom 101 242 5 0 0 0 - - -;
+#X obj 101 264 / 44.1;
+#X text 144 244 Samples;
+#X floatatom 129 354 5 0 0 0 - - -;
+#X obj 129 376 / 44.1;
+#X text 172 354 Samples;
+#X msg 12 328 stop;
+#X obj 243 521 tabwrite~ array99;
+#X obj 101 220 init 80;
+#X obj 129 332 init 30;
+#X obj 243 448 loadbang;
+#X obj 14 38 tgl 15 0 empty empty empty 20 8 0 10 -262144 -1 -1 1 1
+;
+#X floatatom 14 105 5 0 0 0 - - -;
+#X floatatom 30 83 3 0 0 0 - - -;
+#X obj 14 60 dsp;
+#X obj 64 327 t3_del 0;
+#X text 12 10 t3_delay;
+#X text 106 9 time-tagged trigger delay;
+#X obj 102 487 t3_line~ 0.1;
+#X obj 64 353 t f f;
+#X obj 17 455 pack 0 0.1 0.2;
+#X obj 122 456 pack 0 0.9 0.2;
+#X floatatom 233 255 5 0 0 0 - - -;
+#X obj 233 277 / 44.1;
+#X text 276 255 Samples;
+#X floatatom 351 257 5 0 0 0 - - -;
+#X obj 351 279 / 44.1;
+#X text 394 257 Samples;
+#X text 407 238 attack;
+#X text 286 237 release;
+#X obj 351 235 init 12;
+#X text 183 334 sustain + attack;
+#X obj 233 233 init 25;
+#X text 155 223 pre-delay;
+#X obj 314 365 t b f;
+#X obj 319 391 - 0;
+#X floatatom 319 416 5 0 0 0 - - -;
+#X text 365 419 Samples;
+#X text 365 396 sustain;
+#X msg 386 62 \; array99 resize 259 \; array99 bounds 0 0 258 1 \;
+array99 xticks 0 64 2 \; array99 yticks 0 0.1 5 \; array99 xlabel -0.08
+0 64 128 192 256 \; array99 ylabel -9.1 0 0.5 1;
+#X obj 386 39 loadbang;
+#X text 364 178 Samples;
+#X text 375 478 IEM KUG;
+#X text 359 466 musil;
+#X text 389 466 @;
+#X text 395 466 iem.at;
+#X text 310 455 (c) Thomas Musil 2000 - 2005;
+#X text 358 488 Graz \, Austria;
+#X text 310 443 (c) Gerhard Eckel;
+#X connect 1 0 2 0;
+#X connect 1 0 4 0;
+#X connect 2 0 12 0;
+#X connect 3 0 25 0;
+#X connect 4 0 20 0;
+#X connect 5 0 6 0;
+#X connect 6 0 4 1;
+#X connect 8 0 9 0;
+#X connect 8 0 40 0;
+#X connect 9 0 3 1;
+#X connect 11 0 3 0;
+#X connect 13 0 5 0;
+#X connect 14 0 8 0;
+#X connect 15 0 2 0;
+#X connect 16 0 19 0;
+#X connect 19 0 17 0;
+#X connect 19 1 18 0;
+#X connect 20 0 24 0;
+#X connect 23 0 12 0;
+#X connect 24 0 3 0;
+#X connect 24 1 26 0;
+#X connect 25 0 23 0;
+#X connect 26 0 23 0;
+#X connect 27 0 28 0;
+#X connect 28 0 25 2;
+#X connect 30 0 31 0;
+#X connect 30 0 39 0;
+#X connect 31 0 26 2;
+#X connect 35 0 30 0;
+#X connect 37 0 27 0;
+#X connect 39 0 40 0;
+#X connect 39 1 40 1;
+#X connect 40 0 41 0;
+#X connect 45 0 44 0;
diff --git a/iem_t3_lib/t3_metro-help.pd b/iem_t3_lib/t3_metro-help.pd
new file mode 100644
index 0000000..e7f3d55
--- /dev/null
+++ b/iem_t3_lib/t3_metro-help.pd
@@ -0,0 +1,103 @@
+#N canvas 228 46 467 574 10;
+#N canvas 0 0 450 300 graph1 0;
+#X array array99 259 float 0;
+#X coords 0 0 258 1 256 140 1;
+#X restore 89 33 graph;
+#X obj 91 427 t f b;
+#X obj 91 475 pack 0 0;
+#X obj 227 448 bng 15 250 50 0 empty empty empty 8 -8 0 10 -262144
+-1 -1;
+#N canvas 161 0 158 259 toggle 0;
+#X obj 38 25 inlet;
+#X obj 38 178 outlet;
+#X obj 38 53 f;
+#X obj 38 79 == 0;
+#X obj 38 130 * 0.8;
+#X obj 38 152 + 0.1;
+#X connect 0 0 2 0;
+#X connect 2 0 3 0;
+#X connect 3 0 2 1;
+#X connect 3 0 4 0;
+#X connect 4 0 5 0;
+#X connect 5 0 1 0;
+#X restore 121 452 pd toggle;
+#X msg 91 331 start \$1;
+#X msg 215 517 stop;
+#X floatatom 128 234 5 0 0 0 - - -;
+#X obj 128 258 / 44.1;
+#X text 171 235 Samples;
+#X floatatom 240 264 5 0 0 0 - - -;
+#X obj 240 288 / 44.1;
+#X text 283 264 Samples;
+#X obj 91 283 f 0.04;
+#X obj 91 234 bng 25 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
+-1;
+#X obj 227 473 tabwrite~ array99;
+#X obj 91 499 t3_sig~ 0.1;
+#X obj 128 208 init 30;
+#X obj 227 422 loadbang;
+#X obj 11 33 tgl 15 0 empty empty empty 20 8 0 10 -262144 -1 -1 1 1
+;
+#X floatatom 11 100 5 0 0 0 - - -;
+#X floatatom 27 78 3 0 0 0 - - -;
+#X obj 11 55 dsp;
+#X obj 91 307 t3_del 0;
+#X obj 240 241 init 10;
+#X text 8 7 t3_metro;
+#X text 108 7 time-tagged trigger variable metronom;
+#X obj 91 392 t3_metro 1.46;
+#X obj 204 321 +;
+#X obj 204 345 change -1;
+#X obj 204 368 clip 0.01 1e+006;
+#X obj 360 377 t b f;
+#X obj 360 310 random 32000;
+#X obj 360 332 - 16000;
+#X obj 360 354 / 100000;
+#X obj 215 496 del 9000;
+#X obj 384 40 loadbang;
+#X msg 384 67 \; array99 resize 259 \; array99 bounds 0 0 258 1 \;
+array99 xticks 0 64 2 \; array99 yticks 0 0.1 5 \; array99 xlabel -0.08
+0 64 128 192 256 \; array99 ylabel -9.1 0 0.5 1;
+#X text 356 176 Samples;
+#X text 355 438 IEM KUG;
+#X text 339 426 musil;
+#X text 369 426 @;
+#X text 375 426 iem.at;
+#X text 290 415 (c) Thomas Musil 2000 - 2005;
+#X text 338 448 Graz \, Austria;
+#X text 290 403 (c) Gerhard Eckel;
+#X connect 1 0 2 0;
+#X connect 1 1 4 0;
+#X connect 1 1 32 0;
+#X connect 2 0 16 0;
+#X connect 3 0 15 0;
+#X connect 3 0 35 0;
+#X connect 4 0 2 1;
+#X connect 5 0 27 0;
+#X connect 6 0 27 0;
+#X connect 7 0 8 0;
+#X connect 8 0 13 1;
+#X connect 10 0 11 0;
+#X connect 11 0 28 0;
+#X connect 13 0 23 0;
+#X connect 14 0 13 0;
+#X connect 14 0 3 0;
+#X connect 16 0 15 0;
+#X connect 17 0 7 0;
+#X connect 18 0 3 0;
+#X connect 19 0 22 0;
+#X connect 22 0 20 0;
+#X connect 22 1 21 0;
+#X connect 23 0 5 0;
+#X connect 24 0 10 0;
+#X connect 27 0 1 0;
+#X connect 28 0 29 0;
+#X connect 29 0 30 0;
+#X connect 30 0 27 1;
+#X connect 31 0 28 0;
+#X connect 31 1 28 1;
+#X connect 32 0 33 0;
+#X connect 33 0 34 0;
+#X connect 34 0 31 0;
+#X connect 35 0 6 0;
+#X connect 36 0 37 0;
diff --git a/iem_t3_lib/t3_sig~-help.pd b/iem_t3_lib/t3_sig~-help.pd
new file mode 100644
index 0000000..46d14ef
--- /dev/null
+++ b/iem_t3_lib/t3_sig~-help.pd
@@ -0,0 +1,75 @@
+#N canvas 174 106 507 414 10;
+#X floatatom 62 268 8 0 0 0 - - -;
+#X obj 164 371 dac~;
+#X obj 164 317 *~ 0.2;
+#X obj 164 342 hp1~ 5;
+#X floatatom 280 201 8 0 0 0 - - -;
+#X obj 164 293 t3_sig~;
+#X obj 215 226 t3_del 0.1;
+#X msg 164 254 \$1 1;
+#X obj 10 63 dsp;
+#X floatatom 26 85 3 0 0 0 - - -;
+#X floatatom 10 109 5 0 0 0 - - -;
+#X obj 10 42 tgl 15 0 empty empty empty 20 8 0 10 -262144 -1 -1 0 1
+;
+#X obj 164 182 t3_metro 5;
+#X msg 140 115 start 0;
+#X msg 176 139 stop;
+#X obj 280 153 for++ 1 1000 5;
+#X obj 280 177 / 200;
+#X obj 280 7 loadbang;
+#X obj 280 31 bng 15 250 50 0 empty empty empty 20 8 0 10 -262144 -1
+-1;
+#X msg 215 254 \$1 -1;
+#X obj 280 54 metro 10010;
+#X obj 376 72 del 5005;
+#X obj 376 97 t b b;
+#X obj 280 94 t b b;
+#X msg 292 120 1 1000 5;
+#X msg 406 121 1000 1 5;
+#X obj 62 245 t3_timer;
+#X text 5 6 t3_sig~;
+#X text 76 4 time-tagged trigger sig~;
+#X msg 397 23 stop;
+#X text 315 328 IEM KUG;
+#X text 299 316 musil;
+#X text 329 316 @;
+#X text 335 316 iem.at;
+#X text 250 305 (c) Thomas Musil 2000 - 2005;
+#X text 298 338 Graz \, Austria;
+#X text 250 293 (c) Gerhard Eckel;
+#X connect 2 0 3 0;
+#X connect 3 0 1 0;
+#X connect 3 0 1 1;
+#X connect 4 0 6 1;
+#X connect 5 0 2 0;
+#X connect 6 0 19 0;
+#X connect 6 0 26 1;
+#X connect 7 0 5 0;
+#X connect 8 0 10 0;
+#X connect 8 1 9 0;
+#X connect 11 0 8 0;
+#X connect 12 0 7 0;
+#X connect 12 0 6 0;
+#X connect 12 0 26 0;
+#X connect 13 0 12 0;
+#X connect 14 0 12 0;
+#X connect 15 0 16 0;
+#X connect 16 0 4 0;
+#X connect 17 0 18 0;
+#X connect 18 0 20 0;
+#X connect 18 0 13 0;
+#X connect 19 0 5 0;
+#X connect 20 0 21 0;
+#X connect 20 0 23 0;
+#X connect 21 0 22 0;
+#X connect 22 0 15 0;
+#X connect 22 1 25 0;
+#X connect 23 0 15 0;
+#X connect 23 1 24 0;
+#X connect 24 0 15 0;
+#X connect 25 0 15 0;
+#X connect 26 0 0 0;
+#X connect 29 0 20 0;
+#X connect 29 0 15 0;
+#X connect 29 0 21 0;
diff --git a/iem_t3_lib/t3_timer-help.pd b/iem_t3_lib/t3_timer-help.pd
new file mode 100644
index 0000000..0f1595d
--- /dev/null
+++ b/iem_t3_lib/t3_timer-help.pd
@@ -0,0 +1,27 @@
+#N canvas 231 195 316 292 10;
+#X obj 73 119 t3_del 11.11;
+#X msg 22 79 0.55;
+#X obj 22 48 bng 25 250 50 0 empty empty empty 8 -8 0 10 -262144 -1
+-1;
+#X obj 22 145 t3_timer;
+#X floatatom 22 170 6 0 0 0 - - -;
+#X text 88 22 measure time-difference;
+#X text 87 37 between 2 t3_bang-events;
+#X text 6 4 t3_timer;
+#X floatatom 152 93 6 0 0 0 - - -;
+#X text 203 93 ms;
+#X text 72 170 ms;
+#X text 84 5 time-tagged trigger timer;
+#X text 125 248 IEM KUG;
+#X text 109 236 musil;
+#X text 139 236 @;
+#X text 145 236 iem.at;
+#X text 60 225 (c) Thomas Musil 2000 - 2005;
+#X text 108 258 Graz \, Austria;
+#X text 60 213 (c) Gerhard Eckel;
+#X connect 0 0 3 1;
+#X connect 1 0 0 0;
+#X connect 1 0 3 0;
+#X connect 2 0 1 0;
+#X connect 3 0 4 0;
+#X connect 8 0 0 1;