aboutsummaryrefslogtreecommitdiff
path: root/maskxor
diff options
context:
space:
mode:
Diffstat (limited to 'maskxor')
-rw-r--r--maskxor/v3/help-maskxor.pd104
-rw-r--r--maskxor/v3/makefile105
-rw-r--r--maskxor/v3/maskxor-test.pd25
-rw-r--r--maskxor/v3/maskxor.c259
4 files changed, 0 insertions, 493 deletions
diff --git a/maskxor/v3/help-maskxor.pd b/maskxor/v3/help-maskxor.pd
deleted file mode 100644
index 1c30305..0000000
--- a/maskxor/v3/help-maskxor.pd
+++ /dev/null
@@ -1,104 +0,0 @@
-#N canvas 0 0 956 304 10;
-#X obj 368 207 maskxor;
-#X obj 457 63 t b b;
-#X msg 38 157 bang;
-#X floatatom 390 247 5 0 0 0 - - -;
-#X floatatom 368 264 5 0 0 0 - - -;
-#X floatatom 254 122 5 0 0 0 - - -;
-#X msg 457 46 bang;
-#X msg 457 80 listl 1 1 0 0 0 1 1;
-#X msg 500 97 listr 0 1 1 0 2 1 0;
-#X text 39 56 Maskxor takes two lists - listr and listl \, to set up
-a map where map = listl ^ listr.;
-#X text 37 93 Floats will only pass through if map[(int)float] > 0
-\, so if the corresponding element is greater than zero in either listl
-\, or listr \, but not both.;
-#X text 76 148 outputs the map \, the xor-ed element and (if this is
-greater than zero) the last float in.;
-#X obj 412 227 print MASK;
-#X text 41 22 Maskxor - exclusive-OR mask map by Edward Kelly. This
-is GNU software.;
-#X msg 39 193 clear;
-#X text 79 192 resets the object;
-#X text 29 283 Polyphony control objects by Ed Kelly November 2006
-;
-#X text 397 282 See also;
-#X obj 458 280 sieve;
-#X obj 501 280 polymap;
-#X obj 558 280 polystat;
-#N canvas 0 0 450 300 (subpatch) 0;
-#X msg 174 179 0 1 0 0 1 1 2;
-#X obj 150 84 loadbang;
-#X obj 175 217 outlet;
-#X connect 0 0 2 0;
-#X connect 1 0 0 0;
-#X restore 584 152 pd;
-#X obj 568 173 l;
-#X obj 534 148 t a b;
-#X obj 568 190 prepend listr;
-#X obj 473 190 prepend listl;
-#X msg 662 97 1 0 0 1 1;
-#X msg 678 114 1 1 0 0 0 1;
-#X msg 721 131 0 1 1 0 2 1 0;
-#X msg 669 190 mode \$1;
-#X obj 669 167 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
-1;
-#X text 728 191 ... in mode 1 \, floats are only;
-#X text 729 204 passed through the left outlet;
-#X text 728 217 when the left list contains;
-#X text 727 229 fewer non-zero elements than;
-#X text 727 241 the right list. CHANGED BEHAVIOUR!;
-#X msg 659 70 1 0 0 1 0 0 0 1;
-#X msg 646 54 1 0 0 1 0 1 0 1;
-#X text 847 123 |;
-#X text 847 132 |;
-#X text 847 141 |;
-#X text 847 150 |;
-#X text 847 159 |;
-#X text 847 168 |;
-#X text 847 177 |;
-#X text 761 60 _;
-#X text 768 60 _;
-#X text 775 60 _;
-#X text 782 60 _;
-#X text 789 60 _;
-#X text 796 60 _;
-#X text 803 60 _;
-#X text 810 60 _;
-#X text 817 60 _;
-#X text 824 60 _;
-#X text 831 60 _;
-#X text 838 60 _;
-#X text 845 60 _;
-#X text 847 69 |;
-#X text 847 78 |;
-#X text 847 87 |;
-#X text 847 96 |;
-#X text 847 105 |;
-#X text 847 114 |;
-#X text 759 65 <;
-#X connect 0 0 4 0;
-#X connect 0 1 3 0;
-#X connect 0 2 12 0;
-#X connect 1 0 7 0;
-#X connect 1 1 8 0;
-#X connect 2 0 0 0;
-#X connect 5 0 0 0;
-#X connect 6 0 1 0;
-#X connect 7 0 0 0;
-#X connect 8 0 0 0;
-#X connect 14 0 0 0;
-#X connect 21 0 22 1;
-#X connect 22 0 24 0;
-#X connect 23 0 22 1;
-#X connect 23 0 25 0;
-#X connect 23 1 22 0;
-#X connect 24 0 0 0;
-#X connect 25 0 0 0;
-#X connect 26 0 23 0;
-#X connect 27 0 23 0;
-#X connect 28 0 23 0;
-#X connect 29 0 0 0;
-#X connect 30 0 29 0;
-#X connect 36 0 23 0;
-#X connect 37 0 23 0;
diff --git a/maskxor/v3/makefile b/maskxor/v3/makefile
deleted file mode 100644
index 950cfa2..0000000
--- a/maskxor/v3/makefile
+++ /dev/null
@@ -1,105 +0,0 @@
-current:
- echo make pd_linux, pd_nt, pd_irix5, pd_irix6 or pd_darwin, then make install
-
-clean: ; rm -f *.pd_* *.o
-
-# ----------------------- NT -----------------------
-
-pd_nt: maskxor.dll
-
-INSTALL_PREFIX="C:\pd\extra"
-EXT=dll
-.SUFFIXES: .obj .dll
-
-PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo
-VC="D:\Program Files\Microsoft Visual Studio\Vc98"
-
-PDNTINCLUDE = /I. /I\tcl\include /I..\..\src /I$(VC)\include
-
-PDNTLDIR = $(VC)\lib
-PDNTLIB = $(PDNTLDIR)\libc.lib \
- $(PDNTLDIR)\oldnames.lib \
- $(PDNTLDIR)\kernel32.lib \
- ..\..\bin\pd.lib
-
-.c.dll:
- cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
- link /dll /export:$*_setup $*.obj $(PDNTLIB)
-
-# ----------------------- IRIX 5.x -----------------------
-
-pd_irix5: maskxor.pd_irix5
-
-INSTALL_PREFIX=/usr/local
-EXT=pd_irix5
-.SUFFIXES: .pd_irix5
-
-SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
-
-SGIINCLUDE = -I/usr/local/include
-
-.c.pd_irix5:
- cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -elf -shared -rdata_shared -o $*.pd_irix5 $*.o
- rm $*.o
-
-# ----------------------- IRIX 5.x -----------------------
-
-pd_irix6: maskxor.pd_irix6
-
-INSTALL_PREFIX=/usr/local
-EXT=pd_irix6
-.SUFFIXES: .pd_irix6
-
-SGICFLAGS5 = -o32 -DPD -DUNIX -DIRIX -O2
-
-SGIINCLUDE = -I/usr/local/include
-
-.c.pd_irix6:
- cc $(SGICFLAGS5) $(SGIINCLUDE) -o $*.o -c $*.c
- ld -elf -shared -rdata_shared -o $*.pd_irix6 $*.o
- rm $*.o
-
-# ----------------------- LINUX i386 -----------------------
-
-pd_linux: maskxor.pd_linux
-
-INSTALL_PREFIX=/usr/local
-EXT=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/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
-
-# ----------------------- Mac OSX -----------------------
-
-pd_darwin: maskxor.pd_darwin
-
-INSTALL_PREFIX=/usr/local
-EXT=pd_darwin
-.SUFFIXES: .pd_darwin
-
-DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
- -Wno-unused -Wno-parentheses -Wno-switch
-
-.c.pd_darwin:
- cc $(DARWINCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o
- rm -f $*.o
-
-# ----------------------------------------------
-
-install::
- install -d $(INSTALL_PREFIX)/lib/pd/extra
-# install -m 644 *.$(EXT) $(INSTALL_PREFIX)/lib/pd/externs
- -install -m 644 maskxor.$(EXT) $(INSTALL_PREFIX)/lib/pd/extra
- install -m 644 *.pd $(INSTALL_PREFIX)/lib/pd/doc/5.reference
diff --git a/maskxor/v3/maskxor-test.pd b/maskxor/v3/maskxor-test.pd
deleted file mode 100644
index 1674fb8..0000000
--- a/maskxor/v3/maskxor-test.pd
+++ /dev/null
@@ -1,25 +0,0 @@
-#N canvas 0 0 450 300 10;
-#X obj 149 208 maskxor;
-#X obj 180 71 t b b;
-#X msg 144 143 bang;
-#X floatatom 171 253 5 0 0 0 - - -;
-#X floatatom 149 271 5 0 0 0 - - -;
-#X obj 193 230 print MAPOUT;
-#X floatatom 70 151 5 0 0 0 - - -;
-#X msg 182 33 bang;
-#X msg 261 157 debug;
-#X obj 236 265 print;
-#X msg 180 88 listl 1 1 0 0 0 1 1;
-#X msg 223 105 listr 0 1 1 0 2 1 0;
-#X connect 0 0 4 0;
-#X connect 0 1 3 0;
-#X connect 0 2 5 0;
-#X connect 1 0 10 0;
-#X connect 1 1 11 0;
-#X connect 2 0 0 0;
-#X connect 3 0 9 0;
-#X connect 6 0 0 0;
-#X connect 7 0 1 0;
-#X connect 8 0 0 0;
-#X connect 10 0 0 0;
-#X connect 11 0 0 0;
diff --git a/maskxor/v3/maskxor.c b/maskxor/v3/maskxor.c
deleted file mode 100644
index 9137110..0000000
--- a/maskxor/v3/maskxor.c
+++ /dev/null
@@ -1,259 +0,0 @@
-#include "m_pd.h"
-#include <math.h>
-//#define MAXENTRIES 512
-
-static t_class *maskxor_class;
-
-typedef struct _mask
-{
- // t_atom maskxor[MAXENTRIES];
- // t_atom maskl[MAXENTRIES];
- // t_atom maskr[MAXENTRIES];
- t_atom *maskxor, *maskl, *maskr;
-} t_mask;
-
-typedef struct _maskxor
-{
- t_object x_obj;
- t_mask masking;
- t_atom *buffer;
-
- t_float total, suml, sumr, mode, lengthl, lengthr, ltot, rgreater;
- t_float f_in, yes, firstl, firstr, firstx;
- t_outlet *thru, *bool, *mask;
-} t_maskxor;
-
-static void maskxor_makelbuffer(t_maskxor *x, int n, t_atom *list)
-{
- int i;
- float maskel;
- if (x->masking.maskl && x->firstl) {
- freebytes(x->masking.maskl, x->lengthl * sizeof(t_atom));
- x->masking.maskl = 0;
- x->lengthl = 0;
- }
-
- x->masking.maskl = getbytes(n * sizeof(t_atom));
- x->masking.maskl = copybytes(list, n * sizeof(t_atom));
- x->lengthl = n;
- x->suml = 0;
- for (i=0;i<n;i++)
- {
- maskel = atom_getfloatarg(i, x->lengthl, x->masking.maskl);
- if (maskel != 0) x->suml++;
- }
- x->firstl = 1;
- x->rgreater = x->suml <= x->sumr ? 1 : 0;
-}
-
-static void maskxor_makerbuffer(t_maskxor *x, int n, t_atom *list)
-{
- int i;
- float maskel;
- if (x->masking.maskr && x->firstr) {
- freebytes(x->masking.maskr, x->lengthr * sizeof(t_atom));
- x->masking.maskr = 0;
- x->lengthr = 0;
- }
-
- x->masking.maskr = getbytes(n * sizeof(t_atom));
- x->masking.maskr = copybytes(list, n * sizeof(t_atom));
- x->lengthr = n;
- x->sumr = 0;
- for (i=0;i<n;i++)
- {
- maskel = atom_getfloatarg(i, x->lengthr, x->masking.maskr);
- if (maskel != 0) x->sumr++;
- }
- x->firstr = 1;
-}
-
-static void maskxor_makemaskbuffer(t_maskxor *x, int n, t_atom *list, int d, int dir)
-{
- int i;
- float left, right, mask;
- if (x->masking.maskxor && x->firstx) {
- freebytes(x->masking.maskxor, x->ltot * sizeof(t_atom));
- x->buffer = 0;
- x->ltot = 0;
- }
-
- x->masking.maskxor = getbytes(n+d * sizeof(t_atom));
- if(dir > 0)
- {
- x->ltot = x->lengthr;
- for(i=0;i<x->ltot;i++)
- {
- left = i >= n ? 0 : atom_getfloatarg(i, x->lengthl, x->masking.maskl);
- right = atom_getfloatarg(i, x->lengthr, x->masking.maskr);
- mask = (float)((int)left ^ (int)right);
- SETFLOAT(&x->masking.maskxor[i], mask);
- }
- }
- else
- {
- x->ltot = x->lengthl;
- for(i=0;i<x->ltot;i++)
- {
- right = i >= n ? 0 : atom_getfloatarg(i, x->lengthr, x->masking.maskr);
- left = atom_getfloatarg(i, x->lengthl, x->masking.maskl);
- mask = (float)((int)left ^ (int)right);
- SETFLOAT(&x->masking.maskxor[i], mask);
- }
- }
- x->firstx = 1;
-}
-
-void maskxor_float(t_maskxor *x, t_floatarg fin)
-{
- int input = fin > 0 ? (int)fin : 0;
- if(x->mode == 0)
- {
- x->f_in = fin;
- x->yes = atom_getfloatarg(input, x->ltot, x->masking.maskxor);
- outlet_float(x->bool, x->yes);
- if(x->yes != 0) outlet_float(x->thru, x->f_in);
- }
- else if (x->rgreater)
- {
- x->f_in = fin;
- x->yes = atom_getfloatarg(input, x->ltot, x->masking.maskxor);
- outlet_float(x->bool, x->yes);
- if(x->yes != 0) outlet_float(x->thru, x->f_in);
- }
-}
-
-void maskxor_bang(t_maskxor *x, t_symbol *s)
-{
- outlet_list(x->mask, &s_list, x->total, x->masking.maskxor);
- outlet_float(x->bool, x->yes);
- if(x->yes)outlet_float(x->thru, x->f_in);
-}
-
-void maskxor_listl(t_maskxor *x, t_symbol *s, int argc, t_atom *argv)
-{
- int difflen;
- maskxor_makelbuffer(x, argc, argv);
- if(x->lengthl >= x->lengthr)
- {
- difflen = (int)(x->lengthl - x->lengthr);
- maskxor_makemaskbuffer(x, argc, argv, difflen, 0);
- }
- else
- {
- difflen = (int)(x->lengthr - x->lengthl);
- maskxor_makemaskbuffer(x, argc, argv, difflen, 1);
- }
-
- // listl_element = atom_getfloat(argv+i);
- // SETFLOAT(&x->masking.maskl[i], listl_element);
- // if(listl_element != 0) x->suml++;
- // listr_element = atom_getfloatarg(i,MAXENTRIES,x->masking.maskr);
- // xor_element = (float)((int)listl_element ^ (int)listr_element);
- // SETFLOAT(&x->masking.maskxor[i], xor_element);
-
- outlet_list(x->mask, &s_list, x->total, x->masking.maskxor);
-}
-
-void maskxor_listr(t_maskxor *x, t_symbol *s, int argc, t_atom *argv)
-{
- maskxor_makerbuffer(x, argc, argv);
-}
-
-void maskxor_mode(t_maskxor *x, t_floatarg fmode)
-{
- x->mode = fmode != 0 ? 1 : 0;
-}
-
-/* substitute zexy code */
-void maskxor_clear(t_maskxor *x)
-{
- freebytes(x->masking.maskl, x->lengthl * sizeof(t_atom));
- freebytes(x->masking.maskr, x->lengthr * sizeof(t_atom));
- freebytes(x->masking.maskxor, x->ltot * sizeof(t_atom));
- // x->masking.maskl = getbytes(sizeof(t_atom));
- // x->masking.maskr = getbytes(sizeof(t_atom));
- // x->masking.maskxor = getbytes(sizeof(t_atom));
-
- // SETFLOAT(&x->masking.maskr[0], 0);
- // SETFLOAT(&x->masking.maskl[0], 0);
- // SETFLOAT(&x->masking.maskxor[0], 0);
- x->lengthl = x->lengthr = x->ltot = 0;
- x->total=1;
- x->yes = x->f_in = 0;
-}
-
-void maskxor_print(t_maskxor *x)
-{
- float le0, le1, le2, le3, le4, le5, le6, le7, le8;
- float re0, re1, re2, re3, re4, re5, re6, re7, re8;
- float xe0, xe1, xe2, xe3, xe4, xe5, xe6, xe7, xe8;
- le0 = atom_getfloatarg(0, x->ltot, x->masking.maskl);
- le1 = atom_getfloatarg(1, x->ltot, x->masking.maskl);
- le2 = atom_getfloatarg(2, x->ltot, x->masking.maskl);
- le3 = atom_getfloatarg(3, x->ltot, x->masking.maskl);
- le4 = atom_getfloatarg(4, x->ltot, x->masking.maskl);
- le5 = atom_getfloatarg(5, x->ltot, x->masking.maskl);
- le6 = atom_getfloatarg(6, x->ltot, x->masking.maskl);
- le7 = atom_getfloatarg(7, x->ltot, x->masking.maskl);
- le8 = atom_getfloatarg(8, x->ltot, x->masking.maskl);
- re0 = atom_getfloatarg(0, x->ltot, x->masking.maskr);
- re1 = atom_getfloatarg(1, x->ltot, x->masking.maskr);
- re2 = atom_getfloatarg(2, x->ltot, x->masking.maskr);
- re3 = atom_getfloatarg(3, x->ltot, x->masking.maskr);
- re4 = atom_getfloatarg(4, x->ltot, x->masking.maskr);
- re5 = atom_getfloatarg(5, x->ltot, x->masking.maskr);
- re6 = atom_getfloatarg(6, x->ltot, x->masking.maskr);
- re7 = atom_getfloatarg(7, x->ltot, x->masking.maskr);
- re8 = atom_getfloatarg(8, x->ltot, x->masking.maskr);
- xe0 = atom_getfloatarg(0, x->ltot, x->masking.maskxor);
- xe1 = atom_getfloatarg(1, x->ltot, x->masking.maskxor);
- xe2 = atom_getfloatarg(2, x->ltot, x->masking.maskxor);
- xe3 = atom_getfloatarg(3, x->ltot, x->masking.maskxor);
- xe4 = atom_getfloatarg(4, x->ltot, x->masking.maskxor);
- xe5 = atom_getfloatarg(5, x->ltot, x->masking.maskxor);
- xe6 = atom_getfloatarg(6, x->ltot, x->masking.maskxor);
- xe7 = atom_getfloatarg(7, x->ltot, x->masking.maskxor);
- xe8 = atom_getfloatarg(8, x->ltot, x->masking.maskxor);
- post("right mask = %d, %d, %d, %d, %d, %d, %d, %d, %d", re0, re1, re2, re3, re4, re5, re6, re7, re8);
- post(" left mask = %d, %d, %d, %d, %d, %d, %d, %d, %d", le0, le1, le2, le3, le4, le5, le6, le7, le8);
- post(" xor mask = %d, %d, %d, %d, %d, %d, %d, %d, %d", xe0, xe1, xe2, xe3, xe4, xe5, xe6, xe7, xe8);
-}
-
-void *maskxor_new(t_symbol *s, t_floatarg fmode)
-{
- int i;
- t_maskxor *x = (t_maskxor *)pd_new(maskxor_class);
- x->total = 1;
- x->firstl = x->firstr = x->firstx = 0;
- x->mode = fmode != 0 ? 1 : 0;
-
- // SETFLOAT(&x->masking.maskr[0], 0);
- // SETFLOAT(&x->masking.maskl[0], 0);
- // SETFLOAT(&x->masking.maskxor[0], 0);
- x->lengthl = x->lengthr = x->ltot = 0;
-
- x->thru = outlet_new(&x->x_obj, &s_float);
- x->bool = outlet_new(&x->x_obj, &s_float);
- x->mask = outlet_new(&x->x_obj, &s_list);
- return (void *)x;
-}
-
-void maskxor_setup(void)
-{
- maskxor_class = class_new(gensym("maskxor"),
- (t_newmethod)maskxor_new,
- 0, sizeof(t_maskxor),
- CLASS_DEFAULT, A_DEFFLOAT, 0);
- post("|..-.--.-..-maskxor.-...--.-..|");
- post("| exclusive-or mask-map |");
- post("|.--.- Edward Kelly 2006 ---.-|");
-
- class_addfloat(maskxor_class, maskxor_float);
- class_addmethod(maskxor_class, (t_method)maskxor_listl, gensym("listl"), A_GIMME, 0, 0);
- class_addmethod(maskxor_class, (t_method)maskxor_listr, gensym("listr"), A_GIMME, 0, 0);
- class_addbang(maskxor_class, (t_method)maskxor_bang);
- class_addmethod(maskxor_class, (t_method)maskxor_mode, gensym("mode"), A_DEFFLOAT, 0);
- class_addmethod(maskxor_class, (t_method)maskxor_clear, gensym("clear"), A_DEFFLOAT, 0);
- class_addmethod(maskxor_class, (t_method)maskxor_print, gensym("print"), A_DEFFLOAT, 0);
-}