aboutsummaryrefslogtreecommitdiff
path: root/countund
diff options
context:
space:
mode:
Diffstat (limited to 'countund')
-rw-r--r--countund/INSTALL7
-rw-r--r--countund/Makefile82
-rw-r--r--countund/countund.c117
-rw-r--r--countund/help-countund.pd17
4 files changed, 223 insertions, 0 deletions
diff --git a/countund/INSTALL b/countund/INSTALL
new file mode 100644
index 0000000..f2488de
--- /dev/null
+++ b/countund/INSTALL
@@ -0,0 +1,7 @@
+untar in /my/pd/dir/externs
+
+cd /my/pd/dir/extra/countund~
+
+make
+
+you're set !!
diff --git a/countund/Makefile b/countund/Makefile
new file mode 100644
index 0000000..1deb17b
--- /dev/null
+++ b/countund/Makefile
@@ -0,0 +1,82 @@
+NAME=countund
+CSYM=countund
+
+current: pd_linux
+
+# ----------------------- NT -----------------------
+
+pd_nt: $(NAME).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:$(CSYM)_setup $*.obj $(PDNTLIB)
+
+# ----------------------- IRIX 5.x -----------------------
+
+pd_irix5: $(NAME).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: $(NAME).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 -n32 -IPA -shared -rdata_shared -o $*.pd_irix6 $*.o
+ rm $*.o
+
+# ----------------------- LINUX i386 -----------------------
+
+pd_linux: $(NAME).pd_linux
+
+.SUFFIXES: .pd_linux
+
+LINUXCFLAGS = -DPD -DUNIX -DICECAST -O2 -funroll-loops -fomit-frame-pointer \
+ -Wshadow -Wstrict-prototypes\
+ -Wno-unused -Wno-parentheses -Wno-switch
+
+LINUXINCLUDE = -I../../src
+
+.c.pd_linux:
+ cc $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
+ ld -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm -L/usr/local/lib
+ strip --strip-unneeded $*.pd_linux
+ rm -f $*.o ../$*.pd_linux
+ ln -s $*/$*.pd_linux ..
+
+# ----------------------------------------------------------
+
+clean:
+ rm -f *.o *.pd_* so_locations
+
+install:
+ cp help-* ../../doc/5.reference
diff --git a/countund/countund.c b/countund/countund.c
new file mode 100644
index 0000000..709ffd0
--- /dev/null
+++ b/countund/countund.c
@@ -0,0 +1,117 @@
+/* ------------------------ countund~ -------------------------------------- */
+/* */
+/* Count up to a value and then down to zero */
+/* Written by Yves Degoyon (ydegoyon@free.fr). */
+/* */
+/* 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. */
+/* */
+/* See file LICENSE for further informations on licensing terms. */
+/* */
+/* 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. */
+/* */
+/* Based on PureData by Miller Puckette and others. */
+/* */
+/* ---------------------------------------------------------------------------- */
+
+
+
+#include <sys/types.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <malloc.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <time.h>
+#include <sys/time.h>
+
+#include "m_pd.h" /* standard pd stuff */
+
+static char *countund_version = "countund~: count up to a value and then down to zero : author : ydegoyon@free.fr";
+
+static t_class *countund_class;
+
+typedef struct _countund
+{
+ t_object x_obj;
+ t_int x_limit;
+ t_int x_value;
+ t_int x_up;
+} t_countund;
+
+ /* clean up */
+static void countund_free(t_countund *x)
+{
+}
+
+static void *countund_new(t_float flimit)
+{
+ t_countund *x = (t_countund *)pd_new(countund_class);
+ outlet_new(&x->x_obj, &s_float);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("limit"));
+ if ( flimit < 0 ) {
+ post( "countund~: wrong creation argument" );
+ return NULL;
+ }
+ x->x_limit = (int) flimit;
+ x->x_value = 0;
+ x->x_up = 1;
+ return(x);
+}
+
+static void *countund_limit(t_countund* x, t_float flimit)
+{
+ if ( flimit < 0 ) {
+ post( "countund~: wrong count limit" );
+ return;
+ } else {
+ x->x_limit=(int)flimit;
+ }
+}
+
+static void *countund_bang(t_countund *x)
+{
+
+ if ( x->x_up ) {
+ x->x_value+=1;
+ if (x->x_value>x->x_limit) {
+ x->x_value=x->x_limit-1;
+ x->x_up=0;
+ }
+ } else {
+ x->x_value-=1;
+ if (x->x_value<0) {
+ x->x_value=1;
+ x->x_up=1;
+ }
+ }
+ outlet_float( x->x_obj.ob_outlet, x->x_value );
+ return;
+}
+
+void countund_setup(void)
+{
+ post(countund_version);
+ countund_class = class_new(gensym("countund"), (t_newmethod)countund_new,
+ (t_method)countund_free,
+ sizeof(t_countund), 0, A_DEFFLOAT, 0);
+ class_addmethod( countund_class, (t_method)countund_bang, &s_bang, 0);
+ class_addmethod( countund_class, (t_method)countund_limit, gensym("limit"), A_FLOAT, 0);
+ class_sethelpsymbol( countund_class, gensym("help-countund.pd"));
+}
diff --git a/countund/help-countund.pd b/countund/help-countund.pd
new file mode 100644
index 0000000..89c1207
--- /dev/null
+++ b/countund/help-countund.pd
@@ -0,0 +1,17 @@
+#N canvas 194 211 575 337 10;
+#X floatatom 192 112 5 0 0;
+#X msg 76 156 bang;
+#X text 161 29 Count up to a limit and then down to zero;
+#X text 160 41 Bugs and comments @ ydegoyon@free.fr;
+#X text 194 88 Set upper limit;
+#X obj 121 143 countund 100;
+#X obj 118 113 metro 100;
+#X msg 115 82 bang;
+#X obj 121 179 print countund;
+#X floatatom 223 179 5 0 0;
+#X connect 0 0 5 1;
+#X connect 1 0 8 0;
+#X connect 5 0 8 0;
+#X connect 5 0 9 0;
+#X connect 6 0 5 0;
+#X connect 7 0 6 0;