diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2003-08-16 17:08:55 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2003-08-16 17:08:55 +0000 |
commit | 506b8e7dedb80d79bf015e47d92e8b8dd8284584 (patch) | |
tree | 6393e98add0a0ae7f92388665b3b6242977f5b64 /randomblock~ | |
parent | 856eaf396d9a4d371a458a2c373a052bb72c8057 (diff) |
added files straight from Yves' sources
svn path=/trunk/externals/unauthorized/; revision=864
Diffstat (limited to 'randomblock~')
-rw-r--r-- | randomblock~/INSTALL | 7 | ||||
-rw-r--r-- | randomblock~/Makefile | 82 | ||||
-rw-r--r-- | randomblock~/help-randomblock~.pd | 15 | ||||
-rw-r--r-- | randomblock~/mrandtab.pd | 6 | ||||
-rw-r--r-- | randomblock~/randomblock~.c | 117 | ||||
-rw-r--r-- | randomblock~/randtab.pd | 43 |
6 files changed, 270 insertions, 0 deletions
diff --git a/randomblock~/INSTALL b/randomblock~/INSTALL new file mode 100644 index 0000000..ae90f70 --- /dev/null +++ b/randomblock~/INSTALL @@ -0,0 +1,7 @@ +untar in /my/pd/dir/extra
+
+cd /my/pd/dir/extra/randomblock~
+
+make
+
+you're set !!
diff --git a/randomblock~/Makefile b/randomblock~/Makefile new file mode 100644 index 0000000..de2ce94 --- /dev/null +++ b/randomblock~/Makefile @@ -0,0 +1,82 @@ +NAME=randomblock~
+CSYM=randomblock_tilde
+
+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/randomblock~/help-randomblock~.pd b/randomblock~/help-randomblock~.pd new file mode 100644 index 0000000..d4b2e5d --- /dev/null +++ b/randomblock~/help-randomblock~.pd @@ -0,0 +1,15 @@ +#N canvas 194 211 575 337 10; +#X msg 361 263 \; pd dsp 1; +#X floatatom 192 112 5 0 0; +#X text 191 88 Set upper limit of random values; +#X text 107 123 Not used; +#X obj 121 179 print~; +#X msg 76 156 bang; +#X text 160 29 Generates an audio block starting at a random value +; +#X obj 121 143 randomblock~ 100; +#X text 161 42 This can be used to read a table randomly.; +#X text 161 54 This is illustrated in "mrandtab.pd".; +#X connect 1 0 7 1; +#X connect 5 0 4 0; +#X connect 7 0 4 0; diff --git a/randomblock~/mrandtab.pd b/randomblock~/mrandtab.pd new file mode 100644 index 0000000..157111c --- /dev/null +++ b/randomblock~/mrandtab.pd @@ -0,0 +1,6 @@ +#N canvas 187 22 737 487 10; +#X obj 138 151 dac~; +#X obj 136 114 randtab; +#X text 174 86 Everything is in the subpatch; +#X connect 1 0 0 0; +#X connect 1 0 0 1; diff --git a/randomblock~/randomblock~.c b/randomblock~/randomblock~.c new file mode 100644 index 0000000..69f4da5 --- /dev/null +++ b/randomblock~/randomblock~.c @@ -0,0 +1,117 @@ +/* ------------------------ randomblock~ -------------------------------------- */ +/* */ +/* Generates a random signal block */ +/* 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 *randomblock_version = "randomblock~: generates a random audio block : author : ydegoyon@free.fr"; + +static t_class *randomblock_class; + +typedef struct _randomblock +{ + t_object x_obj; + t_int x_limit; +} t_randomblock; + + /* clean up */ +static void randomblock_free(t_randomblock *x) +{ +} + +static void *randomblock_new(t_float flimit) +{ + t_randomblock *x = (t_randomblock *)pd_new(randomblock_class); + outlet_new(&x->x_obj, &s_signal); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("limit")); + if ( flimit <= 0 || flimit > RAND_MAX ) { + post( "randomblock~: wrong creation argument" ); + return NULL; + } + x->x_limit = (int) flimit; + return(x); +} + +static void *randomblock_limit(t_randomblock* x, t_float flimit) +{ + if ( flimit < 0 || flimit > RAND_MAX ) { + post( "randomblock~: wrong random limit" ); + return; + } else { + x->x_limit=(int)flimit; + } +} + +static t_int *randomblock_perform(t_int *w) +{ + t_float *out = (t_float*) w[1]; + int n = (int)(w[2]); + t_randomblock *x = (t_randomblock*) w[3]; + + int rvalue = rand(); + // post("random value : %d", rvalue ); + rvalue = rvalue%(x->x_limit-n); + // post("modulated by %d : %d", (x->x_limit-n), rvalue ); + if ( rvalue < 0 ) rvalue=0; + + while (n--) { + *(out)++=(float)rvalue++; + } + + return (w+4); +} + +static void randomblock_dsp(t_randomblock *x, t_signal **sp) +{ + dsp_add( randomblock_perform, 3, sp[0]->s_vec, sp[0]->s_n, x ) ; +} + +void randomblock_tilde_setup(void) +{ + post(randomblock_version); + randomblock_class = class_new(gensym("randomblock~"), (t_newmethod)randomblock_new, + (t_method)randomblock_free, + sizeof(t_randomblock), 0, A_DEFFLOAT, 0); + class_addmethod( randomblock_class, (t_method)randomblock_dsp, gensym("dsp"), 0); + class_addmethod( randomblock_class, (t_method)randomblock_limit, gensym("limit"), A_FLOAT, 0); + class_sethelpsymbol( randomblock_class, gensym("help-randomblock~.pd")); +} diff --git a/randomblock~/randtab.pd b/randomblock~/randtab.pd new file mode 100644 index 0000000..089a86e --- /dev/null +++ b/randomblock~/randtab.pd @@ -0,0 +1,43 @@ +#N canvas 187 22 737 487 10; +#X obj 143 114 soundfiler; +#X obj 110 354 *~; +#X msg 138 3 bang; +#X msg 142 92 read -resize \$1 \$2; +#X msg 215 12 bang; +#X obj 515 47 table \$0-music; +#X obj 144 66 pack s s; +#X obj 215 35 f \$0; +#X obj 231 56 makefilename %d-music; +#X symbolatom 247 35 40 0 0; +#X floatatom 163 244 10 0 0; +#X floatatom 142 353 5 0 0; +#X obj 110 303 tabread4~ \$0-music; +#X obj 20 331 print~; +#X msg 19 307 bang; +#X obj 138 29 opanel; +#X obj 109 330 /~ 100; +#X obj 34 235 randomblock~ 1000; +#X obj 241 325 print~; +#X msg 240 301 bang; +#X obj 110 401 outlet~; +#X obj 402 206 block~ 32768 1; +#X connect 0 0 10 0; +#X connect 0 0 17 1; +#X connect 1 0 20 0; +#X connect 2 0 15 0; +#X connect 3 0 0 0; +#X connect 4 0 7 0; +#X connect 6 0 3 0; +#X connect 7 0 8 0; +#X connect 8 0 6 1; +#X connect 11 0 1 1; +#X connect 12 0 16 0; +#X connect 12 0 18 0; +#X connect 14 0 13 0; +#X connect 15 0 4 0; +#X connect 15 0 6 0; +#X connect 15 0 9 0; +#X connect 16 0 1 0; +#X connect 17 0 12 0; +#X connect 17 0 13 0; +#X connect 19 0 18 0; |