Update of /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3058/iemlib/src/iem_t3_lib
Modified Files: iem_t3_lib.c makefile_win t3_bpe.c t3_delay.c t3_metro.c t3_timer.c Added Files: makefile_linux t3_line~.c t3_sig~.c Removed Files: sigt3_line.c sigt3_sig.c Log Message: change sig*.c to *~.c and sig* to *_tilde change makefiles
Index: t3_timer.c =================================================================== RCS file: /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib/t3_timer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** t3_timer.c 11 Apr 2006 16:24:09 -0000 1.4 --- t3_timer.c 8 Nov 2006 16:24:38 -0000 1.5 *************** *** 4,17 **** iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
- #ifdef _MSC_VER - #pragma warning( disable : 4244 ) - #pragma warning( disable : 4305 ) - #endif
#include "m_pd.h" #include "iemlib.h" - #include <math.h> - #include <stdio.h> - #include <string.h>
/* -------------------------- t3_timer ------------------------------ */ --- 4,10 ---- *************** *** 25,29 **** } t_t3_timer;
! static void t3_timer_float(t_t3_timer *x, t_float t3_bang) { x->x_settime = (double)clock_getsystime(); --- 18,22 ---- } t_t3_timer;
! static void t3_timer_float(t_t3_timer *x, t_floatarg t3_bang) { x->x_settime = (double)clock_getsystime(); *************** *** 31,35 **** }
! static void t3_timer_ft1(t_t3_timer *x, t_float t3_bang) { outlet_float(x->x_obj.ob_outlet, clock_gettimesince(x->x_settime) --- 24,28 ---- }
! 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) *************** *** 40,44 **** { t_t3_timer *x = (t_t3_timer *)pd_new(t3_timer_class); ! t3_timer_float(x, 0.0); outlet_new(&x->x_obj, &s_float); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); --- 33,37 ---- { 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"));
--- sigt3_sig.c DELETED ---
--- NEW FILE: makefile_linux --- 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
Index: t3_bpe.c =================================================================== RCS file: /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib/t3_bpe.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** t3_bpe.c 11 Apr 2006 16:24:09 -0000 1.4 --- t3_bpe.c 8 Nov 2006 16:24:38 -0000 1.5 *************** *** 4,17 **** iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
- #ifdef _MSC_VER - #pragma warning( disable : 4244 ) - #pragma warning( disable : 4305 ) - #endif - #include "m_pd.h" #include "iemlib.h" - #include <math.h> - #include <stdio.h> - #include <string.h>
/* ------------------------ t3_bpe ---------------------------- */ --- 4,9 ---- *************** *** 43,47 **** { t_atom *vec = x->x_beg; ! float val; double dticks, time; int iticks; --- 35,39 ---- { t_atom *vec = x->x_beg; ! t_float val; double dticks, time; int iticks; *************** *** 58,62 **** val = atom_getfloat(vec++); time = (double)atom_getfloat(vec); ! outlet_float(x->x_out_time, (float)time); x->x_at[1].a_w.w_float = val; x->x_at[0].a_w.w_float = x->x_t3_bang; --- 50,54 ---- 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;
Index: makefile_win =================================================================== RCS file: /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib/makefile_win,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** makefile_win 31 Oct 2006 14:17:16 -0000 1.4 --- makefile_win 8 Nov 2006 16:24:38 -0000 1.5 *************** *** 16,24 **** $(PD_INST_PATH)\bin\pd.lib
! SRC = sigt3_line.c \ ! sigt3_sig.c \ ! t3_bpe.c \ t3_delay.c \ t3_metro.c \ t3_timer.c \ iem_t3_lib.c --- 16,24 ---- $(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
--- sigt3_line.c DELETED ---
--- NEW FILE: t3_sig~.c --- /* 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"
/* -------------------------- sigt3_sig~ ------------------------------ */ static t_class *sigt3_sig_class;
typedef struct _sigt3_sig { 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_sigt3_sig;
static void sigt3_sig_tick(t_sigt3_sig *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 sigt3_sig_stop(t_sigt3_sig *x) { clock_unset(x->x_clock); x->x_new_val = x->x_old_val; }
static void sigt3_sig_list(t_sigt3_sig *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) sigt3_sig_tick(x); else clock_delay(x->x_clock, (double)ticks * (double)x->x_ticks2ms); } }
static t_int *sigt3_sig_perform(t_int *w) { t_float *out = (t_float *)(w[1]); t_sigt3_sig *x = (t_sigt3_sig *)(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 *sigt3_sig_perf8(t_int *w) { t_float *out = (t_float *)(w[1]); t_sigt3_sig *x = (t_sigt3_sig *)(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 sigt3_sig_dsp(t_sigt3_sig *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(sigt3_sig_perform, 3, sp[0]->s_vec, x, sp[0]->s_n); else dsp_add(sigt3_sig_perf8, 3, sp[0]->s_vec, x, sp[0]->s_n); }
static void sigt3_sig_free(t_sigt3_sig *x) { if(x->x_beg) freebytes(x->x_beg, x->x_n*sizeof(t_float)); clock_free(x->x_clock); }
static void *sigt3_sig_new(t_floatarg init_val) { t_sigt3_sig *x = (t_sigt3_sig *)pd_new(sigt3_sig_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)sigt3_sig_tick); outlet_new(&x->x_obj, &s_signal); return (x); }
void sigt3_sig_setup(void) { sigt3_sig_class = class_new(gensym("t3_sig~"), (t_newmethod)sigt3_sig_new, (t_method)sigt3_sig_free, sizeof(t_sigt3_sig), 0, A_DEFFLOAT, 0); class_addmethod(sigt3_sig_class, (t_method)sigt3_sig_dsp, gensym("dsp"), 0); class_addmethod(sigt3_sig_class, (t_method)sigt3_sig_stop, gensym("stop"), 0); class_addlist(sigt3_sig_class, (t_method)sigt3_sig_list); class_sethelpsymbol(sigt3_sig_class, gensym("iemhelp/help-t3_sig~")); }
--- NEW FILE: t3_line~.c --- /* 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 *sigt3_line_class;
typedef struct _sigt3_line { 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_sigt3_line;
static void sigt3_line_nontransient(t_float *vec, t_sigt3_line *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 *sigt3_line_perform(t_int *w) { t_float *out = (t_float *)(w[1]); t_sigt3_line *x = (t_sigt3_line *)(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 sigt3_line_nontransient(out, x, n); return(w+4); }
static void sigt3_line_tick(t_sigt3_line *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) sigt3_line_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 sigt3_line_list(t_sigt3_line *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) sigt3_line_tick(x); else clock_delay(x->x_clock, (double)ticks * x->x_ticks2ms); } }
static void sigt3_line_ft1(t_sigt3_line *x, t_float time) { if(time < 0.0) time = 0.0; x->x_inlet_time = (double)time; }
static void sigt3_line_stop(t_sigt3_line *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 sigt3_line_dsp(t_sigt3_line *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(sigt3_line_perform, 3, sp[0]->s_vec, x, sp[0]->s_n); }
static void sigt3_line_free(t_sigt3_line *x) { if(x->x_beg) freebytes(x->x_beg, x->x_n*sizeof(t_float)); clock_free(x->x_clock); }
static void *sigt3_line_new(t_floatarg init_val) { t_sigt3_line *x = (t_sigt3_line *)pd_new(sigt3_line_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)sigt3_line_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 sigt3_line_setup(void) { sigt3_line_class = class_new(gensym("t3_line~"), (t_newmethod)sigt3_line_new, (t_method)sigt3_line_free, sizeof(t_sigt3_line), 0, A_DEFFLOAT, 0); class_addmethod(sigt3_line_class, (t_method)sigt3_line_dsp, gensym("dsp"), 0); class_addmethod(sigt3_line_class, (t_method)sigt3_line_stop, gensym("stop"), 0); class_addmethod(sigt3_line_class, (t_method)sigt3_line_ft1, gensym("ft1"), A_FLOAT, 0); class_addlist(sigt3_line_class, (t_method)sigt3_line_list); class_sethelpsymbol(sigt3_line_class, gensym("iemhelp/help-t3_line~")); }
Index: iem_t3_lib.c =================================================================== RCS file: /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib/iem_t3_lib.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** iem_t3_lib.c 11 Apr 2006 16:24:09 -0000 1.4 --- iem_t3_lib.c 8 Nov 2006 16:24:38 -0000 1.5 *************** *** 4,34 **** iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
- #ifdef _MSC_VER - #pragma warning( disable : 4244 ) - #pragma warning( disable : 4305 ) - #endif - #include "m_pd.h" #include "iemlib.h" - #include <stdlib.h> - #include <string.h> - #include <stdio.h> - #include <math.h> - /* - #include <ctype.h> - #include <signal.h> - #include <sys/types.h> - #include <sys/stat.h> - #include <fcntl.h>
- #ifndef _WIN32 - #include <sys/signal.h> - #include <unistd.h> - #endif - - #ifdef _WIN32 - #include <io.h> - #endif - */
static t_class *iem_t3_lib_class; --- 4,10 ---- *************** *** 41,49 **** }
- void sigt3_line_setup(void); - void sigt3_sig_setup(void); void t3_bpe_setup(void); void t3_delay_setup(void); void t3_metro_setup(void); void t3_timer_setup(void);
--- 17,25 ---- }
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);
*************** *** 55,63 **** sizeof(t_object), CLASS_NOINLET, 0);
- sigt3_line_setup(); - sigt3_sig_setup(); t3_bpe_setup(); t3_delay_setup(); t3_metro_setup(); t3_timer_setup();
--- 31,39 ---- 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();
Index: t3_delay.c =================================================================== RCS file: /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib/t3_delay.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** t3_delay.c 11 Apr 2006 16:24:09 -0000 1.4 --- t3_delay.c 8 Nov 2006 16:24:38 -0000 1.5 *************** *** 4,17 **** iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
- #ifdef _MSC_VER - #pragma warning( disable : 4244 ) - #pragma warning( disable : 4305 ) - #endif - #include "m_pd.h" #include "iemlib.h" - #include <math.h> - #include <stdio.h> - #include <string.h>
/* ------------------------ t3_delay ---------------------------- */ --- 4,9 ----
Index: t3_metro.c =================================================================== RCS file: /cvsroot/pure-data/externals/iemlib/src/iem_t3_lib/t3_metro.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** t3_metro.c 11 Apr 2006 16:24:09 -0000 1.4 --- t3_metro.c 8 Nov 2006 16:24:38 -0000 1.5 *************** *** 4,17 **** iem_t3_lib written by Gerhard Eckel, Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2005 */
- #ifdef _MSC_VER - #pragma warning( disable : 4244 ) - #pragma warning( disable : 4305 ) - #endif
#include "m_pd.h" #include "iemlib.h" - #include <math.h> - #include <stdio.h> - #include <string.h>
/* ------------------------ t3_metro ---------------------------- */ --- 4,10 ----