aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Kelly <edkelly@users.sourceforge.net>2005-09-21 16:58:11 +0000
committerEd Kelly <edkelly@users.sourceforge.net>2005-09-21 16:58:11 +0000
commit61650518a5b63a113edafc9bc78126af18a0ee43 (patch)
tree97159d84733761b3fa70ab5f5e144928e0f40a52
parent569bff52a611e35d7b35fe5f5c5cf1b8de25dbe2 (diff)
This commit was generated by cvs2svn to compensate for changes in r3613,
which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/ekext/; revision=3614
-rw-r--r--listmoses/help-listmoses.pd37
-rw-r--r--listmoses/listmoses.c142
-rw-r--r--listmoses/makefile105
3 files changed, 284 insertions, 0 deletions
diff --git a/listmoses/help-listmoses.pd b/listmoses/help-listmoses.pd
new file mode 100644
index 0000000..50451ab
--- /dev/null
+++ b/listmoses/help-listmoses.pd
@@ -0,0 +1,37 @@
+#N canvas 0 0 849 300 10;
+#X obj 141 151 listmoses;
+#X floatatom 287 137 5 0 0 0 - - -;
+#X floatatom 324 137 5 0 0 0 - - -;
+#X msg 287 120 60;
+#X msg 324 120 500;
+#X msg 141 60 10 20 50 100 200 500 1000 2000 5000;
+#X obj 287 103 loadbang;
+#X msg 104 35 550 360 10 40 400 2000 3000 30 250;
+#X msg 160 103 1 2 3 4 5 6 7 8 9;
+#X obj 91 186 print lowf;
+#X obj 98 203 print midf;
+#X obj 106 220 print highf;
+#X obj 170 186 print lowa;
+#X obj 177 203 print mida;
+#X obj 185 220 print higha;
+#X text 236 153 constraining boundaries;
+#X text 274 172 listmoses splits two lists up according to the values
+contained within the first list. When used with binline~ it can be
+used to isolate particular frequency/amplitude lists where the frequencies
+are constrained \, or where the amplitudes are constrained (when used
+with _swap_).;
+#X connect 0 0 9 0;
+#X connect 0 1 10 0;
+#X connect 0 2 11 0;
+#X connect 0 3 12 0;
+#X connect 0 4 13 0;
+#X connect 0 5 14 0;
+#X connect 1 0 0 2;
+#X connect 2 0 0 3;
+#X connect 3 0 1 0;
+#X connect 4 0 2 0;
+#X connect 5 0 0 0;
+#X connect 6 0 3 0;
+#X connect 6 0 4 0;
+#X connect 7 0 0 0;
+#X connect 8 0 0 1;
diff --git a/listmoses/listmoses.c b/listmoses/listmoses.c
new file mode 100644
index 0000000..ab61db1
--- /dev/null
+++ b/listmoses/listmoses.c
@@ -0,0 +1,142 @@
+/* listmoses - separate a list according to its contents' values
+ * Copyright (C) 2005 Edward Kelly <morph_2016@yahoo.co.uk>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "m_pd.h"
+
+static t_class *listmoses_class;
+
+typedef struct _listmoses
+{
+ t_object x_obj;
+ t_atom lowlist[1024];
+ t_atom midlist[1024];
+ t_atom highlist[1024];
+ t_atom lowamps[1024];
+ t_atom midamps[1024];
+ t_atom highamps[1024];
+ t_atom ampslist[1024];
+ t_float lowsplit, highsplit;
+ t_int low_argc, mid_argc, high_argc;
+ t_outlet *low_list, *mid_list, *high_list, *low_buddy, *mid_buddy, *high_buddy;
+} t_listmoses;
+
+void listmoses_list(t_listmoses *x, t_symbol *s, int argc, t_atom *argv)
+{
+ float current, curamps;
+ int i;
+ x->low_argc = 0;
+ x->mid_argc = 0;
+ x->high_argc = 0;
+ for (i=0; i<argc; i++)
+ {
+ current = atom_getfloat(argv+i);
+ curamps = atom_getfloatarg(i,argc,x->ampslist);
+ if (current < x->lowsplit)
+ {
+ SETFLOAT(&x->lowlist[x->low_argc], current);
+ SETFLOAT(&x->lowamps[x->low_argc], curamps);
+ x->low_argc++;
+ }
+ else if (current >= x->lowsplit && current < x->highsplit)
+ {
+ SETFLOAT(&x->midlist[x->mid_argc], current);
+ SETFLOAT(&x->midamps[x->mid_argc], curamps);
+ x->mid_argc++;
+ }
+ else
+ {
+ SETFLOAT(&x->highlist[x->high_argc], current);
+ SETFLOAT(&x->highamps[x->high_argc], curamps);
+ x->high_argc++;
+ }
+ }
+ outlet_list(x->high_buddy, gensym("list"), x->high_argc, x->highamps);
+ outlet_list(x->mid_buddy, gensym("list"), x->mid_argc, x->midamps);
+ outlet_list(x->low_buddy, gensym("list"), x->low_argc, x->lowamps);
+ outlet_list(x->high_list, gensym("list"), x->high_argc, x->highlist);
+ outlet_list(x->mid_list, gensym("list"), x->mid_argc, x->midlist);
+ outlet_list(x->low_list, gensym("list"), x->low_argc, x->lowlist);
+}
+
+void listmoses_amps(t_listmoses *x, t_symbol *s, int argc, t_atom *argv)
+{
+ float curamp;
+ int i;
+ for (i=0; i<argc; i++)
+ {
+ curamp = atom_getfloat(argv+i);
+ SETFLOAT (&x->ampslist[i], curamp);
+ }
+}
+
+void listmoses_bang(t_listmoses *x)
+{
+ outlet_list(x->high_buddy, gensym("list"), x->high_argc, x->highamps);
+ outlet_list(x->mid_buddy, gensym("list"), x->mid_argc, x->midamps);
+ outlet_list(x->low_buddy, gensym("list"), x->low_argc, x->lowamps);
+ outlet_list(x->high_list, gensym("list"), x->high_argc, x->highlist);
+ outlet_list(x->mid_list, gensym("list"), x->mid_argc, x->midlist);
+ outlet_list(x->low_list, gensym("list"), x->low_argc, x->lowlist);
+}
+
+void *listmoses_new(t_symbol *s, int argc, t_atom *argv)
+{
+ t_listmoses *x = (t_listmoses *)pd_new(listmoses_class);
+ switch(argc)
+ {
+ default:
+ case 2:
+ x->highsplit = atom_getfloat(argv+1);
+ x->lowsplit = atom_getfloat(argv);
+ case 1:
+ x->highsplit = atom_getfloat(argv);
+ x->lowsplit = 0;
+ break;
+ case 0:
+ x->highsplit = 96;
+ x->lowsplit = 36;
+ }
+
+ x->low_argc = 0;
+ x->mid_argc = 0;
+ x->high_argc = 0;
+
+ x->low_list = outlet_new(&x->x_obj, gensym("list"));
+ x->mid_list = outlet_new(&x->x_obj, gensym("list"));
+ x->high_list = outlet_new(&x->x_obj, gensym("list"));
+ x->low_buddy = outlet_new(&x->x_obj, gensym("list"));
+ x->mid_buddy = outlet_new(&x->x_obj, gensym("list"));
+ x->high_buddy = outlet_new(&x->x_obj, gensym("list"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_list, gensym("amps"));
+ floatinlet_new(&x->x_obj, &x->lowsplit);
+ floatinlet_new(&x->x_obj, &x->highsplit);
+ return (void *)x;
+}
+
+void listmoses_setup(void) {
+ listmoses_class = class_new(gensym("listmoses"),
+ (t_newmethod)listmoses_new,
+ 0, sizeof(t_listmoses),
+ 0, A_DEFFLOAT, 0);
+ post("|<<<<<<<<<<<<<<<<<<<<<listmoses>>>>>>>>>>>>>>>>>>>>>>|");
+ post("|<<split two lists according to values of the first>>|");
+ post("|<<<<<<<<<<<<edward-------kelly------2005>>>>>>>>>>>>|");
+ class_sethelpsymbol(listmoses_class, gensym("help-listmoses"));
+ class_addbang(listmoses_class, listmoses_bang);
+ class_addlist(listmoses_class, listmoses_list);
+ class_addmethod(listmoses_class, (t_method)listmoses_amps, gensym("amps"), A_GIMME, 0);
+}
diff --git a/listmoses/makefile b/listmoses/makefile
new file mode 100644
index 0000000..85d8b7d
--- /dev/null
+++ b/listmoses/makefile
@@ -0,0 +1,105 @@
+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: listmoses.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: listmoses.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: listmoses.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: listmoses.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: listmoses.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 listmoses.$(EXT) $(INSTALL_PREFIX)/lib/pd/extra
+ install -m 644 *.pd $(INSTALL_PREFIX)/lib/pd/doc/5.reference