aboutsummaryrefslogtreecommitdiff
path: root/src/iem_t3_lib
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2006-11-08 16:24:39 +0000
committermusil <tmusil@users.sourceforge.net>2006-11-08 16:24:39 +0000
commitbd3d7f243bb5a105b99ce701774cf3d402396576 (patch)
tree21d6b9b9235b267381acd0ff2c6e49483cff8a1b /src/iem_t3_lib
parent458a70fa945c0e2630d9585d88424e900d0f3e66 (diff)
change sig*.c to *~.c and sig* to *_tilde
change makefiles svn path=/trunk/externals/iemlib/; revision=6235
Diffstat (limited to 'src/iem_t3_lib')
-rw-r--r--src/iem_t3_lib/iem_t3_lib.c32
-rw-r--r--src/iem_t3_lib/makefile_linux51
-rw-r--r--src/iem_t3_lib/makefile_win6
-rw-r--r--src/iem_t3_lib/t3_bpe.c12
-rw-r--r--src/iem_t3_lib/t3_delay.c8
-rw-r--r--src/iem_t3_lib/t3_line~.c (renamed from src/iem_t3_lib/sigt3_line.c)47
-rw-r--r--src/iem_t3_lib/t3_metro.c7
-rw-r--r--src/iem_t3_lib/t3_sig~.c (renamed from src/iem_t3_lib/sigt3_sig.c)50
-rw-r--r--src/iem_t3_lib/t3_timer.c13
9 files changed, 104 insertions, 122 deletions
diff --git a/src/iem_t3_lib/iem_t3_lib.c b/src/iem_t3_lib/iem_t3_lib.c
index 617b202..b911c5d 100644
--- a/src/iem_t3_lib/iem_t3_lib.c
+++ b/src/iem_t3_lib/iem_t3_lib.c
@@ -3,33 +3,9 @@
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;
@@ -40,11 +16,11 @@ static void *iem_t3_lib_new(void)
return (x);
}
-void sigt3_line_setup(void);
-void sigt3_sig_setup(void);
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 ------------------------- */
@@ -54,11 +30,11 @@ 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);
- sigt3_line_setup();
- sigt3_sig_setup();
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");
diff --git a/src/iem_t3_lib/makefile_linux b/src/iem_t3_lib/makefile_linux
new file mode 100644
index 0000000..3705f69
--- /dev/null
+++ b/src/iem_t3_lib/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/src/iem_t3_lib/makefile_win b/src/iem_t3_lib/makefile_win
index 80df3ce..30e9a68 100644
--- a/src/iem_t3_lib/makefile_win
+++ b/src/iem_t3_lib/makefile_win
@@ -15,11 +15,11 @@ PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NOD
$(PD_INST_PATH)\bin\pthreadVC.lib \
$(PD_INST_PATH)\bin\pd.lib
-SRC = sigt3_line.c \
- sigt3_sig.c \
- t3_bpe.c \
+SRC = t3_bpe.c \
t3_delay.c \
+ t3_line~.c \
t3_metro.c \
+ t3_sig~.c \
t3_timer.c \
iem_t3_lib.c
diff --git a/src/iem_t3_lib/t3_bpe.c b/src/iem_t3_lib/t3_bpe.c
index eb72d3c..4b6c5d1 100644
--- a/src/iem_t3_lib/t3_bpe.c
+++ b/src/iem_t3_lib/t3_bpe.c
@@ -3,16 +3,8 @@
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 ---------------------------- */
static t_class *t3_bpe_class;
@@ -42,7 +34,7 @@ static void t3_bpe_stop(t_t3_bpe *x)
static void t3_bpe_tick(t_t3_bpe *x)
{
t_atom *vec = x->x_beg;
- float val;
+ t_float val;
double dticks, time;
int iticks;
@@ -57,7 +49,7 @@ static void t3_bpe_tick(t_t3_bpe *x)
vec += x->x_curindex;
val = atom_getfloat(vec++);
time = (double)atom_getfloat(vec);
- outlet_float(x->x_out_time, (float)time);
+ 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);
diff --git a/src/iem_t3_lib/t3_delay.c b/src/iem_t3_lib/t3_delay.c
index fc43fb6..e9fb769 100644
--- a/src/iem_t3_lib/t3_delay.c
+++ b/src/iem_t3_lib/t3_delay.c
@@ -3,16 +3,8 @@
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 ---------------------------- */
static t_class *t3_delay_class;
diff --git a/src/iem_t3_lib/sigt3_line.c b/src/iem_t3_lib/t3_line~.c
index 108fde2..84aa70f 100644
--- a/src/iem_t3_lib/sigt3_line.c
+++ b/src/iem_t3_lib/t3_line~.c
@@ -3,16 +3,9 @@
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_line~ ------------------------------ */
static t_class *sigt3_line_class;
@@ -21,7 +14,7 @@ typedef struct _sigt3_line
{
t_object x_obj;
t_clock *x_clock;
- float *x_beg;
+ t_float *x_beg;
double x_cur_val;
double x_dst_val;
double x_inlet_val;
@@ -38,7 +31,7 @@ typedef struct _sigt3_line
int x_transient;
} t_sigt3_line;
-static void sigt3_line_nontransient(float *vec, t_sigt3_line *x, int n)
+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;
@@ -52,7 +45,7 @@ static void sigt3_line_nontransient(float *vec, t_sigt3_line *x, int n)
while(n--)
{
cur_val += inc;
- *vec++ = (float)cur_val;
+ *vec++ = (t_float)cur_val;
}
x->x_cur_val += x->x_inc64;
}
@@ -62,7 +55,7 @@ static void sigt3_line_nontransient(float *vec, t_sigt3_line *x, int n)
while(n--)
{
cur_val += inc;
- *vec++ = (float)cur_val;
+ *vec++ = (t_float)cur_val;
}
x->x_cur_val = x->x_dst_val;
}
@@ -71,18 +64,18 @@ static void sigt3_line_nontransient(float *vec, t_sigt3_line *x, int n)
for(i=0; i<cur_samps; i++)
{
cur_val += inc;
- *vec++ = (float)cur_val;
+ *vec++ = (t_float)cur_val;
}
x->x_cur_val = cur_val = x->x_dst_val;
for(i=cur_samps; i<n; i++)
- *vec++ = (float)cur_val;
+ *vec++ = (t_float)cur_val;
x->x_cur_samps = 0;
}
}
else
{
while(n--)
- *vec++ = (float)cur_val;
+ *vec++ = (t_float)cur_val;
}
}
@@ -94,7 +87,7 @@ static t_int *sigt3_line_perform(t_int *w)
if(x->x_transient)
{
- float *trans = x->x_beg;
+ t_float *trans = x->x_beg;
while(n--)
*out++ = *trans++;
@@ -107,7 +100,7 @@ static t_int *sigt3_line_perform(t_int *w)
static void sigt3_line_tick(t_sigt3_line *x)
{
- float *trans = x->x_beg;
+ t_float *trans = x->x_beg;
int n = x->x_n, t3_bang_samps, cur_samps, i;
double inc, cur_val;
@@ -123,7 +116,7 @@ static void sigt3_line_tick(t_sigt3_line *x)
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] = (float)cur_val;
+ trans[i] = (t_float)cur_val;
}
else
{
@@ -145,7 +138,7 @@ static void sigt3_line_tick(t_sigt3_line *x)
for(i=t3_bang_samps; i<n; i++)
{
cur_val += inc;
- trans[i] = (float)cur_val;
+ trans[i] = (t_float)cur_val;
}
x->x_cur_val += (double)diff * inc;
x->x_cur_samps -= diff;
@@ -155,7 +148,7 @@ static void sigt3_line_tick(t_sigt3_line *x)
for(i=t3_bang_samps; i<n; i++)
{
cur_val += inc;
- trans[i] = (float)cur_val;
+ trans[i] = (t_float)cur_val;
}
x->x_cur_val = x->x_dst_val;
x->x_cur_samps = 0;
@@ -166,12 +159,12 @@ static void sigt3_line_tick(t_sigt3_line *x)
for(i=t3_bang_samps; i<end; i++)
{
cur_val += inc;
- trans[i] = (float)cur_val;
+ 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] = (float)cur_val;
+ trans[i] = (t_float)cur_val;
}
}
x->x_transient = 1;
@@ -185,7 +178,7 @@ static void sigt3_line_list(t_sigt3_line *x, t_symbol *s, int ac, t_atom *av)
double time;
x->x_inlet_val = (double)atom_getfloatarg(1, ac, av);
- t3_bang_samps = (int)((float)atom_getfloatarg(0, ac, av)*x->x_ms2samps);
+ 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;
@@ -221,13 +214,13 @@ static void sigt3_line_stop(t_sigt3_line *x)
static void sigt3_line_dsp(t_sigt3_line *x, t_signal **sp)
{
int i;
- float val, *trans;
+ t_float val, *trans;
if(sp[0]->s_n > x->x_n)
{
- freebytes(x->x_beg, x->x_n*sizeof(float));
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
x->x_n = (int)sp[0]->s_n;
- x->x_beg = (float *)getbytes(x->x_n*sizeof(float));
+ x->x_beg = (t_float *)getbytes(x->x_n*sizeof(t_float));
}
else
x->x_n = (int)sp[0]->s_n;
@@ -244,7 +237,7 @@ static void sigt3_line_dsp(t_sigt3_line *x, t_signal **sp)
static void sigt3_line_free(t_sigt3_line *x)
{
if(x->x_beg)
- freebytes(x->x_beg, x->x_n*sizeof(float));
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
clock_free(x->x_clock);
}
@@ -254,7 +247,7 @@ static void *sigt3_line_new(t_floatarg init_val)
int i;
x->x_n = (int)sys_getblksize();
- x->x_beg = (float *)getbytes(x->x_n*sizeof(float));
+ 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;
diff --git a/src/iem_t3_lib/t3_metro.c b/src/iem_t3_lib/t3_metro.c
index 5438554..0f96562 100644
--- a/src/iem_t3_lib/t3_metro.c
+++ b/src/iem_t3_lib/t3_metro.c
@@ -3,16 +3,9 @@
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 ---------------------------- */
static t_class *t3_metro_class;
diff --git a/src/iem_t3_lib/sigt3_sig.c b/src/iem_t3_lib/t3_sig~.c
index 59ddbdb..41b8969 100644
--- a/src/iem_t3_lib/sigt3_sig.c
+++ b/src/iem_t3_lib/t3_sig~.c
@@ -3,16 +3,8 @@
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>
/* -------------------------- sigt3_sig~ ------------------------------ */
static t_class *sigt3_sig_class;
@@ -21,19 +13,19 @@ typedef struct _sigt3_sig
{
t_object x_obj;
t_clock *x_clock;
- float x_old_val;
- float x_new_val;
- float *x_beg;
+ 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;
- float x_ms2samps;
- float x_ticks2ms;
+ t_float x_ms2samps;
+ t_float x_ticks2ms;
} t_sigt3_sig;
static void sigt3_sig_tick(t_sigt3_sig *x)
{
- float *trans = x->x_beg, val;
+ t_float *trans = x->x_beg, val;
int n = x->x_n, t3_bang_samps, i;
t3_bang_samps = x->x_t3_bang_samps;
@@ -61,8 +53,8 @@ static void sigt3_sig_list(t_sigt3_sig *x, t_symbol *s, int ac, t_atom *av)
{
int n = x->x_n, t3_bang_samps, ticks;
- t3_bang_samps = (int)((float)atom_getfloatarg(0, ac, av)*x->x_ms2samps);
- x->x_new_val = (float)atom_getfloatarg(1, ac, av);
+ 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;
@@ -82,7 +74,7 @@ static t_int *sigt3_sig_perform(t_int *w)
if(x->x_transient)
{
- float *trans = x->x_beg;
+ t_float *trans = x->x_beg;
while(n--)
*out++ = *trans++;
@@ -90,7 +82,7 @@ static t_int *sigt3_sig_perform(t_int *w)
}
else
{
- float val = x->x_new_val;
+ t_float val = x->x_new_val;
while(n--)
*out++ = val;
@@ -106,7 +98,7 @@ static t_int *sigt3_sig_perf8(t_int *w)
if(x->x_transient)
{
- float *trans = x->x_beg;
+ t_float *trans = x->x_beg;
for(i=0; i<n; i+=8, out+=8, trans+=8)
{
@@ -123,7 +115,7 @@ static t_int *sigt3_sig_perf8(t_int *w)
}
else
{
- float val = x->x_new_val;
+ t_float val = x->x_new_val;
for(i=0; i<n; i+=8, out+=8)
{
@@ -143,18 +135,18 @@ static t_int *sigt3_sig_perf8(t_int *w)
static void sigt3_sig_dsp(t_sigt3_sig *x, t_signal **sp)
{
int i;
- float *trans, val;
+ t_float *trans, val;
if(sp[0]->s_n > x->x_n)
{
- freebytes(x->x_beg, x->x_n*sizeof(float));
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
x->x_n = sp[0]->s_n;
- x->x_beg = (float *)getbytes(x->x_n*sizeof(float));
+ 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*(float)sp[0]->s_sr;
- x->x_ticks2ms = (float)x->x_n / x->x_ms2samps;
+ 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;
@@ -170,7 +162,7 @@ static void sigt3_sig_dsp(t_sigt3_sig *x, t_signal **sp)
static void sigt3_sig_free(t_sigt3_sig *x)
{
if(x->x_beg)
- freebytes(x->x_beg, x->x_n*sizeof(float));
+ freebytes(x->x_beg, x->x_n*sizeof(t_float));
clock_free(x->x_clock);
}
@@ -180,10 +172,10 @@ static void *sigt3_sig_new(t_floatarg init_val)
x->x_new_val = x->x_old_val = init_val;
x->x_n = (int)sys_getblksize();
- x->x_beg = (float *)getbytes(x->x_n*sizeof(float));
+ 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 * (float)sys_getsr();
- x->x_ticks2ms = (float)x->x_n / x->x_ms2samps;
+ 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);
diff --git a/src/iem_t3_lib/t3_timer.c b/src/iem_t3_lib/t3_timer.c
index aa9c8b5..1169726 100644
--- a/src/iem_t3_lib/t3_timer.c
+++ b/src/iem_t3_lib/t3_timer.c
@@ -3,16 +3,9 @@
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 ------------------------------ */
static t_class *t3_timer_class;
@@ -24,13 +17,13 @@ typedef struct _t3_timer
double x_t3_off;
} t_t3_timer;
-static void t3_timer_float(t_t3_timer *x, t_float t3_bang)
+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_float 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);
@@ -39,7 +32,7 @@ static void t3_timer_ft1(t_t3_timer *x, t_float t3_bang)
static void *t3_timer_new(void)
{
t_t3_timer *x = (t_t3_timer *)pd_new(t3_timer_class);
- t3_timer_float(x, 0.0);
+ 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);