diff options
Diffstat (limited to 'iemlib2/src')
-rw-r--r-- | iemlib2/src/iem_alisttosym.c | 66 | ||||
-rw-r--r-- | iemlib2/src/iem_symtoalist.c | 75 | ||||
-rw-r--r-- | iemlib2/src/makefile_d_fat | 3 | ||||
-rw-r--r-- | iemlib2/src/makefile_d_ppc | 1 | ||||
-rw-r--r-- | iemlib2/src/makefile_darwin | 1 | ||||
-rw-r--r-- | iemlib2/src/makefile_linux | 1 | ||||
-rw-r--r-- | iemlib2/src/makefile_win | 1 |
7 files changed, 148 insertions, 0 deletions
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 \ |