From 7ace8997aa8ecd2e3fe6d05e5df2af77fcc8f17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Sun, 6 Oct 2002 05:14:51 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r159, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/zhzxh~/; revision=160 --- zhzxh~/Makefile | 75 ++++++++++++++++++++++++++++++++++++++++++++++ zhzxh~/help-zhzxh~.pd | 39 ++++++++++++++++++++++++ zhzxh~/zhzxh~.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 zhzxh~/Makefile create mode 100644 zhzxh~/help-zhzxh~.pd create mode 100644 zhzxh~/zhzxh~.c diff --git a/zhzxh~/Makefile b/zhzxh~/Makefile new file mode 100644 index 0000000..9887237 --- /dev/null +++ b/zhzxh~/Makefile @@ -0,0 +1,75 @@ +current: + echo make pd_linux, pd_nt, pd_irix5, or pd_irix6 + +clean: ; rm -f *.pd_linux *.o + +# ----------------------- NT ----------------------- + +pd_nt: zhzxh~.dll + +.SUFFIXES: .dll + +PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo +VC="C:\Program Files\Microsoft Visual Studio\Vc98" + +PDNTINCLUDE = /I. /I\tcl\include /I\ftp\pd\src /I$(VC)\include + +PDNTLDIR = $(VC)\lib +PDNTLIB = $(PDNTLDIR)\libc.lib \ + $(PDNTLDIR)\oldnames.lib \ + $(PDNTLDIR)\kernel32.lib \ + \ftp\pd\bin\pd.lib + +.c.dll: + cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c + link /dll /export:$*_setup $*.obj $(PDNTLIB) + +# ----------------------- IRIX 5.x ----------------------- + +pd_irix5: zhzxh~.pd_irix5 + +.SUFFIXES: .pd_irix5 + +SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2 + + +SGIINCLUDE = -I../../src/ + +.c.pd_irix5: + cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c + ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o + rm $*.o + +# ----------------------- IRIX 6.x ----------------------- + +pd_irix6: zhzxh~.pd_irix6 + +.SUFFIXES: .pd_irix6 + +SGICFLAGS6 = -n32 -DPD -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \ + -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \ + -Ofast=ip32 + +.c.pd_irix6: + cc $(SGICFLAGS6) $(SGIINCLUDE) -o $*.o -c $*.c + ld -IPA -n32 -shared -rdata_shared -o $*.pd_irix6 $*.o + rm $*.o + +# ----------------------- LINUX i386 ----------------------- + +pd_linux: zhzxh~.pd_linux + +.SUFFIXES: .pd_linux + +LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer \ + -Wall -W -Wshadow -Wstrict-prototypes -Werror \ + -Wno-unused -Wno-parentheses -Wno-switch + +LINUXINCLUDE = -I/usr/local/lib/pd/include + +.c.pd_linux: + cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c + ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm + strip --strip-unneeded $*.pd_linux + rm $*.o + diff --git a/zhzxh~/help-zhzxh~.pd b/zhzxh~/help-zhzxh~.pd new file mode 100644 index 0000000..9b5f26a --- /dev/null +++ b/zhzxh~/help-zhzxh~.pd @@ -0,0 +1,39 @@ +#N canvas 12 60 418 347 10; +#X floatatom 127 195 5 0 0; +#X obj 76 307 dac~; +#X obj 78 277 *~; +#X obj 13 123 readsf~; +#X msg 36 94 1; +#X floatatom 99 46 5 0 0; +#X obj 130 183 hsl 128 8 0 2500 0 1 empty empty tone -2 -6 0 8 -262144 +-1 -1 8200 1; +#X obj 78 220 zhzxh~; +#X msg 13 56 open \$1; +#X obj 136 244 vsl 8 64 0 1 0 1 empty empty empty 0 -8 0 8 -262144 +-1 -1 4200 1; +#X text 163 25 http://www.macalester.edu/~bsaylor; +#X text 160 9 Ben Saylor ; +#X obj 13 31 openpanel; +#X obj 13 8 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1 +; +#X obj 105 120 *~; +#X obj 155 94 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +; +#X obj 99 67 mtof; +#X obj 99 93 osc~ 50; +#X connect 0 0 7 1; +#X connect 2 0 1 0; +#X connect 2 0 1 1; +#X connect 3 0 7 0; +#X connect 4 0 3 0; +#X connect 5 0 16 0; +#X connect 6 0 0 0; +#X connect 7 0 2 0; +#X connect 8 0 3 0; +#X connect 9 0 2 1; +#X connect 12 0 8 0; +#X connect 13 0 12 0; +#X connect 14 0 7 0; +#X connect 15 0 14 1; +#X connect 16 0 17 0; +#X connect 17 0 14 0; diff --git a/zhzxh~/zhzxh~.c b/zhzxh~/zhzxh~.c new file mode 100644 index 0000000..59a80d2 --- /dev/null +++ b/zhzxh~/zhzxh~.c @@ -0,0 +1,83 @@ +/* Copyright 2002 Benjamin R. Saylor + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "m_pd.h" + +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +static t_class *zhzxh_class; + +typedef struct _zhzxh { + t_object x_obj; + t_float slope; + t_float lastval; + t_float srate; + t_float f; +} t_zhzxh; + +static t_int *zhzxh_perform(t_int *w) +{ + t_zhzxh *x = (t_zhzxh *)(w[1]); + t_float *in = (t_float *)(w[2]); + t_float *out = (t_float *)(w[3]); + int n = (int)(w[4]); + t_float f; + + t_float lastval = x->lastval; + t_float delta = x->slope / x->srate; + + while (n--) { + f = *(in++); + if (lastval < f) + *out = lastval + delta; + else + *out = lastval - delta; + lastval = *(out++); + } + + x->lastval = lastval; + + return (w+5); +} + +static void zhzxh_dsp(t_zhzxh *x, t_signal **sp) +{ + dsp_add(zhzxh_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); +} + +static void *zhzxh_new(t_symbol *s, int argc, t_atom *argv) +{ + t_zhzxh *x = (t_zhzxh *)pd_new(zhzxh_class); + x->slope = 1; + x->lastval = 0; + x->srate = sys_getsr(); + floatinlet_new(&x->x_obj, &x->slope); + outlet_new(&x->x_obj, gensym("signal")); + + return (x); +} + +void zhzxh_tilde_setup(void) +{ + zhzxh_class = class_new(gensym("zhzxh~"), (t_newmethod)zhzxh_new, 0, sizeof(t_zhzxh), 0, A_GIMME, 0); + class_sethelpsymbol(zhzxh_class, gensym("help-zhzxh~.pd")); + CLASS_MAINSIGNALIN(zhzxh_class, t_zhzxh, f); + class_addmethod(zhzxh_class, (t_method)zhzxh_dsp, gensym("dsp"), 0); +} -- cgit v1.2.1