diff options
Diffstat (limited to 'src/iem_t3_lib')
-rw-r--r-- | src/iem_t3_lib/iem_t3_lib.c | 42 | ||||
-rw-r--r-- | src/iem_t3_lib/iem_t3_lib.dsp | 85 | ||||
-rw-r--r-- | src/iem_t3_lib/iem_t3_lib.dsw | 29 | ||||
-rw-r--r-- | src/iem_t3_lib/iemlib.h | 108 | ||||
-rw-r--r-- | src/iem_t3_lib/makefile | 4 | ||||
-rw-r--r-- | src/iem_t3_lib/makefile_linux | 51 | ||||
-rw-r--r-- | src/iem_t3_lib/makefile_win | 36 | ||||
-rw-r--r-- | src/iem_t3_lib/t3_bpe.c | 133 | ||||
-rw-r--r-- | src/iem_t3_lib/t3_delay.c | 88 | ||||
-rw-r--r-- | src/iem_t3_lib/t3_line~.c | 272 | ||||
-rw-r--r-- | src/iem_t3_lib/t3_metro.c | 113 | ||||
-rw-r--r-- | src/iem_t3_lib/t3_sig~.c | 192 | ||||
-rw-r--r-- | src/iem_t3_lib/t3_timer.c | 48 |
13 files changed, 0 insertions, 1201 deletions
diff --git a/src/iem_t3_lib/iem_t3_lib.c b/src/iem_t3_lib/iem_t3_lib.c deleted file mode 100644 index b911c5d..0000000 --- a/src/iem_t3_lib/iem_t3_lib.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 - 2005 */ - -#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.16) library loaded! (c) Gerhard Eckel, Thomas Musil 05.2005"); - post(" musil%ciem.at iem KUG Graz Austria", '@'); -} diff --git a/src/iem_t3_lib/iem_t3_lib.dsp b/src/iem_t3_lib/iem_t3_lib.dsp deleted file mode 100644 index ab0a094..0000000 --- a/src/iem_t3_lib/iem_t3_lib.dsp +++ /dev/null @@ -1,85 +0,0 @@ -# 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/src/iem_t3_lib/iem_t3_lib.dsw b/src/iem_t3_lib/iem_t3_lib.dsw deleted file mode 100644 index 6c2a29b..0000000 --- a/src/iem_t3_lib/iem_t3_lib.dsw +++ /dev/null @@ -1,29 +0,0 @@ -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/src/iem_t3_lib/iemlib.h b/src/iem_t3_lib/iemlib.h deleted file mode 100644 index 6be2de0..0000000 --- a/src/iem_t3_lib/iemlib.h +++ /dev/null @@ -1,108 +0,0 @@ -/* 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/src/iem_t3_lib/makefile b/src/iem_t3_lib/makefile deleted file mode 100644 index 597ccdf..0000000 --- a/src/iem_t3_lib/makefile +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = iem_t3_lib - -include ../../Make.include - diff --git a/src/iem_t3_lib/makefile_linux b/src/iem_t3_lib/makefile_linux deleted file mode 100644 index 3705f69..0000000 --- a/src/iem_t3_lib/makefile_linux +++ /dev/null @@ -1,51 +0,0 @@ -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/src/iem_t3_lib/makefile_win b/src/iem_t3_lib/makefile_win deleted file mode 100644 index 30e9a68..0000000 --- a/src/iem_t3_lib/makefile_win +++ /dev/null @@ -1,36 +0,0 @@ -all: ..\..\lib\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 - -..\..\lib\iem_t3_lib.dll: $(OBJ) - link $(PD_WIN_L_FLAGS) /dll /export:iem_t3_lib_setup \ - /out:..\..\lib\iem_t3_lib.dll $(OBJ) $(PD_WIN_LIB) - -clean: - del *.obj diff --git a/src/iem_t3_lib/t3_bpe.c b/src/iem_t3_lib/t3_bpe.c deleted file mode 100644 index 4b6c5d1..0000000 --- a/src/iem_t3_lib/t3_bpe.c +++ /dev/null @@ -1,133 +0,0 @@ -/* 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 - 2005 */ - -#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/src/iem_t3_lib/t3_delay.c b/src/iem_t3_lib/t3_delay.c deleted file mode 100644 index e9fb769..0000000 --- a/src/iem_t3_lib/t3_delay.c +++ /dev/null @@ -1,88 +0,0 @@ -/* 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 - 2005 */ - -#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/src/iem_t3_lib/t3_line~.c b/src/iem_t3_lib/t3_line~.c deleted file mode 100644 index a3007a7..0000000 --- a/src/iem_t3_lib/t3_line~.c +++ /dev/null @@ -1,272 +0,0 @@ -/* 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 - 2005 */ - - -#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/src/iem_t3_lib/t3_metro.c b/src/iem_t3_lib/t3_metro.c deleted file mode 100644 index 0f96562..0000000 --- a/src/iem_t3_lib/t3_metro.c +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 - 2005 */ - - -#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/src/iem_t3_lib/t3_sig~.c b/src/iem_t3_lib/t3_sig~.c deleted file mode 100644 index 458e2a6..0000000 --- a/src/iem_t3_lib/t3_sig~.c +++ /dev/null @@ -1,192 +0,0 @@ -/* 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 - 2005 */ - -#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/src/iem_t3_lib/t3_timer.c b/src/iem_t3_lib/t3_timer.c deleted file mode 100644 index 1169726..0000000 --- a/src/iem_t3_lib/t3_timer.c +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 - 2005 */ - - -#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")); -} |