aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2008-12-11 19:56:33 +0000
committermusil <tmusil@users.sourceforge.net>2008-12-11 19:56:33 +0000
commitda941320c90e2cf7256645de5a03337471c22586 (patch)
tree6fc312d9866d955cbcd11559d106ec487731be0d
parent4c1375daa8fcfb5c7c1d291df30027c78937f4df (diff)
some OSC converting stuff: symbol to list of ASCII and list of ASCII to symbol
svn path=/trunk/externals/iemlib/; revision=10449
-rw-r--r--iemlib2/iem_alisttosym-help.pd18
-rw-r--r--iemlib2/iem_symtoalist-help.pd20
-rw-r--r--iemlib2/src/iem_alisttosym.c66
-rw-r--r--iemlib2/src/iem_symtoalist.c75
-rw-r--r--iemlib2/src/makefile_d_fat3
-rw-r--r--iemlib2/src/makefile_d_ppc1
-rw-r--r--iemlib2/src/makefile_darwin1
-rw-r--r--iemlib2/src/makefile_linux1
-rw-r--r--iemlib2/src/makefile_win1
9 files changed, 186 insertions, 0 deletions
diff --git a/iemlib2/iem_alisttosym-help.pd b/iemlib2/iem_alisttosym-help.pd
new file mode 100644
index 0000000..6b4b4d8
--- /dev/null
+++ b/iemlib2/iem_alisttosym-help.pd
@@ -0,0 +1,18 @@
+#N canvas 50 29 529 402 10;
+#X obj 46 128 iem_alisttosym;
+#X symbolatom 46 151 0 0 0 0 - - -;
+#X msg 47 86 97 98 99 100;
+#X text 27 16 iem_alisttosym;
+#X text 152 15 covert a list of ASCII floats to a symbol;
+#X text 93 233 IEM KUG;
+#X text 72 221 musil;
+#X text 107 221 @;
+#X text 115 221 iem.at;
+#X text 76 243 Graz \, Austria;
+#X text 28 210 (c) Thomas Musil 2000 - 2008;
+#X msg 164 88 65 66 67 68;
+#X msg 271 88 49 50 51 52;
+#X connect 0 0 1 0;
+#X connect 2 0 0 0;
+#X connect 11 0 0 0;
+#X connect 12 0 0 0;
diff --git a/iemlib2/iem_symtoalist-help.pd b/iemlib2/iem_symtoalist-help.pd
new file mode 100644
index 0000000..648a203
--- /dev/null
+++ b/iemlib2/iem_symtoalist-help.pd
@@ -0,0 +1,20 @@
+#N canvas 396 66 533 406 10;
+#X text 93 233 IEM KUG;
+#X text 72 221 musil;
+#X text 107 221 @;
+#X text 115 221 iem.at;
+#X text 76 243 Graz \, Austria;
+#X text 28 210 (c) Thomas Musil 2000 - 2008;
+#X text 27 16 iem_symtoalist;
+#X obj 46 128 iem_symtoalist;
+#X msg 47 86 symbol abcd;
+#X msg 164 88 symbol ABCD;
+#X text 152 15 covert a symbol to a list of ASCII floats;
+#X obj 47 152 print;
+#X msg 271 88 1234;
+#X msg 324 87 9.876e-08;
+#X connect 7 0 11 0;
+#X connect 8 0 7 0;
+#X connect 9 0 7 0;
+#X connect 12 0 7 0;
+#X connect 13 0 7 0;
diff --git a/iemlib2/src/iem_alisttosym.c b/iemlib2/src/iem_alisttosym.c
new file mode 100644
index 0000000..c9a4484
--- /dev/null
+++ b/iemlib2/src/iem_alisttosym.c
@@ -0,0 +1,66 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+
+
+/* ------------------------ iem_alisttosym ---------------------------- */
+/* ---------- converts a ASCII list of floats to a symbol ------------- */
+
+static t_class *iem_alisttosym_class;
+
+typedef struct _iem_alisttosym
+{
+ t_object x_obj;
+ char x_string[MAXPDSTRING];
+} t_iem_alisttosym;
+
+static void iem_alisttosym_list(t_iem_alisttosym *x, t_symbol *s, int ac, t_atom *av)
+{
+ t_int i=0, j=0, k=0;
+ unsigned char uc=0;
+
+ if(ac > 0)
+ {
+ for(i=0, j=0; i<ac; i++)
+ {
+ if(IS_A_FLOAT(av, i))
+ {
+ k = atom_getintarg(i, ac, av);
+ if((k >= 0) && (k <= 255))
+ {
+ uc = (unsigned char)k;
+ x->x_string[j++] = (char)uc;
+ }
+ }
+ if(j >= (MAXPDSTRING - 2))
+ break;
+ }
+ }
+ x->x_string[j] = 0;
+ outlet_symbol(x->x_obj.ob_outlet, gensym(x->x_string));
+}
+
+static void iem_alisttosym_free(t_iem_alisttosym *x)
+{
+}
+
+static void *iem_alisttosym_new(void)
+{
+ t_iem_alisttosym *x = (t_iem_alisttosym *)pd_new(iem_alisttosym_class);
+
+ x->x_string[0] = 0;
+ outlet_new(&x->x_obj, &s_symbol);
+ return (x);
+}
+
+void iem_alisttosym_setup(void)
+{
+ iem_alisttosym_class = class_new(gensym("iem_alisttosym"), (t_newmethod)iem_alisttosym_new,
+ 0, sizeof(t_iem_alisttosym), 0, 0);
+ class_addlist(iem_alisttosym_class, iem_alisttosym_list);
+}
diff --git a/iemlib2/src/iem_symtoalist.c b/iemlib2/src/iem_symtoalist.c
new file mode 100644
index 0000000..6855276
--- /dev/null
+++ b/iemlib2/src/iem_symtoalist.c
@@ -0,0 +1,75 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2008 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <string.h>
+#include <stdlib.h>
+
+
+/* ------------------------ iem_symtoalist --------------------- */
+/* --------- converts a symbol to a ASCII list of floats ------- */
+
+static t_class *iem_symtoalist_class;
+
+typedef struct _iem_symtoalist
+{
+ t_object x_obj;
+ char x_string[MAXPDSTRING];
+ t_atom x_av[MAXPDSTRING];
+} t_iem_symtoalist;
+
+static void iem_symtoalist_symbol(t_iem_symtoalist *x, t_symbol *s)
+{
+ char *string=s->s_name;
+ unsigned char uc;
+ t_int i, n=strlen(string);
+
+ for(i=0; i<n; i++)
+ {
+ uc = (unsigned char)string[i];
+ SETFLOAT(x->x_av+i, (t_float)uc);
+ }
+ outlet_list(x->x_obj.ob_outlet, &s_list, n, x->x_av);
+}
+
+static void iem_symtoalist_float(t_iem_symtoalist *x, t_floatarg f)
+{
+ char string[40];
+ unsigned char uc;
+ t_int i, n;
+
+ sprintf(string, "%g", f);
+ n=strlen(string);
+ for(i=0; i<n; i++)
+ {
+ uc = (unsigned char)string[i];
+ SETFLOAT(x->x_av+i, (t_float)uc);
+ }
+ outlet_list(x->x_obj.ob_outlet, &s_list, n, x->x_av);
+}
+
+static void iem_symtoalist_free(t_iem_symtoalist *x)
+{
+}
+
+static void *iem_symtoalist_new(void)
+{
+ t_iem_symtoalist *x = (t_iem_symtoalist *)pd_new(iem_symtoalist_class);
+
+ x->x_string[0] = 0;
+ SETFLOAT(x->x_av, 0.0);
+ outlet_new(&x->x_obj, &s_list);
+ return (x);
+}
+
+void iem_symtoalist_setup(void)
+{
+ iem_symtoalist_class = class_new(gensym("iem_symtoalist"), (t_newmethod)iem_symtoalist_new,
+ 0, sizeof(t_iem_symtoalist), 0, 0);
+ class_addsymbol(iem_symtoalist_class, iem_symtoalist_symbol);
+ class_addfloat(iem_symtoalist_class, iem_symtoalist_float);
+}
diff --git a/iemlib2/src/makefile_d_fat b/iemlib2/src/makefile_d_fat
index 4bb54f6..812c9cd 100644
--- a/iemlib2/src/makefile_d_fat
+++ b/iemlib2/src/makefile_d_fat
@@ -14,11 +14,13 @@ LFLAGS = -bundle -undefined suppress -flat_namespace
# the sources
SRC = add2_comma.c \
+ aspeedlim.c \
bpe.c \
dollarg.c \
exp_inc.c \
fade~.c \
float24.c \
+ iem_alisttosym.c \
iem_anything.c \
iem_append.c \
iem_blocksize~.c \
@@ -30,6 +32,7 @@ SRC = add2_comma.c \
iem_samplerate~.c \
iem_sel_any.c \
iem_send.c \
+ iem_symtoalist.c \
init.c \
LFO_noise~.c \
list2send.c \
diff --git a/iemlib2/src/makefile_d_ppc b/iemlib2/src/makefile_d_ppc
index b91bacc..825a21c 100644
--- a/iemlib2/src/makefile_d_ppc
+++ b/iemlib2/src/makefile_d_ppc
@@ -14,6 +14,7 @@ LFLAGS = -bundle -undefined suppress -flat_namespace
# the sources
SRC = add2_comma.c \
+ aspeedlim.c \
bpe.c \
dollarg.c \
exp_inc.c \
diff --git a/iemlib2/src/makefile_darwin b/iemlib2/src/makefile_darwin
index 15cbbfe..007ad5e 100644
--- a/iemlib2/src/makefile_darwin
+++ b/iemlib2/src/makefile_darwin
@@ -19,6 +19,7 @@ SYSTEM = $(shell uname -m)
# the sources
SRC = add2_comma.c \
+ aspeedlim.c \
bpe.c \
dollarg.c \
exp_inc.c \
diff --git a/iemlib2/src/makefile_linux b/iemlib2/src/makefile_linux
index 8913081..a806606 100644
--- a/iemlib2/src/makefile_linux
+++ b/iemlib2/src/makefile_linux
@@ -18,6 +18,7 @@ SYSTEM = $(shell uname -m)
# the sources
SRC = add2_comma.c \
+ aspeedlim.c \
bpe.c \
dollarg.c \
exp_inc.c \
diff --git a/iemlib2/src/makefile_win b/iemlib2/src/makefile_win
index c54111f..81d579c 100644
--- a/iemlib2/src/makefile_win
+++ b/iemlib2/src/makefile_win
@@ -17,6 +17,7 @@ PD_WIN_LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel /NOD
$(PD_INST_PATH)\bin\pd.lib
SRC = add2_comma.c \
+ aspeedlim.c \
bpe.c \
dollarg.c \
exp_inc.c \