pd-ggee_0.26/0000755000076500007650000000000011467116451011517 5ustar hanshanspd-ggee_0.26/experimental/0000755000076500007650000000000011467116403014211 5ustar hanshanspd-ggee_0.26/experimental/pvocfreq.c0000644000076500007650000000372711467116403016213 0ustar hanshans/* (C) Guenter Geiger */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ shuffle ----------------------------- */ static t_class *shuffle_class; typedef struct _shuffle { t_object x_obj; t_float x; } t_shuffle; void shuffle_float(t_shuffle *x, t_floatarg f) { post("float %f",f); x->x = f; } static t_int *shuffle_perform(t_int *w) { t_shuffle* x = (t_shuffle*)(w[1]); t_float* in1 = (t_float*) w[2]; t_float* in2 = (t_float*) w[3]; t_float* out = (t_float*) w[4]; int n = w[5]; if (x->x <= 0) { while (n--) { *out++ = *in1++; } return w+6; } if (x->x < 0.5) { t_int index = 1/x->x; while (n--) { if (n%index){ *out++ = *in1++; in2++; } else { *out++ = *in2++; in1++; } } return w+6; } if (x->x > 1.0) { while (n--) { *out++ = *in2++; } return w+6; } if (x->x >= 0.5) { t_int index = 1/(1.0- x->x); while (n--) { if (n%index) { *out++ = *in2++; in1++; } else { *out++ = *in1++; in2++; } } } return w+6; } static void shuffle_dsp(t_shuffle *x, t_signal **sp) { dsp_add(shuffle_perform, 5, x, sp[0]->s_vec, sp[1]->s_vec,sp[2]->s_vec, sp[0]->s_n); } static void *shuffle_new() { t_shuffle *x = (t_shuffle *)pd_new(shuffle_class); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); outlet_new(&x->x_obj, gensym("signal")); return (x); } void shuffle_setup(void) { shuffle_class = class_new(gensym("shuffle~"), (t_newmethod)shuffle_new, 0, sizeof(t_shuffle), 0,0); class_addmethod(shuffle_class, nullfn, gensym("signal"), 0); class_addmethod(shuffle_class, (t_method) shuffle_dsp, gensym("dsp"), 0); class_addfloat(shuffle_class,shuffle_float); } pd-ggee_0.26/experimental/pvocfreq-help.pd0000644000076500007650000000013411467116403017307 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 tabwrite4~; #X text 54 47 placeholder help patch; pd-ggee_0.26/experimental/tabwrite4~-help.pd0000644000076500007650000000013411467116403017565 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 tabwrite4~; #X text 54 47 placeholder help patch; pd-ggee_0.26/experimental/tabwrite4~.c0000644000076500007650000001132111467116403016456 0ustar hanshans #include #include #include // fprintf /* ------------------------- tabwrite4~ -------------------------- */ static t_class *tabwrite4_tilde_class; typedef struct _tabwrite4_tilde { t_object x_obj; int x_phase; int x_npoints; float *x_vec; t_symbol *x_arrayname; float x_f; t_sample x_1; t_sample x_2; t_sample x_3; t_sample x_4; float x_index; } t_tabwrite4_tilde; static void tabwrite4_tilde_tick(t_tabwrite4_tilde *x); static void *tabwrite4_tilde_new(t_symbol *s) { t_tabwrite4_tilde *x = (t_tabwrite4_tilde *)pd_new(tabwrite4_tilde_class); x->x_phase = 0x7fffffff; x->x_arrayname = s; x->x_f = 0; x->x_1 = 0.; x->x_2 = 0.; x->x_3 = 0.; inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); outlet_new(&x->x_obj, &s_signal); return (x); } static void tabwrite4_tilde_redraw(t_tabwrite4_tilde *x) { t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class); if (!a) bug("tabwrite4_tilde_redraw"); else garray_redraw(a); } static t_int *tabwrite4_tilde_perform(t_int *w) { t_tabwrite4_tilde *x = (t_tabwrite4_tilde *)(w[1]); t_float *in1 = (t_float *)(w[2]); t_float *in2 = (t_float *)(w[3]); int n = (int)(w[4]); t_float* end = in1 + n; t_float* end2 = in2 + n; float *buf = x->x_vec, *fp, a,b,c,d; float findex = *in2; float frac; int iindex = (int)findex; int wraparound = 0; int maxindex = x->x_npoints-1; if (!buf) return (w+5); b = x->x_1; c = x->x_2; d = x->x_3; while (n--) { float cminusb; findex = *in2++; #if 0 while ((int)findex > iindex) { iindex++; *(buf+iindex) = *(buf+iindex-1); } #endif iindex = (int)findex; // post("iindex %d, findex %f",iindex,findex); if (in2 < end2 && findex > *in2) { wraparound = 1; post("wraparound"); } a=b; b=c; c=d; d = *in1++; frac = findex - iindex; iindex +=64; // one blocksize and 4 points if (iindex < 0) { iindex += maxindex+1; } else if (iindex > maxindex) { iindex -= maxindex; } fp = buf + iindex; cminusb = c-b; *fp = b + frac * ( cminusb - 0.1666667f * (1.-frac) * ( (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b) ) ); } post("written to %d",iindex); x->x_1 = b; x->x_2 = c; x->x_3 = d; #if 0 buf[maxindex-2] = buf[maxindex-3]*0.5; buf[maxindex-1] = buf[maxindex-2]*0.5; buf[maxindex] = buf[maxindex-1]*0.5; buf[2] = buf[3]*0.5; buf[1] = buf[2]*0.5; buf[0] = buf[1]*0.5; #endif if (wraparound) tabwrite4_tilde_redraw(x); return (w+5); } void tabwrite4_tilde_set(t_tabwrite4_tilde *x, t_symbol *s) { t_garray *a; x->x_arrayname = s; if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) { if (*s->s_name) pd_error(x, "tabwrite4~: %s: no such array", x->x_arrayname->s_name); x->x_vec = 0; } else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec)) { pd_error(x, "%s: bad template for tabwrite4~", x->x_arrayname->s_name); x->x_vec = 0; } else garray_usedindsp(a); } static void tabwrite4_tilde_dsp(t_tabwrite4_tilde *x, t_signal **sp) { tabwrite4_tilde_set(x, x->x_arrayname); dsp_add(tabwrite4_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } static void tabwrite4_tilde_bang(t_tabwrite4_tilde *x) { x->x_phase = 0; } static void tabwrite4_tilde_start(t_tabwrite4_tilde *x, t_floatarg f) { x->x_phase = (f > 0 ? f : 0); } static void tabwrite4_tilde_stop(t_tabwrite4_tilde *x) { if (x->x_phase != 0x7fffffff) { tabwrite4_tilde_redraw(x); x->x_phase = 0x7fffffff; } } void tabwrite4_tilde_setup(void) { tabwrite4_tilde_class = class_new(gensym("tabwrite4~"), (t_newmethod)tabwrite4_tilde_new, 0, sizeof(t_tabwrite4_tilde), 0, A_DEFSYM, 0); CLASS_MAINSIGNALIN(tabwrite4_tilde_class, t_tabwrite4_tilde, x_f); class_addmethod(tabwrite4_tilde_class, (t_method)tabwrite4_tilde_dsp, gensym("dsp"), 0); class_addmethod(tabwrite4_tilde_class, (t_method)tabwrite4_tilde_set, gensym("set"), A_SYMBOL, 0); class_addmethod(tabwrite4_tilde_class, (t_method)tabwrite4_tilde_stop, gensym("stop"), 0); class_addmethod(tabwrite4_tilde_class, (t_method)tabwrite4_tilde_start, gensym("start"), A_DEFFLOAT, 0); class_addbang(tabwrite4_tilde_class, tabwrite4_tilde_bang); } pd-ggee_0.26/experimental/stk.h0000644000076500007650000000337111467116403015167 0ustar hanshans#ifdef __linux__ #define __OS_LINUX__ #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include //#include //#include #include #include #include #include #include #include #include #include #include #include #include #include pd-ggee_0.26/experimental/fofsynth~.c0000644000076500007650000002024711467116403016420 0ustar hanshans/* (C) Guenter Geiger */ #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ fofsynth~ ----------------------------- */ #ifndef _WIN32 void garray_usedindsp(t_garray *x); #endif #define DEBUG(a,b) if (x->debug) post(a,b); #define MAXGRAINS 1000 #define PD_PI 3.14159 #if PD_MINOR_VERSION < 38 static float* cos_table; #endif static float* halfcos_table; static float* exp_table; static void cos_maketable(void) { int i; float *fp, phase, phsinc = (2. * PD_PI) / COSTABSIZE; if (cos_table) return; cos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); for (i = COSTABSIZE + 1, fp = cos_table, phase = 0; i--; fp++, phase += phsinc) *fp = cos(phase); } static void halfcos_maketable(void) { int i; float *fp, phase, phsinc = (PD_PI) / COSTABSIZE; if (halfcos_table) return; halfcos_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); for (i = COSTABSIZE + 1, fp = halfcos_table, phase = PD_PI; i--; fp++, phase += phsinc) *fp = 0.5*(cos(phase) + 1.0); } static void exp_maketable(void) { int i; float *fp, phase, phsinc = (2 * PD_PI) / COSTABSIZE; if (exp_table) return; exp_table = (float *)getbytes(sizeof(float) * (COSTABSIZE+1)); for (i = COSTABSIZE + 1, fp = exp_table, phase = 0; i--; fp++, phase += phsinc) *fp = exp(-phase); } static t_class *fofsynth_class; typedef struct _grain { struct _grain *next; t_float formph; /* 0 ... 1 */ t_float formphinc; t_float envph; int falling; } t_grain; typedef struct _fofsynth { t_object x_obj; /* it is possible to use 2 array, prob change this one int the future */ t_symbol* x_arrayname; /* template */ int x_npoints; t_float *x_vec; /* fof */ int debug; int maxgrains; int numgrains; float* x_envelope; /* the queue of grains */ t_grain* grainbase; t_grain* grainstart; t_grain* grainend; t_float fundph; /* 0 to 1; if 1 -> add a new grain */ t_float fundfreq; /* input parameter 1 */ t_float formfreq; /* input paramter 2 */ t_float risedur; /* input parameter 3 ( in % of total duration )*/ t_float falldur; /* input parameter 5 ( in % of total duration */ /* other */ int neednewgrain; } t_fofsynth; /* build a cyclic list */ static t_grain* grain_makecyclic(t_grain* base,int num) { t_grain* cur = base; while (--num) { cur->next = cur+1; cur++; } cur->next = base; return base; } static t_int *fofsynth_perform(t_int *w) { t_fofsynth* x = (t_fofsynth*) (w[1]); t_float *in = (t_float *)(w[2]); t_float *out = (t_float *)(w[3]); int n = (int)(w[4]); float totaldur = (x->risedur+ x->falldur)*0.01/ *in; float srate = 44100.0; /*((t_signal*)w[2])->s_sr;*/ float israte = 1.0/srate; float fundphase = x->fundph; float numperiods = totaldur*x->formfreq; float formphinc = (x->formfreq/srate); float risinc; float fallinc; t_grain* cur; risinc = (x->risedur == 0) ? 1.0 : 1.0/ (srate*totaldur*0.01*x->risedur); fallinc = (x->falldur == 0.0) ? 1.0 :1.0/ (srate*totaldur*0.01*x->falldur); DEBUG(" fundph %3.2f",x->fundph); DEBUG(" fundfreq %3.2f",x->fundfreq); DEBUG(" formfreq %3.2f",x->formfreq); DEBUG(" risedur %3.2f %",x->risedur); DEBUG(" falldur %3.2f %",x->falldur); DEBUG(" totaldur %3.2f s",totaldur); DEBUG(" risinc %0.6f",risinc); DEBUG(" fallinc %0.6f",fallinc); DEBUG(" formant increase %3.2f",formphinc); DEBUG(" numgrains %d",x->numgrains); while (n--) { fundphase+=*++in*israte; *out = 0.0; if (x->neednewgrain) { /* new grain, they are deleted separetely */ t_grain* newgrain = x->grainend; /* DEBUG("new grain created",0); */ if (newgrain->next == x->grainstart) { post("fof: grain overflow"); x->neednewgrain = 0; } else { x->numgrains++; x->grainend = newgrain->next; newgrain->formphinc = formphinc; newgrain->falling = 0; newgrain->formph = newgrain->envph = 0.0; x->neednewgrain = 0; } } cur = x->grainstart; while (cur != x->grainend) { float formphase = cur->formph; float envelope; float tph = (formphase - (float)((int) formphase)); float val = *(x->x_vec + (int) (tph * x->x_npoints)); /* Apply the envelope */ if (!cur->falling && (cur->envph <= 1.0)) { envelope = *(halfcos_table + (int) (cur->envph * COSTABSIZE)); cur->envph+=risinc; val *= envelope; } else if (!cur->falling) { cur->falling = 1; cur->envph = 0; } if (cur->falling) { envelope = *(exp_table + (int) (cur->envph * COSTABSIZE)); cur->envph+=fallinc; val *= envelope; } /* end of envelope code */ formphase+=cur->formphinc; cur->formph = formphase; if (formphase >= numperiods) { /* dead */ DEBUG("grain died",0); x->grainstart = cur->next; x->numgrains--;/* not needed */ } cur = cur->next; *out += val; } if (fundphase > 1.0) { fundphase -= 1.0; x->neednewgrain=1; } out++; } x->fundph=fundphase; x->debug = 0; return (w+5); } void fofsynth_usearray(t_symbol* s,int* points,t_float** vec) { t_garray *a; if (!(a = (t_garray *)pd_findbyclass(s, garray_class))) error("%s: no such array", s->s_name); else if (!garray_getfloatarray(a,points,vec)) error("%s: bad template for fof~", s->s_name); else garray_usedindsp(a); } static void fofsynth_dsp(t_fofsynth *x, t_signal **sp) { if (x->x_arrayname) fofsynth_usearray(x->x_arrayname,&x->x_npoints, &x->x_vec); else { x->x_npoints=COSTABSIZE; x->x_vec = cos_table; } dsp_add(fofsynth_perform, 4, x, sp[0]->s_vec,sp[1]->s_vec, sp[0]->s_n); } static void fofsynth_free(t_fofsynth *x) { freebytes(x->grainbase,sizeof(t_grain)*x->maxgrains); } static void fofsynth_debug(t_fofsynth* x) { x->debug = 1; } static void fofsynth_float(t_fofsynth* x,t_float f) { x->fundfreq = f > 0.0 ? f : -f; } static void *fofsynth_new(t_symbol* s,t_float a,t_float b,t_float c,t_float d) { int maxgrains = MAXGRAINS; t_fofsynth *x = (t_fofsynth *)pd_new(fofsynth_class); x->debug = 0; x->x_arrayname = s; if (s == &s_) x->x_arrayname = NULL; /* setup the grain queue */ x->grainbase = getbytes(sizeof(t_grain)*maxgrains); x->maxgrains = maxgrains; grain_makecyclic(x->grainbase,maxgrains); x->grainstart = x->grainbase; x->grainend = x->grainbase; x->numgrains = 0; /* some of them could be signals too */ floatinlet_new(&x->x_obj, &x->formfreq); floatinlet_new(&x->x_obj, &x->risedur); floatinlet_new(&x->x_obj, &x->falldur); x->fundph = 0.0; x->fundfreq = 200.0; x->formfreq = 600.0; x->risedur = 5.0; x->falldur = 140.0; if (a) x->fundfreq = a; if (b) x->formfreq = b; if (c) x->risedur = c; if (d) x->falldur = d; outlet_new(&x->x_obj, &s_signal); return (x); } void fofsynth_tilde_setup(void) { cos_table = NULL; halfcos_table = NULL; fofsynth_class = class_new(gensym("fof~"), (t_newmethod) fofsynth_new,(t_method) fofsynth_free, sizeof(t_fofsynth), 0,A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); class_addcreator((t_newmethod)fofsynth_new,gensym("fofsynth~"),A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); class_addmethod(fofsynth_class, nullfn, gensym("signal"), 0); class_addmethod(fofsynth_class, (t_method) fofsynth_dsp, gensym("dsp"), 0); class_addfloat(fofsynth_class, (t_method) fofsynth_float); class_addmethod(fofsynth_class,(t_method) fofsynth_debug, gensym("debug"),0); cos_maketable(); halfcos_maketable(); exp_maketable(); } pd-ggee_0.26/experimental/stk-help.pd0000644000076500007650000000207011467116403016264 0ustar hanshans#N canvas 226 114 478 387 10; #X obj 151 263 stk BeeThree; #X obj 142 307 dac~; #X msg 14 84 print; #X text 13 66 Learn about the different instruments:; #X floatatom 240 248 5 0 0 0 - - -; #X msg 48 121 38 0.5; #X msg 15 121 38 1; #X msg 95 121 38 0.25; #X msg 147 121 38 0.1; #X text 14 102 Notes and velocity; #X text 238 231 velocity (0-1); #X msg 18 225 control 1 \$1; #X floatatom 18 209 5 0 0 0 - - -; #X text 16 196 change different control channels (see stk docs); #X text 17 361 (C) 1999-2004 Guenter Geiger; #X text 12 15 stk - external to access the instrument from Perry Cooks Synthesis Toolkit; #X msg 18 276 aftertouch \$1; #X msg 19 324 pitchbend \$1; #X floatatom 18 261 5 0 0 0 - - -; #X floatatom 19 310 5 0 0 0 - - -; #X text 17 248 aftertouch; #X text 18 296 pitchbend; #X connect 0 0 1 0; #X connect 0 0 1 1; #X connect 2 0 0 0; #X connect 4 0 0 1; #X connect 5 0 0 0; #X connect 6 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; #X connect 11 0 0 0; #X connect 12 0 11 0; #X connect 16 0 0 0; #X connect 17 0 0 0; #X connect 18 0 16 0; #X connect 19 0 17 0; pd-ggee_0.26/experimental/Makefile.linux0000644000076500007650000000146511467116403017015 0ustar hanshansNAME=stk current: pd_linux # TARGETS += stk PDDIR = /usr/local/lib/pd INSTALLPATH = $(PDDIR)/extra VERSION = \"0.16\" # ----------------------- Linux ----------------------- pd_linux: $(NAME).pd_linux .SUFFIXES: .pd_linux LINUXCFLAGS = -ggdb -DPD -O3 -fPIC -funroll-loops -fomit-frame-pointer \ -W -Wshadow -Wno-unused -Wno-parentheses -Wno-switch LINUXINCLUDE = -I/usr/include -I/usr/local/include/stk .cpp.pd_linux: g++ $(LINUXCFLAGS) $(LINUXINCLUDE) -c $(NAME).cpp g++ -Wl,--export-dynamic -shared -o $(NAME).pd_linux $(NAME).o -lc -lstk strip --strip-unneeded $(NAME).pd_linux rm -f *.o # ------------------------------------------------------- clean: rm *.pd_linux install: cp $(NAME).pd_* $(INSTALLPATH) install -d $(PDDIR)/doc/5.reference/$(NAME)-help.pd pd-ggee_0.26/experimental/fofsynth~-help.pd0000644000076500007650000000372711467116403017533 0ustar hanshans#N canvas 82 59 828 630 8; #X floatatom 103 48; #X floatatom 222 82; #X floatatom 235 117; #X floatatom 249 179; #X obj 202 403 dac~; #X obj 209 237 fofsynth~; #X text 262 232 fofsynth~ is the same as fof~; #X text 101 31 fundamental frequency; #X text 257 82 formant frequency; #X text 273 116 raise time in percent; #X text 26 611 (C) Guenter Geiger 1999; #X obj 209 338 *~; #X obj 219 285 dbtorms; #X floatatom 219 267; #X obj 14 204 osc~; #X floatatom 14 173; #X obj 14 223 *~; #X obj 40 205 sig~ 3; #X floatatom 54 172; #X text 12 130 vibrato; #X text 11 150 freq; #X text 54 150 depth; #X obj 103 210 line~; #X obj 219 319 line~; #X obj 219 302 pack 100 300; #X obj 209 372 clip~ -1 1; #X msg 183 196 debug; #X msg 623 211 bang; #X graph graph2 0 -1 10240 1 411 607 811 307; #X array array1 10240 float; #X pop; #X obj 623 283 tabwrite~ array1; #X msg 710 274 \; array1 resize 10240; #X msg 151 68 200; #X obj 542 268 *~; #X obj 552 248 sig~ 0.2; #X text 621 191 debug; #X text 319 5 fof~ in its default mode; #X text 298 17 =================================; #X text 291 180 fall time in % of period; #X floatatom 543 180; #X text 334 43 THIS IS STILL NOT REALLY FINISHED; #X msg 151 103 1; #X obj 14 188 sig~ 4; #X msg 153 165 200; #X msg 47 34 120; #X obj 103 191 pack 100 100; #X connect 0 0 44 0; #X connect 1 0 5 1; #X connect 2 0 5 2; #X connect 3 0 5 3; #X connect 5 0 11 0; #X connect 5 0 32 0; #X connect 11 0 25 0; #X connect 12 0 24 0; #X connect 13 0 12 0; #X connect 14 0 16 0; #X connect 15 0 41 0; #X connect 16 0 5 0; #X connect 17 0 16 1; #X connect 18 0 17 0; #X connect 22 0 5 0; #X connect 23 0 11 1; #X connect 24 0 23 0; #X connect 25 0 4 1; #X connect 25 0 4 0; #X connect 26 0 5 0; #X connect 27 0 29 0; #X connect 31 0 1 0; #X connect 32 0 29 0; #X connect 33 0 32 1; #X connect 38 0 33 0; #X connect 40 0 2 0; #X connect 41 0 14 0; #X connect 42 0 3 0; #X connect 43 0 0 0; #X connect 44 0 22 0; pd-ggee_0.26/experimental/Makefile0000755000076500007650000000157711467116403015666 0ustar hanshanscurrent: nt # TARGETS += stk VERSION = \"0.16\" .SUFFIXES: .dll .obj # ----------------------- NT ---------------------------- NTOBJECTS = *.obj NTDLLS = *.dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo PDNTINCLUDE = /I. /I..\..\pd\src ProgramFiles = C:\Program Files PDNTLDIR = "$(ProgramFiles)\Microsoft Visual Studio\Vc98\lib" #PDNTLDIR = "C:\Programme\Msdev\Vc98\lib" PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\wsock32.lib \ $(PDNTLDIR)\kernel32.lib \ $(PDNTLDIR)\uuid.lib \ ..\..\pd\bin\pd.lib nt: $(NTOBJECTS) -link /dll $(PDNTLIB) fofsynth~.obj /export:fofsynth_tilde_setup -link /dll $(PDNTLIB) pvocfreq.obj /export:pvocfreq_setup -link /dll $(PDNTLIB) fasor~.obj /export:fasor_tilde_setup clean: del *.obj del *.dll .c.obj: -cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c .obj.dll: pd-ggee_0.26/experimental/README.stk0000644000076500007650000000100211467116403015662 0ustar hanshans In order to compile the stk external you have to put the latest stk release (4.2.0) in this directory. * First compile stk if stk is compiled just do a make stk.pd_linux. Hint: You may have to set the rawwaves path in stk in so that the external can find them. See the STK INSTALL file for details. You do not have to specify a special audio API, as audio I/O is done through pd. The stk configure command should be something like this: ./configure RAWWAVE_PATH="/home/gary/rawwaves/" Guenter Geiger pd-ggee_0.26/experimental/stk.cpp0000644000076500007650000001062111467116403015516 0ustar hanshans#include #ifdef NT #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* STK includes */ #include "stk.h" /* ------------------------ stk ----------------------------- */ static t_class *stk_class; typedef struct _stk { t_object x_obj; Instrmnt *instrument; t_float x_velo; } t_stk; char* stk_instruments[255]; void stk_print(t_stk* x) { int i=0; while (strncmp(stk_instruments[i],"LastInst",8)) { post("%s",stk_instruments[i]); i++; } } #define DI(name) if ((stk_instruments[i++] = #name) && !strcmp(s->s_name, #name )) \ { x->instrument = new name;} #define DI2(name,y) if ((stk_instruments[i++] = #name) && !strcmp(s->s_name, #name )) \ { x->instrument = new name(y);} static void stk_set_instrument(t_stk* x,t_symbol* s) { int i = 0; x->instrument = NULL; DI2(Clarinet,10.0); DI2(BlowHole,10.0); DI2(Saxofony,10.0); DI2(Flute,10.0); DI2(Brass,10.0); DI(BlowBotl); DI2(Bowed,10.0); DI2(Plucked,5.0); DI2(StifKarp,5.0); DI2(Sitar,5.0); DI2(Mandolin,5.0); DI(Rhodey); DI(Wurley); DI(TubeBell); DI(HevyMetl); DI(PercFlut); DI(BeeThree); DI(FMVoices); DI(VoicForm); DI(Moog); DI(Simple); DI(Drummer); DI(BandedWG); DI(Shakers); DI(ModalBar); // DI2(Mesh2D,10, 10); DI(Resonate); DI(Whistle); if (!x->instrument) error("No such instrument %s",s->s_name); stk_instruments[i] = "LastInst"; } static void stk_bang(t_stk *x) { post("bang"); } static t_int *stk_perform(t_int *w) { t_stk* x = (t_stk*)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); while (n--) { *out++ = x->instrument->tick(); } return (w+4); } static void stk_dsp(t_stk *x, t_signal **sp) { dsp_add(stk_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); } static void stk_noteOn(t_stk *x,t_float f) { x->instrument->noteOn(f,x->x_velo); } static void stk_noteOff(t_stk *x) { x->instrument->noteOff(0); } static void stk_control(t_stk *x,t_floatarg f1,t_floatarg f2) { x->instrument->controlChange((int)f1,f2); } static void stk_control1(t_stk *x,t_floatarg f1) { x->instrument->controlChange(1,f1); } static void stk_control2(t_stk *x,t_floatarg f1) { x->instrument->controlChange(2,f1); } static void stk_control3(t_stk *x,t_floatarg f1) { x->instrument->controlChange(3,f1); } static void stk_control4(t_stk *x,t_floatarg f1) { x->instrument->controlChange(4,f1); } static void stk_aftertouch(t_stk *x,t_floatarg f1) { x->instrument->controlChange(128,f1); } static void stk_pitchbend(t_stk *x,t_floatarg f1) { x->instrument->setFrequency(f1); } static void stk_float(t_stk* x,t_floatarg f) { if (f > 20) stk_noteOn(x,f); else stk_noteOff(x); } static void *stk_new(t_symbol* s) { t_stk *x = (t_stk *)pd_new(stk_class); stk_set_instrument(x,s); if (x->instrument == NULL) { post("stk: %s no such instrument",s->s_name); return NULL; } floatinlet_new(&x->x_obj, &x->x_velo); x->x_velo = 0.1; outlet_new(&x->x_obj, gensym("signal")); return (x); } extern "C" { void stk_setup(void) { stk_class = class_new(gensym("stk"), (t_newmethod)stk_new, 0, sizeof(t_stk), 0,A_DEFSYM,A_NULL); class_addmethod(stk_class, nullfn, gensym("signal"), A_NULL); class_addmethod(stk_class, (t_method) stk_dsp, gensym("dsp"), A_NULL); class_addbang(stk_class,stk_bang); class_addfloat(stk_class,stk_float); class_addmethod(stk_class,(t_method) stk_control,gensym("control"),A_DEFFLOAT,A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_control1,gensym("control1"),A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_control2,gensym("control2"),A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_control3,gensym("control3"),A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_control4,gensym("control4"),A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_aftertouch,gensym("aftertouch"),A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_pitchbend,gensym("pitchbend"),A_DEFFLOAT,A_NULL); class_addmethod(stk_class,(t_method) stk_print,gensym("print"),A_NULL); } } pd-ggee_0.26/control/0000755000076500007650000000000011467116402013173 5ustar hanshanspd-ggee_0.26/control/serialctl.pd0000644000076500007650000000465011467116402015507 0ustar hanshans#N canvas 91 60 907 514 10; #X msg 202 243 getlines; #X msg 201 169 setlines RTS 0; #X msg 201 187 setlines RTS 1; #X msg 24 213 start; #X msg 24 195 stop; #X msg 515 231 vtime 0 20; #X msg 515 212 setlocal 0; #X msg 515 193 setcontrol 0 CS8 CLOCAL CREAD; #X msg 201 224 setlines DTR 1; #X msg 201 206 setlines DTR 0; #X text 12 489 (C) 2000 Guenter Geiger; #X text 32 22 serialin reads from a Unix serial device. There are several ways how serial devices can be setup \, and serialin provides access to these serial device settings. This makes it possible to interpret the data stream from a serial device either within pd itself \, or via a specially written external for the device attached to the serial port (see serial_bird and serial_ms).; #X msg 516 431 79 \, 75 \, 13; #X msg 517 451 OK \, 13; #X text 201 138 setlines set the serial port; #X text 199 151 lines (only acces to RTS and DTR is provided; #X text 23 153 start/stop; #X text 23 165 reading characters; #X text 23 177 from the device; #X text 510 69 setinput \, setcontrol \, setlocal \, vtime provide access to the termios status bits of the serial device. This is lowlevel configuration and is sometimes necessary.; #X text 512 296 set the baudrate; #X msg 514 348 makeraw; #X text 513 330 configure the device as "raw"; #X text 511 110 If a 0 is prepended to the flags \, the flags are reset before any bits are switched. All other commands set the corresponding bits to either 1 (e.g. CLOCAL) or 0 (!CLOCAL).; #X msg 516 250 listflags; #X msg 716 210 setinput list; #X text 511 151 the "list flag" lists all available flags.; #X text 514 412 data can be sent as symbols or as ASCII character code; #X msg 716 230 setcontrol list; #X msg 717 191 setlocal list; #X msg 514 175 setinput 0 IXOFF; #X floatatom 590 314; #X msg 513 313 speed \$1; #X obj 24 455 print; #X floatatom 62 243; #X msg 73 277 send c; #X obj 24 429 serialctl /dev/ttyS0; #X connect 0 0 36 0; #X connect 1 0 36 0; #X connect 2 0 36 0; #X connect 3 0 36 0; #X connect 4 0 36 0; #X connect 5 0 36 0; #X connect 6 0 36 0; #X connect 7 0 36 0; #X connect 8 0 36 0; #X connect 9 0 36 0; #X connect 12 0 36 0; #X connect 13 0 36 0; #X connect 21 0 36 0; #X connect 24 0 36 0; #X connect 25 0 36 0; #X connect 28 0 36 0; #X connect 29 0 36 0; #X connect 30 0 36 0; #X connect 31 0 32 0; #X connect 32 0 36 0; #X connect 34 0 36 0; #X connect 35 0 36 0; #X connect 36 0 33 0; pd-ggee_0.26/control/rl.c0000644000076500007650000000410211467116402013751 0ustar hanshans/* (C) Guenter Geiger */ #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------- lreceive ------------------------------ */ static t_class *lreceive_class; typedef struct _lreceive { t_object x_obj; t_symbol *x_sym; } t_lreceive; static void lreceive_bang(t_lreceive *x) { outlet_bang(x->x_obj.ob_outlet); } static void lreceive_float(t_lreceive *x, t_float f) { outlet_float(x->x_obj.ob_outlet, f); } static void lreceive_symbol(t_lreceive *x, t_symbol *s) { outlet_symbol(x->x_obj.ob_outlet, s); } static void lreceive_pointer(t_lreceive *x, t_gpointer *gp) { outlet_pointer(x->x_obj.ob_outlet, gp); } static void lreceive_list(t_lreceive *x, t_symbol *s, int argc, t_atom *argv) { outlet_list(x->x_obj.ob_outlet, s, argc, argv); } static void lreceive_anything(t_lreceive *x, t_symbol *s, int argc, t_atom *argv) { outlet_anything(x->x_obj.ob_outlet, s, argc, argv); } static void *lreceive_new(t_symbol *s) { t_lreceive *x = (t_lreceive *)pd_new(lreceive_class); char mysym[MAXPDSTRING]; sprintf(mysym,"%s%p",s->s_name,canvas_getcurrent()); x->x_sym = gensym(mysym); pd_bind(&x->x_obj.ob_pd, x->x_sym); outlet_new(&x->x_obj, 0); return (x); } static void lreceive_free(t_lreceive *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); } void rl_setup(void) { lreceive_class = class_new(gensym("receivelocal"), (t_newmethod)lreceive_new, (t_method)lreceive_free, sizeof(t_lreceive), CLASS_NOINLET, A_SYMBOL, 0); class_addcreator((t_newmethod)lreceive_new, gensym("rl"), A_DEFSYM, 0); class_addbang(lreceive_class, lreceive_bang); class_addfloat(lreceive_class, (t_method)lreceive_float); class_addsymbol(lreceive_class, lreceive_symbol); class_addpointer(lreceive_class, lreceive_pointer); class_addlist(lreceive_class, lreceive_list); class_addanything(lreceive_class, lreceive_anything); post("Warning: receivelocal (rl) is deprecated, please use \"receive $0-var\" instead"); } pd-ggee_0.26/control/getdir.c0000644000076500007650000000234111467116402014615 0ustar hanshans/* (C) 2005 Guenter Geiger */ #include "m_pd.h" // HACK !!! struct _glist { t_object gl_obj; /* header in case we're a glist */ t_gobj *gl_list; /* the actual data */ struct _gstub *gl_stub; /* safe pointer handler */ int gl_valid; /* incremented when pointers might be stale */ struct _glist *gl_owner; /* parent glist, supercanvas, or 0 if none */ }; // END HACK !!! typedef struct getdir { t_object x_ob; t_canvas * x_canvas; t_outlet* x_outlet; int x_level; } t_getdir; static void getdir_bang(t_getdir *x) { int i = x->x_level; t_canvas* last = x->x_canvas; while (i>0) { i--; if (last->gl_owner) last = last->gl_owner; } outlet_symbol(x->x_outlet,canvas_getdir(last)); } t_class *getdir_class; static void *getdir_new(t_floatarg level) { t_getdir *x = (t_getdir *)pd_new(getdir_class); x->x_canvas = canvas_getcurrent(); x->x_outlet = outlet_new(&x->x_ob, &s_); x->x_level = level; return (void *)x; } void getdir_setup(void) { getdir_class = class_new(gensym("getdir"), (t_newmethod)getdir_new, 0, sizeof(t_getdir), 0, A_DEFFLOAT,0); class_addbang(getdir_class, getdir_bang); } pd-ggee_0.26/control/stripdir.c0000644000076500007650000000163011467116402015177 0ustar hanshans/* (C) Guenter Geiger */ #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ stripdir ----------------------------- */ static t_class *stripdir_class; typedef struct _stripdir { t_object x_obj; } t_stripdir; void stripdir_symbol(t_stripdir *x,t_symbol* s) { int len = strlen(s->s_name); while (len--) if (*(s->s_name + len) == '/') { outlet_symbol(x->x_obj.ob_outlet,gensym(s->s_name + len + 1)); break; } } static void *stripdir_new() { t_stripdir *x = (t_stripdir *)pd_new(stripdir_class); outlet_new(&x->x_obj, &s_float); return (x); } void stripdir_setup(void) { stripdir_class = class_new(gensym("stripdir"), (t_newmethod)stripdir_new, 0, sizeof(t_stripdir), 0,0); class_addsymbol(stripdir_class,stripdir_symbol); } pd-ggee_0.26/control/sinh.c0000644000076500007650000000145111467116402014301 0ustar hanshans/* (C) Guenter Geiger */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include /* ------------------------ sinh ----------------------------- */ static t_class *sinh_class; typedef struct _sinh { t_object x_obj; } t_sinh; void sinh_bang(t_sinh *x) { post("bang"); } void sinh_float(t_sinh *x,t_floatarg f) { outlet_float(x->x_obj.ob_outlet,sinh(f)); } static void *sinh_new() { t_sinh *x = (t_sinh *)pd_new(sinh_class); outlet_new(&x->x_obj,&s_float); return (x); } void sinh_setup(void) { sinh_class = class_new(gensym("sinh"), (t_newmethod)sinh_new, 0, sizeof(t_sinh), 0,0); class_addbang(sinh_class,sinh_bang); class_addfloat(sinh_class,sinh_float); } pd-ggee_0.26/control/qread-help.pd0000644000076500007650000000012711467116402015542 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 qread; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/sinh-help.pd0000644000076500007650000000012611467116402015406 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 sinh; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/serialmouse.pd0000644000076500007650000000164711467116402016060 0ustar hanshans#N canvas 515 351 462 262 10; #X obj 251 170 print reading; #X msg 154 72 start; #X msg 155 90 stop; #X obj 59 147 serial_ms; #X text 35 9 decodes serial mice attached to the 1 serial port; #X text 35 258 (C) Guenter Geiger; #X msg 37 43 init; #X msg 245 88 setcontrol 0 CREAD CLOCAL CS7; #X msg 247 67 getlines; #X obj 59 170 unpack; #X floatatom 59 192; #X floatatom 90 192; #X msg 344 46 setlines RTS 1; #X msg 247 27 setlines DTR 0; #X msg 247 45 setlines RTS 0; #X msg 342 27 setlines DTR 1; #X msg 304 123 setlocal 0; #X obj 155 113 serialctl /dev/ttyS0; #X connect 1 0 17 0; #X connect 2 0 17 0; #X connect 3 0 9 0; #X connect 3 1 17 0; #X connect 6 0 3 0; #X connect 7 0 17 0; #X connect 8 0 17 0; #X connect 9 0 10 0; #X connect 9 1 11 0; #X connect 12 0 17 0; #X connect 13 0 17 0; #X connect 14 0 17 0; #X connect 15 0 17 0; #X connect 16 0 17 0; #X connect 17 0 0 0; #X connect 17 0 3 0; pd-ggee_0.26/control/unserialize.c0000644000076500007650000000224711467116402015676 0ustar hanshans/* (C) Guenter Geiger */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ unserialize ----------------------------- */ #define MAX_ELEMENTS 256 static t_class *unserialize_class; typedef struct _unserialize { t_object x_obj; t_atom x_abuf[MAX_ELEMENTS]; t_int x_count; t_int x_elements; } t_unserialize; void unserialize_float(t_unserialize *x,t_floatarg f) { SETFLOAT(&x->x_abuf[x->x_count],f); x->x_count++; if (x->x_count == x->x_elements) { outlet_list(x->x_obj.ob_outlet,0,x->x_count,x->x_abuf); x->x_count = 0; } } static void *unserialize_new(t_floatarg f) { t_unserialize *x = (t_unserialize *)pd_new(unserialize_class); outlet_new(&x->x_obj,&s_float); x->x_elements = f; x->x_count=0; if ((f <= 0) || (f > MAX_ELEMENTS)) x->x_elements = 1; return (x); } void unserialize_setup(void) { unserialize_class = class_new(gensym("unserialize"), (t_newmethod)unserialize_new, 0,sizeof(t_unserialize),0, A_DEFFLOAT,0); class_addfloat(unserialize_class,unserialize_float); } pd-ggee_0.26/control/serial_ms-help.pd0000644000076500007650000000013311467116402016421 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 serial_ms; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/serial_bird.c0000644000076500007650000001657511467116402015634 0ustar hanshans/* (C) Guenter Geiger */ #include #include #define DEBUG(x) /*#define DEBUG(x) x*/ static t_class *serial_bird_class; #define BIRD_DATA_START 0x80 #define BIRDCMD_MODE_POS 86 #define BIRD_BYTES_POS 6 #define BIRDCMD_MODE_POSANG 89 #define BIRD_BYTES_POSANG 12 #define BIRDCMD_MODE_POSMAT 90 #define BIRD_BYTES_POSMAT 24 #define BIRDCMD_MODE_POSQUAT 93 #define BIRD_BYTES_POSQUAT 14 #define BIRDCMD_MODE_QUAT 92 #define BIRD_BYTES_QUAT 8 #define BIRDCMD_STREAM 64 #define BIRDCMD_POINT 66 #define BIRD_GETDATA(x,y) ((float)((short)(y<<9 | x<<2))) #define MAXBUFFER 32 typedef struct _serial_bird { t_object x_obj; char x_c[MAXBUFFER]; t_int x_dataformat; t_int x_maxcount; t_int x_count; t_float x_posx; t_float x_posy; t_float x_posz; t_outlet *x_out2; } t_serial_bird; static void serial_bird_reset( t_serial_bird* x) { x->x_posx=0; x->x_posy=0; x->x_count = 0; outlet_float(x->x_obj.ob_outlet, x->x_posx); outlet_float(x->x_out2, x->x_posy); } static void serial_bird_float( t_serial_bird* x,t_floatarg f) { unsigned char c = (unsigned char) f; t_atom at[BIRD_BYTES_POSMAT]; t_int ac = 0; if (c&BIRD_DATA_START) { x->x_count=0; x->x_c[x->x_count] = c & 0x7f; } else x->x_c[x->x_count] = c; DEBUG(post("data %d in = %x, start = %d",x->x_count,c,c&BIRD_DATA_START);) if (x->x_count == x->x_maxcount-1) { switch (x->x_dataformat) { case BIRDCMD_MODE_POS: ac = 3; SETFLOAT(&at[0], 0.25*BIRD_GETDATA(x->x_c[0],x->x_c[1])); SETFLOAT(&at[1], 0.25*BIRD_GETDATA(x->x_c[2],x->x_c[3])); SETFLOAT(&at[2], 0.25*BIRD_GETDATA(x->x_c[4],x->x_c[5])); break; case BIRDCMD_MODE_POSANG: ac = 6; SETFLOAT(&at[0], 0.25*BIRD_GETDATA(x->x_c[0],x->x_c[1])); SETFLOAT(&at[1], 0.25*BIRD_GETDATA(x->x_c[2],x->x_c[3])); SETFLOAT(&at[2], 0.25*BIRD_GETDATA(x->x_c[4],x->x_c[5])); SETFLOAT(&at[3], BIRD_GETDATA(x->x_c[6],x->x_c[7])); SETFLOAT(&at[4], BIRD_GETDATA(x->x_c[8],x->x_c[9])); SETFLOAT(&at[5], BIRD_GETDATA(x->x_c[10],x->x_c[11])); break; case BIRDCMD_MODE_POSMAT: ac = 12; SETFLOAT(&at[0], BIRD_GETDATA(x->x_c[0],x->x_c[1])); SETFLOAT(&at[1], BIRD_GETDATA(x->x_c[2],x->x_c[3])); SETFLOAT(&at[2], BIRD_GETDATA(x->x_c[4],x->x_c[5])); SETFLOAT(&at[3], BIRD_GETDATA(x->x_c[6],x->x_c[7])); SETFLOAT(&at[4], BIRD_GETDATA(x->x_c[8],x->x_c[9])); SETFLOAT(&at[5], BIRD_GETDATA(x->x_c[10],x->x_c[11])); SETFLOAT(&at[6], BIRD_GETDATA(x->x_c[12],x->x_c[13])); SETFLOAT(&at[7], BIRD_GETDATA(x->x_c[14],x->x_c[15])); SETFLOAT(&at[8], BIRD_GETDATA(x->x_c[16],x->x_c[17])); SETFLOAT(&at[9], BIRD_GETDATA(x->x_c[18],x->x_c[19])); SETFLOAT(&at[10], BIRD_GETDATA(x->x_c[20],x->x_c[21])); SETFLOAT(&at[11], BIRD_GETDATA(x->x_c[22],x->x_c[23])); break; case BIRDCMD_MODE_POSQUAT: ac = 7; SETFLOAT(&at[0], BIRD_GETDATA(x->x_c[0],x->x_c[1])); SETFLOAT(&at[1], BIRD_GETDATA(x->x_c[2],x->x_c[3])); SETFLOAT(&at[2], BIRD_GETDATA(x->x_c[4],x->x_c[5])); SETFLOAT(&at[3], BIRD_GETDATA(x->x_c[6],x->x_c[7])); SETFLOAT(&at[4], BIRD_GETDATA(x->x_c[8],x->x_c[9])); SETFLOAT(&at[5], BIRD_GETDATA(x->x_c[10],x->x_c[11])); SETFLOAT(&at[6], BIRD_GETDATA(x->x_c[12],x->x_c[13])); break; case BIRDCMD_MODE_QUAT: ac = 4; SETFLOAT(&at[0], BIRD_GETDATA(x->x_c[0],x->x_c[1])); SETFLOAT(&at[1], BIRD_GETDATA(x->x_c[2],x->x_c[3])); SETFLOAT(&at[2], BIRD_GETDATA(x->x_c[4],x->x_c[5])); SETFLOAT(&at[3], BIRD_GETDATA(x->x_c[6],x->x_c[7])); break; } /* post("posx %d, posy %d",x->x_posx,x->x_posy);*/ outlet_list(x->x_obj.ob_outlet,&s_list, ac, at); } x->x_count = (++x->x_count)%(x->x_maxcount); } static void serial_bird_poll( t_serial_bird* x) { post("poll"); /* outlet_float(x->x_out2,(float)x->x_dataformat);*/ outlet_float(x->x_out2,(float)BIRDCMD_POINT); } static void serial_bird_mode( t_serial_bird* x,t_symbol* s) { post("mode"); /* outlet_float(x->x_out2,(float)x->x_dataformat);*/ if (!strcmp(s->s_name,"position")) { x->x_dataformat = BIRDCMD_MODE_POS; x->x_maxcount = BIRD_BYTES_POS; } if (!strcmp(s->s_name,"positionangle")) { x->x_dataformat = BIRDCMD_MODE_POSANG; x->x_maxcount = BIRD_BYTES_POSANG; } if (!strcmp(s->s_name,"positionmatrix")) { x->x_dataformat = BIRDCMD_MODE_POSMAT; x->x_maxcount = BIRD_BYTES_POSMAT; } if (!strcmp(s->s_name,"positionquat")) { x->x_dataformat = BIRDCMD_MODE_POSQUAT; x->x_maxcount = BIRD_BYTES_POSQUAT; } if (!strcmp(s->s_name,"quaternion")) { x->x_dataformat = BIRDCMD_MODE_QUAT; x->x_maxcount = BIRD_BYTES_QUAT; } outlet_float(x->x_out2,(float)x->x_dataformat); } static void serial_bird_init( t_serial_bird* x) { t_atom cmd[8]; SETFLOAT(cmd,14400.); outlet_anything(x->x_out2,gensym("speed"),1,cmd); SETFLOAT(cmd,0.); SETSYMBOL(cmd+1,gensym("CLOCAL")); SETSYMBOL(cmd+2,gensym("CREAD")); SETSYMBOL(cmd+3,gensym("CS8")); outlet_anything(x->x_out2,gensym("setcontrol"),4,cmd); SETFLOAT(cmd,0.); SETSYMBOL(cmd+1,gensym("IXOFF")); outlet_anything(x->x_out2,gensym("setinput"),2,cmd); SETFLOAT(cmd,0.); outlet_anything(x->x_out2,gensym("setlocal"),1,cmd); SETFLOAT(cmd,0.); SETFLOAT(cmd+1,20.); outlet_anything(x->x_out2,gensym("vtime"),2,cmd); SETSYMBOL(cmd,gensym("RTS")); SETFLOAT(cmd+1,0.); outlet_anything(x->x_out2,gensym("setlines"),2,cmd); SETSYMBOL(cmd,gensym("DTR")); SETFLOAT(cmd+1,1.); outlet_anything(x->x_out2,gensym("setlines"),2,cmd); /* start the polling on the serial device immediately */ outlet_anything(x->x_out2,gensym("start"),0,cmd); } static void serial_bird_start( t_serial_bird* x) { post("start"); /* outlet_float(x->x_out2,(float)x->x_dataformat);*/ outlet_float(x->x_out2,(float)BIRDCMD_STREAM); } static void serial_bird_stop( t_serial_bird* x) { post("stop"); outlet_float(x->x_out2,(float)BIRDCMD_POINT); } static void *serial_bird_new(t_symbol *s) { t_serial_bird *x = (t_serial_bird *)pd_new(serial_bird_class); x->x_count = 0; x->x_posx = 0; x->x_posy = 0; x->x_dataformat = BIRDCMD_MODE_POSANG; x->x_maxcount = BIRD_BYTES_POSANG; outlet_new(&x->x_obj, &s_float); x->x_out2 = outlet_new(&x->x_obj, &s_float); return x; } void serial_bird_setup(void) { serial_bird_class = class_new(gensym("serial_bird"), (t_newmethod)serial_bird_new, NULL, sizeof(t_serial_bird), 0,A_DEFSYM,0); class_addfloat(serial_bird_class,serial_bird_float); class_addmethod(serial_bird_class,(t_method) serial_bird_reset,gensym("reset"),0); class_addmethod(serial_bird_class,(t_method) serial_bird_init,gensym("init"),0); class_addmethod(serial_bird_class,(t_method) serial_bird_start,gensym("start"),0); class_addmethod(serial_bird_class,(t_method) serial_bird_stop,gensym("stop"),0); class_addmethod(serial_bird_class,(t_method) serial_bird_poll,gensym("poll"),0); class_addmethod(serial_bird_class,(t_method) serial_bird_mode,gensym("mode"),A_SYMBOL,NULL); } pd-ggee_0.26/control/serial_ms.c0000644000076500007650000000504511467116402015321 0ustar hanshans/* (C) Guenter Geiger */ #include static t_class *serial_ms_class; typedef struct _serial_ms { t_object x_obj; char x_c[4]; t_int x_count; t_int x_posx; t_int x_posy; t_outlet *x_out2; } t_serial_ms; static void serial_ms_reset( t_serial_ms* x) { x->x_posx=0; x->x_posy=0; x->x_count = 0; outlet_float(x->x_obj.ob_outlet, x->x_posx); outlet_float(x->x_out2, x->x_posy); } static void serial_ms_init( t_serial_ms* x) { t_atom cmd[8]; SETFLOAT(cmd,0.); SETSYMBOL(cmd+1,gensym("CLOCAL")); SETSYMBOL(cmd+2,gensym("CREAD")); SETSYMBOL(cmd+3,gensym("CS7")); /* SETSYMBOL(cmd+4,gensym("HUPCL")); */ outlet_anything(x->x_out2,gensym("setcontrol"),4,cmd); SETFLOAT(cmd,0.); SETSYMBOL(cmd+1,gensym("IGNBRK")); SETSYMBOL(cmd+2,gensym("IGNPAR")); outlet_anything(x->x_out2,gensym("setinput"),3,cmd); SETFLOAT(cmd,0.); SETFLOAT(cmd+1,1.); outlet_anything(x->x_out2,gensym("vtime"),2,cmd); SETFLOAT(cmd,1200.); outlet_anything(x->x_out2,gensym("speed"),1,cmd); SETSYMBOL(cmd,gensym("*n")); outlet_anything(x->x_out2,gensym("send"),1,cmd); SETSYMBOL(cmd,gensym("N")); outlet_anything(x->x_out2,gensym("send"),1,cmd); } static void serial_ms_float( t_serial_ms* x,t_floatarg f) { int dx,dy; t_atom at[2]; x->x_c[x->x_count] = (char) f; x->x_count = (++x->x_count)%3; if (x->x_count==2) { dx= (signed char)(((x->x_c[0] & 0x03) << 6) | (x->x_c[1] & 0x3F)); dy= (signed char)(((x->x_c[0] & 0x0C) << 4) | (x->x_c[2] & 0x3F)); x->x_posx += dx; x->x_posy += dy; /* post("posx %d, posy %d",x->x_posx,x->x_posy);*/ SETFLOAT(at,x->x_posx); SETFLOAT(at+1,x->x_posy); outlet_list(x->x_obj.ob_outlet,&s_list, 2, at); } } static void *serial_ms_new(t_symbol *s) { t_serial_ms *x = (t_serial_ms *)pd_new(serial_ms_class); x->x_count = 0; x->x_posx = 0; x->x_posy = 0; outlet_new(&x->x_obj, &s_float); x->x_out2 = outlet_new(&x->x_obj, &s_float); return x; } void serial_ms_setup(void) { serial_ms_class = class_new(gensym("serial_ms"), (t_newmethod)serial_ms_new, NULL, sizeof(t_serial_ms), 0,A_DEFSYM,0); class_addfloat(serial_ms_class,serial_ms_float); class_addmethod(serial_ms_class,(t_method) serial_ms_reset,gensym("reset"),0); class_addmethod(serial_ms_class, (t_method)serial_ms_init, gensym("init"),0); } pd-ggee_0.26/control/stripdir-help.pd0000644000076500007650000000031611467116402016306 0ustar hanshans#N canvas 231 207 452 294 10; #X obj 22 78 stripdir; #X symbolatom 22 48 0 0 0; #X obj 22 105 print; #X text 20 22 strips all leading directories from a path; #X connect 0 0 2 0; #X connect 1 0 0 0; pd-ggee_0.26/control/qread.c0000644000076500007650000000472611467116402014444 0ustar hanshans/* (C) Guenter Geiger */ #include #include /* ------------------------ qread ----------------------------- */ #include static t_class *qread_class; #define MAXLINE 255 typedef struct _qread { t_object x_obj; FILE* x_file; int x_size; t_clock* x_clock; t_glist * x_glist; int x_num; t_symbol* x_name; } t_qread; static void qread_open(t_qread *x,t_symbol *filename) { char fname[MAXPDSTRING]; if (filename == &s_) { post("sfread: open without filename"); return; } canvas_makefilename((void*)glist_getcanvas(x->x_glist), filename->s_name, fname, MAXPDSTRING); /* close the old file */ if (x->x_file) fclose(x->x_file); if (!(x->x_file = fopen(fname,"r"))) { error("can't open %s",fname); return; } } void qread_next(t_qread *x) { int i; float delay; char name[MAXLINE]; t_atom at[20]; int ac=0; t_floatarg ff; if (!x->x_file) return; fscanf(x->x_file,"%f",&delay); if (feof(x->x_file)) { clock_unset(x->x_clock); return; } fscanf(x->x_file,"%s",name); #ifdef DEBUG post("next: name = %s delay = %f",name,delay); #endif for (i=0;i<=x->x_num && !feof(x->x_file);i++) { fscanf(x->x_file,"%f",&ff); SETFLOAT(at+i,ff); } ac = i-1; fscanf(x->x_file,";"); clock_delay(x->x_clock,delay); outlet_list(x->x_obj.ob_outlet, gensym(name), ac, at); } static void qread_bang(t_qread *x) { if (!x->x_file) return; fseek(x->x_file,0,SEEK_SET); clock_delay(x->x_clock,0); #ifdef DEBUG post("bang"); #endif } static void qread_stop(t_qread *x) { clock_unset(x->x_clock); } static void *qread_new(t_floatarg n) { t_qread *x = (t_qread *)pd_new(qread_class); outlet_new(&x->x_obj, &s_float); x->x_name = gensym("qread"); x->x_glist = (t_glist*) canvas_getcurrent(); x->x_clock = clock_new(x, (t_method)qread_next); x->x_file = NULL; x->x_num = n; return (x); } void qread_setup(void) { qread_class = class_new(gensym("qread"), (t_newmethod)qread_new, 0, sizeof(t_qread), 0,A_DEFFLOAT,A_NULL); class_addbang(qread_class,qread_bang); class_addmethod(qread_class,(t_method)qread_next,gensym("next"),A_NULL); class_addmethod(qread_class,(t_method)qread_open,gensym("open"),A_SYMBOL,A_NULL); class_addmethod(qread_class,(t_method)qread_stop,gensym("stop"),A_NULL); } pd-ggee_0.26/control/shell-help.pd0000644000076500007650000000245011467116402015556 0ustar hanshans#N canvas 199 124 499 378 10; #X obj 35 100 shell; #X msg 35 65 ls; #X msg 360 97 date +%k%M; #X floatatom 360 141 4 0 0 0 - - -; #X obj 360 118 shell; #X obj 51 319 shell; #X msg 74 288 cvs commit -m fixed_bug_in_shell; #X msg 65 264 cvs -q update; #X msg 12 193 xedit; #X msg 36 213 /usr/bin/perl; #X text 343 79 Getting the time; #X obj 362 233 shell; #X text 345 194 Getting the date; #X symbolatom 362 274 0 0 0 0 - - -; #X msg 362 212 date +%Y.%m.%d; #X obj 362 253 symbol; #X obj 409 234 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 65 126 print DONE; #X obj 35 147 print STDOUT; #X text 30 7 This object allows you to run commands in a UNIX shell. STDIN is received on the inlet. STDOUT is output on the left inlet \, STDERR is output to the Pd console. When execution is complete \, the right outlet is banged.; #X floatatom 61 234 5 0 0 0 - - -; #X floatatom 408 142 5 0 0 0 - - -; #X obj 408 161 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X connect 0 0 18 0; #X connect 0 1 17 0; #X connect 1 0 0 0; #X connect 2 0 4 0; #X connect 4 0 3 0; #X connect 4 1 21 0; #X connect 6 0 5 0; #X connect 7 0 5 0; #X connect 8 0 5 0; #X connect 9 0 5 0; #X connect 11 0 15 0; #X connect 11 1 16 0; #X connect 14 0 11 0; #X connect 15 0 13 0; #X connect 20 0 5 0; #X connect 21 0 22 0; pd-ggee_0.26/control/cvs.pd0000644000076500007650000000137711467116402014323 0ustar hanshans#N canvas 420 4 512 424 10; #X obj 13 338 shell; #X obj 57 386 print; #X msg 13 116 cvs -q update; #X obj 13 361 route ?; #X text 10 97 Click to see changes; #X msg 195 126 fixed_bug_in_shell; #X msg 31 273 cvs commit -m \$1; #X msg 194 152 another_useless_bugfix; #X text 191 100 Click one of these to commit; #X text 13 9 PD CVS access; #X text 118 9 (Yes \, its crazy); #X text 10 57 You will be asked for your password in the console; #X msg 195 185 added_the_cvs_patch; #X text 203 247 Add a new file to the repository; #X msg 202 270 control/cvs.pd; #X msg 52 307 cvs add \$1; #X connect 0 0 3 0; #X connect 2 0 0 0; #X connect 3 1 1 0; #X connect 5 0 6 0; #X connect 6 0 0 0; #X connect 7 0 6 0; #X connect 12 0 6 0; #X connect 14 0 15 0; #X connect 15 0 0 0; pd-ggee_0.26/control/inv.c0000644000076500007650000000305711467116402014140 0ustar hanshans/* (C) Guenter Geiger */ #include typedef struct inv { t_object x_obj; } t_inv; static t_class *inv_class; static void *inv_new(void) { t_inv *x = (t_inv *)pd_new(inv_class); outlet_new(&x->x_obj, gensym("signal")); return (x); } static t_int *inv_perform(t_int *w) /* not static; also used in d_fft.c */ { float *in = *(t_float **)(w+1), *out = *(t_float **)(w+2); t_int n = *(t_int *)(w+3); while (n--) { *out++ = 1/ *in++; } return (w + 4); } static void inv_dsp(t_inv *x, t_signal **sp) { dsp_add(inv_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } void inv_tilde_setup(void) { inv_class = class_new(gensym("inv~"), (t_newmethod)inv_new, 0, sizeof(t_inv), 0, 0); class_addcreator(inv_new,gensym("1/x~"),0); class_addmethod(inv_class, nullfn, gensym("signal"), 0); class_addmethod(inv_class, (t_method)inv_dsp, gensym("dsp"), 0); } typedef struct scalarinv { t_object x_obj; } t_scalarinv; static t_class *scalarinv_class; static void *scalarinv_new(void) { t_scalarinv *x = (t_scalarinv *)pd_new(scalarinv_class); outlet_new(&x->x_obj, gensym("float")); return (x); } static void scalarinv_float(t_scalarinv *x,t_float val) { outlet_float(x->x_obj.ob_outlet,1.0f/val); } void inv_setup(void) { scalarinv_class = class_new(gensym("inv"), (t_newmethod)scalarinv_new, 0, sizeof(t_scalarinv), 0, 0); class_addcreator(scalarinv_new,gensym("1/x"),0); class_addfloat(scalarinv_class, (t_method)scalarinv_float); } pd-ggee_0.26/control/rtout.c0000644000076500007650000000150111467116402014511 0ustar hanshans/* (C) Guenter Geiger */ #include /* -------------------------- rtout -------------------------- */ void sys_putmidimess(int portno, int a, int b, int c); static t_class *rtout_class; typedef struct _rtout { t_object x_obj; t_float x_rt; t_float x_channel; } t_rtout; static void *rtout_new(t_floatarg channel) { t_rtout *x = (t_rtout *)pd_new(rtout_class); if (channel <= 0) channel = 1; x->x_channel = channel; return (x); } static void rtout_float(t_rtout *x, t_float f) { int binchan = (int) x->x_channel - 1; sys_putmidimess((binchan>>4),(int) f,0,0); } void rtout_setup(void) { rtout_class = class_new(gensym("rtout"), (t_newmethod)rtout_new, 0, sizeof(t_rtout), 0, A_DEFFLOAT, A_DEFFLOAT, 0); class_addfloat(rtout_class, rtout_float); } pd-ggee_0.26/control/rtout-help.pd0000644000076500007650000000012711467116402015623 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 rtout; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/unwonk.pd0000644000076500007650000000164111467116402015043 0ustar hanshans#N canvas 273 9 542 405 10; #X obj 53 134 unwonk; #X obj 211 246 print; #X floatatom 39 175; #X floatatom 65 175; #X obj 144 179 unwonk 1 2 3; #X floatatom 119 223; #X floatatom 145 223; #X floatatom 171 223; #X msg 30 100 1 2 3 4 5 6 7 8; #X obj 30 267 unwonk 1 2 3 4 5 6 7 8 9; #X floatatom 27 310; #X floatatom 53 310; #X floatatom 79 310; #X floatatom 105 311; #X floatatom 131 311; #X floatatom 157 311; #X text 25 364 (C) 1999 Guenter Geiger; #X text 27 24 unwonk is an unpack which sends; #X text 27 41 unused symbols to the last outlet; #X text 25 59 instead of discarding them; #X connect 0 0 2 0; #X connect 0 1 3 0; #X connect 0 2 4 0; #X connect 4 0 5 0; #X connect 4 1 6 0; #X connect 4 2 7 0; #X connect 4 3 1 0; #X connect 8 0 0 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X connect 9 1 11 0; #X connect 9 2 12 0; #X connect 9 3 13 0; #X connect 9 4 14 0; #X connect 9 5 15 0; pd-ggee_0.26/control/inv.pd0000644000076500007650000000125411467116402014316 0ustar hanshans#N canvas 201 39 506 289 10; #X floatatom 32 76; #X floatatom 32 137; #X obj 188 93 sig~ 220; #X floatatom 188 74; #X obj 188 150 1/x~; #X obj 188 192 clip~ -1 1; #X obj 181 222 dac~; #X text 25 267 (C) Guenter Geiger; #X obj 188 111 phasor~; #X obj 188 129 +~ 1; #X obj 188 173 -~ 0.5; #X text 184 54 the signal version doesnt look useful to me; #X text 34 54 To make life easier; #X text 32 12 1/x takes the inverse of the input; #X obj 32 107 invert; #X connect 0 0 14 0; #X connect 2 0 8 0; #X connect 3 0 2 0; #X connect 4 0 10 0; #X connect 5 0 6 0; #X connect 5 0 6 1; #X connect 8 0 9 0; #X connect 9 0 4 0; #X connect 10 0 5 0; #X connect 14 0 1 0; pd-ggee_0.26/control/unserialize-help.pd0000644000076500007650000000013511467116402016777 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 unserialize; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/serialctl-help.pd0000644000076500007650000000465611467116402016443 0ustar hanshans#N canvas 91 60 907 514 10; #X msg 202 243 getlines; #X msg 201 169 setlines RTS 0; #X msg 201 187 setlines RTS 1; #X msg 24 213 start; #X msg 24 195 stop; #X msg 515 231 vtime 0 20; #X msg 515 212 setlocal 0; #X msg 515 193 setcontrol 0 CS8 CLOCAL CREAD; #X msg 201 224 setlines DTR 1; #X msg 201 206 setlines DTR 0; #X text 12 489 (C) 2000 Guenter Geiger; #X text 32 22 [serialctl] reads from a Unix serial device. There are several ways how serial devices can be setup \, and [serialctl] provides access to these serial device settings. This makes it possible to interpret the data stream from a serial device either within pd itself \, or via a specially written external for the device attached to the serial port (see serial_bird and serial_ms).; #X msg 516 431 79 \, 75 \, 13; #X msg 517 451 OK \, 13; #X text 201 138 setlines set the serial port; #X text 199 151 lines (only acces to RTS and DTR is provided; #X text 23 153 start/stop; #X text 23 165 reading characters; #X text 23 177 from the device; #X text 510 69 setinput \, setcontrol \, setlocal \, vtime provide access to the termios status bits of the serial device. This is lowlevel configuration and is sometimes necessary.; #X text 512 296 set the baudrate; #X msg 514 348 makeraw; #X text 513 330 configure the device as "raw"; #X text 511 110 If a 0 is prepended to the flags \, the flags are reset before any bits are switched. All other commands set the corresponding bits to either 1 (e.g. CLOCAL) or 0 (!CLOCAL).; #X msg 516 250 listflags; #X msg 716 210 setinput list; #X text 511 151 the "list flag" lists all available flags.; #X text 514 412 data can be sent as symbols or as ASCII character code; #X msg 716 230 setcontrol list; #X msg 717 191 setlocal list; #X msg 514 175 setinput 0 IXOFF; #X floatatom 590 314; #X msg 513 313 speed \$1; #X obj 24 455 print; #X floatatom 62 243; #X msg 73 277 send c; #X obj 24 429 serialctl /dev/ttyS0; #X connect 0 0 36 0; #X connect 1 0 36 0; #X connect 2 0 36 0; #X connect 3 0 36 0; #X connect 4 0 36 0; #X connect 5 0 36 0; #X connect 6 0 36 0; #X connect 7 0 36 0; #X connect 8 0 36 0; #X connect 9 0 36 0; #X connect 12 0 36 0; #X connect 13 0 36 0; #X connect 21 0 36 0; #X connect 24 0 36 0; #X connect 25 0 36 0; #X connect 28 0 36 0; #X connect 29 0 36 0; #X connect 30 0 36 0; #X connect 31 0 32 0; #X connect 32 0 36 0; #X connect 34 0 36 0; #X connect 35 0 36 0; #X connect 36 0 33 0; pd-ggee_0.26/control/serial_mt-help.pd0000644000076500007650000000013311467116402016422 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 serial_mt; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/rl-help.pd0000644000076500007650000000012411467116402015060 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 rl; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/sl.c0000644000076500007650000000355411467116402013764 0ustar hanshans/* (C) Guenter Geiger */ #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------- lsend ------------------------------ */ static t_class *lsend_class; typedef struct _lsend { t_object x_obj; t_symbol *x_sym; } t_lsend; static void lsend_bang(t_lsend *x) { if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); } static void lsend_float(t_lsend *x, t_float f) { if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); } static void lsend_symbol(t_lsend *x, t_symbol *s) { if (x->x_sym->s_thing) pd_symbol(x->x_sym->s_thing, s); } static void lsend_pointer(t_lsend *x, t_gpointer *gp) { if (x->x_sym->s_thing) pd_pointer(x->x_sym->s_thing, gp); } static void lsend_list(t_lsend *x, t_symbol *s, int argc, t_atom *argv) { if (x->x_sym->s_thing) pd_list(x->x_sym->s_thing, s, argc, argv); } static void lsend_anything(t_lsend *x, t_symbol *s, int argc, t_atom *argv) { if (x->x_sym->s_thing) typedmess(x->x_sym->s_thing, s, argc, argv); } static void *lsend_new(t_symbol *s) { t_lsend *x = (t_lsend *)pd_new(lsend_class); char mysym[MAXPDSTRING]; sprintf(mysym,"%s%p",s->s_name,canvas_getcurrent()); x->x_sym = gensym(mysym); return (x); } void sl_setup(void) { lsend_class = class_new(gensym("sendlocal"), (t_newmethod)lsend_new, 0, sizeof(t_lsend), 0, A_DEFSYM, 0); class_addcreator((t_newmethod)lsend_new, gensym("sl"), A_DEFSYM, 0); class_addbang(lsend_class, lsend_bang); class_addfloat(lsend_class, lsend_float); class_addsymbol(lsend_class, lsend_symbol); class_addpointer(lsend_class, lsend_pointer); class_addlist(lsend_class, lsend_list); class_addanything(lsend_class, lsend_anything); post("Warning: sendlocal (sl) is deprecated, please use \"send $0-var\" instead"); } pd-ggee_0.26/control/serialize.c0000644000076500007650000000226411467116402015332 0ustar hanshans/* (C) Guenter Geiger */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ serialize ----------------------------- */ #define MAX_ELEMENTS 256 static t_class *serialize_class; typedef struct _serialize { t_object x_obj; t_atom x_abuf[MAX_ELEMENTS]; t_int x_count; t_float x_elements; } t_serialize; void serialize_float(t_serialize *x,t_floatarg f) { SETFLOAT(&x->x_abuf[x->x_count],f); x->x_count++; if (x->x_count == x->x_elements) { outlet_list(x->x_obj.ob_outlet,0,x->x_count,x->x_abuf); x->x_count = 0; } } static void *serialize_new(t_floatarg f) { t_serialize *x = (t_serialize *)pd_new(serialize_class); outlet_new(&x->x_obj,&s_float); x->x_elements = f; x->x_count=0; if ((f <= 0) || (f > MAX_ELEMENTS)) x->x_elements = 1; floatinlet_new(&x->x_obj, &x->x_elements); return (x); } void serialize_setup(void) { serialize_class = class_new(gensym("serialize"), (t_newmethod)serialize_new, 0, sizeof(t_serialize),0, A_DEFFLOAT,0); class_addfloat(serialize_class,serialize_float); } pd-ggee_0.26/control/sl-help.pd0000644000076500007650000000012411467116402015061 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 sl; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/serial_bird.pd0000644000076500007650000000205111467116402015775 0ustar hanshans#N canvas 48 227 891 382 10; #X obj 77 254 serial_bird; #X msg 98 89 start; #X msg 90 55 poll; #X msg 414 97 mode position; #X msg 77 26 init; #X msg 414 80 mode positionangle; #X obj 77 277 unpack 1 2 3 4 5 6; #X floatatom 180 310; #X floatatom 159 331; #X floatatom 138 355; #X floatatom 97 323; #X floatatom 76 344; #X floatatom 55 368; #X text 415 23 The serial_bird object interprets the acsension Flock of Birds device.; #X text 414 51 The mode command sets the output mode (see FOB description for further information; #X text 114 24 Init initializes the serial device; #X text 125 50 poll stops streaming mode and outputs; #X text 125 60 one data set; #X text 136 89 start streaming mode with start; #X obj 180 254 serialctl /dev/ttyS0; #X connect 0 0 6 0; #X connect 0 1 19 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 0 0; #X connect 6 0 12 0; #X connect 6 1 11 0; #X connect 6 2 10 0; #X connect 6 3 9 0; #X connect 6 4 8 0; #X connect 6 5 7 0; #X connect 19 0 0 0; pd-ggee_0.26/control/constant-help.pd0000644000076500007650000000013211467116402016273 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 constant; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/getdir-help.pd0000644000076500007650000000130711467116402015725 0ustar hanshans#N canvas 196 88 460 383 10; #X obj 177 95 getdir; #X msg 177 57 bang; #X obj 176 133 print; #X text 17 21 get the directory that this patch is operating in:; #X text 18 165 You can also get the path of the parent patch \, if this patch is an object embedded in another patch. You use the argument to set how many levels up to go:; #X msg 99 212 bang; #X obj 98 288 print; #X obj 99 250 getdir 1; #X msg 294 209 bang; #X obj 293 285 print; #X obj 294 247 getdir 2; #X text 18 331 If there is no parent at that level \, it returns the directory as if there was no argument \, i.e. level 0; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 5 0 7 0; #X connect 7 0 6 0; #X connect 8 0 10 0; #X connect 10 0 9 0; pd-ggee_0.26/control/serial_bird-help.pd0000644000076500007650000000013511467116402016724 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 serial_bird; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/unwonk.c0000644000076500007650000000521711467116402014665 0ustar hanshans/* (C) Guenter Geiger */ #include /* -------------------------- unwonk ------------------------------ */ static t_class *unwonk_class; typedef struct unwonkout { t_atomtype u_type; t_outlet *u_outlet; } t_unwonkout; typedef struct _unwonk { t_object x_obj; t_int x_n; t_unwonkout *x_vec; } t_unwonk; static void *unwonk_new(t_symbol *s, int argc, t_atom *argv) { t_unwonk *x = (t_unwonk *)pd_new(unwonk_class); t_atom defarg[2], *ap; t_unwonkout *u; int i; if (!argc) { argv = defarg; argc = 2; SETFLOAT(&defarg[0], 0); SETFLOAT(&defarg[1], 0); } x->x_n = argc + 1; x->x_vec = (t_unwonkout *)getbytes(x->x_n * sizeof(*x->x_vec)); for (i = 0, ap = argv, u = x->x_vec; i < argc; u++, ap++, i++) { t_atomtype type = ap->a_type; if (type == A_SYMBOL) { char c = *ap->a_w.w_symbol->s_name; if (c == 's') { u->u_type = A_SYMBOL; u->u_outlet = outlet_new(&x->x_obj, &s_symbol); } else if (c == 'p') { u->u_type = A_POINTER; u->u_outlet = outlet_new(&x->x_obj, &s_pointer); } else { if (c != 'f') error("unwonk: %s: bad type", ap->a_w.w_symbol->s_name); u->u_type = A_FLOAT; u->u_outlet = outlet_new(&x->x_obj, &s_float); } } else { u->u_type = A_FLOAT; u->u_outlet = outlet_new(&x->x_obj, &s_float); } } u->u_type = A_GIMME; u->u_outlet = outlet_new(&x->x_obj, &s_list); return (x); } static void unwonk_list(t_unwonk *x, t_symbol *s, int argc, t_atom *argv) { t_atom *ap; t_unwonkout *u; int i; int margc = argc; if (argc > x->x_n - 1) margc = x->x_n - 1; if (argc - margc > 0) { ap = argv + margc; u = x->x_vec + margc; outlet_list(u->u_outlet,0,argc - margc, ap); } for (i = margc, u = x->x_vec + i, ap = argv + i; u--, ap--, i--;) { t_atomtype type = u->u_type; if (type != ap->a_type) error("unwonk: type mismatch"); else if (type == A_FLOAT) outlet_float(u->u_outlet, ap->a_w.w_float); else if (type == A_SYMBOL) outlet_symbol(u->u_outlet, ap->a_w.w_symbol); else outlet_pointer(u->u_outlet, ap->a_w.w_gpointer); } } static void unwonk_free(t_unwonk *x) { freebytes(x->x_vec, x->x_n * sizeof(*x->x_vec)); } void unwonk_setup(void) { unwonk_class = class_new(gensym("unwonk"), (t_newmethod)unwonk_new, (t_method)unwonk_free, sizeof(t_unwonk), 0, A_GIMME, 0); class_addlist(unwonk_class, unwonk_list); } pd-ggee_0.26/control/Makefile0000755000076500007650000000240011467116402014632 0ustar hanshanscurrent: nt # TARGETS += stk VERSION = \"0.16\" .SUFFIXES: .dll .obj # ----------------------- NT ---------------------------- NTOBJECTS = *.obj NTDLLS = *.dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo PDNTINCLUDE = /I. /I..\..\pd\src ProgramFiles = c:\Program Files PDNTLDIR = "$(ProgramFiles)\Microsoft Visual Studio\Vc98\lib" PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\wsock32.lib \ $(PDNTLDIR)\kernel32.lib \ $(PDNTLDIR)\uuid.lib \ ..\..\pd\bin\pd.lib nt: $(NTOBJECTS) -link /dll $(PDNTLIB) constant.obj /export:constant_setup -link /dll $(PDNTLIB) inv.obj /export:inv_setup -link /dll $(PDNTLIB) qread.obj /export:qread_setup -link /dll $(PDNTLIB) rl.obj /export:rl_setup -link /dll $(PDNTLIB) rtout.obj /export:rtout_setup -link /dll $(PDNTLIB) unserialize.obj /export:unserialize_setup -link /dll $(PDNTLIB) serialize.obj /export:serialize_setup -link /dll $(PDNTLIB) sinh.obj /export:sinh_setup -link /dll $(PDNTLIB) sl.obj /export:sl_setup -link /dll $(PDNTLIB) stripdir.obj /export:stripdir_setup -link /dll $(PDNTLIB) unwonk.obj /export:unwonk_setup clean: del *.obj del *.dll .c.obj: -cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c .obj.dll: pd-ggee_0.26/control/serial_mt.c0000644000076500007650000000277111467116402015325 0ustar hanshans/* (C) Guenter Geiger */ #include static t_class *serial_mt_class; typedef struct _serial_mt { t_object x_obj; char x_c[4]; t_int x_count; t_int x_posx; t_int x_posy; t_outlet *x_out2; } t_serial_mt; static void serial_mt_reset( t_serial_mt* x) { x->x_posx=0; x->x_posy=0; x->x_count = 0; } static void serial_mt_float( t_serial_mt* x,t_floatarg f) { int dx,dy; x->x_c[x->x_count] = (char) f; x->x_count = (++x->x_count)%3; if (x->x_count==2) { dx= (signed char)(((x->x_c[0] & 0x03) << 6) | (x->x_c[1] & 0x3F)); dy= (signed char)(((x->x_c[0] & 0x0C) << 4) | (x->x_c[2] & 0x3F)); x->x_posx += dx; x->x_posy += dy; /* post("posx %d, posy %d",x->x_posx,x->x_posy); */ outlet_float(x->x_obj.ob_outlet, x->x_posx); outlet_float(x->x_out2, x->x_posy); } } static void *serial_mt_new(t_symbol *s) { t_serial_mt *x = (t_serial_mt *)pd_new(serial_mt_class); x->x_count = 0; x->x_posx = 0; x->x_posy = 0; outlet_new(&x->x_obj, &s_float); x->x_out2 = outlet_new(&x->x_obj, &s_float); return x; } void serial_mt_setup(void) { serial_mt_class = class_new(gensym("serial_mt"), (t_newmethod)serial_mt_new, NULL, sizeof(t_serial_mt), 0,A_DEFSYM,0); class_addfloat(serial_mt_class,serial_mt_float); class_addmethod(serial_mt_class,(t_method) serial_mt_reset,gensym("reset"),0); } pd-ggee_0.26/control/unwonk-help.pd0000644000076500007650000000013011467116402015761 0ustar hanshans#N canvas 1 52 450 300 10; #X obj 140 126 unwonk; #X text 54 47 placeholder help patch; pd-ggee_0.26/control/constant.c0000644000076500007650000000212211467116402015165 0ustar hanshans/* (C) Guenter Geiger */ #include #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ constant ----------------------------- */ #ifndef M_PI #define M_PI 3.141593f #endif static t_class *constant_class; typedef struct _constant { t_object x_obj; t_float x_constant; } t_constant; void constant_bang(t_constant *x) { outlet_float(x->x_obj.ob_outlet, x->x_constant); } static void *constant_new(t_symbol* s) { t_constant *x = (t_constant *)pd_new(constant_class); if (s == &s_) x->x_constant = M_PI; if (!strcmp(s->s_name,"PI")) x->x_constant = M_PI; if (!strcmp(s->s_name,"TWOPI")) x->x_constant = 2*M_PI; if (!strcmp(s->s_name,"e")) x->x_constant = exp(1.0); outlet_new(&x->x_obj, &s_float); return (x); } void constant_setup(void) { constant_class = class_new(gensym("constant"), (t_newmethod)constant_new, 0, sizeof(t_constant), 0,0); class_addbang(constant_class,constant_bang); } pd-ggee_0.26/control/inv-help.pd0000644000076500007650000000045311467116402015244 0ustar hanshans#N canvas 141 276 450 300 10; #X obj 165 115 inv; #X floatatom 165 164 5 0 0 0 - - -; #X text 41 32 perform 1/x using float from inlet; #X obj 166 77 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 1500 1; #X msg 126 77 5; #X connect 0 0 1 0; #X connect 3 0 0 0; #X connect 4 0 0 0; pd-ggee_0.26/control/serialize-help.pd0000644000076500007650000000037211467116402016437 0ustar hanshans#N canvas 246 82 551 292 10; #X obj 34 106 serialize 4; #X obj 34 141 print; #X floatatom 34 69; #X text 30 195 (C) 2000 Guenter Geiger; #X text 30 39 serialize ... turn a stream of floats into a list; #X connect 0 0 1 0; #X connect 2 0 0 0; pd-ggee_0.26/control/shell.c0000644000076500007650000001437011467116402014453 0ustar hanshans/* (C) Guenter Geiger */ /* this doesn't run on Windows (yet?) */ #ifndef _WIN32 #include #include #include #include #include #include #include #include #include void sys_rmpollfn(int fd); void sys_addpollfn(int fd, void* fn, void *ptr); /* ------------------------ shell ----------------------------- */ #define INBUFSIZE 1024 static t_class *shell_class; static void drop_priority(void) { #if (_POSIX_PRIORITY_SCHEDULING - 0) >= 200112L struct sched_param par; int p1 ,p2, p3; par.sched_priority = 0; sched_setscheduler(0,SCHED_OTHER,&par); #endif } typedef struct _shell { t_object x_obj; int x_echo; char *sr_inbuf; int sr_inhead; int sr_intail; void* x_binbuf; int fdpipe[2]; int fdinpipe[2]; int pid; int x_del; t_outlet* x_done; t_clock* x_clock; } t_shell; static int shell_pid; void shell_cleanup(t_shell* x) { sys_rmpollfn(x->fdpipe[0]); if (x->fdpipe[0]>0) close(x->fdpipe[0]); if (x->fdpipe[1]>0) close(x->fdpipe[1]); if (x->fdinpipe[0]>0) close(x->fdinpipe[0]); if (x->fdinpipe[1]>0) close(x->fdinpipe[1]); x->fdpipe[0] = -1; x->fdpipe[1] = -1; x->fdinpipe[0] = -1; x->fdinpipe[1] = -1; clock_unset(x->x_clock); } void shell_check(t_shell* x) { int ret; int status; ret = waitpid(x->pid,&status,WNOHANG); if (ret == x->pid) { shell_cleanup(x); if (WIFEXITED(status)) { outlet_float(x->x_done,WEXITSTATUS(status)); } else outlet_float(x->x_done,0); } else { if (x->x_del < 100) x->x_del+=2; /* increment poll times */ clock_delay(x->x_clock,x->x_del); } } void shell_bang(t_shell *x) { post("bang"); } /* snippet from pd's code */ static void shell_doit(void *z, t_binbuf *b) { t_shell *x = (t_shell *)z; int msg, natom = binbuf_getnatom(b); t_atom *at = binbuf_getvec(b); for (msg = 0; msg < natom;) { int emsg; for (emsg = msg; emsg < natom && at[emsg].a_type != A_COMMA && at[emsg].a_type != A_SEMI; emsg++) ; if (emsg > msg) { int i; for (i = msg; i < emsg; i++) if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM) { pd_error(x, "netreceive: got dollar sign in message"); goto nodice; } if (at[msg].a_type == A_FLOAT) { if (emsg > msg + 1) outlet_list(x->x_obj.ob_outlet, 0, emsg-msg, at + msg); else outlet_float(x->x_obj.ob_outlet, at[msg].a_w.w_float); } else if (at[msg].a_type == A_SYMBOL) outlet_anything(x->x_obj.ob_outlet, at[msg].a_w.w_symbol, emsg-msg-1, at + msg + 1); } nodice: msg = emsg + 1; } } void shell_read(t_shell *x, int fd) { char buf[INBUFSIZE]; t_binbuf* bbuf = binbuf_new(); int i; int readto = (x->sr_inhead >= x->sr_intail ? INBUFSIZE : x->sr_intail-1); int ret; ret = read(fd, buf,INBUFSIZE-1); buf[ret] = '\0'; for (i=0;ifdpipe[0] = -1; close(fd); return; } else if (ret == 0) { post("EOF on socket %d\n", fd); sys_rmpollfn(fd); x->fdpipe[0] = -1; close(fd); return; } else { int natom; t_atom *at; binbuf_text(bbuf, buf, strlen(buf)); natom = binbuf_getnatom(bbuf); at = binbuf_getvec(bbuf); shell_doit(x,bbuf); } binbuf_free(bbuf); } static void shell_send(t_shell *x, t_symbol *s,int ac, t_atom *at) { int i; char tmp[MAXPDSTRING]; int size = 0; if (x->fdinpipe[0] == -1) return; /* nothing to send to */ for (i=0;ifdinpipe[0],tmp,strlen(tmp)); } static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at) { int i; char* argv[255]; t_symbol* sym; if (!strcmp(s->s_name,"send")) { post("send"); shell_send(x,s,ac,at); return; } argv[0] = s->s_name; if (x->fdpipe[0] != -1) { post("shell: old process still running"); kill(x->pid,SIGKILL); shell_cleanup(x); } if (pipe(x->fdpipe) < 0) { error("unable to create pipe"); return; } if (pipe(x->fdinpipe) < 0) { error("unable to create input pipe"); return; } sys_addpollfn(x->fdpipe[0],shell_read,x); if (!(x->pid = fork())) { /* reassign stdout */ dup2(x->fdpipe[1],1); dup2(x->fdinpipe[1],0); /* drop privileges */ drop_priority(); seteuid(getuid()); /* lose setuid priveliges */ #ifdef __APPLE__ for (i=1;i<=ac;i++) { argv[i] = getbytes(255); atom_string(at,argv[i],255); at++; } argv[i] = 0; execvp(s->s_name,argv); #else char* cmd = getbytes(1024); char* tcmd = getbytes(1024); strcpy(cmd,s->s_name); for (i=1;i<=ac;i++) { atom_string(at,tcmd,255); strcat(cmd," "); strcat(cmd,tcmd); at++; } verbose(4,"executing %s",cmd); system(cmd); #endif /* __APPLE__ */ exit(0); } x->x_del = 4; clock_delay(x->x_clock,x->x_del); if (x->x_echo) outlet_anything(x->x_obj.ob_outlet, s, ac, at); } void shell_free(t_shell* x) { binbuf_free(x->x_binbuf); } static void *shell_new(void) { t_shell *x = (t_shell *)pd_new(shell_class); x->x_echo = 0; x->fdpipe[0] = -1; x->fdpipe[1] = -1; x->fdinpipe[0] = -1; x->fdinpipe[1] = -1; x->sr_inhead = x->sr_intail = 0; if (!(x->sr_inbuf = (char*) malloc(INBUFSIZE))) bug("t_shell");; x->x_binbuf = binbuf_new(); outlet_new(&x->x_obj, &s_list); x->x_done = outlet_new(&x->x_obj, &s_bang); x->x_clock = clock_new(x, (t_method) shell_check); return (x); } void shell_setup(void) { shell_class = class_new(gensym("shell"), (t_newmethod)shell_new, (t_method)shell_free,sizeof(t_shell), 0,0); class_addbang(shell_class,shell_bang); class_addanything(shell_class, shell_anything); } #endif /* _WIN32 */ pd-ggee_0.26/changes0000644000076500007650000000624011467116403013051 0ustar hanshans0.1 First compilation, changed object names to include "~" 0.2 Added basic fof~ object 0.3 added Windows nt support (no sfread yet) 0.4 added the format message to streamout~ (will be autodetected by streamin~). improved fof~ (offset bug, signal frequency) added adsr~ object. 0.5 fixed deadlock bug in streamin~ - streamout~ added 8bit format, fixed makefile flags for alpha (-mieee) added host message and default arguments to streamout~ 0.6 added sfwrite object compilation support for Windows added state object (savestate) added slider object 0.7 envgen~ prototype bugfixes in sfread (multichannel, added loop switch) initialization bug in state object, added support for saving with symbols toddle object (was here in 0.6 already) 0.8 state - in order to prevent overwriting of states, the save messages stays only valid for 2 seconds now. state - initialization bug slider - made slider thicker envgen - added freeze message to envgen, fixed bug in duration setting delete points when deleting widget, reorganized durations structure, fixed bug during object instantiation. 0.9 envgen is a message object now, which sends messages to a line~ implemented state for envgen. 0.10 added stk object. 0.11 - 0.12 fixed bug in ticker (moving when on) added several objects serial (speeks the Micosoft Mouse protocol) rtout (for sending realtime (raw) midi messages) locals, localr (sending messages locally) 1/x~ , 1/x ... simple shortcuts for the inverse fasor~ ( a phasor which changes it's frequency only on phase 0) sfplay ... from Winfried Ritsch unwonk .. an unpack which sends it's rest through the last outlet atan2~ ... the signal arctan to figure out phase values. This is very slow. 0.14 - slider: now has a width argument, thanks to dieter@rhiz.org fixed the "drawing when hidden" bug. - readserial: several updates for the MicroTouch ThruGlass controller - log~, exp~, .. just what they say, very bad performers .... - envgen memory bug fixed. - sfread fixed segfault when open fails during play 0.15 - added different filter objects, which create lists suitable for biquad. - again several other minor bugfixes - first implementation of a dynamic mixer object - added wave header for sfwrite, improved performance 0.16 - renamed ggext to ggee, new compilation scheme which produces single externals - speed improvments for sfread~ 0.17 - fixed build problem for "make ggext" 0.18 0.19 - rewrote selections for envgen. - added (endoffile) bang to sfplay if file is not found 0.20 - fixed shell external 0.21 - added patch from to serialize - fixed pipe exhaustion problem in shell 0.22 - removed the GUI Objects Slider, HSlider, toddle, ticker 0.23 - updated the stk external to use stk 3.2 0.24 - moved moog~ to filters, improved stability. 0.25 - big GUI revival with face lifting 0.26 - fixed for packaging for Debian pd-ggee_0.26/ggee-meta.pd0000644000076500007650000000044511467116403013677 0ustar hanshans#N canvas 10 10 200 200 10; #N canvas 20 20 420 300 META 0; #X text 10 10 META this is a prototype of a libdir meta file; #X text 10 10 NAME ggee; #X text 10 10 AUTHOR Guenter Geiger; #X text 10 10 DESCRIPTION ; #X text 10 10 LICENSE BSD; #X text 10 10 VERSION 0.26; #X restore 10 10 pd META; pd-ggee_0.26/README.txt0000644000076500007650000000114511467116403013213 0ustar hanshans ggee is a library by Guenter Geiger with five sections: control, experimental, filters, gui, and signal. * objects for controlling things: constant rl serial_ms sl getdir rtout serial_mt stripdir inv serial_bird shell unserialize qread serialize sinh unwonk * experimental synths: fofsynth~ tabwrite4~ pvocfreq * objects for controlling filters: bandpass highpass hlshelf lowshelf notch equalizer highshelf lowpass moog~ * GUI objects: button fatom image sliderh ticker envgen gcanvas slider state toddle * manipulating signals: atan2~ mixer~ sfwrite~ streamin~ streamout~ Guenter Geiger pd-ggee_0.26/gui/0000755000076500007650000000000011467116403012300 5ustar hanshanspd-ggee_0.26/gui/slider-help.pd0000644000076500007650000000211711467116403015036 0ustar hanshans#N canvas 465 157 666 446 12; #X obj 14 121 slider 127 0 15; #X floatatom 12 42 0 0 0 0 - - -; #X floatatom 14 319 0 0 0 0 - - -; #X text 140 188 This was instantiated with slider\ 200\ 100; #X obj 14 85 random 127; #X obj 468 343 state sl; #X msg 468 283 save; #X msg 520 283 1; #X floatatom 98 296 0 0 0 0 - - -; #X obj 186 252 slider 127 0 40; #X text 184 231 This was instantiated with slider\ 127\ 0\ 40; #X obj 274 333 sliderh 127 0 30; #X text 273 307 Same with sliderh; #X floatatom 274 384 5 0 0 0 - - -; #X text 126 11 Instantiate a new slider with Put->Object and type slider into the object. The slider takes up to 3 parameters \, the first is the maximum value \, the second is the minimum. The third is the width of the slider (contributed by Dieter . Click on the through to move in 0.01. Middle button jumps.; #X obj 12 64 metro 2; #X obj 98 167 slider 200 100 15; #X text 125 117 Slider is state aware.; #X connect 0 0 2 0; #X connect 1 0 15 0; #X connect 4 0 0 0; #X connect 6 0 5 0; #X connect 7 0 5 0; #X connect 11 0 13 0; #X connect 15 0 4 0; #X connect 16 0 8 0; pd-ggee_0.26/gui/state.c0000644000076500007650000001701511467116403013570 0ustar hanshans/* (C) Guenter Geiger */ #include #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* hacks .... this duplicates definitions in pd and must be * adjusted if something changes there !!!! */ #define EMPTYSYMBOL "emptysymbol" typedef struct _mygatom { t_text a_text; t_atom a_atom; } t_mygatom; /* this is not !! the real t_gatom ...*/ #define TATOM(a) (&((t_mygatom*)a)->a_atom) #define ATOMVAL(a) a->a_w.w_float /* glist's are not visible, but the only thing we need is to get the list link from them */ typedef struct _myglist { t_object gl_gobj; t_gobj* g_list; } t_myglist; #define FIRSTOBJECT(a) (((t_myglist*)a)->g_list) #ifndef vmess #define vmess pd_vmess #endif /* ------------------------ State ----------------------------- */ #include "envgen.h" static t_class *state_class; typedef struct _state { t_object x_obj; t_canvas* x_canvas; t_symbol* x_name; int x_slot; t_symbol* x_symslot; int x_save; int x_loading; t_clock* x_clock; } t_state; void state_dosave(t_state *x) { char name[255]; FILE* fp; t_text* a; t_symbol* dir; char dirstr[255]; #ifdef _WIN32 dir = gensym(""); #else dir = canvas_getdir(x->x_canvas); #endif strcpy(dirstr,dir->s_name); #ifndef _WIN32 strcat(dirstr,"/"); #endif if (x->x_symslot) sprintf(name,"%s%s.%s",dirstr,x->x_name->s_name,x->x_symslot->s_name); else sprintf(name,"%s%s.%d",dirstr,x->x_name->s_name,x->x_slot); fp = fopen(name,"w"); if (!fp) { post("state: unable to open %s",name); return; } a = (t_text*)FIRSTOBJECT(x->x_canvas); do { if (a->te_type == T_ATOM) { if (TATOM(a)->a_type == A_SYMBOL) { if (strlen(TATOM(a)->a_w.w_symbol->s_name)) fprintf(fp,"%s\n",atom_getsymbol(TATOM(a))->s_name); else fprintf(fp,EMPTYSYMBOL"\n"); } else { fprintf(fp,"%f\n",atom_getfloat(TATOM(a))); } } /* slider should be an atom as well ... how to do it ? */ if (!strcmp(class_getname(a->te_pd),"slider")) { fprintf(fp,"%f\n",atom_getfloat(TATOM(a))); } if (!strcmp(class_getname(a->te_pd),"sliderh")) { fprintf(fp,"%f\n",atom_getfloat(TATOM(a))); } if (!strcmp(class_getname(a->te_pd),"ticker")) { fprintf(fp,"%f\n",atom_getfloat(TATOM(a))); } #if 0 if (!strcmp(class_getname(a->te_pd),"vsl")) { /* float val = atom_getfloat(TATOM(a));*/ float val = *((float*) (((char*)a) + sizeof(t_iemgui) + sizeof(int))); fprintf(fp,"%f\n",val); fprintf(stderr,"vslider %f\n",val); } if (!strcmp(class_getname(a->te_pd),"hsl")) { float val = *((float*) (((char*)a) + sizeof(t_iemgui) + sizeof(int))); fprintf(fp,"%f\n",val); fprintf(stderr,"hslider %f\n",val); } #endif if (!strncmp(class_getname(a->te_pd),"envgen",6)) { int i; t_envgen* e = (t_envgen*) a; fprintf(fp,"%d ",e->last_state); fprintf(fp,"%f ",e->finalvalues[0]); for (i=1;i <= e->last_state;i++) fprintf(fp,"%f %f ",e->duration[i] - e->duration[i-1],e->finalvalues[i]); fprintf(fp,"\n"); } } while ((a = (t_text*)((t_gobj*)a)->g_next)); post("state saved to: %s",name); fclose(fp); } void state_save(t_state *x) { x->x_save = 1; clock_delay(x->x_clock,2000); } void state_saveoff(t_state *x) { x->x_save = 0; } void state_load(t_state *x) { char name[255]; FILE* fp; t_text* a; t_float in; t_symbol* dir; char dirstr[255]; #ifdef _WIN32 dir = gensym(""); #else dir = canvas_getdir(x->x_canvas); #endif strcpy(dirstr,dir->s_name); #ifndef _WIN32 strcat(dirstr,"/"); #endif if (x->x_symslot) sprintf(name,"%s%s.%s",dirstr,x->x_name->s_name,x->x_symslot->s_name); else sprintf(name,"%s%s.%d",dirstr,x->x_name->s_name,x->x_slot); fp = fopen(name,"r"); if (!fp) { post("state: unable to open %s",name); return; } a = (t_text*) FIRSTOBJECT(x->x_canvas); x->x_loading = 1; post("state loading from: %s",name); *name = 0; do { if (a->te_type == T_ATOM || !strcmp(class_getname(a->te_pd),"slider") || !strcmp(class_getname(a->te_pd),"ticker") || !strcmp(class_getname(a->te_pd),"sliderh") /* || !strcmp(class_getname(a->te_pd),"vsl") || !strcmp(class_getname(a->te_pd),"hsl" ) */ ) { if (TATOM(a)->a_type == A_SYMBOL) { if (fscanf(fp,"%s",name)<=0) continue; if (strcmp(name,EMPTYSYMBOL)) vmess((t_pd*)a,gensym("set"),"s",gensym(name)); } else { if (fscanf(fp,"%f",&in)<=0) continue; vmess((t_pd*)a,&s_float,"f",in); } } if (!strncmp(class_getname(a->te_pd),"envgen",6)) { int i; int end; float val; float dur; t_atom ilist[255]; fscanf(fp,"%f",&in); end = in; if (fscanf(fp,"%f",&val)<=0) continue; SETFLOAT(ilist,val); for (i=1 ;i <= end;i++) { fscanf(fp,"%f",&dur); fscanf(fp,"%f",&val); SETFLOAT(ilist +2*i-1,dur); SETFLOAT(ilist+2*i,val); } pd_typedmess((t_pd*)a,&s_list,2*end+1,ilist); // post("ok %d",end); } } while ((a = (t_text*)((t_gobj*)a)->g_next) && !feof(fp)); x->x_loading = 0; fclose(fp); } void state_float(t_state *x,t_floatarg f) { if (x->x_loading) return; x->x_symslot = NULL; x->x_slot = f; if (x->x_save) { x->x_save = 0; state_dosave(x); return; } state_load(x); outlet_float(x->x_obj.ob_outlet,x->x_slot); } void state_anything(t_state *x,t_symbol* s,t_int argc,t_atom* argv) { x->x_symslot = s; if (x->x_save) { x->x_save = 0; state_dosave(x); return; } state_load(x); outlet_symbol(x->x_obj.ob_outlet,x->x_symslot); } void state_symbol(t_state *x,t_symbol* s) { x->x_symslot = s; if (x->x_save) { x->x_save = 0; state_dosave(x); return; } state_load(x); outlet_symbol(x->x_obj.ob_outlet,x->x_symslot); } void state_bang(t_state *x) { if (x->x_symslot) outlet_symbol(x->x_obj.ob_outlet,x->x_symslot); else outlet_float(x->x_obj.ob_outlet,x->x_slot); } static void *state_new(t_symbol* name) { t_state *x = (t_state *)pd_new(state_class); x->x_canvas = canvas_getcurrent(); if (name != &s_) x->x_name = name; else x->x_name = gensym("state"); x->x_clock = clock_new(x, (t_method)state_saveoff); x->x_slot = 0; x->x_symslot = NULL; x->x_loading = 0; x->x_save = 0; outlet_new(&x->x_obj, &s_float); return (x); } void state_setup(void) { state_class = class_new(gensym("state"), (t_newmethod)state_new, 0, sizeof(t_state), 0,A_DEFSYM,0); class_addfloat(state_class,state_float); class_addmethod(state_class,(t_method) state_save, gensym("save"), 0); class_addanything(state_class,(t_method) state_anything); class_addbang(state_class,state_bang); class_addsymbol(state_class,state_symbol); /* class_addmethod(state_class, (t_method)state_load, gensym("load"), 0);*/ } pd-ggee_0.26/gui/w_envgen.h0000644000076500007650000003002011467116403014254 0ustar hanshans#include #include #include #ifdef _WIN32 #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #define abs fabs #endif #define BACKGROUNDCOLOR "grey" #define BORDER 2 static void draw_inlets(t_envgen *x, t_glist *glist, int firsttime, int nin, int nout) { int n = nout; int nplus, i; int xpos = text_xpix(&x->x_obj,glist); int ypos = text_ypix(&x->x_obj,glist); nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = xpos + (x->w.width-2*BORDER) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n", glist_getcanvas(glist), onset, ypos + x->w.height - 1 + 2*BORDER, onset + IOWIDTH, ypos + x->w.height + 2*BORDER, x, i); else sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, ypos + x->w.height - 1 + 2*BORDER, onset + IOWIDTH, ypos + x->w.height + 2*BORDER); } n = nin; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = xpos + (x->w.width - IOWIDTH) * i / nplus - BORDER; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n", glist_getcanvas(glist), onset, ypos - BORDER, onset + IOWIDTH, ypos + 1 - BORDER, x, i); else sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, ypos - BORDER, onset + IOWIDTH, ypos + 1 - BORDER); } } static int envgen_next_doodle(t_envgen *x, struct _glist *glist, int xpos,int ypos) { int ret = -1; float xscale,yscale; int dxpos,dypos; float minval = 100000.0; float tval; int i; int insertpos = -1; if (xpos > text_xpix(&x->x_obj,glist) + x->w.width) xpos = text_xpix(&x->x_obj,glist) + x->w.width; xscale = x->w.width/x->duration[x->last_state]; yscale = x->w.height; dxpos = text_xpix(&x->x_obj,glist);/* + BORDER */; dypos = text_ypix(&x->x_obj,glist) + BORDER; for (i=0;i<=x->last_state;i++) { float dx2 = (dxpos + (x->duration[i] * xscale)) - xpos; float dy2 = (dypos + yscale - (x->finalvalues[i] * yscale)) - ypos; dx2*=dx2; dy2*=dy2; tval = sqrt(dx2+dy2); if (tval <= minval) { minval = tval; insertpos = i; } } /* decide if we want to make a new one */ if (minval > /*5*/ 8 && insertpos >= 0 && !x->x_freeze) { while (((dxpos + (x->duration[insertpos] * xscale)) - xpos) < 0) insertpos++; while (((dxpos + (x->duration[insertpos-1] * xscale)) - xpos) > 0) insertpos--; if (x->last_state+1 >= x->args) envgen_resize(x,x->args+1); for (i=x->last_state;i>=insertpos;i--) { x->duration[i+1] = x->duration[i]; x->finalvalues[i+1] = x->finalvalues[i]; } x->duration[insertpos] = (float)(xpos-dxpos)/x->w.width*x->duration[x->last_state++]; x->w.pointerx = xpos; x->w.pointery = ypos; } else { x->w.pointerx = text_xpix(&x->x_obj,glist) + x->duration[insertpos]*x->w.width/x->duration[x->last_state]; x->w.pointery = text_ypix(&x->x_obj,glist) + (1.f - x->finalvalues[insertpos])*x->w.height; } x->w.grabbed = insertpos; return insertpos; } static void envgen_create_doodles(t_envgen *x, t_glist *glist) { float xscale,yscale; int xpos,ypos; int i; char guistr[255]; xscale = x->w.width/x->duration[x->last_state]; yscale = x->w.height; xpos = text_xpix(&x->x_obj,glist); ypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height); for (i=0;i<=x->last_state;i++) { sprintf(guistr,".x%x.c create oval %d %d %d %d -tags %xD%d",(unsigned int)glist_getcanvas(glist), (int) (xpos+(x->duration[i] * xscale) - 2), (int) (ypos - x->finalvalues[i]*yscale - 2), (int) (xpos+(x->duration[i] * xscale)+2), (int) (ypos - x->finalvalues[i]*yscale + 2), (unsigned int)x,i); if (i == x->w.grabbed) strcat(guistr," -fill red\n"); else strcat(guistr,"\n"); sys_vgui("%s",guistr); } x->w.numdoodles = i; } static void envgen_delete_doodles(t_envgen *x, t_glist *glist) { int i; for (i=0;i<=x->w.numdoodles;i++) { sys_vgui(".x%x.c delete %xD%d\n",glist_getcanvas(glist),x,i); } } static void envgen_update_doodles(t_envgen *x, t_glist *glist) { envgen_delete_doodles(x,glist); /* LATER only create new doodles if necessary */ envgen_create_doodles(x, glist); } static void envgen_delnum(t_envgen *x) { sys_vgui(".x%x.c delete %xT\n",glist_getcanvas(x->w.glist),x); } static void envgen_shownum(t_envgen *x,t_glist* glist) { float xscale,yscale; int xpos,ypos; int i= x->w.grabbed; xscale = x->w.width/x->duration[x->last_state]; yscale = x->w.height; xpos = text_xpix(&x->x_obj,glist); ypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height); envgen_delnum(x); sys_vgui(".x%x.c create text %d %d -text %fx%f -tags %xT\n", (unsigned int)glist_getcanvas(x->w.glist), (int) (xpos+(x->duration[i] * xscale) + 12), (int) (ypos - x->finalvalues[i]*yscale - 2), x->finalvalues[i]*(x->max-x->min), x->duration[i], (unsigned int)x); clock_delay(x->w.numclock,700); } static void envgen_create(t_envgen *x, t_glist *glist) { int i; static char buf[1024]; float xscale,yscale; int xpos,ypos; char num[40]; xpos = text_xpix(&x->x_obj,glist); ypos = (int) text_ypix(&x->x_obj,glist); x->w.numclock = clock_new(x, (t_method) envgen_delnum); sys_vgui(".x%x.c create rectangle \ %d %d %d %d -tags %xS -fill "BACKGROUNDCOLOR"\n", glist_getcanvas(glist), xpos-BORDER, ypos-BORDER, xpos + x->w.width+2*BORDER, ypos + x->w.height+2*BORDER, x); xscale = x->w.width/x->duration[x->last_state]; yscale = x->w.height; sprintf(buf,".x%x.c create line",(unsigned int)glist_getcanvas(glist)); for (i=0;i<=x->last_state;i++) { sprintf(num," %d %d ",(int)(xpos + x->duration[i]*xscale), (int)(ypos + x->w.height- x->finalvalues[i]*yscale)); strcat(buf,num); } sprintf(num,"-tags %pP\n",x); strcat(buf,num); sys_vgui("%s",buf); envgen_create_doodles(x,glist); } static void envgen_update(t_envgen *x, t_glist *glist) { int i; static char buf[1024]; float xscale,yscale; char num[40]; int xpos = text_xpix(&x->x_obj,glist); int ypos = text_ypix(&x->x_obj,glist); sys_vgui(".x%x.c coords %xS \ %d %d %d %d\n", glist_getcanvas(glist), x, xpos - BORDER, ypos -BORDER, xpos + x->w.width+2*BORDER, ypos + x->w.height+2*BORDER); xscale = x->w.width/x->duration[x->last_state]; yscale = x->w.height; sprintf(buf,".x%x.c coords %pP",(unsigned int)glist_getcanvas(glist),x); for (i=0;i<=x->last_state;i++) { sprintf(num," %d %d ",(int)(xpos + x->duration[i]*xscale), (int) (ypos + x->w.height - x->finalvalues[i]*yscale)); strcat(buf,num); } strcat(buf,"\n"); sys_vgui("%s",buf); envgen_update_doodles(x,glist); draw_inlets(x, glist, 0,1,2); } void envgen_drawme(t_envgen *x, t_glist *glist, int firsttime) { if (firsttime) envgen_create(x,glist); else envgen_update(x,glist); draw_inlets(x, glist, firsttime, 1,2); } void envgen_erase(t_envgen* x,t_glist* glist) { int n; sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); sys_vgui(".x%x.c delete %pP\n", glist_getcanvas(glist), x); sys_vgui(".x%x.c delete %xi0\n",glist_getcanvas(glist),x); sys_vgui(".x%x.c delete %xo0\n",glist_getcanvas(glist),x); sys_vgui(".x%x.c delete %xo1\n",glist_getcanvas(glist),x); envgen_delete_doodles(x,glist); } /* ------------------------ envgen widgetbehaviour----------------------------- */ static void envgen_getrect(t_gobj *z, t_glist *owner, int *xp1, int *yp1, int *xp2, int *yp2) { int width, height; t_envgen* s = (t_envgen*)z; width = s->w.width + 2*BORDER; height = s->w.height + 2*BORDER; *xp1 = text_xpix(&s->x_obj,owner)-BORDER; *yp1 = text_ypix(&s->x_obj,owner)-BORDER; *xp2 = text_xpix(&s->x_obj,owner) + width + 4; *yp2 = text_ypix(&s->x_obj,owner) + height + 4; } static void envgen_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_envgen *x = (t_envgen *)z; x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; envgen_drawme(x, glist, 0); canvas_fixlinesfor(glist,(t_text*) x); } static void envgen_select(t_gobj *z, t_glist *glist, int state) { t_envgen *x = (t_envgen *)z; sys_vgui(".x%x.c itemconfigure %xS -fill %s\n", glist, x, (state? "blue" : BACKGROUNDCOLOR)); } static void envgen_activate(t_gobj *z, t_glist *glist, int state) { /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ } static void envgen_delete(t_gobj *z, t_glist *glist) { t_text *x = (t_text *)z; canvas_deletelinesfor(glist, x); } static void envgen_vis(t_gobj *z, t_glist *glist, int vis) { t_envgen* s = (t_envgen*)z; if (vis) envgen_drawme(s, glist, 1); else envgen_erase(s,glist); } /* can we use the normal text save function ?? */ static void envgen_save(t_gobj *z, t_binbuf *b) { t_envgen *x = (t_envgen *)z; binbuf_addv(b, "ssiisiiffss", gensym("#X"), gensym("obj"), (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix, atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->w.width,x->w.height,x->max,x->min,x->r_sym,x->s_sym); binbuf_addv(b, ";"); } static void envgen_followpointer(t_envgen* x,t_glist* glist) { float dur; float xscale = x->duration[x->last_state]/x->w.width; if ((x->w.grabbed > 0) && (x->w.grabbed < x->last_state)) { dur = (x->w.pointerx - text_xpix(&x->x_obj,glist))*xscale; if (dur < x->duration[x->w.grabbed-1]) dur = x->duration[x->w.grabbed-1]; if (dur > x->duration[x->w.grabbed+1]) dur = x->duration[x->w.grabbed+1]; x->duration[x->w.grabbed] = dur; } x->finalvalues[x->w.grabbed] = 1.0f - (x->w.pointery - (float)text_ypix(&x->x_obj,glist))/(float)x->w.height; if (x->finalvalues[x->w.grabbed] < 0.0) x->finalvalues[x->w.grabbed]= 0.0; else if (x->finalvalues[x->w.grabbed] > 1.0) x->finalvalues[x->w.grabbed]= 1.0; } void envgen_motion(t_envgen *x, t_floatarg dx, t_floatarg dy) { if (x->w.shift) { x->w.pointerx+=dx/1000.f; x->w.pointery+=dy/1000.f; } else { x->w.pointerx+=dx; x->w.pointery+=dy; } if (!x->resizing) envgen_followpointer(x,x->w.glist); else { x->w.width+=dx; x->w.height+=dy; } envgen_shownum(x,x->w.glist); envgen_update(x,x->w.glist); } void envgen_key(t_envgen *x, t_floatarg f) { if (f == 8.0 && x->w.grabbed < x->last_state && x->w.grabbed > 0) { int i; for (i=x->w.grabbed;i<=x->last_state;i++) { x->duration[i] = x->duration[i+1]; x->finalvalues[i] = x->finalvalues[i+1]; } x->last_state--; x->w.grabbed--; envgen_update(x,x->w.glist); } } static int envgen_newclick(t_envgen *x, struct _glist *glist, int xpos, int ypos, int shift, int alt, int dbl, int doit) { /* check if user wants to resize */ float wxpos = text_xpix(&x->x_obj,glist); float wypos = (int) (text_ypix(&x->x_obj,glist) + x->w.height); if (doit){ envgen_next_doodle(x,glist,xpos,ypos); glist_grab(x->w.glist, &x->x_obj.te_g, (t_glistmotionfn) envgen_motion, (t_glistkeyfn) envgen_key, xpos, ypos); x->resizing = 0; if (x->resizeable && (xpos > wxpos + x->w.width) && (ypos > wypos)) { x->resizing = 1; return; } x->w.shift = shift; envgen_followpointer(x,glist); envgen_shownum(x,glist); envgen_update(x,glist); } return (1); } pd-ggee_0.26/gui/envgen.h0000644000076500007650000000205511467116403013735 0ustar hanshans#ifndef __GG_ENVGEN_H__ #define __GG_ENVGEN_H__ #include "g_canvas.h" typedef struct _wenvgen { t_glist* glist; int width; int height; int numdoodles; int grabbed; /* for moving points */ int shift; /* move 100th */ float pointerx; float pointery; t_clock* numclock; } t_wenvgen; typedef struct _envgen { t_object x_obj; t_float x_val; int x_state; int last_state; int sustain_state; int envchanged; t_float* finalvalues; t_float* duration; t_float totaldur; t_int args; /* get rid of that */ t_int resizing; t_int resizeable; t_symbol* r_sym; t_symbol* s_sym; t_float min; t_float max; t_clock* x_clock; t_float x_freeze; t_outlet* out2; /* widget parameters */ t_wenvgen w; } t_envgen; t_widgetbehavior envgen_widgetbehavior; void envgen_drawme(t_envgen *x, t_glist *glist, int firsttime); int envgen_set_values(t_envgen * x); void envgen_resize(t_envgen* x,int ns); #endif pd-ggee_0.26/gui/image.c0000644000076500007650000001354511467116403013536 0ustar hanshans#include #include #include "g_canvas.h" #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ image ----------------------------- */ static t_class *image_class; typedef struct _image { t_object x_obj; t_glist * x_glist; int x_width; int x_height; t_symbol* x_fname; } t_image; /* widget helper functions */ void image_drawme(t_image *x, t_glist *glist, int firsttime) { if (firsttime) { char fname[MAXPDSTRING]; canvas_makefilename(glist_getcanvas(x->x_glist), x->x_fname->s_name, fname, MAXPDSTRING); sys_vgui("image create photo img%x -file {%s}\n",x,fname); sys_vgui(".x%x.c create image %d %d -image img%x -tags %xS\n", glist_getcanvas(glist),text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x,x); /* TODO callback from gui sys_vgui("image_size logo"); */ } else { sys_vgui(".x%x.c coords %xS %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)); } } void image_erase(t_image* x,t_glist* glist) { int n; sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); } static t_symbol *get_filename(t_int argc, t_atom *argv) { t_symbol *fname; fname = atom_getsymbolarg(0, argc, argv); if(argc > 1) { int i; char buf[MAXPDSTRING]; strcpy(buf, fname->s_name); for(i = 1; i < argc; i++) { strcat(buf, " "); strcat(buf, atom_getsymbolarg(i, argc, argv)->s_name); } fname = gensym(buf); } return fname; } /* ------------------------ image widgetbehaviour----------------------------- */ static void image_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { int width, height; t_image* x = (t_image*)z; width = x->x_width; height = x->x_height; *xp1 = text_xpix(&x->x_obj, glist); *yp1 = text_ypix(&x->x_obj, glist); *xp2 = text_xpix(&x->x_obj, glist) + width; *yp2 = text_ypix(&x->x_obj, glist) + height; } static void image_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_image *x = (t_image *)z; x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height); image_drawme(x, glist, 0); canvas_fixlinesfor(glist,(t_text*) x); } static void image_select(t_gobj *z, t_glist *glist, int state) { t_image *x = (t_image *)z; if (state) { sys_vgui(".x%x.c create rectangle \ %d %d %d %d -tags %xSEL -outline blue\n", glist_getcanvas(glist), text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height, x); } else { sys_vgui(".x%x.c delete %xSEL\n", glist_getcanvas(glist), x); } } static void image_activate(t_gobj *z, t_glist *glist, int state) { /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ } static void image_delete(t_gobj *z, t_glist *glist) { t_text *x = (t_text *)z; canvas_deletelinesfor(glist, x); } static void image_vis(t_gobj *z, t_glist *glist, int vis) { t_image* x = (t_image*)z; if (vis) image_drawme(x, glist, 1); else image_erase(x,glist); } /* can we use the normal text save function ?? */ static void image_save(t_gobj *z, t_binbuf *b) { t_image *x = (t_image *)z; binbuf_addv(b, "ssiiss", gensym("#X"), gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix, atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->x_fname); binbuf_addv(b, ";"); } t_widgetbehavior image_widgetbehavior; void image_size(t_image* x,t_floatarg w,t_floatarg h) { x->x_width = w; x->x_height = h; } void image_color(t_image* x,t_symbol* col) { /* outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang .. so color black does the same as bang, but doesn't forward the bang */ } void image_open(t_image* x, t_symbol *s, t_int argc, t_atom *argv) { x->x_fname = get_filename(argc, argv); image_erase(x, x->x_glist); image_drawme(x, x->x_glist, 1); } static void image_setwidget(void) { image_widgetbehavior.w_getrectfn = image_getrect; image_widgetbehavior.w_displacefn = image_displace; image_widgetbehavior.w_selectfn = image_select; image_widgetbehavior.w_activatefn = image_activate; image_widgetbehavior.w_deletefn = image_delete; image_widgetbehavior.w_visfn = image_vis; #if (PD_VERSION_MINOR > 31) image_widgetbehavior.w_clickfn = NULL; image_widgetbehavior.w_propertiesfn = NULL; #endif #if PD_MINOR_VERSION < 37 image_widgetbehavior.w_savefn = image_save; #endif } static void *image_new(t_symbol *s, t_int argc, t_atom *argv) { t_image *x = (t_image *)pd_new(image_class); x->x_glist = (t_glist*) canvas_getcurrent(); x->x_width = 15; x->x_height = 15; x->x_fname = get_filename(argc, argv); outlet_new(&x->x_obj, &s_float); return (x); } void image_setup(void) { image_class = class_new(gensym("image"), (t_newmethod)image_new, 0, sizeof(t_image),0, A_GIMME,0); class_addmethod(image_class, (t_method)image_size, gensym("size"), A_FLOAT, A_FLOAT, 0); /* class_addmethod(image_class, (t_method)image_color, gensym("color"), A_SYMBOL, 0); */ class_addmethod(image_class, (t_method)image_open, gensym("open"), A_GIMME, 0); image_setwidget(); class_setwidget(image_class,&image_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(image_class,&image_save); #endif } pd-ggee_0.26/gui/fatom-help.pd0000644000076500007650000000006211467116403014657 0ustar hanshans#N canvas 1 52 450 300 10; #X text 80 96 comment; pd-ggee_0.26/gui/gcanvas.c0000644000076500007650000003061611467116403014074 0ustar hanshans/* (C) Guenter Geiger */ #include "m_pd.h" #include "g_canvas.h" /* ------------------------ gcanvas ----------------------------- */ #define DEFAULTSIZE 80 static t_class *gcanvas_class; #define RECT 1 #define LINE 2 #define MAXELEM 1024 typedef struct _elem { int x; int y; int w; int h; int g; int type; char* color; } t_element; typedef struct _gcanvas { t_object x_obj; t_glist * x_glist; t_outlet* out2; t_outlet* out3; int x_width; int x_height; int x; int y; t_element* x_element[MAXELEM]; int x_numelem; } t_gcanvas; /* cv .. canvas o .. object identifier c .. element id x,y,w,h .. coordinates */ static void rectangle(void* cv,void* o,int c,int x, int y,int w,int h,char* color) { sys_vgui(".x%x.c create rectangle \ %d %d %d %d -tags %x%d -fill %s\n",cv,x,y,x+w,y+h,o,c,color); } static void move_object(void* cv,void* o,int c,int x, int y,int w,int h) { sys_vgui(".x%x.c coords %x%d %d %d %d %d\n", cv,o,c,x,y,x+w,y+h); } static void color_object(void* cv,void* o,int c,char* color) { sys_vgui(".x%x.c itemconfigure %x%d -fill %s\n", cv, o, c,color); } static void delete_object(void* cv,void* o,int c) { sys_vgui(".x%x.c delete %x%d\n", cv, o,c); } static void line(void* cv,void* o,int c,int x,int y,int w,int h,char* color) { sys_vgui(".x%x.c create line \ %d %d %d %d -tags %x%d -fill %s\n",cv,x,y,x+w,y+h,o,c,color); } static void gcanvas_draw_element(t_gcanvas *x,int num) { t_element* e = x->x_element[num]; if (!e) post("gcanvas_draw_element assertion failed"); switch (e->type) { case RECT: rectangle(glist_getcanvas(x->x_glist),x,num, x->x_obj.te_xpix + e->x, x->x_obj.te_ypix + e->y, e->w, e->h,e->color); break; case LINE: line(glist_getcanvas(x->x_glist),x,num, x->x_obj.te_xpix + e->x, x->x_obj.te_ypix + e->y, e->w, e->h,e->color); break; default: post("gcanvas: unknown element"); } } static void gcanvas_move_element(t_gcanvas *x,int num) { t_element* e = x->x_element[num]; move_object( glist_getcanvas(x->x_glist),x,num, x->x_obj.te_xpix + e->x, x->x_obj.te_ypix + e->y, e->w, e->h); } static void gcanvas_delete_element(t_gcanvas *x,int num) { delete_object(glist_getcanvas(x->x_glist),x,num); } static void gcanvas_color_element(t_gcanvas* x,int num,char* color) { t_element* e = x->x_element[num]; e->color = color; color_object(glist_getcanvas(x->x_glist),x,num,color); } /* widget helper functions */ void gcanvas_drawme(t_gcanvas *x, t_glist *glist, int firsttime) { int i; if (firsttime) { for (i=0;ix_numelem;i++) gcanvas_draw_element(x,i); } else { for (i=0;ix_numelem;i++) gcanvas_move_element(x,i); } { /* outlets */ int n = 3; int nplus, i; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n", glist_getcanvas(glist), onset, x->x_obj.te_ypix + x->x_height - 1, onset + IOWIDTH, x->x_obj.te_ypix + x->x_height, x, i); else sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, x->x_obj.te_ypix + x->x_height - 1, onset + IOWIDTH, x->x_obj.te_ypix + x->x_height); } /* inlets */ n = 0; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n", glist_getcanvas(glist), onset, x->x_obj.te_ypix, onset + IOWIDTH, x->x_obj.te_ypix + 1, x, i); else sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, x->x_obj.te_ypix, onset + IOWIDTH, x->x_obj.te_ypix + 1); } } } void gcanvas_erase(t_gcanvas* x,t_glist* glist) { int n,i; for (i=0;ix_numelem;i++) gcanvas_delete_element(x,i); n = 3; while (n--) { sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,n); } } /* ------------------------ gcanvas widgetbehaviour----------------------------- */ static void gcanvas_getrect(t_gobj *z, t_glist *owner, int *xp1, int *yp1, int *xp2, int *yp2) { int width, height; t_gcanvas* s = (t_gcanvas*)z; width = s->x_width; height = s->x_height; *xp1 = s->x_obj.te_xpix; *yp1 = s->x_obj.te_ypix; *xp2 = s->x_obj.te_xpix + width; *yp2 = s->x_obj.te_ypix + height; } static void gcanvas_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_gcanvas *x = (t_gcanvas *)z; x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; gcanvas_drawme(x, glist, 0); canvas_fixlinesfor(glist,(t_text*) x); } static void gcanvas_select(t_gobj *z, t_glist *glist, int state) { t_gcanvas *x = (t_gcanvas *)z; color_object(glist,x,0,state ? "blue" : x->x_element[0]->color); } static void gcanvas_activate(t_gobj *z, t_glist *glist, int state) { /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ } static void gcanvas_delete(t_gobj *z, t_glist *glist) { t_text *x = (t_text *)z; canvas_deletelinesfor(glist, x); } static void gcanvas_vis(t_gobj *z, t_glist *glist, int vis) { t_gcanvas* x = (t_gcanvas*)z; if (vis) gcanvas_drawme(x, glist, 1); else gcanvas_erase(x,glist); } /* can we use the normal text save function ?? */ static void gcanvas_save(t_gobj *z, t_binbuf *b) { t_gcanvas *x = (t_gcanvas *)z; binbuf_addv(b, "ssiisii", gensym("#X"),gensym("obj"), (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix, gensym("gcanvas"),x->x_width,x->x_height); binbuf_addv(b, ";"); } t_widgetbehavior gcanvas_widgetbehavior; static void gcanvas_motion(t_gcanvas *x, t_floatarg dx, t_floatarg dy) { x->x += dx; x->y += dy; outlet_float(x->out2,x->y); outlet_float(x->x_obj.ob_outlet,x->x); } void gcanvas_key(t_gcanvas *x, t_floatarg f) { post("key"); } static void gcanvas_click(t_gcanvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg doit,int up) { glist_grab(x->x_glist, &x->x_obj.te_g, (t_glistmotionfn) gcanvas_motion, (t_glistkeyfn) NULL, xpos, ypos); x->x = xpos - x->x_obj.te_xpix; x->y = ypos - x->x_obj.te_ypix; outlet_float(x->out2,x->y); outlet_float(x->x_obj.ob_outlet,x->x); outlet_float(x->out3,0); } static int gcanvas_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { if (doit) gcanvas_click((t_gcanvas *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt,dbl); if (dbl) outlet_float(((t_gcanvas*)z)->out3,1); return (1); } void gcanvas_size(t_gcanvas* x,t_floatarg w,t_floatarg h) { x->x_width = w; x->x_height = h; gcanvas_drawme(x, x->x_glist, 0); } static void gcanvas_setwidget(void) { gcanvas_widgetbehavior.w_getrectfn = gcanvas_getrect; gcanvas_widgetbehavior.w_displacefn = gcanvas_displace; gcanvas_widgetbehavior.w_selectfn = gcanvas_select; gcanvas_widgetbehavior.w_activatefn = gcanvas_activate; gcanvas_widgetbehavior.w_deletefn = gcanvas_delete; gcanvas_widgetbehavior.w_visfn = gcanvas_vis; gcanvas_widgetbehavior.w_clickfn = gcanvas_newclick; class_setsavefn(gcanvas_class,gcanvas_save); } static void gcanvas_rect(t_gcanvas* x,t_symbol* c,float xp,float y,float w,float h) { t_element* e = getbytes(sizeof(t_element)); x->x_element[x->x_numelem++] = e; e->type = RECT; e->x = xp; e->y = y; e->w = w; e->h = h; e->color = c->s_name; gcanvas_draw_element(x,x->x_numelem-1); } static void gcanvas_line(t_gcanvas* x,t_symbol* c,float xp,float y,float w,float h) { if (x->x_numelem < MAXELEM-1) { t_element* e = getbytes(sizeof(t_element)); x->x_element[x->x_numelem++] = e; e->type = LINE; e->x = xp; e->y = y; e->w = w; e->h = h; e->g = 1; e->color = c->s_name; gcanvas_draw_element(x,x->x_numelem-1); } } static void gcanvas_move(t_gcanvas* x,float num,float xp,float y,float w,float h) { t_element* e = x->x_element[(int)num]; if (e) { e->x = xp; e->y = y; e->w = w; e->h = h; gcanvas_move_element(x,(int)num); } } static void gcanvas_color(t_gcanvas* x,t_symbol* c,float num) { gcanvas_color_element(x,(int)num,c->s_name); } void gcanvas_deletenum(t_gcanvas* x,float num) { int i = (int) num; if (x->x_element[i]) { gcanvas_delete_element(x,i); freebytes(x->x_element[i],sizeof(t_element)); x->x_element[i] = NULL; } } static void gcanvas_reset(t_gcanvas* x) { int i; for (i=1;ix_numelem;i++) gcanvas_deletenum(x,i); x->x_numelem = 1; } static void *gcanvas_new(t_symbol* s,t_int ac,t_atom* at) { int i; t_gcanvas *x = (t_gcanvas *)pd_new(gcanvas_class); x->x_glist = (t_glist*) canvas_getcurrent(); for (i=0;ix_element[i] = NULL; x->x_numelem = 0; /* Fetch the width */ x->x_width = DEFAULTSIZE; if (ac-- > 0) { if (at->a_type != A_FLOAT) error("gcanvas: wrong argument type"); else x->x_width = atom_getfloat(at++); if (x->x_width < 0 || x->x_width > 2000) { error("gcanvas: unallowed width %f",x->x_width); x->x_width = DEFAULTSIZE; } } /* Fetch the height */ x->x_height = DEFAULTSIZE; if (ac-- > 0) { if (at->a_type != A_FLOAT) error("gcanvas: wrong argument type"); else x->x_height = atom_getfloat(at++); if (x->x_height < 0 || x->x_height > 2000) { error("gcanvas: unallowed height %f",x->x_height); x->x_width = DEFAULTSIZE; } } x->x_element[0] = getbytes(sizeof(t_element)); x->x_numelem++; x->x_element[0]->type = RECT; x->x_element[0]->x = 0; x->x_element[0]->y = 0; x->x_element[0]->w = x->x_width; x->x_element[0]->h = x->x_height; x->x_element[0]->color = "white"; outlet_new(&x->x_obj, &s_float); x->out2 = outlet_new(&x->x_obj, &s_float); x->out3 = outlet_new(&x->x_obj, &s_float); return (x); } void gcanvas_setup(void) { gcanvas_class = class_new(gensym("gcanvas"), (t_newmethod)gcanvas_new, 0, sizeof(t_gcanvas),0, A_GIMME,0); class_addmethod(gcanvas_class, (t_method)gcanvas_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(gcanvas_class, (t_method)gcanvas_size, gensym("size"), A_FLOAT, A_FLOAT, 0); class_addmethod(gcanvas_class, (t_method)gcanvas_line, gensym("line"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT,A_FLOAT,0); class_addmethod(gcanvas_class, (t_method)gcanvas_rect, gensym("rect"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT,A_FLOAT,0); class_addmethod(gcanvas_class, (t_method)gcanvas_move, gensym("move"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT,A_FLOAT,0); class_addmethod(gcanvas_class, (t_method)gcanvas_color, gensym("color"), A_SYMBOL,A_FLOAT,0); class_addmethod(gcanvas_class, (t_method)gcanvas_deletenum,gensym("delete"), A_FLOAT,0); class_addmethod(gcanvas_class, (t_method)gcanvas_reset,gensym("reset"),0); gcanvas_setwidget(); class_setwidget(gcanvas_class,&gcanvas_widgetbehavior); } pd-ggee_0.26/gui/gcanvas-help.pd0000644000076500007650000000471111467116403015200 0ustar hanshans#N canvas 292 26 524 527 10; #X obj 34 472 nbx 5 25 -1e+37 1e+37 0 0 empty empty X: -20 14 1 16 -241655 -1 -1 49 256; #X obj 40 248 gcanvas 200 200; #X obj 136 471 nbx 5 25 -1e+37 1e+37 0 0 empty empty Y: -20 14 1 16 -241655 -1 -1 26 256; #X text 18 3 [gcanvas]; #X text 69 505 mouse values; #X text 41 24 click and drag in the grey [gcanvas] to get pixel values ; #X obj 241 486 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 261 487 mouse clicked in box; #N canvas 0 22 441 440 resize 0; #X obj 132 192 gcanvas 49 49; #X msg 132 172 size 49 49; #X obj 37 193 vsl 20 200 200 5 0 0 empty empty Y 0 -8 1 11 -241655 -1 -1 15308 0; #X obj 135 72 hsl 200 20 5 200 0 0 empty empty X -2 -6 1 11 -241655 -1 -1 4592 0; #X obj 20 62 loadbang; #X msg 37 85 50; #N canvas 526 29 466 316 guts 0; #X obj 141 36 inlet; #X obj 184 271 outlet; #X obj 154 160 pack f f; #X obj 175 135 t b f; #X obj 154 181 t b a; #X obj 208 37 inlet; #X text 130 36 Y; #X text 253 38 X; #X obj 208 76 int; #X obj 141 78 int; #X msg 184 200 set size \$1 \$2; #X connect 0 0 9 0; #X connect 2 0 4 0; #X connect 3 0 2 0; #X connect 3 1 2 1; #X connect 4 0 1 0; #X connect 4 1 10 0; #X connect 5 0 8 0; #X connect 8 0 2 0; #X connect 9 0 3 0; #X connect 10 0 1 0; #X restore 132 118 pd guts; #X obj 246 274 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 266 275 mouse clicked in box; #X connect 0 2 7 0; #X connect 1 0 0 0; #X connect 2 0 6 0; #X connect 3 0 6 1; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 5 0 2 0; #X connect 6 0 1 0; #X restore 331 343 pd resize; #X floatatom 241 466 5 0 0 0 - - -; #X msg 42 63 color grey 0; #X msg 25 44 color red 0; #X text 131 52 change color of an element; #X msg 142 211 delete 1; #X msg 53 84 line green 25 50 50 50; #X text 202 84 draw a line with args: color x y width height; #X msg 63 104 rect blue 125 150 9 50; #X text 205 104 draw a rectangle with args: color x y width height ; #X msg 76 132 move 2 50 50 50 50; #X text 195 131 move an element with args: element# x y width height ; #X text 211 211 delete an element from the canvas; #X msg 79 210 reset; #X msg 83 172 move 2 50 \$1 50 50; #X obj 86 153 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X connect 1 0 0 0; #X connect 1 1 2 0; #X connect 1 2 9 0; #X connect 9 0 6 0; #X connect 10 0 1 0; #X connect 11 0 1 0; #X connect 13 0 1 0; #X connect 14 0 1 0; #X connect 16 0 1 0; #X connect 18 0 1 0; #X connect 21 0 1 0; #X connect 22 0 1 0; #X connect 23 0 22 0; pd-ggee_0.26/gui/ticker-help.pd0000644000076500007650000000056311467116403015040 0ustar hanshans#N canvas 0 22 454 304 10; #X obj 76 108 ticker ; #X text 25 21 [ticker] is a OS-native checkbox; #X obj 44 70 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X msg 75 69 bang; #X floatatom 75 157 5 0 0 0 - - -; #X obj 44 158 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X connect 0 0 4 0; #X connect 0 0 5 0; #X connect 2 0 0 0; #X connect 3 0 0 0; pd-ggee_0.26/gui/button-help.pd0000644000076500007650000000064411467116403015072 0ustar hanshans#N canvas 215 105 529 408 10; #X obj 41 115 button OK; #X obj 77 249 print; #X obj 118 128 button Hit_me_with_your_rhythm_stick; #X msg 118 181 yes I will; #X obj 118 83 button OK; #X text 17 21 Button \, a bang with a label (no pics yet); #X text 26 374 (C) dosmildos Guenter Geiger; #X text 17 41 button \, _ are made into spaces; #X connect 0 0 1 0; #X connect 2 0 3 0; #X connect 3 0 1 0; #X connect 4 0 2 0; pd-ggee_0.26/gui/slider.c0000644000076500007650000000310711467116403013727 0ustar hanshans#include #include #include "g_canvas.h" /* for widgetbehaviour */ #include "fatom.h" static t_class *slider_class; static void slider_save(t_gobj *z, t_binbuf *b) { t_fatom *x = (t_fatom *)z; binbuf_addv(b, "ssiisiii", gensym("#X"), gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->x_max,x->x_min,x->x_width); binbuf_addv(b, ";"); } static void *slider_new(t_floatarg max, t_floatarg min, t_floatarg h) { t_fatom *x = (t_fatom *)pd_new(slider_class); x->x_type = gensym("vslider"); return fatom_new(x,max,min,h,&s_); } t_widgetbehavior slider_widgetbehavior; void slider_setup() { slider_class = class_new(gensym("slider"), (t_newmethod)slider_new, 0, sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); slider_widgetbehavior.w_getrectfn = fatom_getrect, slider_widgetbehavior.w_displacefn = fatom_displace, slider_widgetbehavior.w_selectfn = fatom_select, slider_widgetbehavior.w_activatefn = fatom_activate, slider_widgetbehavior.w_deletefn = fatom_delete, slider_widgetbehavior.w_visfn= fatom_vis, #if PD_MINOR_VERSION < 37 slider_widgetbehavior.w_savefn = slider_save, slider_widgetbehavior.w_propertiesfn = NULL, #endif slider_widgetbehavior.w_clickfn = NULL, fatom_setup_common(slider_class); class_setwidget(slider_class,&slider_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(slider_class,&slider_save); #endif class_setpropertiesfn(slider_class,&fatom_properties); } pd-ggee_0.26/gui/ticker.c0000644000076500007650000000342711467116403013733 0ustar hanshans#include #include "g_canvas.h" #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "fatom.h" /* can we use the normal text save function ?? */ static t_class *ticker_class; static void ticker_save(t_gobj *z, t_binbuf *b) { t_fatom *x = (t_fatom *)z; binbuf_addv(b, "ssiiss", gensym("#X"), gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->x_text,x->x_max,x->x_width); binbuf_addv(b, ";"); } static void ticker_bang(t_fatom* x) { x->x_val = !x->x_val; fatom_float(x,x->x_val); } static void *ticker_new(t_symbol* t) { t_fatom *x = (t_fatom *)pd_new(ticker_class); x->x_type = gensym("checkbutton"); return fatom_new(x,10,0,0,t); } t_widgetbehavior ticker_widgetbehavior; void ticker_setup() { ticker_class = class_new(gensym("ticker"), (t_newmethod)ticker_new, 0, sizeof(t_fatom),0,A_DEFSYMBOL,0); class_addbang(ticker_class,ticker_bang); fatom_setup_common(ticker_class); class_addbang(ticker_class, (t_method)ticker_bang); ticker_widgetbehavior.w_getrectfn= fatom_getrect; ticker_widgetbehavior.w_displacefn= fatom_displace; ticker_widgetbehavior.w_selectfn= fatom_select; ticker_widgetbehavior.w_activatefn= fatom_activate; ticker_widgetbehavior.w_deletefn= fatom_delete; ticker_widgetbehavior.w_visfn= fatom_vis; #if PD_MINOR_VERSION < 37 ticker_widgetbehavior.w_savefn= ticker_save; ticker_widgetbehavior.w_propertiesfn= NULL; #endif ticker_widgetbehavior.w_clickfn= NULL; class_setwidget(ticker_class,&ticker_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(ticker_class,&ticker_save); #endif } pd-ggee_0.26/gui/sliderh.c0000644000076500007650000000322511467116403014100 0ustar hanshans#include #include "g_canvas.h" #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include "fatom.h" /* can we use the normal text save function ?? */ static t_class *sliderh_class; static void sliderh_save(t_gobj *z, t_binbuf *b) { t_fatom *x = (t_fatom *)z; binbuf_addv(b, "ssiisiii", gensym("#X"), gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->x_max,x->x_min,x->x_width); binbuf_addv(b, ";"); } static void *sliderh_new(t_floatarg max, t_floatarg min,t_floatarg h) { t_fatom *x = (t_fatom *)pd_new(sliderh_class); x->x_type = gensym("hslider"); return fatom_new(x,max,min,h,&s_); } t_widgetbehavior sliderh_widgetbehavior; void sliderh_setup() { sliderh_class = class_new(gensym("sliderh"), (t_newmethod)sliderh_new, 0, sizeof(t_fatom),0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); fatom_setup_common(sliderh_class); sliderh_widgetbehavior.w_getrectfn = fatom_getrect; sliderh_widgetbehavior.w_displacefn= fatom_displace; sliderh_widgetbehavior.w_selectfn= fatom_select; sliderh_widgetbehavior.w_activatefn=fatom_activate; sliderh_widgetbehavior.w_deletefn= fatom_delete; sliderh_widgetbehavior.w_visfn= fatom_vis; #if PD_MINOR_VERSION < 37 sliderh_widgetbehavior.w_savefn= sliderh_save; sliderh_widgetbehavior.w_propertiesfn= NULL; #endif sliderh_widgetbehavior.w_clickfn= NULL; class_setwidget(sliderh_class,&sliderh_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(sliderh_class,&sliderh_save); #endif } pd-ggee_0.26/gui/image-help.pd0000644000076500007650000000145411467116403014641 0ustar hanshans#N canvas 140 178 568 628 10; #X obj 246 361 image logo100.gif; #X text 19 18 Incorporate images. This is instantiated with; #X text 19 34 [image logo100.gif]; #X text 17 57 [image] works with .gif \, .ppm \, and .pgm image formats only.; #X msg 86 132 open \$1; #X obj 86 88 bng 15 250 50 0 empty empty empty 0 -6 0 10 -4034 -1 -1 ; #X obj 86 109 openpanel; #X obj 238 567 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 -1 -1; #X msg 265 152 size \$1 \$2; #X obj 265 129 pack 0 0; #X obj 313 106 hsl 128 15 0 127 0 0 empty empty y 7 7 0 10 -203904 -1 -1 11800 1; #X obj 263 88 hsl 128 15 0 127 0 0 empty empty x 7 7 0 10 -204800 -1 -1 12700 1; #X connect 0 0 7 0; #X connect 4 0 0 0; #X connect 5 0 6 0; #X connect 6 0 4 0; #X connect 8 0 0 0; #X connect 9 0 8 0; #X connect 10 0 9 1; #X connect 11 0 9 0; pd-ggee_0.26/gui/state.list0000755000076500007650000000002511467116403014315 0ustar hanshans66.000000 0.000000 pd-ggee_0.26/gui/sliderh-help.pd0000644000076500007650000000023211467116403015202 0ustar hanshans#N canvas 0 0 450 300 10; #X obj 44 79 sliderh 127 0 20; #X text 44 59 sliderh 127 0 20; #X obj 46 147 sliderh 127 0 10; #X text 43 127 sliderh 127 0 10; pd-ggee_0.26/gui/logo100.gif0000644000076500007650000000444511467116403014157 0ustar hanshansGIF89aDd÷ÿÿÿÿÿÿÌÿÿ™ÿÿfÿÿ3ÿÿÿÌÿÿÌÌÿÌ™ÿÌfÿÌ3ÿÌÿ™ÿÿ™Ìÿ™™ÿ™fÿ™3ÿ™ÿfÿÿfÌÿf™ÿffÿf3ÿfÿ3ÿÿ3Ìÿ3™ÿ3fÿ33ÿ3ÿÿÿÌÿ™ÿfÿ3ÿÌÿÿÌÿÌÌÿ™ÌÿfÌÿ3ÌÿÌÌÿÌÌÌÌÌ™ÌÌfÌÌ3ÌÌÌ™ÿÌ™ÌÌ™™Ì™fÌ™3Ì™ÌfÿÌfÌÌf™ÌffÌf3ÌfÌ3ÿÌ3ÌÌ3™Ì3fÌ33Ì3ÌÿÌÌÌ™ÌfÌ3Ì™ÿÿ™ÿÌ™ÿ™™ÿf™ÿ3™ÿ™Ìÿ™Ì̙̙™Ìf™Ì3™Ì™™ÿ™™Ì™™™™™f™™3™™™fÿ™fÌ™f™™ff™f3™f™3ÿ™3Ì™3™™3f™33™3™ÿ™Ì™™™f™3™fÿÿfÿÌfÿ™fÿffÿ3fÿfÌÿfÌÌfÌ™fÌffÌ3fÌf™ÿf™Ìf™™f™ff™3f™ffÿffÌff™fffff3fff3ÿf3Ìf3™f3ff33f3fÿfÌf™fff3f3ÿÿ3ÿÌ3ÿ™3ÿf3ÿ33ÿ3Ìÿ3ÌÌ3Ì™3Ìf3Ì33Ì3™ÿ3™Ì3™™3™f3™33™3fÿ3fÌ3f™3ff3f33f33ÿ33Ì33™33f333333ÿ3Ì3™3f333ÿÿÿÌÿ™ÿfÿ3ÿÌÿÌÌÌ™ÌfÌ3Ì™ÿ™Ì™™™f™3™fÿfÌf™fff3f3ÿ3Ì3™3f333ÿÌ™f3îÝ»ªˆwUD"îÝ»ªˆwUD"îÝ»ªˆwUD"îîîÝÝÝ»»»ªªªˆˆˆwwwUUUDDD""",DdÿH° Áƒ*\Ȱ¡ÀzöHt@Q†Œ92æpà°ãÀzõ$@@ÑEŒuY¹2ˆË—0c™qÀcB,[ÆÜɳ§Ï ë1qbM2~*]ªÈÆ‹s¨ÌS†@L³jݺ“#¬\Êõ‰àêØ³hƒ›¶­Ö£ÜÊ] D(€¸m™ëÈ@¼Z÷îܱƒoO¿3=²cÁÁG"(ðØpLíq]°à%ãÉ [†™ã#¬Ÿ+ïåüXðh—¥ž^¡³ËÈ‚¸~írÁÙK#Gp] Æîzõ¶µ:øÒÐ{Ô°ÝsïFœÇÃzè\)t— ŒWÿr€= Ù·nÐݧôÛ;r§?¢Ã€zOªÔsþ-A¨‰gÕé TÈ8£ ímU9pµeÙQW=¤(¨!2] eß@nõ™n1Yx€= j¨!gÕEPˆÕÆÓ¨¢ŠÎM‹Á¨•cÇñ†8:ƒÌ!;”\‰=aöbX@*YZ†E®ÂÓ¡ÁåN± 4ƒˆòt@E*ÈâN5@Ý€k’VPR5Vbö”é ’È¡¦g2òÔ¥@pÁNY¤*³)w›žÃÝVC£;17[‹aéš…(–©cNÁ˜šk5ØUA”GØ¥Šã!œÊ`—ÑÅÿ§Õz_‰x*LP‰ã*ª ãkFW[;=X+Z@¬p£ÎÀ ‚m¹”± E_̪ØE°«mõá_Öæ j¶¥å ×£ÄÊd¸g‘ƒ®Ì®ÂzA š.Lˆ¤XXîÂkç!‘)Sù²;–»ËÚ9F=2èukVNt^»9$\fõÐ+`Vʆì²Èø» I÷úÔ1wÈâHJÂú@¯X’þ––*’OÂV ®"®ŠV¶e¬@T‡U“=T2øºíüÓ׎u€ ++ˆˆ¬ÈAFÈ®ûdÕO¨ÿHÆ=º®HDÈ"äcÔª®’¬¿÷ðÇãA‡kU¨†Šgª¢=¨ÍSÁÿ‰u„‰×µ,)õÀúøÔž;`…†ûÔ·, ç}ÔJ ¹º‘ˆÐ¹¬ÐN°Þ>ó›ƒ "“»*Z±¯XßÊ̯ÄIF*à(ÃòbÏ>2 98£ØsõuìbáÐ9> >å@ à;SçÏÿÓ˜9ÃûY«ß–Ñš9Xô¡?þÝéŽC‹ÑÊ· äCzûSÑä§¹ž,Yü^øT”ƒ—¡¥gwIKäF'ÊÁÆ~J!£ƒåÎrÓ³úÎ⛂¬`:Dg% à#€h9Y©ÿ$„U c ZÐHqC¦ñ`9Â!¡¸zŒnˆay¢ç0s@8£ŠËªBÏ¢E·å!E@ ›ŠV`®´DlRS +&¢°)!̨„ˆÉ)(:k çb- Ü#A‡†dpG<äK…ÄÐ4@dÎ-ƒ„d!óAŠôÍ’‹‹ö––#a9PV×æÒ¼¶Í%‡8Ó\Œ¹­è€"0qÙ½€ð´qZ=BŽæÊ_é8åÚ-wâÔ8}ŸƒVL¤"¥`1Ej ÛmæÅ¤î|š3£…¾r©rqJ',ˆ6Mô•—¹ËÎ7µ‘˜<à.ž*WüPÿ˗Ъ=ܼ_"„È<8ñ»Ì±nS®hÒ'ÿ,Q@uc•ÓtÐ3…‰ü<ãq–æ»Wϼ9/ƒ²GQÛœáç~9N~%„é©DPMX53¥Jš4uÓÑrB¨4X„I =¦$«ÀW8™é‚@¾zxê–ø É f£¾vÖ'&#È I9¨_,ÁV_âçä$¬YÍLu*ÄV.9¥ž‰ëOþÔÄíæuå-õ¥W¾,¯}%_‹I‚•°\åBë!826-å9ìc³Ùí­d*gm¤ƒ¢G²®D#2 ˆDd˜¢ˆD$%)ÉIP¯f6² ­F <› Øö¶¸Í­n;pd-ggee_0.26/gui/envgen.c0000644000076500007650000002133311467116403013730 0ustar hanshans/* (C) Guenter Geiger */ #include //#define DEBUG /* ------------------------ envgen~ ----------------------------- */ #define NONE 0 #define ATTACK 1 #define SUSTAIN -1 #define STATES 100 #include "envgen.h" #include "w_envgen.h" static t_class *envgen_class; #define OUT_LIST(x,nr,a) \ outlet_list(x->x_obj.ob_outlet,&s_list,nr,(t_atom*)&a);\ if (x->s_sym != &s_ && x->s_sym->s_thing) pd_list(x->s_sym->s_thing, &s_list, nr, (t_atom*)&a); char dumpy[2000]; /* initialize envelope with argument vector */ #include /* envgen crashes frequently when reallocating memory .... I really don't know why, it crashes during resizebytes, which means it is unable to realloc() the memory ????? the pointer seems to be ok, I don't know what else could cause the problem. for the moment we prevent from reallocating by setting the STATES variable to 100 */ void envgen_resize(t_envgen* x,int ns) { if (ns > x->args) { int newargs = ns*sizeof(t_float); x->duration = resizebytes(x->duration,x->args*sizeof(t_float),newargs); x->finalvalues = resizebytes(x->finalvalues,x->args*sizeof(t_float),newargs); x->args = ns; } } void envgen_totaldur(t_envgen* x,t_float dur) { int i; float f = dur/x->duration[x->last_state]; if (dur < 10) { post("envgen: duration too small %f",dur); return; } for (i=1;i<=x->last_state;i++) x->duration[i]*=f; } static void envgen_dump(t_envgen* e) { t_atom argv[50]; int argc= 0; t_atom* a = argv; int i; SETFLOAT(a,e->finalvalues[0]);argc++; for (i=1;i <= e->last_state;i++) { SETFLOAT(argv+argc,e->duration[i] - e->duration[i-1]); argc++; SETFLOAT(argv+argc,e->finalvalues[i]); argc++; } outlet_list(e->out2,&s_list,argc,(t_atom*)&argv); } void envgen_init(t_envgen *x,int argc,t_atom* argv) { t_float* dur; t_float* val; t_float tdur = 0; if (!argc) return; x->duration[0] = 0; x->last_state = argc>>1; envgen_resize(x,argc>>1); dur = x->duration; val = x->finalvalues; if (argc) { *val = atom_getfloat(argv++); *dur = 0.0; } dur++;val++;argc--; for (;argc > 0;argc--) { tdur += atom_getfloat(argv++); #ifdef DEBUG post("dur =%f",tdur); #endif *dur++ = tdur; argc--; if (argc > 0) *val++ = atom_getfloat(argv++); else *val++ = 0; #ifdef DEBUG post("val =%f",*(val-1)); #endif } } void envgen_list(t_envgen *x,t_symbol* s, int argc,t_atom* argv) { envgen_init(x,argc,argv); if (glist_isvisible(x->w.glist)) { envgen_drawme(x, x->w.glist, 0); } } void envgen_setresize(t_envgen *x, t_floatarg f) { x->resizeable = f; } void envgen_float(t_envgen *x, t_floatarg f) { int state = 0; float val; while (x->duration[state] < f && state < x->last_state) state++; if (state == 0 || f >= x->duration[x->last_state]) { val = x->finalvalues[state]*(x->max-x->min); outlet_float(x->x_obj.ob_outlet,f); if (x->s_sym != &s_) pd_float(x->s_sym->s_thing, f); return; } val = x->finalvalues[state-1] + (f - x->duration[state-1])* (x->finalvalues[state] - x->finalvalues[state-1])/ (x->duration[state] - x->duration[state-1]); val *= (x->max - x->min); outlet_float(x->x_obj.ob_outlet,val); if (x->s_sym != &s_) pd_float(x->s_sym->s_thing, val); } void envgen_bang(t_envgen *x) { t_atom a[2]; SETFLOAT(a,x->finalvalues[NONE]); SETFLOAT(a+1,0); OUT_LIST(x,2,a); /* we don't force the first value anymore, so the first value is actually with what we have left off at the end ... this reduces clicks */ x->x_state = ATTACK; x->x_val = x->finalvalues[NONE]; SETFLOAT(a,x->finalvalues[x->x_state]*(x->max-x->min)); SETFLOAT(a+1,x->duration[x->x_state]); OUT_LIST(x,2,a); clock_delay(x->x_clock,x->duration[x->x_state]); } void envgen_release(t_envgen* x) { t_atom a[2]; float del = x->duration[x->x_state] - x->duration[x->x_state-1]; if (x->x_state <= x->sustain_state) { x->x_state = x->sustain_state+1; /* skip sustain state */ clock_delay(x->x_clock,del); SETFLOAT(a,x->finalvalues[x->x_state]*(x->max-x->min)); SETFLOAT(a+1,del); OUT_LIST(x,2,a); } } static void envgen_sustain(t_envgen *x, t_floatarg f) { if (f > 0 && f < x->last_state) x->sustain_state = f; else pd_error(x,"sustain value not betweem 0 and %f, ignoring message", x->last_state); } static void envgen_tick(t_envgen* x) { t_atom a[2]; x->x_state++; if (x->x_state <= x->last_state && x->x_state != x->sustain_state) { float del = x->duration[x->x_state] - x->duration[x->x_state-1]; clock_delay(x->x_clock,del); SETFLOAT(a,x->finalvalues[x->x_state]*(x->max-x->min)); SETFLOAT(a+1,del); OUT_LIST(x,2,a); } // else // clock_unset(x->x_clock); } static void envgen_freeze(t_envgen* x, t_floatarg f) { x->x_freeze = f; } static void bindsym(t_pd* x,t_symbol* o,t_symbol* s) { if (o != &s_) pd_unbind(x,o); o = s; pd_bind(x,s); } static void *envgen_new(t_symbol *s,int argc,t_atom* argv) { t_envgen *x = (t_envgen *)pd_new(envgen_class); x->args = STATES; x->finalvalues = getbytes( x->args*sizeof(t_float)); x->duration = getbytes( x->args*sizeof(t_float)); #ifdef DEBUG post("finalvalues %x",x->finalvalues); #endif /* widget */ x->w.grabbed = 0; x->resizing = 0; x->resizeable = 1; x->w.glist = (t_glist*) canvas_getcurrent(); x->w.width = 200; if (argc) x->w.width = atom_getfloat(argv++),argc--; x->w.height = 140; if (argc) x->w.height = atom_getfloat(argv++),argc--; x->max = 1.0; if (argc) x->max = atom_getfloat(argv++),argc--; x->min = 0.0; if (argc) x->min = atom_getfloat(argv++),argc--; x->r_sym = &s_; if (argc) { t_symbol* n; n = atom_getsymbol(argv++); bindsym(&x->x_obj.ob_pd,x->r_sym,n); x->r_sym = n; argc--; } // post("recv %s",x->r_sym->s_name); x->s_sym = &s_; if (argc) x->s_sym = atom_getsymbol(argv++),argc--; // post("send %s",x->s_sym->s_name); if (argc) envgen_init(x,argc,argv); else { t_atom a[5]; SETFLOAT(a,0); SETFLOAT(a+1,50); SETFLOAT(a+2,1); SETFLOAT(a+3,50); SETFLOAT(a+4,0); envgen_init(x,5,a); } x->x_val = 0.0; x->x_state = NONE; x->sustain_state = SUSTAIN; x->x_freeze = 0; outlet_new(&x->x_obj, &s_float); x->out2 = outlet_new(&x->x_obj, &s_float); x->x_clock = clock_new(x, (t_method) envgen_tick); return (x); } void envgen_motion(t_envgen *x, t_floatarg dx, t_floatarg dy); void envgen_click(t_envgen *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt); void envgen_key(t_envgen *x, t_floatarg f); t_widgetbehavior envgen_widgetbehavior; void envgen_setup(void) { envgen_class = class_new(gensym("envgen"), (t_newmethod)envgen_new, 0, sizeof(t_envgen), 0,A_GIMME,0); class_addcreator((t_newmethod)envgen_new,gensym("envgen~"),A_GIMME,0); class_addfloat(envgen_class, envgen_float); class_addbang(envgen_class,envgen_bang); class_addlist(envgen_class,envgen_list); class_addmethod(envgen_class,(t_method)envgen_sustain,gensym("sustain"),A_FLOAT,A_NULL); class_addmethod(envgen_class, (t_method)envgen_motion, gensym("motion"), A_FLOAT, A_FLOAT, 0); class_addmethod(envgen_class, (t_method)envgen_key, gensym("key"), A_FLOAT, 0); class_addmethod(envgen_class,(t_method)envgen_totaldur,gensym("duration"),A_FLOAT,NULL); class_addmethod(envgen_class,(t_method)envgen_freeze,gensym("freeze"),A_FLOAT,NULL); class_addmethod(envgen_class,(t_method)envgen_setresize,gensym("resize"),A_FLOAT,A_NULL); class_addmethod(envgen_class,(t_method)envgen_release,gensym("release"),A_NULL); envgen_widgetbehavior.w_getrectfn = envgen_getrect; envgen_widgetbehavior.w_displacefn = envgen_displace; envgen_widgetbehavior.w_selectfn = envgen_select; envgen_widgetbehavior.w_activatefn = envgen_activate; envgen_widgetbehavior.w_deletefn = envgen_delete; envgen_widgetbehavior.w_visfn = envgen_vis; envgen_widgetbehavior.w_clickfn = envgen_newclick; #if PD_MINOR_VERSION < 37 envgen_widgetbehavior.w_propertiesfn = NULL; envgen_widgetbehavior.w_savefn = envgen_save; #endif class_setwidget(envgen_class,&envgen_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(envgen_class,&envgen_save); #endif class_addmethod(envgen_class,(t_method)envgen_dump,gensym("dump"),A_NULL); } pd-ggee_0.26/gui/state-help.pd0000644000076500007650000000013511467116403014672 0ustar hanshans#N canvas 523 175 450 300 10; #X obj 180 119 state; #X text 67 43 any idea for state saving; pd-ggee_0.26/gui/Makefile0000755000076500007650000000200411467116403013737 0ustar hanshanscurrent: nt # TARGETS += stk VERSION = \"0.16\" .SUFFIXES: .dll .obj # ----------------------- NT ---------------------------- NTOBJECTS = *.obj NTDLLS = *.dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo PDNTINCLUDE = /I. /I..\..\pd\src /I../include ProgramFiles = C:\Program Files PDNTLDIR = "$(ProgramFiles)\Microsoft Visual Studio\Vc98\lib" #PDNTLDIR = "C:\Programme\Msdev\Vc98\lib" PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\wsock32.lib \ $(PDNTLDIR)\kernel32.lib \ $(PDNTLDIR)\uuid.lib \ ..\..\pd\bin\pd.lib nt: $(NTOBJECTS) -link /dll $(PDNTLIB) envgen.obj /export:envgen_setup -link /dll $(PDNTLIB) slider.obj /export:slider_setup -link /dll $(PDNTLIB) state.obj /export:state_setup -link /dll $(PDNTLIB) ticker.obj /export:ticker_setup -link /dll $(PDNTLIB) toddle.obj /export:toddle_setup -copy slider.dll hslider.dll clean: del *.obj del *.dll .c.obj: -cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c .obj.dll: pd-ggee_0.26/gui/button.c0000644000076500007650000002173211467116403013764 0ustar hanshans#include #include #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #ifndef IOWIDTH #define IOWIDTH 4 #endif typedef struct _button { t_object x_obj; t_atom a_pos; t_glist * x_glist; int x_rect_width; int x_rect_height; t_symbol* x_sym; t_symbol* x_text; int x_height; int x_width; } t_button; /* widget helper functions */ #define DEBUG(x) static void draw_inlets(t_button *x, t_glist *glist, int firsttime, int nin, int nout) { int n = nin; int nplus, i; nplus = (n == 1 ? 1 : n-1); DEBUG(post("draw inlet");) for (i = 0; i < n; i++) { int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxo%d\n", glist_getcanvas(glist), onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2, onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1, x, i); else sys_vgui(".x%lx.c coords %lxo%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2, onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1); } n = nout; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxi%d\n", glist_getcanvas(glist), onset, text_ypix(&x->x_obj, glist), onset + IOWIDTH, text_ypix(&x->x_obj, glist)+5, x, i); else sys_vgui(".x%lx.c coords %lxi%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, text_ypix(&x->x_obj, glist), onset + IOWIDTH, text_ypix(&x->x_obj, glist)+5); } DEBUG(post("draw inlet end");) } static void draw_handle(t_button *x, t_glist *glist, int firsttime) { int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH+2); if (firsttime) sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxhandle\n", glist_getcanvas(glist), onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12, onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4, x); else sys_vgui(".x%lx.c coords %lxhandle %d %d %d %d\n", glist_getcanvas(glist), x, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12, onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4); } static void create_widget(t_button *x, t_glist *glist) { char text[MAXPDSTRING]; int len,i; t_canvas *canvas=glist_getcanvas(glist); x->x_rect_width = x->x_width+10; x->x_rect_height = x->x_height*20+12; strncpy(text,x->x_text->s_name,MAXPDSTRING); len = strlen(text); for (i=0;ix_height,text, x); } static void button_drawme(t_button *x, t_glist *glist, int firsttime) { t_canvas *canvas=glist_getcanvas(glist); DEBUG(post("drawme %d",firsttime);) if (firsttime) { DEBUG(post("glist %lx canvas %lx",x->x_glist,canvas);) // if (x->x_glist != canvas) { create_widget(x,glist); x->x_glist = canvas; // } sys_vgui(".x%lx.c create window %d %d -anchor nw -window .x%lx.c.s%lx -tags %lxS\n", canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x->x_glist,x,x); } else { sys_vgui(".x%lx.c coords %lxS \ %d %d\n", canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)); } draw_inlets(x, glist, firsttime, 1,1); // draw_handle(x, glist, firsttime); } static void button_erase(t_button* x,t_glist* glist) { int n; DEBUG(post("erase");) sys_vgui("destroy .x%lx.c.s%lx\n",glist_getcanvas(glist),x); sys_vgui(".x%lx.c delete %lxS\n",glist_getcanvas(glist), x); /* inlets and outlets */ sys_vgui(".x%lx.c delete %lxi%d\n",glist_getcanvas(glist),x,0); sys_vgui(".x%lx.c delete %lxo%d\n",glist_getcanvas(glist),x,0); sys_vgui(".x%lx.c delete %lxhandle\n",glist_getcanvas(glist),x,0); } /* ------------------------ button widgetbehaviour----------------------------- */ static void button_getrect(t_gobj *z, t_glist *owner, int *xp1, int *yp1, int *xp2, int *yp2) { int width, height; t_button* s = (t_button*)z; width = s->x_rect_width; height = s->x_rect_height; *xp1 = text_xpix(&s->x_obj, owner); *yp1 = text_ypix(&s->x_obj, owner) - 1; *xp2 = text_xpix(&s->x_obj, owner) + width; *yp2 = text_ypix(&s->x_obj, owner) + height; } static void button_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_button *x = (t_button *)z; DEBUG(post("displace");) x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; if (glist_isvisible(glist)) { sys_vgui(".x%lx.c coords %lxSEL %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1, text_xpix(&x->x_obj, glist) + x->x_rect_width, text_ypix(&x->x_obj, glist) + x->x_rect_height-2); button_drawme(x, glist, 0); canvas_fixlinesfor(glist,(t_text*) x); } DEBUG(post("displace end");) } static void button_select(t_gobj *z, t_glist *glist, int state) { t_button *x = (t_button *)z; if (state) { sys_vgui(".x%lx.c create rectangle \ %d %d %d %d -tags %lxSEL -outline blue\n", glist_getcanvas(glist), text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1, text_xpix(&x->x_obj, glist) + x->x_rect_width, text_ypix(&x->x_obj, glist) + x->x_rect_height-2, x); } else { sys_vgui(".x%lx.c delete %lxSEL\n", glist_getcanvas(glist), x); } } static void button_activate(t_gobj *z, t_glist *glist, int state) { /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ } static void button_delete(t_gobj *z, t_glist *glist) { t_text *x = (t_text *)z; canvas_deletelinesfor(glist, x); } static void button_vis(t_gobj *z, t_glist *glist, int vis) { t_button* s = (t_button*)z; DEBUG(post("vis: %d",vis);) if (vis) { button_drawme(s, glist, 1); } else { button_erase(s,glist); sys_unqueuegui(z); } } static void button_save(t_gobj *z, t_binbuf *b); t_widgetbehavior button_widgetbehavior; void button_size(t_button* x,t_floatarg w,t_floatarg h) { x->x_width = w; x->x_height = h; } void button_color(t_button* x,t_symbol* col) { /* outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang .. so color black does the same as bang, but doesn't forward the bang */ } static void button_bang(t_button* x) { sys_vgui(".x%lx.c.s%lx flash\n",x->x_glist,x); outlet_bang(x->x_obj.ob_outlet); } static void button_b(t_button* x) { outlet_bang(x->x_obj.ob_outlet); } static void button_save(t_gobj *z, t_binbuf *b) { t_button *x = (t_button *)z; binbuf_addv(b, "ssiiss", gensym("#X"), gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->x_text); binbuf_addv(b, ";"); } static t_class *button_class; static void *button_new(t_symbol* text) { t_button *x = (t_button *)pd_new(button_class); char buf[256]; x->x_glist = (t_glist*)NULL; x->x_width = 30; x->x_height = 1; if (text == &s_) x->x_text = gensym("OK"); else x->x_text = text; /* TODO .. ask the button for its width */ x->x_width += strlen(x->x_text->s_name)*5.2; sprintf(buf,"button%lx", (long unsigned int)x); x->x_sym = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->x_sym); /* pipe startup code to tk */ sys_vgui("proc button_cb%lx {} {pd [concat %s b \\;]}\n", x, buf); outlet_new(&x->x_obj, &s_float); return (x); } void button_setup(void) { button_class = class_new(gensym("button"), (t_newmethod)button_new, 0, sizeof(t_button),0,A_DEFSYM,0); class_addbang(button_class, (t_method)button_bang); class_addmethod(button_class, (t_method)button_b,gensym("b"),0); button_widgetbehavior.w_getrectfn= button_getrect, button_widgetbehavior.w_displacefn= button_displace, button_widgetbehavior.w_selectfn= button_select, button_widgetbehavior.w_activatefn= button_activate, button_widgetbehavior.w_deletefn= button_delete, button_widgetbehavior.w_visfn= button_vis, #if PD_MINOR_VERSION < 37 button_widgetbehavior.w_savefn= button_save, #endif button_widgetbehavior.w_clickfn= NULL, #if PD_MINOR_VERSION < 37 button_widgetbehavior.w_propertiesfn= NULL, #endif class_setwidget(button_class,&button_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(button_class,&button_save); #endif } pd-ggee_0.26/gui/toddle.c0000644000076500007650000002372711467116403013732 0ustar hanshans/* (C) Guenter Geiger */ #include #include "g_canvas.h" #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #define PD_VERSION_MINOR 32 #define BACKGROUND "-fill grey" #define BACKGROUNDCOLOR "grey" #define te_xpos te_xpix #define te_ypos te_ypix /* ------------------------ toddle ----------------------------- */ #define DEFAULTSIZE 15 #define DEFAULTCOLOR "black" static t_class *toddle_class; typedef struct _toddle { t_object x_obj; t_glist * x_glist; int x_width; int x_height; t_symbol* x_color; t_clock* x_clock; } t_toddle; /* widget helper functions */ void toddle_drawbang(t_toddle *x,t_glist *glist,int on) { if (glist_isvisible(glist)) { if (on) sys_vgui(".x%x.c create oval %d %d %d %d -fill %s -tags %xB\n",glist_getcanvas(glist), x->x_obj.te_xpos+1,x->x_obj.te_ypos+1, x->x_obj.te_xpos + x->x_width -1, x->x_obj.te_ypos + x->x_height -1,x->x_color->s_name,x); else sys_vgui(".x%x.c delete %xB\n", glist_getcanvas(glist), x); } } void toddle_drawme(t_toddle *x, t_glist *glist, int firsttime) { if (firsttime) { #if 0 sys_vgui(".x%x.c create line \ %d %d %d %d %d %d %d %d %d %d -tags %xS\n", glist_getcanvas(glist), x->x_obj.te_xpos, x->x_obj.te_ypos, x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos, x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height, x->x_obj.te_xpos, x->x_obj.te_ypos + x->x_height, x->x_obj.te_xpos, x->x_obj.te_ypos, x); #endif sys_vgui(".x%x.c create rectangle \ %d %d %d %d -tags %xS "BACKGROUND"\n", glist_getcanvas(glist), x->x_obj.te_xpos, x->x_obj.te_ypos, x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height, x); sys_vgui(".x%x.c create oval \ %d %d %d %d -tags %xP\n",glist_getcanvas(glist), x->x_obj.te_xpos+1,x->x_obj.te_ypos+1, x->x_obj.te_xpos + x->x_width -1, x->x_obj.te_ypos + x->x_height -1,x); } else { #if 0 sys_vgui(".x%x.c coords %xS \ %d %d %d %d %d %d %d %d %d %d\n", glist_getcanvas(glist), x, x->x_obj.te_xpos, x->x_obj.te_ypos, x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos, x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height, x->x_obj.te_xpos, x->x_obj.te_ypos + x->x_height, x->x_obj.te_xpos, x->x_obj.te_ypos); #endif sys_vgui(".x%x.c coords %xS \ %d %d %d %d\n", glist_getcanvas(glist), x, x->x_obj.te_xpos, x->x_obj.te_ypos, x->x_obj.te_xpos + x->x_width, x->x_obj.te_ypos + x->x_height); sys_vgui(".x%x.c coords %xP \ %d %d %d %d\n",glist_getcanvas(glist),x, x->x_obj.te_xpos+1,x->x_obj.te_ypos+1, x->x_obj.te_xpos + x->x_width-1, x->x_obj.te_ypos + x->x_height-1); } { int n = 1; int nplus, i; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = x->x_obj.te_xpos + (x->x_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n", glist_getcanvas(glist), onset, x->x_obj.te_ypos + x->x_height - 1, onset + IOWIDTH, x->x_obj.te_ypos + x->x_height, x, i); else sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, x->x_obj.te_ypos + x->x_height - 1, onset + IOWIDTH, x->x_obj.te_ypos + x->x_height); } n = 1; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = x->x_obj.te_xpos + (x->x_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n", glist_getcanvas(glist), onset, x->x_obj.te_ypos, onset + IOWIDTH, x->x_obj.te_ypos + 1, x, i); else sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, x->x_obj.te_ypos, onset + IOWIDTH, x->x_obj.te_ypos + 1); } } } void toddle_erase(t_toddle* x,t_glist* glist) { int n; sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); sys_vgui(".x%x.c delete %xP\n", glist_getcanvas(glist), x); n = 1; while (n--) { sys_vgui(".x%x.c delete %xi%d\n",glist_getcanvas(glist),x,n); sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,n); } } /* ------------------------ toddle widgetbehaviour----------------------------- */ static void toddle_getrect(t_gobj *z, t_glist *owner, int *xp1, int *yp1, int *xp2, int *yp2) { int width, height; t_toddle* s = (t_toddle*)z; width = s->x_width; height = s->x_height; *xp1 = s->x_obj.te_xpos; *yp1 = s->x_obj.te_ypos; *xp2 = s->x_obj.te_xpos + width; *yp2 = s->x_obj.te_ypos + height; } static void toddle_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_toddle *x = (t_toddle *)z; x->x_obj.te_xpos += dx; x->x_obj.te_ypos += dy; toddle_drawme(x, glist, 0); canvas_fixlinesfor(glist,(t_text*) x); } static void toddle_select(t_gobj *z, t_glist *glist, int state) { t_toddle *x = (t_toddle *)z; sys_vgui(".x%x.c itemconfigure %xS -fill %s\n", glist, x, (state? "blue" : BACKGROUNDCOLOR)); } static void toddle_activate(t_gobj *z, t_glist *glist, int state) { /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ } static void toddle_delete(t_gobj *z, t_glist *glist) { t_text *x = (t_text *)z; canvas_deletelinesfor(glist, x); } static void toddle_vis(t_gobj *z, t_glist *glist, int vis) { t_toddle* x = (t_toddle*)z; if (vis) toddle_drawme(x, glist, 1); else toddle_erase(x,glist); } /* can we use the normal text save function ?? */ static void toddle_save(t_gobj *z, t_binbuf *b) { t_toddle *x = (t_toddle *)z; binbuf_addv(b, "ssiissii", gensym("#X"), gensym("obj"), (t_int)x->x_obj.te_xpos, (t_int)x->x_obj.te_ypos, atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)), x->x_color,x->x_width,x->x_height); binbuf_addv(b, ";"); } t_widgetbehavior toddle_widgetbehavior; void toddle_bang(t_toddle *x) { toddle_drawbang(x,x->x_glist,1); outlet_bang(x->x_obj.ob_outlet); clock_delay(x->x_clock, 100); } static void toddle_click(t_toddle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { toddle_bang(x); } #if (PD_VERSION_MINOR > 31) static int toddle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { if (doit) toddle_click((t_toddle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); return (1); } #endif void toddle_float(t_toddle *x,t_floatarg f) { toddle_drawbang(x,x->x_glist,1); clock_delay(x->x_clock, 100); outlet_float(x->x_obj.ob_outlet,f); } void toddle_on(t_toddle* x) { toddle_drawbang(x,x->x_glist,1); } void toddle_off(t_toddle* x) { toddle_drawbang(x,x->x_glist,0); } void toddle_tick(t_toddle* x) { toddle_drawbang(x,x->x_glist,0); clock_unset(x->x_clock); } void toddle_size(t_toddle* x,t_floatarg w,t_floatarg h) { x->x_width = w; x->x_height = h; toddle_drawme(x, x->x_glist, 0); } void toddle_color(t_toddle* x,t_symbol* col) { x->x_color = col; toddle_drawbang(x,x->x_glist,1); clock_delay(x->x_clock, 100); /* outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang .. so color black does the same as bang, but doesn't forward the bang */ } static void toddle_setwidget(void) { toddle_widgetbehavior.w_getrectfn = toddle_getrect; toddle_widgetbehavior.w_displacefn = toddle_displace; toddle_widgetbehavior.w_selectfn = toddle_select; toddle_widgetbehavior.w_activatefn = toddle_activate; toddle_widgetbehavior.w_deletefn = toddle_delete; toddle_widgetbehavior.w_visfn = toddle_vis; toddle_widgetbehavior.w_clickfn = toddle_newclick; #if (PD_MINOR_VERSION < 37) toddle_widgetbehavior.w_propertiesfn = NULL; toddle_widgetbehavior.w_savefn = toddle_save; #endif #if PD_MINOR_VERSION >= 37 class_setsavefn(toddle_class,&toddle_save); #endif } static void *toddle_new(t_symbol* col,t_floatarg h,t_floatarg o) { t_toddle *x = (t_toddle *)pd_new(toddle_class); x->x_glist = (t_glist*) canvas_getcurrent(); if (h) x->x_width = h; else x->x_width = DEFAULTSIZE; if (o) x->x_height = o; else x->x_height = DEFAULTSIZE; if (col != &s_) x->x_color = col; else x->x_color = gensym(DEFAULTCOLOR); x->x_clock = clock_new(x, (t_method)toddle_tick); outlet_new(&x->x_obj, &s_float); return (x); } void toddle_setup(void) { toddle_class = class_new(gensym("toddle"), (t_newmethod)toddle_new, 0, sizeof(t_toddle),0, A_DEFSYM,A_DEFFLOAT,A_DEFFLOAT,0); class_addcreator((t_newmethod)toddle_new,gensym("bng"),A_DEFSYM,A_DEFFLOAT,A_DEFFLOAT,A_GIMME,0); class_addbang(toddle_class,toddle_bang); class_addfloat(toddle_class,toddle_float); class_addmethod(toddle_class, (t_method)toddle_click, gensym("click"), A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); class_addmethod(toddle_class, (t_method)toddle_size, gensym("size"), A_FLOAT, A_FLOAT, 0); class_addmethod(toddle_class, (t_method)toddle_color, gensym("color"), A_SYMBOL, 0); class_addmethod(toddle_class, (t_method)toddle_on, gensym("on"), 0); class_addmethod(toddle_class, (t_method)toddle_off, gensym("off"), 0); toddle_setwidget(); class_setwidget(toddle_class,&toddle_widgetbehavior); } pd-ggee_0.26/gui/envgen-help.pd0000644000076500007650000000614111467116403015037 0ustar hanshans#N canvas 96 72 500 495 10; #X obj 101 192 envgen 203 123 1 0 ; #X text 21 6 envgen:; #X text 22 27 Envelope generator. This external delivers value for line~ if it is banged. When numbers are sent to its input it delivers the corresponding value of the envelope; #X msg 79 135 bang; #X text 21 75 arguments; #X text 51 84 xsize ysize xmax ymax send_symbol receive_symbol ... ; #X obj 124 158 metro 2000; #X obj 124 134 tgl 15 0 empty empty empty 0 -6 0 8 -24198 -1 -1 0 1 ; #X obj 192 138 hsl 128 15 20 2000 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X msg 345 183 \; pd dsp 1; #N canvas 0 22 462 312 guts 0; #X obj 151 62 osc~ 250; #X obj 151 101 *~; #X obj 241 101 *~; #X obj 241 61 noise~; #X obj 177 172 *~; #X obj 133 150 line~; #X obj 188 235 dac~; #X obj 215 188 hsl 128 15 0.01 1 1 0 empty empty master_amplitude -2 -6 0 8 -262144 -1 -1 0 1; #X obj 254 11 inlet; #X obj 393 18 inlet; #X obj 157 15 inlet; #X obj 6 8 inlet; #X obj 196 207 *~ 0.6; #X connect 0 0 1 0; #X connect 1 0 4 1; #X connect 2 0 4 1; #X connect 3 0 2 0; #X connect 4 0 12 0; #X connect 5 0 4 0; #X connect 7 0 12 1; #X connect 8 0 1 1; #X connect 9 0 2 1; #X connect 10 0 0 0; #X connect 11 0 5 0; #X connect 12 0 6 1; #X connect 12 0 6 0; #X restore 168 380 pd guts; #X obj 183 353 tgl 15 0 empty empty empty 0 -6 0 8 -225271 -1 -1 0 1; #X obj 206 353 tgl 15 1 empty empty empty 0 -6 0 8 -225271 -1 -1 1 1; #X obj 170 329 hsl 128 15 100 1000 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #N canvas 95 30 517 478 all 0; #X obj 43 276 envgen 203 123 1 0 ; #X msg 83 169 motion 4 4; #X msg 57 74 duration 5000; #X msg 15 14 bang; #X msg 81 127 release; #X msg 42 43 0 50 1 50; #X text 109 44 reset to default; #X text 53 15 output data; #X text 149 74 set the duration in milliseconds (ms); #X obj 165 220 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 10 -262144 -1 -1 0 1; #X msg 68 102 sustain 5000; #X obj 41 414 print ENVGEN_TIMED_OUTPUT; #X text 155 169 move selected point (values are x and y amounts in pixels); #X connect 0 0 11 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #X connect 4 0 0 0; #X connect 5 0 0 0; #X connect 9 0 0 0; #X connect 10 0 0 0; #X restore 145 413 pd all messages; #X text 45 413 For more info:; #N canvas 122 39 527 491 saving 0; #X obj 73 134 envgen 203 123 1 0 ; #X msg 71 26 bang; #X msg 90 61 dump; #X obj 277 278 list prepend set; #X obj 277 299 list trim; #X msg 195 95 0 50 1 50; #X text 262 96 reset to default; #X text 115 19 a bang outputs the data on the left inlet as separate messages and times them properly to work with [line~]; #X text 126 60 outputs all of the data as a list on the right outlet ; #X text 21 427 This message box will then save the data. Click to send it back to [envgen]; #X obj 71 278 print ENVGEN_LEFT; #X msg 12 333; #X connect 0 0 10 0; #X connect 0 1 3 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 4 0; #X connect 4 0 11 0; #X connect 5 0 0 0; #X connect 11 0 0 0; #X restore 258 413 pd saving state; #X connect 0 0 10 0; #X connect 3 0 0 0; #X connect 6 0 0 0; #X connect 7 0 6 0; #X connect 8 0 6 1; #X connect 11 0 10 2; #X connect 12 0 10 3; #X connect 13 0 10 1; pd-ggee_0.26/gui/toddle-help.pd0000644000076500007650000000271711467116403015035 0ustar hanshans#N canvas 194 167 644 497 12; #X obj 21 258 toddle blue 50 50; #X obj 254 397 toddle magenta 62 67; #X obj 21 315 print; #X msg 21 232 bang; #X msg 254 251 size 15 15; #X obj 22 57 toddle black 15 15; #X text 333 250 set the size; #X text 42 54 default toddle; #X obj 22 92 toddle black 40 40; #X text 72 105 toddle black 40 40; #X obj 22 149 toddle red 15 15; #X text 46 148 toddle red; #X obj 22 180 toddle green 10 40; #X text 43 193 toddle green 10 40; #X text 19 460 (C) 1999 Guenter Geiger; #X text 232 9 The Toddle object; #X text 232 24 ==================; #X msg 460 248 size \$1 \$2; #X floatatom 460 206 0 0 0; #X obj 460 227 pack 1 2; #X floatatom 511 206 0 0 0; #X msg 460 183 bang; #X text 254 155 wow .....; #X msg 460 285 color magenta \, bang; #X msg 459 306 color red \, bang; #X msg 459 328 color slategrey \, bang; #X msg 460 350 color darkgreen \, bang; #X text 199 52 To create: Put->Object and type in the "toddle"; #X floatatom 75 231 0 0 0; #X text 75 263 toddle is not a "bang"; #X text 75 278 converter \, but routes; #X text 76 294 messages through; #X connect 0 0 2 0; #X connect 3 0 0 0; #X connect 4 0 1 0; #X connect 5 0 8 0; #X connect 8 0 10 0; #X connect 10 0 12 0; #X connect 17 0 1 0; #X connect 18 0 19 0; #X connect 19 0 17 0; #X connect 20 0 19 1; #X connect 20 0 21 0; #X connect 21 0 18 0; #X connect 23 0 1 0; #X connect 24 0 1 0; #X connect 25 0 1 0; #X connect 26 0 1 0; #X connect 28 0 0 0; pd-ggee_0.26/gui/fatom.c0000644000076500007650000000043111467116403013550 0ustar hanshans#include #include "g_canvas.h" #include "fatom.h" static t_class *fatom_class; void fatom_setup() { post("fatom setup"); fatom_class = class_new(gensym("fatom"), (t_newmethod)fatom_new, 0, sizeof(t_fatom),0,A_DEFSYM,0); fatom_setup_common(fatom_class); } pd-ggee_0.26/gui/fatom.h0000644000076500007650000003170211467116403013562 0ustar hanshans/* ------------------------ fatom ----------------------------- */ #define x_val a_pos.a_w.w_float #define DEBUG(x) #include #include typedef struct _fatom { t_object x_obj; t_atom a_pos; /* the value of the fatom */ t_glist * x_glist; /* value of the current canvas, intialized in _new */ int x_rect_width; /* width of the widget */ int x_rect_height; /* height of the widget */ t_symbol* x_sym; /* symbol for receiving callbacks from GUI */ t_symbol* x_type; /* type of fatom (vslider, hslider, checkbutton) */ t_symbol* x_text; /* associated widget text */ int x_max; /* maximum value of a_pos (x_val) */ int x_min; /* minimum value of a_pos (x_val) */ int x_width; /* width of widget (e.g x_rect_height + 15 for hslider, x_rect_width + 15 for slider) */ t_symbol* x_color; t_symbol* x_bgcolor; } t_fatom; /* widget helper functions */ static void draw_inlets(t_fatom *x, t_glist *glist, int firsttime, int nin, int nout) { int n = nin; int nplus, i; nplus = (n == 1 ? 1 : n-1); DEBUG(post("draw inlet");) for (i = 0; i < n; i++) { int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n", glist_getcanvas(glist), onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 1, onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height, x, i); else sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 1, onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height); } n = nout; nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n", glist_getcanvas(glist), onset, text_ypix(&x->x_obj, glist), onset + IOWIDTH, text_ypix(&x->x_obj, glist) + 1, x, i); else sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n", glist_getcanvas(glist), x, i, onset, text_ypix(&x->x_obj, glist), onset + IOWIDTH, text_ypix(&x->x_obj, glist) + 1); } DEBUG(post("draw inlet end");) } static void draw_handle(t_fatom *x, t_glist *glist, int firsttime) { int onset = text_xpix(&x->x_obj, glist) + (x->x_rect_width - IOWIDTH+2); if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xhandle\n", glist_getcanvas(glist), onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12, onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-4, x); else sys_vgui(".x%x.c coords %xhandle %d %d %d %d\n", glist_getcanvas(glist), x, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12, onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-4); } static void create_widget(t_fatom *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); post("slider create widget"); sys_vgui("destroy .x%x.c.s%x\n",glist_getcanvas(glist),x); if (!strcmp(x->x_type->s_name,"vslider")) { x->x_rect_width = x->x_width+15; x->x_rect_height = x->x_max-x->x_min+26; sys_vgui("scale .x%x.c.s%x \ -sliderlength 10 \ -showvalue 0 \ -length %d \ -resolution 0.01 \ -repeatinterval 20 \ -from %d -to %d \ -width %d \ -bg %s \ -activebackground %s \ -troughcolor %s \ -command fatom_cb%x\n",canvas,x, x->x_max-x->x_min+14, x->x_max, x->x_min, x->x_width, x->x_color->s_name, x->x_color->s_name, x->x_bgcolor->s_name, x); } else if (!strcmp(x->x_type->s_name,"hslider")) { x->x_rect_width = x->x_max-x->x_min + 24; x->x_rect_height = x->x_width + 15; sys_vgui("scale .x%x.c.s%x \ -sliderlength 10 \ -showvalue 0 \ -length %d \ -resolution 0.01 \ -orient horizontal \ -repeatinterval 20 \ -from %d -to %d \ -width %d \ -bg %s \ -activebackground %s \ -troughcolor %s \ -command fatom_cb%x\n",canvas,x, x->x_max-x->x_min+14, x->x_min, x->x_max, x->x_width, x->x_color->s_name, x->x_color->s_name, x->x_bgcolor->s_name, x); } else if (!strcmp(x->x_type->s_name,"checkbutton")) { x->x_rect_width = 32; x->x_rect_height = 28; sys_vgui("checkbutton .x%x.c.s%x \ -command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -text \"%s\" \ -bg %s \ -activebackground %s \ \n",canvas,x,x,x,x, x->x_text->s_name, x->x_color->s_name, x->x_bgcolor->s_name); } else if (!strcmp(x->x_type->s_name,"hradio")) { int i; x->x_rect_width = 8*20; x->x_rect_height = 25; for (i=0;i<8;i++) { sys_vgui("radiobutton .x%x.c.s%x%d \ -command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -value %d\n",canvas,x,i,x,x,x,i); } /* TODO pack them */ } else if (!strcmp(x->x_type->s_name,"vradio")) { int i; x->x_rect_width = 30; x->x_rect_height = 20*8+5; for (i=0;i<8;i++) { sys_vgui("radiobutton .x%x.c.s%x%d \ -command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -value %d\n",canvas,x,i,x,x,x,i); } /* TODO pack them */ } else { x->x_rect_width = 32; x->x_rect_height = 140; sys_vgui("scale .x%x.c.s%x \ -sliderlength 10 \ -showvalue 0 \ -length 131 \ -from 127 -to 0 \ -command fatom_cb%x\n",canvas,x,x); } /* set the start value */ if (!strcmp(x->x_type->s_name,"checkbutton")) { if (x->x_val) sys_vgui(".x%x.c.s%x select\n",canvas,x,x->x_val); else sys_vgui(".x%x.c.s%x deselect\n",canvas,x,x->x_val); } else sys_vgui(".x%x.c.s%x set %f\n",canvas,x,x->x_val); } static void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime) { t_canvas *canvas=glist_getcanvas(glist);// x->x_glist;//glist_getcanvas(glist); DEBUG(post("drawme %d",firsttime);) if (firsttime) { DEBUG(post("glist %x canvas %x",x->x_glist,canvas)); create_widget(x,glist); x->x_glist = canvas; post("create window to hold widget"); sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n", canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2,x->x_glist,x,x); } else { sys_vgui(".x%x.c coords %xS \ %d %d\n", canvas, x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2); } draw_inlets(x, glist, firsttime, 1,1); // draw_handle(x, glist, firsttime); } static void fatom_erase(t_fatom* x,t_glist* glist) { int n; DEBUG(post("erase");) sys_vgui("destroy .x%x.c.s%x\n",glist_getcanvas(glist),x); sys_vgui(".x%x.c delete %xS\n",glist_getcanvas(glist), x); /* inlets and outlets */ sys_vgui(".x%x.c delete %xi%d\n",glist_getcanvas(glist),x,0); sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,0); sys_vgui(".x%x.c delete %xhandle\n",glist_getcanvas(glist),x,0); } /* ------------------------ fatom widgetbehaviour----------------------------- */ static void fatom_getrect(t_gobj *z, t_glist *owner, int *xp1, int *yp1, int *xp2, int *yp2) { int width, height; t_fatom* s = (t_fatom*)z; width = s->x_rect_width; height = s->x_rect_height; *xp1 = text_xpix(&s->x_obj, owner); *yp1 = text_ypix(&s->x_obj, owner); *xp2 = text_xpix(&s->x_obj, owner) + width; *yp2 = text_ypix(&s->x_obj, owner) + height; } static void fatom_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_fatom *x = (t_fatom *)z; DEBUG(post("displace");) x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; if (glist_isvisible(glist)) { sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), text_xpix(&x->x_obj, glist) + x->x_rect_width, text_ypix(&x->x_obj, glist) + x->x_rect_height); fatom_drawme(x, glist, 0); canvas_fixlinesfor(glist,(t_text*) x); } DEBUG(post("displace end");) } static void fatom_select(t_gobj *z, t_glist *glist, int state) { t_fatom *x = (t_fatom *)z; if (state) { sys_vgui(".x%x.c create rectangle \ %d %d %d %d -tags %xSEL -outline blue\n", glist_getcanvas(glist), text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), text_xpix(&x->x_obj, glist) + x->x_rect_width, text_ypix(&x->x_obj, glist) + x->x_rect_height, x); } else { sys_vgui(".x%x.c delete %xSEL\n", glist_getcanvas(glist), x); } } static void fatom_activate(t_gobj *z, t_glist *glist, int state) { /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ } static void fatom_delete(t_gobj *z, t_glist *glist) { t_text *x = (t_text *)z; canvas_deletelinesfor(glist, x); } static void fatom_vis(t_gobj *z, t_glist *glist, int vis) { t_fatom* x = (t_fatom*)z; DEBUG(post("vis: %d",vis);) if (vis) { fatom_drawme(x, glist, 1); } else { fatom_erase(x,glist); } } static void fatom_save(t_gobj *z, t_binbuf *b); t_widgetbehavior fatom_widgetbehavior; void fatom_size(t_fatom* x,t_floatarg w,t_floatarg h) { x->x_rect_width = w; x->x_rect_height = h; } void fatom_color(t_fatom* x,t_symbol* col) { /* outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang .. so color black does the same as bang, but doesn't forward the bang */ } static void fatom_float(t_fatom* x,t_floatarg f) { x->x_val = f; if (glist_isvisible(x->x_glist)) { if (!strcmp(x->x_type->s_name,"checkbutton")) { if (x->x_val) sys_vgui(".x%x.c.s%x select\n",x->x_glist,x,f); else sys_vgui(".x%x.c.s%x deselect\n",x->x_glist,x,f); } else sys_vgui(".x%x.c.s%x set %f\n",x->x_glist,x,f); } outlet_float(x->x_obj.ob_outlet,f); } static void fatom_bang(t_fatom* x,t_floatarg f) { outlet_float(x->x_obj.ob_outlet,x->x_val); } static void fatom_f(t_fatom* x,t_floatarg f) { x->x_val = f; outlet_float(x->x_obj.ob_outlet,f); } static void fatom_properties(t_gobj *z, t_glist *owner) { post("N/I"); } static void fatom_save(t_gobj *z, t_binbuf *b) { t_fatom *x = (t_fatom *)z; binbuf_addv(b, "ssiiss", gensym("#X"),gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , gensym("fatom"),x->x_type); binbuf_addv(b, ";"); } static void *fatom_new(t_fatom* x,t_floatarg max, t_floatarg min, t_floatarg h,t_symbol* text) { char buf[256]; x->x_glist = canvas_getcurrent(); if (text != &s_) x->x_text = text; else x->x_text = gensym(""); x->a_pos.a_type = A_FLOAT; if (!max) x->x_max = 127; else x->x_max = max; x->x_min = min; if (h) x->x_width = h; else x->x_width = 15; x->x_color = gensym("grey"); x->x_bgcolor = gensym("grey"); /* bind to a symbol for slider callback (later make this based on the filepath ??) */ sprintf(buf,"fatom%x",x); x->x_sym = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->x_sym); /* pipe startup code to slitk */ sys_vgui("proc fatom_cb%x {val} {\n pd [concat fatom%x f $val \\;]\n }\n",x,x); outlet_new(&x->x_obj, &s_float); return (x); } void fatom_setup_common(t_class* class) { fatom_widgetbehavior.w_getrectfn = fatom_getrect; fatom_widgetbehavior.w_displacefn = fatom_displace; fatom_widgetbehavior.w_selectfn = fatom_select; fatom_widgetbehavior.w_activatefn = fatom_activate; fatom_widgetbehavior.w_deletefn = fatom_delete; fatom_widgetbehavior.w_visfn = fatom_vis; #if PD_MINOR_VERSION < 37 fatom_widgetbehavior.w_savefn = fatom_save; fatom_widgetbehavior.w_propertiesfn = NULL, #endif fatom_widgetbehavior.w_clickfn = NULL, class_addfloat(class, (t_method)fatom_float); class_addbang(class, (t_method)fatom_bang); class_addmethod(class, (t_method)fatom_f, gensym("f"), A_FLOAT, 0); /* class_addmethod(class, (t_method)fatom_size, gensym("size"), A_FLOAT, A_FLOAT, 0); class_addmethod(class, (t_method)fatom_color, gensym("color"), A_SYMBOL, 0); */ /* class_addmethod(class, (t_method)fatom_open, gensym("open"), A_SYMBOL, 0); */ class_setwidget(class,&fatom_widgetbehavior); #if PD_MINOR_VERSION >= 37 class_setsavefn(class,&fatom_save); #endif } pd-ggee_0.26/other/0000755000076500007650000000000011467116402012634 5ustar hanshanspd-ggee_0.26/other/messages.c0000644000076500007650000000131711467116402014611 0ustar hanshans/* (C) Guenter Geiger */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ messages ----------------------------- */ static t_class *messages_class; typedef struct _messages { t_object x_obj; } t_messages; void messages_bang(t_messages *x) { post("bang"); } static void *messages_new() { t_messages *x = (t_messages *)pd_new(messages_class); outlet_new(&x->x_obj, &s_float); return (x); } void messages_setup(void) { messages_class = class_new(gensym("messages"), (t_newmethod)messages_new, 0, sizeof(t_messages), 0,0); class_addbang(messages_class,messages_bang); } pd-ggee_0.26/other/ls_setup0000755000076500007650000000705711467116402014431 0ustar hanshansFile: loudspeaker_hdm_3D Configured 28 sets in 3 dimensions: Triplet 0 Loudspeakers: 1 5 6 Matrix 4.456940 0.000000 -3.755852 -2.228470 -0.923062 2.655788 -2.228470 0.923062 2.655788 Triplet 1 Loudspeakers: 1 5 9 Matrix 0.652704 1.575766 0.777862 0.000000 -1.846125 -0.000000 0.652704 -0.270359 -0.777862 Triplet 2 Loudspeakers: 1 6 9 Matrix 0.652704 -1.575766 0.777862 -0.000000 1.846125 0.000000 0.652704 0.270359 -0.777862 Triplet 3 Loudspeakers: 2 6 8 Matrix 0.000002 4.456941 -3.755853 0.923062 -2.228471 2.655789 -0.923063 -2.228470 2.655789 Triplet 4 Loudspeakers: 2 6 10 Matrix -1.575766 0.652704 0.777862 1.846125 -0.000001 -0.000000 0.270359 0.652703 -0.777862 Triplet 5 Loudspeakers: 2 8 10 Matrix 1.575766 0.652703 0.777862 -1.846125 0.000001 0.000000 -0.270358 0.652704 -0.777862 Triplet 6 Loudspeakers: 3 5 7 Matrix 0.000002 -4.456941 -3.755853 0.923062 2.228471 2.655789 -0.923063 2.228470 2.655789 Triplet 7 Loudspeakers: 3 5 11 Matrix -1.575766 -0.652704 0.777862 1.846125 0.000001 0.000000 0.270359 -0.652703 -0.777862 Triplet 8 Loudspeakers: 3 7 11 Matrix 1.575766 -0.652703 0.777862 -1.846125 -0.000001 -0.000000 -0.270358 -0.652704 -0.777862 Triplet 9 Loudspeakers: 4 7 8 Matrix -4.456932 -0.000000 -3.755843 2.228464 -0.923062 2.655782 2.228468 0.923062 2.655785 Triplet 10 Loudspeakers: 4 7 12 Matrix -0.652703 1.575764 0.777862 -0.000001 -1.846122 0.000000 -0.652704 -0.270359 -0.777862 Triplet 11 Loudspeakers: 4 8 12 Matrix -0.652705 -1.575766 0.777862 0.000001 1.846125 -0.000000 -0.652703 0.270359 -0.777862 Triplet 12 Loudspeakers: 5 6 7 Matrix 0.923063 -0.923062 -0.000001 -0.000000 0.923062 0.777862 -0.923062 -0.000000 0.777862 Triplet 13 Loudspeakers: 5 9 13 Matrix 0.652704 -0.270359 0.777862 1.305407 1.305407 0.000000 -0.652704 -1.575766 -0.777862 Triplet 14 Loudspeakers: 5 11 13 Matrix 0.270359 -0.652703 0.777862 -1.305407 -1.305407 -0.000000 1.575766 0.652704 -0.777862 Triplet 15 Loudspeakers: 6 7 8 Matrix 0.923062 0.000000 0.777862 -0.000000 -0.923062 0.777862 -0.923062 0.923062 0.000001 Triplet 16 Loudspeakers: 6 9 14 Matrix 0.652704 0.270359 0.777862 1.305407 -1.305407 -0.000000 -0.652704 1.575766 -0.777862 Triplet 17 Loudspeakers: 6 10 14 Matrix 0.270359 0.652703 0.777862 -1.305407 1.305407 0.000000 1.575766 -0.652704 -0.777862 Triplet 18 Loudspeakers: 7 11 15 Matrix -0.270358 -0.652704 0.777862 1.305408 -1.305407 0.000000 -1.575766 0.652703 -0.777862 Triplet 19 Loudspeakers: 7 12 15 Matrix -0.652704 -0.270359 0.777862 -1.305406 1.305405 -0.000000 0.652703 -1.575764 -0.777862 Triplet 20 Loudspeakers: 8 10 16 Matrix -0.270358 0.652704 0.777862 1.305408 1.305407 -0.000000 -1.575766 -0.652703 -0.777862 Triplet 21 Loudspeakers: 8 12 16 Matrix -0.652703 0.270359 0.777862 -1.305408 -1.305407 0.000000 0.652705 1.575766 -0.777862 Triplet 22 Loudspeakers: 9 13 14 Matrix 4.456940 -0.000000 3.755852 -2.228470 -0.923062 -2.655788 -2.228470 0.923062 -2.655788 Triplet 23 Loudspeakers: 10 14 16 Matrix 0.000002 4.456941 3.755853 0.923062 -2.228471 -2.655789 -0.923063 -2.228470 -2.655789 Triplet 24 Loudspeakers: 11 13 15 Matrix 0.000002 -4.456941 3.755853 0.923062 2.228471 -2.655789 -0.923063 2.228470 -2.655789 Triplet 25 Loudspeakers: 12 15 16 Matrix -4.456932 0.000000 3.755843 2.228464 -0.923062 -2.655782 2.228468 0.923062 -2.655785 Triplet 26 Loudspeakers: 13 14 15 Matrix 0.923063 -0.923062 0.000001 -0.000000 0.923062 -0.777862 -0.923062 0.000000 -0.777862 Triplet 27 Loudspeakers: 14 15 16 Matrix 0.923062 -0.000000 -0.777862 -0.000000 -0.923062 -0.777862 -0.923062 0.923062 -0.000001 pd-ggee_0.26/other/vbap-help.pd0000644000076500007650000000252011467116402015036 0ustar hanshans#N canvas 477 72 599 479 10; #X msg 82 109 20 0; #X obj 27 108 pack 1 2; #X floatatom 27 87 0 0 0; #X floatatom 70 88 0 0 0; #X obj 62 176 route 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; #X floatatom 62 221 0 0 0; #X floatatom 78 251 0 0 0; #X floatatom 94 284 0 0 0; #X floatatom 111 316 0 0 0; #X floatatom 127 224 0 0 0; #X floatatom 143 251 0 0 0; #X floatatom 160 282 0 0 0; #X floatatom 176 317 0 0 0; #X floatatom 216 225 0 0 0; #X floatatom 239 251 0 0 0; #X floatatom 273 277 0 0 0; #X floatatom 334 247 0 0 0; #X floatatom 309 225 0 0 0; #X floatatom 308 314 0 0 0; #X floatatom 373 276 0 0 0; #X floatatom 415 315 0 0 0; #X floatatom 401 227 0 0 0; #X floatatom 476 295 0 0 0; #X floatatom 443 258 0 0 0; #X text 31 15 A VBAP (Vector Base Amplitude Panning) external; #X obj 82 144 vbap; #X connect 0 0 25 0; #X connect 1 0 25 0; #X connect 2 0 1 0; #X connect 3 0 1 1; #X connect 4 0 5 0; #X connect 4 1 6 0; #X connect 4 2 7 0; #X connect 4 3 8 0; #X connect 4 4 9 0; #X connect 4 5 10 0; #X connect 4 6 11 0; #X connect 4 7 12 0; #X connect 4 8 13 0; #X connect 4 9 14 0; #X connect 4 10 15 0; #X connect 4 11 16 0; #X connect 4 12 17 0; #X connect 4 13 18 0; #X connect 4 14 19 0; #X connect 4 15 20 0; #X connect 4 16 21 0; #X connect 4 17 22 0; #X connect 4 18 23 0; #X connect 25 0 4 0; pd-ggee_0.26/other/ls_setup160000755000076500007650000000705711467116402014600 0ustar hanshansFile: loudspeaker_hdm_3D Configured 28 sets in 3 dimensions: Triplet 0 Loudspeakers: 1 5 6 Matrix 4.456940 0.000000 -3.755852 -2.228470 -0.923062 2.655788 -2.228470 0.923062 2.655788 Triplet 1 Loudspeakers: 1 5 9 Matrix 0.652704 1.575766 0.777862 0.000000 -1.846125 -0.000000 0.652704 -0.270359 -0.777862 Triplet 2 Loudspeakers: 1 6 9 Matrix 0.652704 -1.575766 0.777862 -0.000000 1.846125 0.000000 0.652704 0.270359 -0.777862 Triplet 3 Loudspeakers: 2 6 8 Matrix 0.000002 4.456941 -3.755853 0.923062 -2.228471 2.655789 -0.923063 -2.228470 2.655789 Triplet 4 Loudspeakers: 2 6 10 Matrix -1.575766 0.652704 0.777862 1.846125 -0.000001 -0.000000 0.270359 0.652703 -0.777862 Triplet 5 Loudspeakers: 2 8 10 Matrix 1.575766 0.652703 0.777862 -1.846125 0.000001 0.000000 -0.270358 0.652704 -0.777862 Triplet 6 Loudspeakers: 3 5 7 Matrix 0.000002 -4.456941 -3.755853 0.923062 2.228471 2.655789 -0.923063 2.228470 2.655789 Triplet 7 Loudspeakers: 3 5 11 Matrix -1.575766 -0.652704 0.777862 1.846125 0.000001 0.000000 0.270359 -0.652703 -0.777862 Triplet 8 Loudspeakers: 3 7 11 Matrix 1.575766 -0.652703 0.777862 -1.846125 -0.000001 -0.000000 -0.270358 -0.652704 -0.777862 Triplet 9 Loudspeakers: 4 7 8 Matrix -4.456932 -0.000000 -3.755843 2.228464 -0.923062 2.655782 2.228468 0.923062 2.655785 Triplet 10 Loudspeakers: 4 7 12 Matrix -0.652703 1.575764 0.777862 -0.000001 -1.846122 0.000000 -0.652704 -0.270359 -0.777862 Triplet 11 Loudspeakers: 4 8 12 Matrix -0.652705 -1.575766 0.777862 0.000001 1.846125 -0.000000 -0.652703 0.270359 -0.777862 Triplet 12 Loudspeakers: 5 6 7 Matrix 0.923063 -0.923062 -0.000001 -0.000000 0.923062 0.777862 -0.923062 -0.000000 0.777862 Triplet 13 Loudspeakers: 5 9 13 Matrix 0.652704 -0.270359 0.777862 1.305407 1.305407 0.000000 -0.652704 -1.575766 -0.777862 Triplet 14 Loudspeakers: 5 11 13 Matrix 0.270359 -0.652703 0.777862 -1.305407 -1.305407 -0.000000 1.575766 0.652704 -0.777862 Triplet 15 Loudspeakers: 6 7 8 Matrix 0.923062 0.000000 0.777862 -0.000000 -0.923062 0.777862 -0.923062 0.923062 0.000001 Triplet 16 Loudspeakers: 6 9 14 Matrix 0.652704 0.270359 0.777862 1.305407 -1.305407 -0.000000 -0.652704 1.575766 -0.777862 Triplet 17 Loudspeakers: 6 10 14 Matrix 0.270359 0.652703 0.777862 -1.305407 1.305407 0.000000 1.575766 -0.652704 -0.777862 Triplet 18 Loudspeakers: 7 11 15 Matrix -0.270358 -0.652704 0.777862 1.305408 -1.305407 0.000000 -1.575766 0.652703 -0.777862 Triplet 19 Loudspeakers: 7 12 15 Matrix -0.652704 -0.270359 0.777862 -1.305406 1.305405 -0.000000 0.652703 -1.575764 -0.777862 Triplet 20 Loudspeakers: 8 10 16 Matrix -0.270358 0.652704 0.777862 1.305408 1.305407 -0.000000 -1.575766 -0.652703 -0.777862 Triplet 21 Loudspeakers: 8 12 16 Matrix -0.652703 0.270359 0.777862 -1.305408 -1.305407 0.000000 0.652705 1.575766 -0.777862 Triplet 22 Loudspeakers: 9 13 14 Matrix 4.456940 -0.000000 3.755852 -2.228470 -0.923062 -2.655788 -2.228470 0.923062 -2.655788 Triplet 23 Loudspeakers: 10 14 16 Matrix 0.000002 4.456941 3.755853 0.923062 -2.228471 -2.655789 -0.923063 -2.228470 -2.655789 Triplet 24 Loudspeakers: 11 13 15 Matrix 0.000002 -4.456941 3.755853 0.923062 2.228471 -2.655789 -0.923063 2.228470 -2.655789 Triplet 25 Loudspeakers: 12 15 16 Matrix -4.456932 0.000000 3.755843 2.228464 -0.923062 -2.655782 2.228468 0.923062 -2.655785 Triplet 26 Loudspeakers: 13 14 15 Matrix 0.923063 -0.923062 0.000001 -0.000000 0.923062 -0.777862 -0.923062 0.000000 -0.777862 Triplet 27 Loudspeakers: 14 15 16 Matrix 0.923062 -0.000000 -0.777862 -0.000000 -0.923062 -0.777862 -0.923062 0.923062 -0.000001 pd-ggee_0.26/other/Makefile0000755000076500007650000000136211467116402014301 0ustar hanshanscurrent: nt # TARGETS += stk VERSION = \"0.24\" .SUFFIXES: .dll .obj # ----------------------- NT ---------------------------- NTOBJECTS = *.obj NTDLLS = *.dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo PDNTINCLUDE = /I. /I..\..\pd\src ProgramFiles = C:\Program Files PDNTLDIR = "$(ProgramFiles)\Microsoft Visual Studio\Vc98\lib" #PDNTLDIR = "C:\Programme\Msdev\Vc98\lib" PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\wsock32.lib \ $(PDNTLDIR)\kernel32.lib \ $(PDNTLDIR)\uuid.lib \ ..\..\pd\bin\pd.lib nt: $(NTOBJECTS) -link /dll $(PDNTLIB) vbap.obj /export:vbap_setup clean: del *.obj del *.dll .c.obj: -cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c .obj.dll: pd-ggee_0.26/other/vbap.c0000644000076500007650000001437711467116402013744 0ustar hanshans/* (C) Guenter Geiger */ /* (C) Guenter Geiger based on code by: (c) Ville Pulkki 2.2.1999 Helsinki University of Technology Laboratory of Acoustics and Audio Signal Processing */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include #ifndef __APPLE__ #include #endif #include /* strtok */ #define MAX_TRIPLET_AMOUNT 64 /* this is related to the number of ls .. and shoud be 3**(MAX_LS_AMOUNT / 4) */ #define MAX_LS_AMOUNT 16 #define MAX_DIM_SQUARE 9 /* ------------------------ vbap ----------------------------- */ static t_class *vbap_class; typedef struct _vbap { t_object x_ob; t_outlet* x_out2; t_outlet* x_out3; t_float lsm[MAX_TRIPLET_AMOUNT][MAX_LS_AMOUNT+1]; /* loudspeaker triplet matrices */ int lstripl[MAX_TRIPLET_AMOUNT][3]; /* loudspeaker triplet ldspeaker numbers */ int lasttrip[3]; int triplet_amount; int dimension; int opened; } t_vbap; t_float *angle_to_cart(t_float azi, t_float ele); void vbap(t_vbap* x,t_float g[3], int ls[3], t_float azi, t_float ele) ; int read_ls_conf(t_vbap* x,FILE *fp ); void vbap_list(t_vbap *x,t_symbol* s,t_int argc,t_atom* argv) { t_float azi,ele; t_float g[3]; int ls[3]; t_atom a[2]; if (argc != 2) post("vbap: list message required %d",argc); else { int i; azi = atom_getfloat(argv++); ele = atom_getfloat(argv++); vbap(x,g,ls,azi,ele); for (i=0;idimension;i++) { if (x->lasttrip[i] != ls[i]) { SETFLOAT(a,(t_float)x->lasttrip[i]); SETFLOAT(a+1,0.0f); outlet_list(x->x_ob.ob_outlet, &s_list,2 ,(t_atom*)&a); x->lasttrip[i] = ls[i]; } } for (i=0;idimension;i++) { SETFLOAT(a,(t_float)ls[i]); SETFLOAT(a+1,g[i]); outlet_list(x->x_ob.ob_outlet, &s_list,2 ,(t_atom*)&a); } } } void vbap_bang(t_vbap *x) { post("vbap: bang"); } static void *vbap_new(t_symbol* s) { FILE *fp; t_vbap *x = (t_vbap *)pd_new(vbap_class); char fname[MAXPDSTRING]; if (s == &s_) { post("vbap: Using default loudspeaker setup"); s = gensym("ls_setup"); } /* opening the loudspeaker matrix file*/ canvas_makefilename(canvas_getcurrent(),s->s_name, fname,MAXPDSTRING); if((fp=fopen(fname,"r"))==NULL){ post("vbap: Could not open loudspeaker data file %s\n",fname); x->opened = 0; } else { if (!read_ls_conf(x,fp)) return NULL; x->opened = 1; fclose(fp); } x->lasttrip[0] = 0; x->lasttrip[1] = 1; x->lasttrip[2] = 2; outlet_new(&x->x_ob, &s_list); return (x); } void vbap_setup(void) { vbap_class = class_new(gensym("vbap"), (t_newmethod)vbap_new, 0, sizeof(t_vbap), 0,A_DEFSYM,0); /* class_addbang(vbap_class,vbap_bang);*/ class_addlist(vbap_class,vbap_list); } t_float *angle_to_cart(t_float azi, t_float ele) { t_float *res; t_float atorad = (2 * 3.1415927 / 360) ; res = (t_float *) malloc(3*sizeof(t_float)); res[0] = (float) (cos((t_float) (azi * atorad)) * cos((t_float) (ele * atorad))); res[1] = (float) (sin((t_float) (azi * atorad)) * cos((t_float) (ele * atorad))); res[2] = (float) (sin((t_float) (ele * atorad))); return res; } void vbap(t_vbap* x,t_float g[3], int ls[3], float azi, float ele) { /* calculates gain factors using loudspeaker setup and given direction */ t_float *cartdir; t_float power; int i,j,k; t_float small_g; t_float big_sm_g, gtmp[3]; int winner_triplet; cartdir=angle_to_cart(azi,ele); big_sm_g = -100000.0; for(i=0;itriplet_amount;i++){ small_g = 10000000.0; for(j=0;jdimension;j++){ gtmp[j]=0.0; for(k=0;kdimension;k++) gtmp[j]+=cartdir[k]*x->lsm[i][k+j*x->dimension]; if(gtmp[j] < small_g) small_g = gtmp[j]; } if(small_g > big_sm_g){ big_sm_g = small_g; winner_triplet=i; g[0]=gtmp[0]; g[1]=gtmp[1]; ls[0]=x->lstripl[i][0]; ls[1]=x->lstripl[i][1]; if(x->dimension==3){ g[2]=gtmp[2]; ls[2]=x->lstripl[i][2]; } else { g[2]=0.0; ls[2]=0; } } } /* this should probably be optimized somehow */ power=sqrt(g[0]*g[0] + g[1]*g[1] + g[2]*g[2]); /* power=g[0]+g[1];*/ g[0] /= power; g[1] /= power; g[2] /= power; free(cartdir); } int read_ls_conf(t_vbap* x,FILE *fp ){ /* reads from specified file the loudspeaker triplet setup */ int amount,i,j,a,b,d=0; char *toke; char c[1000]; t_float mx[MAX_DIM_SQUARE]; fgets(c,1000,fp); toke = (char *) strtok(c, " "); toke = (char *) strtok(NULL, " "); toke = (char *) strtok(NULL, " "); if((toke = (char *) strtok(NULL, " "))==NULL){ fprintf(stderr,"Wrong ls matrix file?\n"); return 0; } sscanf(toke, "%d",&amount); toke = (char *) strtok(NULL, " "); toke = (char *) strtok(NULL, " "); if((toke = (char *) strtok(NULL, " "))==NULL){ fprintf(stderr,"Wrong ls matrix file?\n"); return 0; } sscanf(toke, "%d",&x->dimension); x->triplet_amount = amount; for(i=0;idimension==3){ fprintf(stderr,"Something wrong in ls matrix file\n"); return 0; } if(strncmp(toke,"Pair",4)!=0 && x->dimension==2){ fprintf(stderr,"Something wrong in ls matrix file\n"); return 0; } toke = (char *) strtok(NULL, " "); toke = (char *) strtok(NULL, " "); toke = (char *) strtok(NULL, " "); sscanf(toke, "%d",&a); x->lstripl[i][0]=a; toke = (char *) strtok(NULL, " "); sscanf(toke, "%d",&b); x->lstripl[i][1]=b; if (x->dimension==3){ toke = (char *) strtok(NULL, " "); sscanf(toke, "%d",&d); x->lstripl[i][2]=d; } toke = (char *) strtok(NULL, " "); for(j=0;j<(x->dimension*x->dimension);j++){ toke = (char *) strtok(NULL, " "); sscanf(toke, "%f",&(mx[j])); x->lsm[i][j]=mx[j]; } } return 1; } pd-ggee_0.26/filters/0000755000076500007650000000000011467116403013164 5ustar hanshanspd-ggee_0.26/filters/highshelf-help.pd0000644000076500007650000000237411467116403016406 0ustar hanshans#N canvas 321 83 456 417 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 70 26 ===================================; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 96 109 0 0 0 0 - - -; #X floatatom 157 109 0 0 0 0 - - -; #X obj 157 132 trigger bang float; #X obj 43 206 biquad~; #X obj 43 146 noise~; #X obj 99 64 hsl 128 17 20 20000 1 1 empty empty frequency 5 9 0 10 -203904 -1 -1 5100 0; #X obj 160 87 hsl 128 17 0 100 0 1 empty empty gain 5 9 0 10 -204786 -1 -1 2800 0; #X obj 34 266 dac~; #X obj 43 234 *~ 0.1; #X floatatom 297 109 0 0 0 0 - - -; #X obj 297 132 trigger bang float; #X obj 300 87 hsl 128 17 0 100 0 1 empty empty slope 5 9 0 10 -261682 -1 -1 6600 0; #X text 76 12 Highshelf coefficients for biquad~; #X obj 96 175 highshelf 5000 70 100; #X connect 4 0 17 0; #X connect 5 0 6 0; #X connect 6 0 17 0; #X connect 6 1 17 1; #X connect 7 0 12 0; #X connect 8 0 7 0; #X connect 9 0 4 0; #X connect 10 0 5 0; #X connect 12 0 11 0; #X connect 12 0 11 1; #X connect 13 0 14 0; #X connect 14 0 17 0; #X connect 14 1 17 2; #X connect 15 0 13 0; #X connect 17 0 7 0; pd-ggee_0.26/filters/highpass-help.pd0000644000076500007650000000200711467116403016244 0ustar hanshans#N canvas 92 30 461 436 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 70 26 ===================================; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 176 119 0 0 0 0 - - -; #X floatatom 267 119 0 0 0 0 - - -; #X obj 267 142 trigger bang float; #X obj 113 216 biquad~; #X obj 113 156 noise~; #X obj 179 74 hsl 128 17 20 20000 1 1 empty empty frequency 5 9 0 10 -203904 -1 -1 10100 0; #X obj 270 97 hsl 128 17 0 100 0 1 empty empty bandwidth 5 9 0 10 -261682 -1 -1 6200 0; #X obj 176 185 highpass; #X obj 104 276 dac~; #X text 76 12 Highpass coefficients for biquad~; #X obj 113 244 *~ 0.1; #X connect 4 0 11 0; #X connect 5 0 6 0; #X connect 6 0 11 0; #X connect 6 1 11 1; #X connect 7 0 14 0; #X connect 8 0 7 0; #X connect 9 0 4 0; #X connect 10 0 5 0; #X connect 11 0 7 0; #X connect 14 0 12 0; #X connect 14 0 12 1; pd-ggee_0.26/filters/bandpass.c0000644000076500007650000000364111467116403015127 0ustar hanshans /* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- bandpass ----------------------------*/ static t_class *bandpass_class; void bandpass_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float alpha = e_alpha(x->x_bw* 0.01,omega); t_float b1 = 0.; t_float b0 = alpha; t_float b2 = -alpha; t_float a0 = 1 + alpha; t_float a1 = -2.*cos(omega); t_float a2 = 1 - alpha; /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("bandpass: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void bandpass_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; bandpass_bang(x); } static void *bandpass_new(t_floatarg f,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); /* floatinlet_new(&x->x_obj, &x->x_gain); */ floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; return (x); } void bandpass_setup(void) { bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(bandpass_class,bandpass_bang); class_addfloat(bandpass_class,bandpass_float); } pd-ggee_0.26/filters/lowpass-help.pd0000644000076500007650000000200611467116403016125 0ustar hanshans#N canvas 271 181 461 436 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 70 26 ===================================; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 176 119 0 0 0 0 - - -; #X floatatom 267 119 0 0 0 0 - - -; #X obj 267 142 trigger bang float; #X obj 113 216 biquad~; #X obj 113 156 noise~; #X obj 179 74 hsl 128 17 20 20000 1 1 empty empty frequency 5 9 0 10 -203904 -1 -1 8000 0; #X obj 270 97 hsl 128 17 0 100 0 1 empty empty bandwidth 5 9 0 10 -261682 -1 -1 6400 0; #X obj 104 276 dac~; #X obj 113 244 *~ 0.1; #X text 76 12 Lowpass coefficients for biquad~; #X obj 176 185 lowpass; #X connect 4 0 14 0; #X connect 5 0 6 0; #X connect 6 0 14 0; #X connect 6 1 14 1; #X connect 7 0 12 0; #X connect 8 0 7 0; #X connect 9 0 4 0; #X connect 10 0 5 0; #X connect 12 0 11 0; #X connect 12 0 11 1; #X connect 14 0 7 0; pd-ggee_0.26/filters/notch.c0000644000076500007650000000357011467116403014450 0ustar hanshans/* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- notch ----------------------------*/ static t_class *notch_class; void notch_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float alpha = e_alpha(x->x_bw* 0.01,omega); t_float b1 = -2.*cos(omega); t_float b0 = 1; t_float b2 = b0; t_float a0 = 1 + alpha; t_float a1 = -2.*cos(omega); t_float a2 = 1 - alpha; /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("notch: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void notch_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; notch_bang(x); } static void *notch_new(t_floatarg f,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); /* floatinlet_new(&x->x_obj, &x->x_gain); */ floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; return (x); } void notch_setup(void) { notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(notch_class,notch_bang); class_addfloat(notch_class,notch_float); } pd-ggee_0.26/filters/hlshelf.c0000644000076500007650000001207711467116403014764 0ustar hanshans/* (C) Guenter Geiger */ #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* ------------------------ hlshelf ----------------------------- */ #ifndef M_PI #define M_PI 3.141593f #endif #define SRATE 44100.0 #define MAX_GAIN 120.0f static t_class *hlshelf_class; typedef struct _hlshelf { t_object x_obj; float s_rate; float s_gain0; float s_gain1; float s_gain2; float s_ltransfq; float s_htransfq; float s_lradians; float s_hradians; } t_hlshelf; int hlshelf_check_stability(t_float fb1, t_float fb2, t_float ff1, t_float ff2, t_float ff3) { float discriminant = fb1 * fb1 + 4 * fb2; if (discriminant < 0) /* imaginary roots -- resonant filter */ { /* they're conjugates so we just check that the product is less than one */ if (fb2 >= -1.0f) goto stable; } else /* real roots */ { /* check that the parabola 1 - fb1 x - fb2 x^2 has a vertex between -1 and 1, and that it's nonnegative at both ends, which implies both roots are in [1-,1]. */ if (fb1 <= 2.0f && fb1 >= -2.0f && 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) goto stable; } return 0; stable: return 1; } void hlshelf_check(t_hlshelf *x) { if(x->s_gain0 - x->s_gain1 > MAX_GAIN) { x->s_gain0 = x->s_gain1 + MAX_GAIN; post("setting gain0 to %f",x->s_gain0); } if(x->s_gain1 > MAX_GAIN) { x->s_gain1 = MAX_GAIN; post("setting gain1 to %f",x->s_gain1); } if(x->s_gain2 - x->s_gain1 > MAX_GAIN) { x->s_gain2 = x->s_gain1 + MAX_GAIN; post("setting gain2 to %f",x->s_gain2); } /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */ x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f; if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f; x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); } void hlshelf_bang(t_hlshelf *x) { t_atom at[6]; float c0, c1, c2, d0, d1, d2; /* output coefs */ float a1, a2, b1, b2, g1, g2; /* temp coefs */ double xf; hlshelf_check(x); /* low shelf */ xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ if(xf < -200.) /* exp(x) -> 0 */ { a1 = 1.0f; b1 = -1.0f; g1 = 0.0f; } else { double t = tan(x->s_lradians); double e = exp(xf); double r = t / e; double kr = t * e; a1 = (r - 1) / (r + 1); b1 = (kr - 1) / (kr + 1); g1 = (kr + 1) / (r + 1); } /* high shelf */ xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ if(xf < -200.) /* exp(x) -> 0 */ { a2 = -1.0f; b2 = 1.0f; g2 = 0.0f; } else { double t = tan(x->s_hradians); double e = exp(xf); double r = t / e; double kr = t * e; a2 = (1 - r) / (1 + r); b2 = (1 - kr) / (1 + kr); g2 = (1 + kr) / (1 + r); } /* form product */ c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f)); ; c1 = a1 + a2; c2 = a1 * a2; d0 = 1.0f; d1 = b1 + b2; d2 = b1 * b2; if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) { post("hlshelf: filter unstable -> resetting"); c0=1.;c1=0.;c2=0.; d0=1.;d1=0.;d2=0.; } SETFLOAT(at,-c1/d0); SETFLOAT(at+1,-c2/d0); SETFLOAT(at+2,d0/d0); SETFLOAT(at+3,d1/d0); SETFLOAT(at+4,d2/d0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void hlshelf_float(t_hlshelf *x,t_floatarg f) { x->s_gain0 = f; hlshelf_bang(x); } static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at) { t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class); t_float k0 = atom_getfloat(at); t_float k1 = atom_getfloat(at+1); t_float k2 = atom_getfloat(at+2); t_float f1 = atom_getfloat(at+3); t_float f2 = atom_getfloat(at+4); f1 = atom_getfloat(at); f2 = atom_getfloat(at); if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */ f1 = 150.0f; f2 = 5000.0f; } if (f1 < 0) f1 = 0.0f; if (f2 > SRATE) f2 = .5f*SRATE; x->s_rate = SRATE; /* srate default */ x->s_gain0 = k0; x->s_gain1 = k1; x->s_gain2 = k2; x->s_ltransfq = 0.0f; x->s_htransfq = SRATE/2; x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); floatinlet_new(&x->x_obj, &x->s_gain1); floatinlet_new(&x->x_obj, &x->s_gain2); floatinlet_new(&x->x_obj, &x->s_ltransfq); floatinlet_new(&x->x_obj, &x->s_htransfq); outlet_new(&x->x_obj, &s_list); return (x); } void hlshelf_setup(void) { hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0, sizeof(t_hlshelf), 0, A_GIMME, 0); class_addbang(hlshelf_class,hlshelf_bang); class_addfloat(hlshelf_class,hlshelf_float); } pd-ggee_0.26/filters/moog~.c0000644000076500007650000000744311467116403014477 0ustar hanshans/* (C) Guenter Geiger */ #include "math.h" #include /* ----------------------------- moog ----------------------------- */ static t_class *moog_class; typedef struct _moog { t_object x_obj; t_pd in2; t_float x_1,x_2,x_3,x_4; t_float y_1,y_2,y_3,y_4; } t_moog; static void moog_reset(t_moog *x) { x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0.0; x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0.0; } static void *moog_new(t_symbol *s, int argc, t_atom *argv) { if (argc > 1) post("moog~: extra arguments ignored"); { t_moog *x = (t_moog *)pd_new(moog_class); outlet_new(&x->x_obj, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal); moog_reset(x); return (x); } } static t_float calc_k(t_float f,t_float k) { if (k>4.) k =4.; if (k < 0.) k = 0.; if (f <= 3800) return k; k = k - 0.5*((f-3800)/4300); return k; } t_int *moog_perform(t_int *w) { t_moog* x = (t_moog*) (w[1]); t_float *in1 = (t_float *)(w[2]); t_float *p = (t_float *)(w[3]); t_float *k = (t_float *)(w[4]); t_float *out = (t_float *)(w[5]); int n = (int)(w[6]); float in; float pt,pt1; float x1 = x->x_1; float x2 = x->x_2; float x3 = x->x_3; float x4 = x->x_4; float ys1 = x->y_1; float ys2 = x->y_2; float ys3 = x->y_3; float ys4 = x->y_4; while (n--) { if (*p > 8140) *p = 8140.; *k = calc_k(*p,*k); pt =*p; pt1=(pt+1)*0.76923077; in = *in1++ - *k*ys4; ys1 = (pt1)*in + 0.3*x1 - pt*ys1; x1 = in; ys2 = (pt1)*ys1 + 0.3*x2 - pt*ys2; x2 = ys1; ys3 = (pt1)*ys2 + 0.3 *x3 - pt*ys3; x3 = ys2; ys4 = (pt1)*ys3 + 0.3*x4 - pt*ys4; x4 = ys3; *out++ = ys4; } x->y_1 = ys1; x->y_2 = ys2; x->y_3 = ys3; x->y_4 = ys4; x->x_1 = x1; x->x_2 = x2; x->x_3 = x3; x->x_4 = x4; return (w+7); } #define CLIP(x) x = ((x) > 1.0 ? (1.0) : (x)) t_int *moog_perf8(t_int *w) { t_moog* x = (t_moog*) (w[1]); t_float *in1 = (t_float *)(w[2]); t_float *p = (t_float *)(w[3]); t_float *k = (t_float *)(w[4]); t_float *out = (t_float *)(w[5]); int n = (int)(w[6]); t_float x1 = x->x_1; t_float x2 = x->x_2; t_float x3 = x->x_3; t_float x4 = x->x_4; t_float ys1 = x->y_1; t_float ys2 = x->y_2; t_float ys3 = x->y_3; t_float ys4 = x->y_4; t_float temp,temp2; t_float pt,pt1; t_float in; while (n--) { if (*p > 8140.) *p = 8140.; *k = calc_k(*p,*k); pt =*p* 0.01*0.0140845 - 0.9999999f; pt1=(pt+1.0)*0.76923077; in = *in1++ - *k*ys4; ys1 = pt1*(in + 0.3*x1) - pt*ys1; x1 = in; ys2 = pt1*(ys1 + 0.3*x2) - pt*ys2; x2 = ys1; ys3 = pt1*(ys2 + 0.3*x3) - pt*ys3; x3 = ys2; ys4 = pt1*(ys3 + 0.3*x4) - pt*ys4; x4 = ys3; *out++ = ys4; p++;k++; } x->y_1 = ys1; x->y_2 = ys2; x->y_3 = ys3; x->y_4 = ys4; x->x_1 = x1; x->x_2 = x2; x->x_3 = x3; x->x_4 = x4; return (w+7); } void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n) { if (n&7) dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n); else dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n); } static void moog_dsp(t_moog *x, t_signal **sp) { dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n); } void moog_tilde_setup(void) { moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0, sizeof(t_moog), 0, A_GIMME, 0); class_addmethod(moog_class, nullfn, gensym("signal"), 0); class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0); class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL); } pd-ggee_0.26/filters/filtgain.pd0000644000076500007650000000330511467116403015307 0ustar hanshans#N canvas 178 144 702 459 10; #X obj 38 342 biquad~; #X obj 38 316 osc~ 220; #X obj 118 340 env~; #X floatatom 38 297; #X obj 38 419 dac~; #X obj 193 428 tabwrite array1; #X obj 325 400 int; #X obj 350 401 + 1; #X msg 296 399 0; #X obj 193 410 float; #X obj 218 372 t b f; #X obj 38 398 *~; #X obj 61 399 dbtorms; #X floatatom 368 359; #X obj 296 418 sel 500; #X obj 38 277 * 40; #X obj 325 380 metro 10; #X obj 325 359 r paint; #X obj 61 381 r volume; #X obj 38 7 inlet; #X floatatom 194 368; #X floatatom 279 360; #X obj 118 360 - 100; #X obj 118 382 * 0.01; #X graph graph2 0 -1 500 1 148 253 648 113; #X array array1 500 float; #X pop; #X msg 273 272 5000; #X msg 273 82 5000; #X msg 398 82 10000; #X msg 398 272 10000; #X msg 173 83 1000; #X msg 173 271 1000; #X text 105 6 subpatch used in filter externals see; #X obj 347 12 bandpass; #X obj 414 13 notch; #X obj 470 14 lowpass; #X obj 522 13 highpass; #X obj 522 35 equalizer; #X obj 347 34 highshelf; #X obj 414 34 lowshelf; #X obj 470 34 hlshelf; #X connect 0 0 2 0; #X connect 0 0 11 0; #X connect 1 0 0 0; #X connect 2 0 22 0; #X connect 3 0 1 0; #X connect 6 0 7 0; #X connect 6 0 10 0; #X connect 6 0 14 0; #X connect 6 0 15 0; #X connect 7 0 6 1; #X connect 8 0 6 0; #X connect 9 0 5 0; #X connect 10 0 9 0; #X connect 10 1 5 1; #X connect 11 0 4 0; #X connect 11 0 4 1; #X connect 12 0 11 1; #X connect 13 0 16 1; #X connect 14 0 8 0; #X connect 15 0 3 0; #X connect 16 0 6 0; #X connect 17 0 16 0; #X connect 18 0 12 0; #X connect 19 0 0 0; #X connect 20 0 5 0; #X connect 21 0 5 1; #X connect 22 0 23 0; #X connect 23 0 9 1; #X connect 26 0 25 0; #X connect 27 0 28 0; #X connect 29 0 30 0; pd-ggee_0.26/filters/hlshelf-help.pd0000644000076500007650000000356011467116403016070 0ustar hanshans#N canvas 317 111 789 401 10; #X text 7 351 (C) Guenter Geiger 2000; #X text 211 298 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 208 248 The hlshelf object creates filter coefficients for the biquad~ filter. The three shelfs of the filter are controlled through the gains \, the boundaries of the areas through f-low and f-high; #X text 37 12 high-low shelf coefficients for biquad~; #X text 31 26 ========================================; #X floatatom 488 101 0 0 0 0 - - -; #X floatatom 349 101 0 0 0 0 - - -; #X obj 349 123 trigger bang float; #X obj 45 223 biquad~; #X obj 45 163 noise~; #X obj 491 81 hsl 128 17 20 20000 1 1 empty empty frequency-low 5 9 0 10 -203904 -1 -1 4400 0; #X obj 352 81 hsl 128 17 0 100 0 1 empty empty gain2 5 9 0 10 -204786 -1 -1 9100 0; #X obj 36 283 dac~; #X obj 45 251 *~ 0.1; #X obj 129 192 hlshelf 30 50 70 500 5000; #X obj 488 123 trigger bang float; #X floatatom 628 101 0 0 0 0 - - -; #X obj 631 81 hsl 128 17 20 20000 1 1 empty empty frequency-high 5 9 0 10 -204800 -1 -1 8800 0; #X obj 628 123 trigger bang float; #X floatatom 209 101 0 0 0 0 - - -; #X obj 209 123 trigger bang float; #X obj 212 81 hsl 128 17 0 100 0 1 empty empty gain1 5 9 0 10 -204786 -1 -1 9200 0; #X floatatom 69 100 0 0 0 0 - - -; #X obj 72 80 hsl 128 17 0 100 0 1 empty empty gain0 5 9 0 10 -204786 -1 -1 2300 0; #X obj 129 140 bang; #X connect 5 0 15 0; #X connect 6 0 7 0; #X connect 7 0 24 0; #X connect 7 1 14 2; #X connect 8 0 13 0; #X connect 9 0 8 0; #X connect 10 0 5 0; #X connect 11 0 6 0; #X connect 13 0 12 0; #X connect 13 0 12 1; #X connect 14 0 8 0; #X connect 15 0 24 0; #X connect 15 1 14 3; #X connect 16 0 18 0; #X connect 17 0 16 0; #X connect 18 0 24 0; #X connect 18 1 14 4; #X connect 19 0 20 0; #X connect 20 0 24 0; #X connect 20 1 14 1; #X connect 21 0 19 0; #X connect 22 0 14 0; #X connect 23 0 22 0; #X connect 24 0 14 0; pd-ggee_0.26/filters/lowshelf-help.pd0000644000076500007650000000237211467116403016266 0ustar hanshans#N canvas 321 83 456 417 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 70 26 ===================================; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 96 109 0 0 0 0 - - -; #X floatatom 157 109 0 0 0 0 - - -; #X obj 157 132 trigger bang float; #X obj 43 206 biquad~; #X obj 43 146 noise~; #X obj 99 64 hsl 128 17 20 20000 1 1 empty empty frequency 5 9 0 10 -203904 -1 -1 5100 0; #X obj 160 87 hsl 128 17 0 100 0 1 empty empty gain 5 9 0 10 -204786 -1 -1 2800 0; #X obj 34 266 dac~; #X obj 43 234 *~ 0.1; #X text 76 12 Lowshelf coefficients for biquad~; #X floatatom 297 109 0 0 0 0 - - -; #X obj 297 132 trigger bang float; #X obj 300 87 hsl 128 17 0 100 0 1 empty empty slope 5 9 0 10 -261682 -1 -1 6600 0; #X obj 96 175 lowshelf 4000 50 100; #X connect 4 0 17 0; #X connect 5 0 6 0; #X connect 6 0 17 0; #X connect 6 1 17 1; #X connect 7 0 12 0; #X connect 8 0 7 0; #X connect 9 0 4 0; #X connect 10 0 5 0; #X connect 12 0 11 0; #X connect 12 0 11 1; #X connect 14 0 15 0; #X connect 15 0 17 0; #X connect 15 1 17 2; #X connect 16 0 14 0; #X connect 17 0 7 0; pd-ggee_0.26/filters/lowpass.c0000644000076500007650000000363411467116403015026 0ustar hanshans/* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- lowpass ----------------------------*/ static t_class *lowpass_class; void lowpass_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float alpha = e_alpha(x->x_bw*0.01,omega); t_float b1 = 1 - cos(omega); t_float b0 = b1/2.; t_float b2 = b0; t_float a0 = 1 + alpha; t_float a1 = -2.*cos(omega); t_float a2 = 1 - alpha; /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("lowpass: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void lowpass_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; lowpass_bang(x); } static void *lowpass_new(t_floatarg f,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); /* floatinlet_new(&x->x_obj, &x->x_gain); */ floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; return (x); } void lowpass_setup(void) { lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(lowpass_class,lowpass_bang); class_addfloat(lowpass_class,lowpass_float); } pd-ggee_0.26/filters/moog~-help.pd0000644000076500007650000000167411467116403015606 0ustar hanshans#N canvas 225 113 568 397 10; #X obj 186 210 moog~; #X obj 178 288 dac~; #X floatatom 226 163 5 0 0; #X floatatom 183 104 5 0 0; #X floatatom 25 113 5 0 0; #X obj 238 237 env~; #X floatatom 238 257 5 0 0; #X obj 186 257 *~ 0.1; #X msg 182 163 reset; #X obj 116 105 +~ 1; #X floatatom 116 63 5 0 0; #X floatatom 180 128 5 0 0; #X obj 116 146 +~ 100; #X obj 116 84 osc~ 0.25; #X obj 116 125 *~ 2000; #X obj 226 182 sig~ 3; #X obj 25 139 phasor~ 110; #X msg 249 52 \; pd dsp 1 \;; #X text 17 7 A signal controlled "moog" resonant lowpass; #X text 272 163 Q (1-4); #X text 61 46 resonance freq modulation; #X connect 0 0 5 0; #X connect 0 0 7 0; #X connect 2 0 15 0; #X connect 3 0 14 1; #X connect 4 0 16 0; #X connect 5 0 6 0; #X connect 7 0 1 0; #X connect 7 0 1 1; #X connect 8 0 0 0; #X connect 9 0 14 0; #X connect 10 0 13 0; #X connect 11 0 12 1; #X connect 12 0 0 1; #X connect 13 0 9 0; #X connect 14 0 12 0; #X connect 15 0 0 2; #X connect 16 0 0 0; pd-ggee_0.26/filters/highshelf.c0000644000076500007650000000430011467116403015266 0ustar hanshans/* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- highshelf ----------------------------*/ static t_class *highshelf_class; void highshelf_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float A = e_A(x->x_gain); t_float cs = cos(omega); t_float sn = sin(omega); t_float beta = e_beta(A,x->x_bw* 0.01); t_float b0 = A*((A+1) + (A-1)*cs + beta*sn); t_float b1 =-2.*A*((A-1) + (A+1)*cs); t_float b2 = A*((A+1) + (A-1)*cs - beta*sn); t_float a0 = ((A+1) - (A-1)*cs + beta*sn); t_float a1 = 2.*((A-1) - (A+1)*cs); t_float a2 = ((A+1) - (A-1)*cs - beta*sn); /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("highshelf: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void highshelf_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; highshelf_bang(x); } static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); floatinlet_new(&x->x_obj, &x->x_gain); floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; if (g != 0.) x->x_gain = g; return (x); } void highshelf_setup(void) { highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(highshelf_class,highshelf_bang); class_addfloat(highshelf_class,highshelf_float); } pd-ggee_0.26/filters/equalizer.c0000644000076500007650000000374111467116403015336 0ustar hanshans/* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- equ ----------------------------*/ static t_class *equ_class; void equ_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float alpha = e_alpha(x->x_bw*0.01,omega); t_float b0 = 1 + alpha*e_A(x->x_gain); t_float b1 = -2.*cos(omega); t_float b2 = 1 - alpha*e_A(x->x_gain); t_float a0 = 1 + alpha/e_A(x->x_gain); t_float a1 = -2.*cos(omega); t_float a2 = 1 - alpha/e_A(x->x_gain); /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("equ: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void equ_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; equ_bang(x); } static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); floatinlet_new(&x->x_obj, &x->x_gain); floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; if (g != 0.) x->x_gain = g; return (x); } void equalizer_setup(void) { equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(equ_class,equ_bang); class_addfloat(equ_class,equ_float); } pd-ggee_0.26/filters/lowshelf.c0000644000076500007650000000426111467116403015156 0ustar hanshans/* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- lowshelf ----------------------------*/ static t_class *lowshelf_class; void lowshelf_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float A = e_A(x->x_gain); t_float cs = cos(omega); t_float sn = sin(omega); t_float beta = e_beta(A,x->x_bw*0.01); t_float b0 = A*((A+1) - (A-1)*cs + beta*sn); t_float b1 = 2.*A*((A-1) - (A+1)*cs); t_float b2 = A*((A+1) - (A-1)*cs - beta*sn); t_float a0 = ((A+1) + (A-1)*cs + beta*sn); t_float a1 = -2.*((A-1) + (A+1)*cs); t_float a2 = ((A+1) + (A-1)*cs - beta*sn); /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("lowshelf: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void lowshelf_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; lowshelf_bang(x); } static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); floatinlet_new(&x->x_obj, &x->x_gain); floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; if (g != 0.) x->x_gain = g; return (x); } void lowshelf_setup(void) { lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(lowshelf_class,lowshelf_bang); class_addfloat(lowshelf_class,lowshelf_float); } pd-ggee_0.26/filters/Makefile0000755000076500007650000000214211467116403014626 0ustar hanshanscurrent: nt # TARGETS += stk VERSION = \"0.24\" .SUFFIXES: .dll .obj # ----------------------- NT ---------------------------- NTOBJECTS = *.obj NTDLLS = *.dll PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo PDNTINCLUDE = /I. /I..\..\pd\src ProgramFiles = C:\Program Files PDNTLDIR = "$(ProgramFiles)\Microsoft Visual Studio\Vc98\lib" #PDNTLDIR = "C:\Programme\Msdev\Vc98\lib" PDNTLIB = $(PDNTLDIR)\libc.lib \ $(PDNTLDIR)\oldnames.lib \ $(PDNTLDIR)\wsock32.lib \ $(PDNTLDIR)\kernel32.lib \ $(PDNTLDIR)\uuid.lib \ ..\..\pd\bin\pd.lib nt: $(NTOBJECTS) -link /dll $(PDNTLIB) bandpass.obj /export:bandpass_setup -link /dll $(PDNTLIB) highpass.obj /export:highpass_setup -link /dll $(PDNTLIB) highshelf.obj /export:highshelf_setup -link /dll $(PDNTLIB) hlshelf.obj /export:hlshelf_setup -link /dll $(PDNTLIB) lowpass.obj /export:lowpass_setup -link /dll $(PDNTLIB) notch.obj /export:notch_setup -link /dll $(PDNTLIB) equalizer.obj /export:equalizer_setup clean: del *.obj del *.dll .c.obj: -cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c .obj.dll: pd-ggee_0.26/filters/notch-help.pd0000644000076500007650000000200311467116403015545 0ustar hanshans#N canvas 271 181 461 436 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 70 26 ===================================; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 176 119 0 0 0 0 - - -; #X floatatom 267 119 0 0 0 0 - - -; #X obj 267 142 trigger bang float; #X obj 113 216 biquad~; #X obj 113 156 noise~; #X obj 179 74 hsl 128 17 20 20000 1 1 empty empty frequency 5 9 0 10 -203904 -1 -1 8800 0; #X obj 270 97 hsl 128 17 0 300 0 1 empty empty bandwidth 5 9 0 10 -261682 -1 -1 12700 0; #X obj 104 276 dac~; #X obj 113 244 *~ 0.1; #X text 76 12 Notch coefficients for biquad~; #X obj 176 185 notch; #X connect 4 0 14 0; #X connect 5 0 6 0; #X connect 6 0 14 0; #X connect 6 1 14 1; #X connect 7 0 12 0; #X connect 8 0 7 0; #X connect 9 0 4 0; #X connect 10 0 5 0; #X connect 12 0 11 0; #X connect 12 0 11 1; #X connect 14 0 7 0; pd-ggee_0.26/filters/equalizer-help.pd0000644000076500007650000000242411467116403016442 0ustar hanshans#N canvas 153 157 456 417 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 96 109 0 0 0 0 - - -; #X floatatom 157 109 0 0 0 0 - - -; #X obj 157 132 trigger bang float; #X obj 43 206 biquad~; #X obj 43 146 noise~; #X obj 99 64 hsl 128 17 20 20000 1 1 empty empty frequency 5 9 0 10 -203904 -1 -1 5400 0; #X obj 160 87 hsl 128 17 0 100 0 1 empty empty gain 5 9 0 10 -204786 -1 -1 6300 0; #X obj 34 266 dac~; #X obj 43 234 *~ 0.1; #X floatatom 297 109 0 0 0 0 - - -; #X obj 297 132 trigger bang float; #X obj 300 87 hsl 128 17 0 100 0 1 empty empty bandwidth 5 9 0 10 -261682 -1 -1 9100 0; #X text 71 26 ==============================================; #X text 76 12 Parametric Equalizer coefficients for biquad~; #X obj 96 175 equalizer 5000 70 8; #X connect 3 0 17 0; #X connect 4 0 5 0; #X connect 5 0 17 0; #X connect 5 1 17 1; #X connect 6 0 11 0; #X connect 7 0 6 0; #X connect 8 0 3 0; #X connect 9 0 4 0; #X connect 11 0 10 0; #X connect 11 0 10 1; #X connect 12 0 13 0; #X connect 13 0 17 0; #X connect 13 1 17 2; #X connect 14 0 12 0; #X connect 17 0 6 0; pd-ggee_0.26/filters/highpass.c0000644000076500007650000000365611467116403015150 0ustar hanshans/* (C) Guenter Geiger */ /* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include "filters.h" /* ------------------- highpass ----------------------------*/ static t_class *highpass_class; void highpass_bang(t_rbjfilter *x) { t_atom at[5]; t_float omega = e_omega(x->x_freq,x->x_rate); t_float alpha = e_alpha(x->x_bw* 0.01,omega); t_float b1 = -(1 + cos(omega)); t_float b0 = -b1/2.; t_float b2 = b0; t_float a0 = 1 + alpha; t_float a1 = -2.*cos(omega); t_float a2 = 1 - alpha; /* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { post("highpass: filter unstable -> resetting"); a0=1.;a1=0.;a2=0.; b0=1.;b1=0.;b2=0.; } SETFLOAT(at,-a1/a0); SETFLOAT(at+1,-a2/a0); SETFLOAT(at+2,b0/a0); SETFLOAT(at+3,b1/a0); SETFLOAT(at+4,b2/a0); outlet_list(x->x_obj.ob_outlet,&s_list,5,at); } void highpass_float(t_rbjfilter *x,t_floatarg f) { x->x_freq = f; highpass_bang(x); } static void *highpass_new(t_floatarg f,t_floatarg bw) { t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class); x->x_rate = 44100.0; outlet_new(&x->x_obj,&s_float); /* floatinlet_new(&x->x_obj, &x->x_gain); */ floatinlet_new(&x->x_obj, &x->x_bw); if (f > 0.) x->x_freq = f; if (bw > 0.) x->x_bw = bw; return (x); } void highpass_setup(void) { highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0, sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); class_addbang(highpass_class,highpass_bang); class_addfloat(highpass_class,highpass_float); } pd-ggee_0.26/filters/bandpass-help.pd0000644000076500007650000000172311467116403016235 0ustar hanshans#N canvas 92 30 461 436 10; #X text 63 298 These filters are all controlled by a bandwidth which is expressed in octaves. A bandwidth of 100 is equivalent to one octave. ; #X text 76 12 Bandpass coefficients for biquad~; #X text 70 26 ===================================; #X text 63 340 Attention \, only the left inlet triggers new coefficients for biquad~; #X text 8 388 (C) Guenter Geiger 2000; #X floatatom 176 119 0 0 0 0 - - -; #X floatatom 267 119 0 0 0 0 - - -; #X obj 267 142 trigger bang float; #X obj 113 216 biquad~; #X obj 113 156 noise~; #X obj 102 258 dac~; #X obj 179 74 hsl 128 17 20 20000 1 0 empty empty frequency 5 9 0 10 -203904 -1 -1 0 0; #X obj 270 97 hsl 128 17 0 100 0 0 empty empty bandwidth 5 9 0 10 -261682 -1 -1 0 1; #X obj 176 185 bandpass; #X connect 5 0 13 0; #X connect 6 0 7 0; #X connect 7 0 13 0; #X connect 7 1 13 1; #X connect 8 0 10 1; #X connect 8 0 10 0; #X connect 9 0 8 0; #X connect 11 0 5 0; #X connect 12 0 6 0; #X connect 13 0 8 0; pd-ggee_0.26/filters/filters.h0000644000076500007650000000277411467116403015017 0ustar hanshans/* These filter coefficients computations are taken from http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt written by Robert Bristow-Johnson */ #ifndef __GGEE_FILTERS_H__ #define __GGEE_FILTERS_H__ #ifndef M_PI #define M_PI 3.141593f #endif #include #define LN2 0.69314718 #define e_A(g) (pow(10,(g/40.))) #define e_omega(f,r) (2.0*M_PI*f/r) #define e_alpha(bw,omega) (sin(omega)*sinh(LN2/2. * bw * omega/sin(omega))) #define e_beta(a,S) (sqrt((a*a + 1)/(S) - (a-1)*(a-1))) typedef struct _rbjfilter { t_object x_obj; t_float x_rate; t_float x_freq; t_float x_gain; t_float x_bw; } t_rbjfilter; static int check_stability(t_float fb1, t_float fb2, t_float ff1, t_float ff2, t_float ff3) { float discriminant = fb1 * fb1 + 4 * fb2; if (discriminant < 0) /* imaginary roots -- resonant filter */ { /* they're conjugates so we just check that the product is less than one */ if (fb2 >= -1.0f) goto stable; } else /* real roots */ { /* check that the parabola 1 - fb1 x - fb2 x^2 has a vertex between -1 and 1, and that it's nonnegative at both ends, which implies both roots are in [1-,1]. */ if (fb1 <= 2.0f && fb1 >= -2.0f && 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) goto stable; } return 0; stable: return 1; } #endif pd-ggee_0.26/LICENSE.txt0000644000076500007650000000325011467116403013337 0ustar hanshansThis software is copyrighted by Guenter Geiger and others. The following terms apply to all files associated with the software unless explicitly disclaimed in individual files. The authors hereby grant permission to use, copy, modify, distribute, and license this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. No written agreement, license, or royalty fee is required for any of the authorized uses. Modifications to this software may be copyrighted by their authors and need not follow the licensing terms described here, provided that the new terms are clearly indicated on the first page of each file where they apply. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. RESTRICTED RIGHTS: Use, duplication or disclosure by the government is subject to the restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software Clause as DFARS 252.227-7013 and FAR 52.227-19. pd-ggee_0.26/Makefile0000644000076500007650000002601111467116403013154 0ustar hanshans## Pd library template version 1.0.5 # For instructions on how to use this template, see: # http://puredata.info/docs/developer/MakefileTemplate LIBRARY_NAME = ggee # add your .c source files, one object per file, to the SOURCES # variable, help files will be included automatically SOURCES = control/constant.c control/rl.c control/serial_ms.c control/sl.c control/getdir.c control/rtout.c control/serial_mt.c control/stripdir.c control/inv.c control/serial_bird.c control/shell.c control/unserialize.c control/qread.c control/serialize.c control/sinh.c control/unwonk.c experimental/fofsynth~.c experimental/tabwrite4~.c experimental/pvocfreq.c filters/bandpass.c filters/highpass.c filters/hlshelf.c filters/lowshelf.c filters/notch.c filters/equalizer.c filters/highshelf.c filters/lowpass.c filters/moog~.c gui/button.c gui/fatom.c gui/image.c gui/sliderh.c gui/ticker.c gui/envgen.c gui/gcanvas.c gui/slider.c gui/state.c gui/toddle.c signal/atan2~.c signal/mixer~.c signal/sfwrite~.c signal/streamin~.c signal/streamout~.c SOURCES_linux = # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will # be included automatically PDOBJECTS = # example patches and related files, in the 'examples' subfolder EXAMPLES = # manuals and related files, in the 'manual' subfolder MANUAL = # if you want to include any other files in the source and binary tarballs, # list them here. This can be anything from header files, test patches, # documentation, etc. README.txt and LICENSE.txt are required and therefore # automatically included EXTRA_DIST = #------------------------------------------------------------------------------# # # things you might need to edit if you are using other C libraries # #------------------------------------------------------------------------------# CFLAGS = -DPD -I. -I"$(PD_INCLUDE)"/pd -Wall -W -g LDFLAGS = LIBS = #------------------------------------------------------------------------------# # # you shouldn't need to edit anything below here, if we did it right :) # #------------------------------------------------------------------------------# # get library version from meta file LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd) CFLAGS += -DVERSION='"$(LIBRARY_VERSION)"' PD_INCLUDE = $(PD_PATH)/include # where to install the library, overridden below depending on platform prefix = /usr/local libdir = $(prefix)/lib pkglibdir = $(libdir)/pd-externals objectsdir = $(pkglibdir) INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -m 644 INSTALL_DATA = $(INSTALL) -p -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows) DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION) UNAME := $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) ifeq ($(CPU),arm) # iPhone/iPod Touch SOURCES += $(SOURCES_iphoneos) EXTENSION = pd_darwin OS = iphoneos PD_PATH = /Applications/Pd-extended.app/Contents/Resources IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin CC=$(IPHONE_BASE)/gcc CPP=$(IPHONE_BASE)/cpp CXX=$(IPHONE_BASE)/g++ ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) LIBS += -lc STRIP = strip -x DISTBINDIR=$(DISTDIR)-$(OS) else # Mac OS X SOURCES += $(SOURCES_macosx) EXTENSION = pd_darwin OS = macosx PD_PATH = /Applications/Pd-extended.app/Contents/Resources OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast # build universal 32-bit on 10.4 and 32/64 on newer ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 else FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 SOURCES += $(SOURCES_iphoneos) endif CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib # if the 'pd' binary exists, check the linking against it to aid with stripping LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd) LIBS += -lc STRIP = strip -x DISTBINDIR=$(DISTDIR)-$(OS) # install into ~/Library/Pd on Mac OS X since /usr/local isn't used much pkglibdir=$(HOME)/Library/Pd endif endif ifeq ($(UNAME),Linux) CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux OS = linux PD_PATH = /usr OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer CFLAGS += -fPIC LDFLAGS += -Wl,--export-dynamic -shared -fPIC LIBS += -lc STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) CPU := $(shell uname -m) SOURCES += $(SOURCES_cygwin) EXTENSION = dll OS = cygwin PD_PATH = $(cygpath $(PROGRAMFILES))/pd OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer CFLAGS += LDFLAGS += -Wl,--export-dynamic -shared -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" LIBS += -lc -lpd STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS) endif ifeq (MINGW,$(findstring MINGW,$(UNAME))) CPU := $(shell uname -m) SOURCES += $(SOURCES_windows) EXTENSION = dll OS = windows PD_PATH = $(shell cd "$(PROGRAMFILES)"/pd && pwd) OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer CFLAGS += -mms-bitfields LDFLAGS += -s -shared -Wl,--enable-auto-import LIBS += -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" -L"$(PD_PATH)/obj" -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 STRIP = strip --strip-unneeded -R .note -R .comment DISTBINDIR=$(DISTDIR)-$(OS) endif # in case somebody manually set the HELPPATCHES above HELPPATCHES ?= $(SOURCES:.c=-help.pd) $(PDOBJECTS:.pd=-help.pd) CFLAGS += $(OPT_CFLAGS) .PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags $(LIBRARY_NAME) all: $(SOURCES:.c=.$(EXTENSION)) %.o: %.c $(CC) $(CFLAGS) -o "$*.o" -c "$*.c" %.$(EXTENSION): %.o $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) chmod a-x "$*.$(EXTENSION)" # this links everything into a single binary file $(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS) chmod a-x $(LIBRARY_NAME).$(EXTENSION) install: libdir_install # The meta and help files are explicitly installed to make sure they are # actually there. Those files are not optional, then need to be there. libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SOURCES))" || \ $(INSTALL_PROGRAM) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/*.$(EXTENSION) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_DATA) $(PDOBJECTS) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) # install library linked as single binary single_install: $(LIBRARY_NAME) install-doc install-exec $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_PROGRAM) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION) install-doc: $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) test -z "$(strip $(SOURCES) $(PDOBJECTS))" || \ $(INSTALL_DATA) $(HELPPATCHES) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt $(INSTALL_DATA) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt install-examples: test -z "$(strip $(EXAMPLES))" || \ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ for file in $(EXAMPLES); do \ $(INSTALL_DATA) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \ done install-manual: test -z "$(strip $(MANUAL))" || \ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \ for file in $(MANUAL); do \ $(INSTALL_DATA) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \ done clean: -rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o) -rm -f -- $(SOURCES:.c=.$(EXTENSION)) -rm -f -- $(LIBRARY_NAME).o -rm -f -- $(LIBRARY_NAME).$(EXTENSION) distclean: clean -rm -f -- $(DISTBINDIR).tar.gz -rm -rf -- $(DISTBINDIR) -rm -f -- $(DISTDIR).tar.gz -rm -rf -- $(DISTDIR) -rm -f -- $(ORIGDIR).tar.gz -rm -rf -- $(ORIGDIR) $(DISTBINDIR): $(INSTALL_DIR) $(DISTBINDIR) libdir: all $(DISTBINDIR) $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) $(INSTALL_DATA) $(SOURCES) $(DISTBINDIR) $(INSTALL_DATA) $(HELPPATCHES) $(DISTBINDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_DATA) $(EXTRA_DIST) $(DISTBINDIR) # tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) $(DISTDIR): $(INSTALL_DIR) $(DISTDIR) $(ORIGDIR): $(INSTALL_DIR) $(ORIGDIR) dist: $(DISTDIR) $(INSTALL_DATA) Makefile $(DISTDIR) $(INSTALL_DATA) README.txt $(DISTDIR) $(INSTALL_DATA) LICENSE.txt $(DISTDIR) $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTDIR) test -z "$(strip $(ALLSOURCES))" || \ $(INSTALL_DATA) $(ALLSOURCES) $(DISTDIR) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_DATA) $(PDOBJECTS) $(DISTDIR) test -z "$(strip $(HELPPATCHES))" || \ $(INSTALL_DATA) $(HELPPATCHES) $(DISTDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_DATA) $(EXTRA_DIST) $(DISTDIR) test -z "$(strip $(EXAMPLES))" || \ $(INSTALL_DIR) $(DISTDIR)/examples && \ for file in $(EXAMPLES); do \ $(INSTALL_DATA) examples/$$file $(DISTDIR)/examples; \ done test -z "$(strip $(MANUAL))" || \ $(INSTALL_DIR) $(DISTDIR)/manual && \ for file in $(MANUAL); do \ $(INSTALL_DATA) manual/$$file $(DISTDIR)/manual; \ done tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) # make a Debian source package dpkg-source: debclean make distclean dist mv $(DISTDIR) $(ORIGDIR) tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR) rm -f -- $(DISTDIR).tar.gz rm -rf -- $(DISTDIR) $(ORIGDIR) cd .. && dpkg-source -b $(LIBRARY_NAME) etags: etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h showsetup: @echo "CFLAGS: $(CFLAGS)" @echo "LDFLAGS: $(LDFLAGS)" @echo "LIBS: $(LIBS)" @echo "PD_INCLUDE: $(PD_INCLUDE)" @echo "PD_PATH: $(PD_PATH)" @echo "objectsdir: $(objectsdir)" @echo "LIBRARY_NAME: $(LIBRARY_NAME)" @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)" @echo "SOURCES: $(SOURCES)" @echo "PDOBJECTS: $(PDOBJECTS)" @echo "ALLSOURCES: $(ALLSOURCES)" @echo "UNAME: $(UNAME)" @echo "CPU: $(CPU)" @echo "pkglibdir: $(pkglibdir)" @echo "DISTDIR: $(DISTDIR)" @echo "ORIGDIR: $(ORIGDIR)" pd-ggee_0.26/authors0000644000076500007650000000102411467116403013121 0ustar hanshans Guenter Geiger with the help of many people, pd Miller Puckette piperead and pipewrite d13 sfplay Winfried Ritsch mixer and others opt@test.at suggestions and testing klaus@xdv.org vbap Ville Pulkki filters math Robert Bristow-Johnson and several others which I may have forgotten to mention, please notify me if you feel you should be included.pd-ggee_0.26/signal/0000755000076500007650000000000011467116403012771 5ustar hanshanspd-ggee_0.26/signal/streamout~-help.pd0000644000076500007650000002500311467116403016465 0ustar hanshans#N canvas 45 154 991 483 12; #X floatatom 227 194 0 0 0 0 - - -; #X msg 46 32 disconnect; #X obj 369 71 osc~; #X floatatom 368 20 0 0 0 0 - - -; #X obj 368 44 sig~ 220; #X text 9 224 The format message sets the transmission format; #X text 14 462 (C) 1999 Guenter Geiger; #X obj 455 21 streamin~ 3001; #X obj 448 78 dac~; #X msg 156 68 connect tritonus 3000; #X msg 20 113 format float; #X msg 20 144 format 16bit; #X text 9 241 format float: send float numbers; #X text 8 260 format 16bit: send 16 bit integers; #X msg 20 176 format 8bit; #X text 445 259 host:; #X text 9 206 format:; #X text 444 206 connect:; #X text 443 223 connect sets the host and portnumber and immediatly tries to connect .; #X text 445 276 Set the host name and connect to the host \, if a connection was active.; #X msg 250 100 1; #X msg 284 100 0; #X text 444 311 disconnect (0); #X text 443 328 disconnect and 0 disconnect the object; #X text 444 348 1:; #X text 441 365 if the number 1 is sent to streamout \, the object connects to the stored host and portnumber. Default is localhost \, port number 3000; #X msg 179 12 connect gige 15001; #X msg 156 37 connect localhost 3001; #X text 8 277 format 8bit: send 8 bit integers; #X obj 227 162 streamout~; #N canvas 0 0 450 300 graph1 0; #X array array1 900 float 1; #A 0 0.0890625 0.0875 0.0859375 0.084375 0.0828125 0.08125 0.0796875 0.0773438 0.0757812 0.0734375 0.0710938 0.0695313 0.0671875 0.0648438 0.0625 0.0601563 0.0578125 0.0546875 0.0523438 0.05 0.046875 0.0445313 0.0414063 0.0390625 0.0359375 0.0328125 0.0296875 0.0273438 0.0242188 0.0210938 0.0179687 0.0148437 0.0117188 0.00859375 0.00546875 0.00234375 -0.00078125 -0.00390625 -0.00703125 -0.0101563 -0.0132813 -0.0164063 -0.01875 -0.021875 -0.025 -0.028125 -0.03125 -0.034375 -0.0367188 -0.0398437 -0.0429688 -0.0453125 -0.0484375 -0.0507812 -0.0539063 -0.05625 -0.0585938 -0.0617188 -0.0640625 -0.0664062 -0.06875 -0.0710938 -0.0726563 -0.075 -0.0773438 -0.0789063 -0.08125 -0.0828125 -0.084375 -0.0859375 -0.0875 -0.0890625 -0.090625 -0.0921875 -0.0929688 -0.0945313 -0.0953125 -0.0960938 -0.096875 -0.0976562 -0.0984375 -0.0992187 -0.0992187 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.0992187 -0.0984375 -0.0984375 -0.0976562 -0.096875 -0.0960938 -0.0945313 -0.09375 -0.0929688 -0.0914062 -0.0898438 -0.0882813 -0.0875 -0.0851563 -0.0835937 -0.0820312 -0.0804688 -0.078125 -0.0765625 -0.0742188 -0.071875 -0.0703125 -0.0679687 -0.065625 -0.0632813 -0.0601563 -0.0578125 -0.0554687 -0.0523438 -0.05 -0.0476562 -0.0445313 -0.0414063 -0.0390625 -0.0359375 -0.0328125 -0.0296875 -0.0273438 -0.0242188 -0.0210938 -0.0179687 -0.0148437 -0.0117188 -0.00859375 -0.00546875 -0.00234375 0.00078125 0.00390625 0.00703125 0.0101563 0.0132813 0.0164063 0.01875 0.021875 0.025 0.028125 0.03125 0.034375 0.0367188 0.0398437 0.0429688 0.0453125 0.0484375 0.0507812 0.053125 0.05625 0.0585938 0.0609375 0.0632813 0.065625 0.0679687 0.0703125 0.071875 0.0742188 0.0765625 0.078125 0.0796875 0.0820312 0.0835937 0.0851563 0.0867188 0.0882813 0.0890625 0.090625 0.0914062 0.0929688 0.09375 0.0945313 0.0953125 0.0960938 0.096875 0.096875 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.096875 0.096875 0.0960938 0.0953125 0.0945313 0.09375 0.0929688 0.0914062 0.090625 0.0890625 0.0882813 0.0867188 0.0851563 0.0835937 0.0820312 0.0804688 0.078125 0.0765625 0.0742188 0.0726563 0.0703125 0.0679687 0.065625 0.0632813 0.0609375 0.0585938 0.05625 0.0539063 0.0507812 0.0484375 0.0453125 0.0429688 0.0398437 0.0375 0.034375 0.03125 0.028125 0.0257812 0.0226563 0.0195312 0.0164063 0.0132813 0.0101563 0.00703125 0.00390625 0.00078125 -0.00234375 -0.00546875 -0.00859375 -0.0117188 -0.0148437 -0.0179687 -0.0210938 -0.0234375 -0.0265625 -0.0296875 -0.0328125 -0.0359375 -0.0382813 -0.0414063 -0.0445313 -0.046875 -0.05 -0.0523438 -0.0554687 -0.0578125 -0.0601563 -0.0625 -0.0648438 -0.0671875 -0.0695313 -0.071875 -0.0742188 -0.0765625 -0.078125 -0.0804688 -0.0820312 -0.0835937 -0.0851563 -0.0867188 -0.0882813 -0.0898438 -0.0914062 -0.0921875 -0.09375 -0.0945313 -0.0960938 -0.096875 -0.0976562 -0.0984375 -0.0984375 -0.0992187 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.0992187 -0.0992187 -0.0984375 -0.0976562 -0.096875 -0.0960938 -0.0953125 -0.0945313 -0.0929688 -0.0921875 -0.090625 -0.0890625 -0.0875 -0.0859375 -0.084375 -0.0828125 -0.08125 -0.0789063 -0.0773438 -0.075 -0.0734375 -0.0710938 -0.06875 -0.0664062 -0.0640625 -0.0617188 -0.059375 -0.05625 -0.0539063 -0.0515625 -0.0484375 -0.0460938 -0.0429688 -0.0398437 -0.0375 -0.034375 -0.03125 -0.028125 -0.0257812 -0.0226563 -0.0195312 -0.0164063 -0.0132813 -0.0101563 -0.00703125 -0.00390625 -0.00078125 0.00234375 0.00546875 0.00859375 0.0117188 0.0148437 0.0179687 0.0210938 0.0234375 0.0265625 0.0296875 0.0328125 0.0359375 0.0382813 0.0414063 0.04375 0.046875 0.0492188 0.0523438 0.0546875 0.0570313 0.0601563 0.0625 0.0648438 0.0671875 0.06875 0.0710938 0.0734375 0.075 0.0773438 0.0789063 0.08125 0.0828125 0.084375 0.0859375 0.0875 0.0882813 0.0898438 0.0914062 0.0921875 0.0929688 0.09375 0.0953125 0.0953125 0.0960938 0.096875 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.096875 0.096875 0.0960938 0.0953125 0.0953125 0.09375 0.0929688 0.0921875 0.0914062 0.0898438 0.0882813 0.0875 0.0859375 0.084375 0.0828125 0.08125 0.0789063 0.0773438 0.075 0.0734375 0.0710938 0.06875 0.0671875 0.0648438 0.0625 0.0601563 0.0570313 0.0546875 0.0523438 0.0492188 0.046875 0.04375 0.0414063 0.0382813 0.0359375 0.0328125 0.0296875 0.0265625 0.0234375 0.0210938 0.0179687 0.0148437 0.0117188 0.00859375 0.00546875 0.00234375 -0.00078125 -0.00390625 -0.00703125 -0.0101563 -0.0132813 -0.0164063 -0.0195312 -0.0226563 -0.0257812 -0.028125 -0.03125 -0.034375 -0.0375 -0.0398437 -0.0429688 -0.0460938 -0.0484375 -0.0515625 -0.0539063 -0.05625 -0.059375 -0.0617188 -0.0640625 -0.0664062 -0.06875 -0.0710938 -0.0734375 -0.075 -0.0773438 -0.0789063 -0.08125 -0.0828125 -0.084375 -0.0859375 -0.0875 -0.0890625 -0.090625 -0.0921875 -0.0929688 -0.0945313 -0.0953125 -0.0960938 -0.096875 -0.0976562 -0.0984375 -0.0992187 -0.0992187 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.0992187 -0.0984375 -0.0984375 -0.0976562 -0.096875 -0.0960938 -0.0945313 -0.09375 -0.0921875 -0.0914062 -0.0898438 -0.0882813 -0.0867188 -0.0851563 -0.0835937 -0.0820312 -0.0796875 -0.078125 -0.0757812 -0.0742188 -0.071875 -0.0695313 -0.0671875 -0.0648438 -0.0625 -0.0601563 -0.0578125 -0.0554687 -0.0523438 -0.05 -0.046875 -0.0445313 -0.0414063 -0.0382813 -0.0359375 -0.0328125 -0.0296875 -0.0265625 -0.0234375 -0.0210938 -0.0179687 -0.0148437 -0.0117188 -0.00859375 -0.00546875 -0.00234375 0.00078125 0.00390625 0.00703125 0.0101563 0.0132813 0.0164063 0.0195312 0.0226563 0.0257812 0.028125 0.03125 0.034375 0.0375 0.0398437 0.0429688 0.0453125 0.0484375 0.0507812 0.0539063 0.05625 0.0585938 0.0609375 0.0632813 0.065625 0.0679687 0.0703125 0.0726563 0.0742188 0.0765625 0.078125 0.0804688 0.0820312 0.0835937 0.0851563 0.0867188 0.0882813 0.0890625 0.090625 0.0914062 0.0929688 0.09375 0.0945313 0.0953125 0.0960938 0.096875 0.096875 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.096875 0.096875 0.0960938 0.0953125 0.0945313 0.09375 0.0929688 0.0914062 0.090625 0.0890625 0.0882813 0.0867188 0.0851563 0.0835937 0.0820312 0.0796875 0.078125 0.0765625 0.0742188 0.071875 0.0703125 0.0679687 0.065625 0.0632813 0.0609375 0.0585938 0.05625 0.053125 0.0507812 0.0484375 0.0453125 0.0421875 0.0398437 0.0367188 0.034375 0.03125 0.028125 0.025 0.021875 0.01875 0.0164063 0.0132813 0.0101563 0.00703125 0.00390625 0.00078125 -0.00234375 -0.00546875 -0.00859375 -0.0117188 -0.0148437 -0.0179687 -0.0210938 -0.0242188 -0.0273438 -0.0304688 -0.0328125 -0.0359375 -0.0390625 -0.0414063 -0.0445313 -0.0476562 -0.05 -0.053125 -0.0554687 -0.0578125 -0.0601563 -0.0632813 -0.065625 -0.0679687 -0.0703125 -0.071875 -0.0742188 -0.0765625 -0.078125 -0.0804688 -0.0820312 -0.0835937 -0.0859375 -0.0875 -0.0882813 -0.0898438 -0.0914062 -0.0929688 -0.09375 -0.0945313 -0.0960938 -0.096875 -0.0976562 -0.0984375 -0.0984375 -0.0992187 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.0992187 -0.0992187 -0.0984375 -0.0976562 -0.096875 -0.0960938 -0.0953125 -0.0945313 -0.0929688 -0.0921875 -0.090625 -0.0890625 -0.0875 -0.0859375 -0.084375 -0.0828125 -0.08125 -0.0789063 -0.0773438 -0.075 -0.0726563 -0.0710938 -0.06875 -0.0664062 -0.0640625 -0.0617188 -0.0585938 -0.05625 -0.0539063 -0.0507812 -0.0484375 -0.0453125 -0.0429688 -0.0398437 -0.0367188 -0.034375 -0.03125 -0.028125 -0.025 -0.021875 -0.01875 -0.015625 -0.0132813 -0.0101563 -0.00703125 -0.00390625 -0.00078125 0.00234375 0.00546875 0.00859375 0.0117188 0.0148437 0.0179687 0.0210938 0.0242188 0.0273438 0.0296875 0.0328125 0.0359375 0.0390625 0.0414063 0.0445313 0.046875 0.05 0.0523438 0.0546875 0.0578125 0.0601563 0.0625 0.0648438 0.0671875 0.0695313 0.0710938 0.0734375 0.0757812 0.0773438 0.0796875 0.08125 0.0828125 0.084375 0.0859375 0.0875 0.0890625 0.0898438 0.0914062 0.0921875 0.0929688 0.0945313 0.0953125 0.0960938 0.0960938 0.096875 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.0976562 0.096875 0.096875 0.0960938 0.0953125 0.0945313 0.09375 0.0929688 0.0921875 0.090625 0.0898438 0.0882813 0.0875 0.0859375 0.084375 0.0828125 0.0804688 0.0789063 0.0773438 0.075 0.0734375 0.0710938 0.06875 0.0664062 0.0640625 0.0617188 0.059375 0.0570313 0.0546875 0.0515625 0.0492188 0.046875 0.04375 0.0414063 0.0382813 0.0351562 0.0320312 0.0296875 0.0265625 0.0234375 0.0203125 0.0171875 0.0140625 0.0109375 0.0078125 0.00546875 0.00234375 -0.00078125 -0.00390625 -0.00703125 -0.0101563 -0.0132813 -0.0164063 -0.0195312 -0.0226563 -0.0257812 -0.0289063 -0.0320312 -0.034375 -0.0375 -0.040625 -0.0429688 -0.0460938 -0.0492188 -0.0515625 -0.0539063 -0.0570313 -0.059375 -0.0617188 -0.0640625 -0.0664062 -0.06875 -0.0710938 -0.0734375 -0.0757812 -0.0773438 -0.0796875 -0.08125 -0.0828125 -0.0851563 -0.0867188 -0.0882813 -0.0890625 -0.090625 -0.0921875 -0.0929688 -0.0945313 -0.0953125 -0.0960938 -0.096875 -0.0976562 -0.0984375 -0.0992187 -0.0992187 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.1 -0.0992187 -0.0984375 -0.0984375 -0.0976562 -0.096875 -0.0953125 -0.0945313; #X coords 0 1 899 -1 200 140 1; #X restore 689 52 graph; #X obj 460 140 tabwrite~ array1; #X msg 541 79 bang; #X obj 458 47 *~ 0.1; #X connect 1 0 29 0; #X connect 2 0 29 0; #X connect 3 0 4 0; #X connect 4 0 2 0; #X connect 7 0 33 0; #X connect 9 0 29 0; #X connect 10 0 29 0; #X connect 11 0 29 0; #X connect 14 0 29 0; #X connect 20 0 29 0; #X connect 21 0 29 0; #X connect 26 0 29 0; #X connect 27 0 29 0; #X connect 29 0 0 0; #X connect 32 0 31 0; #X connect 33 0 8 0; #X connect 33 0 8 1; #X connect 33 0 31 0; pd-ggee_0.26/signal/streamin~.c0000644000076500007650000002156411467116403015165 0ustar hanshans /* Written by Guenter Geiger (C) 1999 */ /* Thanks to Anthony Lee for Windows bug fixes */ #include #include "stream.h" #include #include #ifdef _WIN32 #include #else #include #include #include #include #include #include #include #include #define SOCKET_ERROR -1 #endif /* these pragmas are only used for MSVC, not MinGW or Cygwin */ #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #ifdef unix #define NONBLOCKED #endif #define MAXFRAMES 128 #define MAXFRAMESIZE 256 #define AVERAGENUM 10 /*#define DEBUGMESS(x) x*/ #define DEBUGMESS(x) /* Utility functions */ /* TODO !!!! - check udp support */ #ifdef _WIN32 extern int close(int); #endif extern void sys_rmpollfn(int fd); extern sys_addpollfn(int fd, void* fn, void *ptr); static void sys_sockerror(char *s) { #ifdef _WIN32 int err = WSAGetLastError(); if (err == 10054) return; #else int err = errno; #endif post("%s: %s (%d)\n", s, strerror(err), err); } static void sys_closesocket(int fd) { #ifdef _WIN32 closesocket(fd); #else close(fd); #endif } int setsocketoptions(int sockfd) { #ifndef _WIN32 int sockopt = 1; if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (const char*) &sockopt, sizeof(int)) < 0) { DEBUGMESS(post("setsockopt NODELAY failed\n")); } else { DEBUGMESS(post("TCP_NODELAY set")); } /* if we don`t use REUSEADDR we have to wait under unix until the address gets freed after a close ... this can be very annoying when working with netsend/netreceive GG */ sockopt = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(int)) < 0) post("setsockopt failed\n"); #endif return 0; } /* ------------------------ streamin~ ----------------------------- */ static t_class *streamin_class; typedef struct _streamin { t_object x_obj; int x_socket; int x_connectsocket; int x_nconnections; int x_ndrops; int x_fd; int x_tcp; /* buffering */ int framein; int frameout; t_frame frames[MAXFRAMES]; int maxframes; int nbytes; int counter; int average[AVERAGENUM]; int averagecur; int underflow; } t_streamin; static void streamin_datapoll(t_streamin *x) { int ret; int n; t_tag tag; int i; n = x->nbytes; if (x->nbytes == 0) { /* get the new tag */ ret = recv(x->x_socket, (char*) &x->frames[x->framein].tag,sizeof(t_tag),MSG_PEEK); if (ret != sizeof(t_tag)) { #ifdef _WIN32 sys_closesocket(x->x_socket); sys_rmpollfn(x->x_socket); x->x_socket = -1; #endif return; } ret = recv(x->x_socket, (char*) &x->frames[x->framein].tag,sizeof(t_tag),0); if ((x->frames[x->framein].tag.framesize - sizeof(t_tag)) > MAXFRAMESIZE) { error("streamin~: got an invalid frame size of %d, maximum is %d\n", x->frames[x->framein].tag.framesize, MAXFRAMESIZE); x->frames[x->framein].tag.framesize = MAXFRAMESIZE + sizeof(t_tag); } x->nbytes = n = x->frames[x->framein].tag.framesize; } ret = recv(x->x_socket, (char*) x->frames[x->framein].data + x->frames[x->framein].tag.framesize - n, n, 0); if (ret > 0) n-=ret; x->nbytes = n; if (n == 0) { x->counter++; x->framein++; x->framein %= MAXFRAMES; } } static void streamin_reset(t_streamin* x,t_floatarg frames) { int i; x->counter = 0; x->nbytes = 0; x->framein = 0; x->frameout = 0; for (i=0;iaverage[i] = x->maxframes; x->averagecur=0; if (frames == 0.0) x->maxframes = MAXFRAMES/2; else x->maxframes = frames; x->underflow = 0; } static void streamin_connectpoll(t_streamin *x) { int fd = accept(x->x_connectsocket, 0, 0); #ifdef NONBLOCKED fcntl(fd,F_SETFL,O_NONBLOCK); #endif if (fd < 0) { post("streamin~: accept failed"); return; } if (x->x_socket > 0) { post("streamin~: new connection"); sys_closesocket(x->x_socket); sys_rmpollfn(x->x_socket); } streamin_reset(x,0); x->x_socket = fd; sys_addpollfn(fd, streamin_datapoll, x); } static int streamin_createsocket(t_streamin* x, int portno,t_symbol* prot) { struct sockaddr_in server; int sockfd; int tcp = x->x_tcp; /* create a socket */ if (!tcp) sockfd = socket(AF_INET, SOCK_DGRAM, 0); else sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { sys_sockerror("socket"); return (0); } server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; /* assign server port number */ server.sin_port = htons((u_short)portno); post("listening to port number %d", portno); setsocketoptions(sockfd); /* name the socket */ if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) { sys_sockerror("bind"); sys_closesocket(sockfd); return (0); } if (!tcp) { x->x_socket = sockfd; x->nbytes = 0; sys_addpollfn(sockfd, streamin_datapoll, x); } else { if (listen(sockfd, 5) < 0) { sys_sockerror("listen"); sys_closesocket(sockfd); } else { x->x_connectsocket = sockfd; sys_addpollfn(sockfd, streamin_connectpoll, x); } } return 1; } static void streamin_free(t_streamin *x) { if (x->x_connectsocket > 0) { sys_closesocket(x->x_connectsocket); sys_rmpollfn(x->x_connectsocket); } sys_rmpollfn(x->x_socket); sys_closesocket(x->x_socket); } #define QUEUESIZE ((x->framein + MAXFRAMES - x->frameout)%MAXFRAMES) static t_int *streamin_perform(t_int *w) { t_streamin *x = (t_streamin*) (w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); int ret; int i = 0; if (x->counter < x->maxframes) { return (w+4); } if (x->framein == x->frameout) { x->underflow++; return w+4; } /* queue balancing */ x->average[x->averagecur] = QUEUESIZE; x->averagecur++; x->averagecur %= AVERAGENUM; switch (x->frames[x->frameout].tag.format) { case SF_FLOAT: { t_float* buf = (t_float*)(x->frames[x->frameout].data); while (n--) *out++ = *buf++; x->frameout++; x->frameout %= MAXFRAMES; break; } case SF_16BIT: { short* buf = (short*)(x->frames[x->frameout].data); while (n--) *out++ = (float) *buf++*3.051850e-05; x->frameout++; x->frameout %= MAXFRAMES; break; } case SF_8BIT: { unsigned char* buf = (char*)(x->frames[x->frameout].data); while (n--) *out++ = (float) (0.0078125 * (*buf++)) - 1.0; x->frameout++; x->frameout %= MAXFRAMES; break; } default: post("unknown format %d",x->frames[x->frameout].tag.format); break; } return (w+4); } static void streamin_dsp(t_streamin *x, t_signal **sp) { dsp_add(streamin_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); } static void streamin_print(t_streamin* x) { int i; int avg = 0; for (i=0;iaverage[i]; post("last size = %d, avg size = %d, %d underflows", QUEUESIZE,avg/AVERAGENUM,x->underflow); } static void *streamin_new(t_floatarg fportno, t_floatarg prot) { t_streamin *x; int i; if (fportno == 0) fportno = 4267; post("port %f",fportno); x = (t_streamin *)pd_new(streamin_class); x->x_connectsocket = -1; x->x_socket = -1; x->x_tcp = 1; outlet_new(&x->x_obj, &s_signal); x->x_nconnections = 0; x->x_ndrops = 0; for (i=0;iframes[i].data = getbytes(MAXFRAMESIZE); } x->framein = 0; x->frameout = 0; x->maxframes = MAXFRAMES/2; if (prot) x->x_tcp = 0; streamin_createsocket(x, fportno, gensym("tcp")); return (x); } void streamin_tilde_setup(void) { streamin_class = class_new(gensym("streamin~"), (t_newmethod) streamin_new, (t_method) streamin_free, sizeof(t_streamin), 0, A_DEFFLOAT,A_DEFFLOAT, A_NULL); class_addmethod(streamin_class, nullfn, gensym("signal"), 0); class_addmethod(streamin_class, (t_method) streamin_dsp, gensym("dsp"), 0); class_addmethod(streamin_class, (t_method) streamin_print, gensym("print"), 0); class_addmethod(streamin_class, (t_method) streamin_reset, gensym("reset"),A_DEFFLOAT, 0); } pd-ggee_0.26/signal/atan2~-help.pd0000644000076500007650000000027011467116403015446 0ustar hanshans#N canvas 197 203 500 184 10; #X obj 33 88 atan2~; #X text 30 121 (C) Guenter Geiger; #X text 30 18 The atan2 function is used to get the phase from a imaginary value of the fft.; pd-ggee_0.26/signal/streamout~.c0000644000076500007650000001766411467116403015374 0ustar hanshans /* (C) Guenter Geiger */ #include #include "stream.h" #include #include #include #ifdef _WIN32 #include #else #include #include #include #include #include #define SOCKET_ERROR -1 #endif #ifdef __APPLE__ #include #endif /* Utility functions */ static void sys_sockerror(char *s) { #ifdef unix int err = errno; #else int err = WSAGetLastError(); if (err == 10054) return; #endif post("%s: %s (%d)\n", s, strerror(err), err); } static void sys_closesocket(int fd) { #ifdef UNIX close(fd); /* shutdown() ?? */ #endif #ifdef _WIN32 closesocket(fd); #endif } /* ------------------------ streamout~ ----------------------------- */ static t_class *streamout_class; typedef struct _streamout { t_object x_obj; int x_fd; int x_protocol; t_tag x_tag; t_symbol* hostname; int portno; short* cbuf; int nsamples; int tbufsize; } t_streamout; static void streamout_tempbuf(t_streamout *x,int size) { if (x->cbuf && x->tbufsize) freebytes(x->cbuf,x->tbufsize); x->tbufsize=size*sizeof(float)*x->x_tag.channels; if (!x->cbuf) x->cbuf = getbytes(x->tbufsize); x->nsamples = size; } static void streamout_disconnect(t_streamout *x) { if (x->x_fd >= 0) { sys_closesocket(x->x_fd); x->x_fd = -1; outlet_float(x->x_obj.ob_outlet, 0); } } static void streamout_connect(t_streamout *x, t_symbol *hostname, t_floatarg fportno) { struct sockaddr_in server; struct hostent *hp; int sockfd; int portno = fportno; x->hostname = hostname; if (!fportno) x->portno = 4267; else x->portno = (int) fportno; x->x_tag.count = 0; if (x->x_fd >= 0) { post("streamout~: already connected"); return; } /* create a socket */ sockfd = socket(AF_INET, x->x_protocol, 0); if (sockfd < 0) { post("streamout: Connection to %s on port %d failed",hostname->s_name,portno); sys_sockerror("socket"); return; } /* connect socket using hostname provided in command line */ server.sin_family = AF_INET; hp = gethostbyname(x->hostname->s_name); if (hp == 0) { post("bad host?\n"); return; } memcpy((char *)&server.sin_addr, (char *)hp->h_addr, hp->h_length); /* assign client port number */ server.sin_port = htons((u_short)portno); /* try to connect. LATER make a separate thread to do this because it might block */ if (connect(sockfd, (struct sockaddr *) &server, sizeof (server)) < 0) { sys_sockerror("connecting stream socket"); sys_closesocket(sockfd); return; } post("connected host %s on port %d",hostname->s_name, portno); x->x_fd = sockfd; outlet_float(x->x_obj.ob_outlet, 1); } static t_int *streamout_perform(t_int *w) { t_streamout* x = (t_streamout*) (w[1]); t_float *in[4]; char* bp; int n; int length; int sent = 0; int i; int chans = x->x_tag.channels; for (i=0;ix_tag.format)*chans; if (n != x->nsamples) streamout_tempbuf(x,n); x->x_tag.framesize=length; x->x_tag.count++; /* format the buffer */ switch (x->x_tag.format) { case SF_FLOAT: { float* cibuf =(float*) x->cbuf; bp = (char*) x->cbuf; for (i=0;icbuf; bp = (char*) x->cbuf; for (i=0;icbuf; bp = (char*) x->cbuf; for (i=0;ix_fd > 0) { /* send the format tag */ #ifdef __APPLE__ if (send(x->x_fd,(char*)&x->x_tag,sizeof(t_tag),SO_NOSIGPIPE) < 0) #elif defined unix if (send(x->x_fd,(char*)&x->x_tag,sizeof(t_tag),/*MSG_DONTWAIT|*/MSG_NOSIGNAL) < 0) #else if (send(x->x_fd,(char*)&x->x_tag,sizeof(t_tag),0) < 0) #endif { sys_sockerror("streamout"); streamout_disconnect(x); return (w+4); } /* send the buffer */ for (sent = 0; sent < length;) { int res = 0; #ifdef __APPLE__ res = send(x->x_fd, bp, length-sent, SO_NOSIGPIPE); #elif defined unix res = send(x->x_fd, bp, length-sent, /*MSG_DONTWAIT|*/MSG_NOSIGNAL); #else res = send(x->x_fd, bp, length-sent, 0); #endif if (res <= 0) { sys_sockerror("streamout"); streamout_disconnect(x); break; } else { sent += res; bp += res; } } } return (w+3+chans); } static void streamout_dsp(t_streamout *x, t_signal **sp) { switch (x->x_tag.channels) { case 1: dsp_add(streamout_perform, 3, x,sp[0]->s_vec, sp[0]->s_n); post("one channel mode"); break; case 2: dsp_add(streamout_perform, 4, x,sp[0]->s_vec, sp[1]->s_vec,sp[0]->s_n); post("two channel mode"); break; case 4: dsp_add(streamout_perform, 6, x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec,sp[3]->s_vec,sp[0]->s_n); post("four channel mode"); break; default: post("streamout: %d channels not supported",x->x_tag.channels); } } static void streamout_format(t_streamout *x,t_symbol* form) { if (!strncmp(form->s_name,"float",5)) x->x_tag.format = (int) SF_FLOAT; if (!strncmp(form->s_name,"16bit",5)) x->x_tag.format = (int) SF_16BIT; if (!strncmp(form->s_name,"8bit",4)) x->x_tag.format = (int) SF_8BIT; post ("format set to %s", form->s_name); } static void streamout_host(t_streamout *x,t_symbol* host) { if (host != &s_) x->hostname = host; if (x->x_fd >= 0) { streamout_connect(x,x->hostname,(float) x->portno); } } static void streamout_float(t_streamout* x,t_float arg) { if (arg == 0.0) streamout_disconnect(x); else streamout_connect(x,x->hostname,(float) x->portno); } static void *streamout_new(t_symbol* prot,float channels) { t_streamout *x = (t_streamout *)pd_new(streamout_class); outlet_new(&x->x_obj, &s_float); if (channels == 0) channels = 1; x->hostname = gensym("localhost"); x->portno = 3000; x->x_fd = -1; x->x_protocol = SOCK_STREAM; if (prot != &s_) if (!strncmp(prot->s_name,"udp",3)) x->x_protocol = SOCK_DGRAM; x->x_tag.format = SF_FLOAT; x->x_tag.channels = channels; x->x_tag.version = 1; x->cbuf = NULL; streamout_tempbuf(x,64); return (x); } static void streamout_free(t_streamout* x) { if (x->cbuf && x->tbufsize) freebytes(x->cbuf,x->tbufsize); } void streamout_tilde_setup(void) { streamout_class = class_new(gensym("streamout~"), (t_newmethod) streamout_new, (t_method) streamout_free, sizeof(t_streamout), 0, A_DEFSYM,A_DEFFLOAT, 0); class_addmethod(streamout_class, (t_method) streamout_connect, gensym("connect"), A_SYMBOL, A_DEFFLOAT, 0); class_addmethod(streamout_class, (t_method) streamout_disconnect, gensym("disconnect"), 0); class_addfloat(streamout_class,streamout_float); class_addmethod(streamout_class, nullfn, gensym("signal"), 0); class_addmethod(streamout_class, (t_method) streamout_dsp, gensym("dsp"), 0); class_addmethod(streamout_class, (t_method)streamout_format,gensym("format"),A_SYMBOL,0); class_addmethod(streamout_class, (t_method)streamout_host,gensym("host"),A_DEFSYM,0); } pd-ggee_0.26/signal/sfwrite~.c0000644000076500007650000001573111467116403015025 0ustar hanshans/* (C) Guenter Geiger */ #include #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include #include #ifndef _WIN32 #include #include #else #include #endif #include #include #ifdef _WIN32 #define BINREADMODE "rb" #define OPENPARAMS O_WRONLY | O_CREAT | O_TRUNC #else #define BINREADMODE "r" #define OPENPARAMS O_WRONLY | O_CREAT | O_NONBLOCK | O_TRUNC #endif #define MAX_CHANS 4 /* * ------------------------------------------- sfwrite~ ------------------------------- */ #define BLOCKTIME 0.01 #define uint32 unsigned int #define uint16 unsigned short static t_class *sfwrite_class; typedef struct _sfwrite { t_object x_obj; t_symbol* filename; int x_file; t_int rec; t_int x_channels; uint32 size; t_glist * x_glist; t_int x_blocked; t_int x_blockwarn; } t_sfwrite; typedef struct _wave { char w_fileid[4]; /* chunk id 'RIFF' */ uint32 w_chunksize; /* chunk size */ char w_waveid[4]; /* wave chunk id 'WAVE' */ char w_fmtid[4]; /* format chunk id 'fmt ' */ uint32 w_fmtchunksize; /* format chunk size */ uint16 w_fmttag; /* format tag, 1 for PCM */ uint16 w_nchannels; /* number of channels */ uint32 w_samplespersec; /* sample rate in hz */ uint32 w_navgbytespersec; /* average bytes per second */ uint16 w_nblockalign; /* number of bytes per sample */ uint16 w_nbitspersample; /* number of bits in a sample */ char w_datachunkid[4]; /* data chunk id 'data' */ uint32 w_datachunksize; /* length of data chunk */ } t_wave; static void sfwrite_wave_setup(t_sfwrite* x,t_wave* w) { strncpy(w->w_fileid,"RIFF",4); /* chunk id 'RIFF' */ w->w_chunksize = x->size + sizeof(t_wave) -8; /* chunk size */ strncpy(w->w_waveid,"WAVE",4); /* wave chunk id 'WAVE' */ strncpy(w->w_fmtid,"fmt ",4); /* format chunk id 'fmt '*/ w->w_fmtchunksize = 16; /* format chunk size */ w->w_fmttag = 1; /* format tag, 1 for PCM */ w->w_nchannels = x->x_channels; /* number of channels */ w->w_samplespersec = 44100; /* sample rate in hz */ w->w_navgbytespersec = 44100*x->x_channels*2; /* average bytes per second */ w->w_nblockalign = 4; /* number of bytes per sample */ w->w_nbitspersample = 16; /* number of bits in a sample */ strncpy(w->w_datachunkid,"data",4); /* data chunk id 'data'*/ w->w_datachunksize = x->size; /* length of data chunk */ } static void sfwrite_close(t_sfwrite *x) { if (x->x_file > 0) { t_wave w; sfwrite_wave_setup(x,&w); lseek(x->x_file,0,SEEK_SET); write(x->x_file,&w,sizeof(w)); close(x->x_file); } x->x_file = -1; } static void sfwrite_open(t_sfwrite *x,t_symbol *filename) { char fname[MAXPDSTRING]; if (filename == &s_) { post("sfwrite: open without filename"); return; } canvas_makefilename(glist_getcanvas(x->x_glist), filename->s_name, fname, MAXPDSTRING); x->x_blocked = 0; x->filename = filename; post("sfwrite: filename = %s",x->filename->s_name); sfwrite_close(x); if ((x->x_file = open(fname,OPENPARAMS,0664)) < 0) { error("can't create %s",fname); return; } /* skip the header */ lseek(x->x_file,sizeof(t_wave),SEEK_SET); x->size = 0; } static void sfwrite_block(t_sfwrite *x, t_floatarg f) { x->x_blockwarn = f; } static void sfwrite_float(t_sfwrite *x, t_floatarg f) { int t = f; if (t) { post("sfwrite: start", f); x->rec=1; } else { post("sfwrite: stop", f); x->rec=0; } } static short out[4*64]; static t_int *sfwrite_perform(t_int *w) { t_sfwrite* x = (t_sfwrite*)(w[1]); t_float * in[4]; int c = x->x_channels; int i,num,n; short* tout = out; int ret; double timebefore,timeafter; double late; for (i=0;i < c;i++) { in[i] = (t_float *)(w[2+i]); } n = num = (int)(w[2+c]); /* loop */ if (x->rec && x->x_file) { while (n--) { for (i=0;ix_file,out,sizeof(short)*num*c)) < (signed int)sizeof(short)*num*c) { post("sfwrite: short write %d",ret); } timeafter = sys_getrealtime(); late = timeafter - timebefore; /* OK, we let only 10 ms block here */ if (late > BLOCKTIME && x->x_blockwarn) { post("sfwrite blocked %f ms",late*1000); x->x_blocked++; if (x->x_blocked > x->x_blockwarn) { x->rec = 0; post("maximum blockcount %d reached, recording stopped (set blockcount with \"block \"",x->x_blockwarn); } } x->size +=64*x->x_channels*sizeof(short) ; } return (w+3+c); } static void sfwrite_dsp(t_sfwrite *x, t_signal **sp) { switch (x->x_channels) { case 1: dsp_add(sfwrite_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); break; case 2: dsp_add(sfwrite_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); break; case 4: dsp_add(sfwrite_perform, 6, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n); break; } } static void sfwrite_free(t_sfwrite* x) { sfwrite_close(x); } static void *sfwrite_new(t_floatarg chan) { t_sfwrite *x = (t_sfwrite *)pd_new(sfwrite_class); t_int c = chan; if (c<1 || c > MAX_CHANS) c = 1; x->x_glist = (t_glist*) canvas_getcurrent(); x->x_channels = c--; x->x_file=0; x->rec = 0; x->size = 0; x->x_blocked = 0; x->x_blockwarn = 10; while (c--) { inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); } return (x); } void sfwrite_tilde_setup(void) { sfwrite_class = class_new(gensym("sfwrite~"), (t_newmethod)sfwrite_new, (t_method)sfwrite_free, sizeof(t_sfwrite), 0,A_DEFFLOAT,0); class_addmethod(sfwrite_class,nullfn,gensym("signal"), 0); class_addmethod(sfwrite_class, (t_method) sfwrite_dsp, gensym("dsp"), 0); class_addmethod(sfwrite_class, (t_method) sfwrite_open, gensym("open"), A_SYMBOL,A_NULL); class_addmethod(sfwrite_class, (t_method) sfwrite_close, gensym("close"), 0); class_addmethod(sfwrite_class, (t_method)sfwrite_block,gensym("block"),A_DEFFLOAT,0); class_addfloat(sfwrite_class, sfwrite_float); } pd-ggee_0.26/signal/mixer~-help.pd0000644000076500007650000000407411467116403015573 0ustar hanshans#N canvas 205 153 590 395 10; #X obj 163 120 osc~ 220; #X obj 186 297 dac~; #X obj 163 140 *~ 0.1; #X obj 217 120 osc~ 220; #X obj 217 140 *~ 0.1; #X obj 272 120 osc~ 220; #X obj 272 140 *~ 0.1; #X obj 325 120 osc~ 220; #X obj 325 140 *~ 0.1; #X floatatom 217 97 0 0 0; #X floatatom 273 98 0 0 0; #X floatatom 326 95 0 0 0; #X floatatom 166 96 0 0 0; #X msg 106 175 1 \$1; #X msg 104 198 2 \$1; #X msg 104 221 3 \$1; #X floatatom 58 114 0 0 0; #X floatatom 58 153 0 0 0; #X floatatom 59 201 0 0 0; #X floatatom 59 84 0 0 0; #X msg 105 143 0 \$1; #X obj 196 246 mixer~ 20 --------------------------------------; #X obj 386 119 osc~ 220; #X obj 386 139 *~ 0.1; #X obj 440 119 osc~ 220; #X obj 440 139 *~ 0.1; #X obj 495 119 osc~ 220; #X obj 495 139 *~ 0.1; #X obj 548 119 osc~ 220; #X obj 548 139 *~ 0.1; #X floatatom 440 96 0 0 0; #X floatatom 496 97 0 0 0; #X floatatom 549 94 0 0 0; #X floatatom 389 95 0 0 0; #X floatatom 55 251 0 0 0; #X floatatom 55 290 0 0 0; #X floatatom 56 338 0 0 0; #X floatatom 56 221 0 0 0; #X msg 102 280 4 \$1; #X msg 103 312 5 \$1; #X msg 101 335 6 \$1; #X msg 101 358 7 \$1; #X text 57 7 The beginnig of a dynamic mixer matrix object \, implemented together with Oswald; #X connect 0 0 2 0; #X connect 2 0 21 0; #X connect 3 0 4 0; #X connect 4 0 21 1; #X connect 5 0 6 0; #X connect 6 0 21 2; #X connect 7 0 8 0; #X connect 8 0 21 3; #X connect 9 0 3 0; #X connect 10 0 5 0; #X connect 11 0 7 0; #X connect 12 0 0 0; #X connect 13 0 21 0; #X connect 14 0 21 0; #X connect 15 0 21 0; #X connect 16 0 13 0; #X connect 17 0 14 0; #X connect 18 0 15 0; #X connect 19 0 20 0; #X connect 20 0 21 0; #X connect 21 0 1 0; #X connect 21 0 1 1; #X connect 22 0 23 0; #X connect 23 0 21 4; #X connect 24 0 25 0; #X connect 25 0 21 5; #X connect 26 0 27 0; #X connect 27 0 21 6; #X connect 28 0 29 0; #X connect 29 0 21 7; #X connect 30 0 24 0; #X connect 31 0 26 0; #X connect 32 0 28 0; #X connect 33 0 22 0; #X connect 34 0 39 0; #X connect 35 0 40 0; #X connect 36 0 41 0; #X connect 37 0 38 0; #X connect 38 0 21 0; #X connect 39 0 21 0; #X connect 40 0 21 0; #X connect 41 0 21 0; pd-ggee_0.26/signal/sfwrite~-help.pd0000644000076500007650000000205711467116403016131 0ustar hanshans#N canvas 340 71 600 460 12; #X obj 185 96 sfwrite~ 2; #X msg 65 16 open test.wav; #X floatatom 185 16; #X msg 147 308 0; #X obj 232 17 adc~; #X msg 91 278 0; #X msg 59 278 1; #X obj 142 222 table; #X msg 136 171 bang; #X msg 32 171 resize 441000; #X msg 181 172 read16 test.wav 200 l; #X obj 417 104 env~; #X obj 298 34 osc~ 220; #X obj 125 396 dac~; #X floatatom 411 10; #X obj 125 341 sfread~ 2; #X obj 281 379 dbtorms; #X obj 281 279 slider 96 0 15; #X obj 159 372 *~ 0; #X obj 125 372 *~ 0; #X msg 125 277 open test.wav \, bang; #X floatatom 417 129; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 15 1; #X connect 5 0 15 0; #X connect 6 0 15 0; #X connect 8 0 7 0; #X connect 9 0 7 0; #X connect 10 0 7 0; #X connect 11 0 21 0; #X connect 12 0 0 0; #X connect 12 0 0 1; #X connect 12 0 11 0; #X connect 12 0 19 0; #X connect 12 0 18 0; #X connect 14 0 12 0; #X connect 15 0 19 0; #X connect 15 1 18 0; #X connect 16 0 18 1; #X connect 16 0 19 1; #X connect 18 0 13 1; #X connect 19 0 13 0; #X connect 20 0 15 0; pd-ggee_0.26/signal/Makefile0000755000076500007650000000102311467116403014430 0ustar hanshans# Adapt the PDPATH if your pd is not installed in the standard place PDPATH="$(PROGRAMFILES)/pd" EXTERNALS = $(shell ls *.c) all: $(EXTERNALS:.c=.dll) .SUFFIXES: .dll DEFINES = -DPD -DNT CFLAGS = -Wall -W -Wshadow -Wstrict-prototypes \ -Wno-unused -Wno-parentheses -Wno-switch INCLUDE = -I.. -I. -I$(PDPATH)/src LIBS = -lwsock32 %.dll: %.c $(CC) -mms-bitfields $(CFLAGS) $(DEFINES) $(INCLUDE) -o "$*.o" -c "$*.c" gcc -shared -o "$*.dll" "$*.o" $(PDPATH)/bin/pd.dll $(LIBS) rm "$*.o" clean: -rm *.a *.def *.dll *.opd-ggee_0.26/signal/streamin~-help.pd0000644000076500007650000000240111467116403016261 0ustar hanshans#N canvas 248 65 623 459 12; #X obj 45 133 print~; #X msg 45 105 bang; #X obj 23 62 streamin~ 3000; #X obj 132 210 streamout~; #X msg 132 108 disconnect; #X obj 371 87 osc~; #X obj 371 65 sig~ 220; #X floatatom 371 42 0 0 0 0 - - -; #X msg 285 162 format float; #X msg 284 184 format 16bit; #X text 14 432 (C) 1999 Guenter Geiger; #X msg 286 204 format 8bit; #X floatatom 132 235 0 0 0 0 - - -; #X text 21 295 The streamin~ object just takes the portnumber it is listening to as it's argument.; #X text 23 334 For help on the streamout object \, see the streamout.pd patch.; #X obj 23 197 dac~; #X obj 355 115 *~ 0.1; #X floatatom 418 88 0 0 0 0 - - -; #X floatatom 149 159 0 0 0 0 - - -; #X msg 285 252 connect gige 3001; #X msg 132 86 connect localhost 3000; #X msg 23 8 reset 4; #X msg 40 32 print; #X text 96 8 reset \, using n frames (default = 128); #X text 96 32 print queue info; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 2 0 15 0; #X connect 2 0 15 1; #X connect 3 0 12 0; #X connect 4 0 3 0; #X connect 5 0 16 0; #X connect 6 0 5 0; #X connect 7 0 6 0; #X connect 8 0 3 0; #X connect 9 0 3 0; #X connect 11 0 3 0; #X connect 16 0 3 0; #X connect 17 0 16 1; #X connect 18 0 3 0; #X connect 19 0 3 0; #X connect 20 0 3 0; #X connect 21 0 2 0; #X connect 22 0 2 0; pd-ggee_0.26/signal/stream.h0000644000076500007650000000345111467116403014440 0ustar hanshans/* (C) Guenter Geiger 1999 */ /*! * \file * \author Guenter Geiger * * \brief Definitions used by both streamin~ and streamout~ * * \todo This code does not honor network byte order. */ #ifndef __PD_STREAM_H #define __PD_STREAM_H #include /*! * \brief Format identifiers for frames */ enum tag_format { SF_FLOAT = 1, SF_DOUBLE = 2, SF_8BIT = 10, SF_16BIT = 11, SF_32BIT = 12, SF_ALAW = 20, SF_MP3 = 30 }; #define SF_SIZEOF(a) (a == SF_FLOAT ? sizeof(t_float) : a == SF_16BIT ? sizeof(short) : 1) #ifdef __GNUC__ #define PACKED __attribute__ ((packed)) #endif /*! * \brief 16-byte frame header * * \note Version 1 */ typedef struct _tag { /*! Frame header version. Currently ignored in streamin, but always set * to 1 for streamout. * * \todo Add version checking on incoming frames. However, this could * break existing uses of the external. */ char version; /*! This field identifies the type of data is in the frame payload */ char format; /*! ??? */ int32_t count; /*! ??? */ char channels; /*! This indicates the full size of the frame. It is basically * ( sizeof(t_tag) + payload length ). */ int32_t framesize; /*! ??? */ char extension[5]; } PACKED t_tag; /*! * \brief A complete frame */ typedef struct _frame { /*! This is the frame header that contains the metadata about the frame */ t_tag tag; /*! This buffer stores the frame data payload. The amount of data in this * buffer is the tag.framesize - sizeof(t_tag). Its contents can be * interpreted according to the tag.version. */ char *data; } t_frame; #endif /* __PD_STREAM_H */ pd-ggee_0.26/signal/atan2~.c0000644000076500007650000000450611467116403014345 0ustar hanshans/* (C) Guenter Geiger */ #include "math.h" #include /* ----------------------------- atan2 ----------------------------- */ static t_class *atan2_class; #define INVTWOPI 0.15915494f typedef struct _atan2 { t_object x_obj; } t_atan2; static void *atan2_new(t_symbol *s, int argc, t_atom *argv) { if (argc > 1) post("+~: extra arguments ignored"); { t_atan2 *x = (t_atan2 *)pd_new(atan2_class); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); outlet_new(&x->x_obj, &s_signal); return (x); } } t_int *atan2_perform(t_int *w) { t_float *in1 = (t_float *)(w[1]); t_float *in2 = (t_float *)(w[2]); t_float *out = (t_float *)(w[3]); int n = (int)(w[4]); while (n--) *out++ = (t_float) atan2(*in1++,*in2++) *INVTWOPI; return (w+5); } t_int *atan2_perf8(t_int *w) { t_float *in1 = (t_float *)(w[1]); t_float *in2 = (t_float *)(w[2]); t_float *out = (t_float *)(w[3]); int n = (int)(w[4]); for (; n; n -= 8, in1 += 8, in2 += 8, out += 8) { float f0 = in1[0], f1 = in1[1], f2 = in1[2], f3 = in1[3]; float f4 = in1[4], f5 = in1[5], f6 = in1[6], f7 = in1[7]; float g0 = in2[0], g1 = in2[1], g2 = in2[2], g3 = in2[3]; float g4 = in2[4], g5 = in2[5], g6 = in2[6], g7 = in2[7]; out[0] = (t_float) atan2(f0,g0)*INVTWOPI; out[1] = (t_float) atan2(f1,g1)*INVTWOPI; out[2] = (t_float) atan2(f2,g2)*INVTWOPI; out[3] = (t_float) atan2(f3,g3)*INVTWOPI; out[4] = (t_float) atan2(f4,g4)*INVTWOPI; out[5] = (t_float) atan2(f5,g5)*INVTWOPI; out[6] = (t_float) atan2(f6,g6)*INVTWOPI; out[7] = (t_float) atan2(f7,g7)*INVTWOPI; } return (w+5); } void dsp_add_atan2(t_sample *in1, t_sample *in2, t_sample *out, int n) { if (n&7) dsp_add(atan2_perform, 4, in1, in2, out, n); else dsp_add(atan2_perf8, 4, in1, in2, out, n); } static void atan2_dsp(t_atan2 *x, t_signal **sp) { dsp_add_atan2(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); } void atan2_tilde_setup(void) { atan2_class = class_new(gensym("atan2~"), (t_newmethod)atan2_new, 0, sizeof(t_atan2), 0, A_GIMME, 0); class_addmethod(atan2_class, nullfn, gensym("signal"), 0); class_addmethod(atan2_class, (t_method)atan2_dsp, gensym("dsp"), 0); } pd-ggee_0.26/signal/mixer~.c0000644000076500007650000000415211467116403014461 0ustar hanshans/* (C) Oswald Berthold */ #include "math.h" #include /* ----------------------------- mixer ----------------------------- */ static t_class *mixer_class; typedef struct _mixer { t_object x_obj; t_int x_n; t_float* x_m; } t_mixer; static void *mixer_new(t_symbol *s, t_floatarg num) { int i; t_mixer *x = (t_mixer *)pd_new(mixer_class); if (num < 1) x->x_n = 1; else x->x_n = (int) num; x->x_m = getbytes(sizeof(t_float)*x->x_n); for (i=0;ix_n /* - 1 */ ;i++) { inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); x->x_m[i] = 1.; } outlet_new(&x->x_obj, &s_signal); return (x); } void mixer_list(t_mixer* x,t_symbol* s,t_int argc, t_atom* argv) { int chan; t_float val; if (argc != 2) { post("unknown"); return; } chan = (int) atom_getfloat(argv++); val = atom_getfloat(argv++); x->x_m[chan] = val; } t_int *mixer_perform(t_int *w) { t_mixer* x = (t_mixer*) (w[1]); int n = (int)(w[2]); t_float **in = getbytes(sizeof(float)*x->x_n); t_float *out; int i,j; int offset = 3; for (i=0;i < x->x_n;i++) { in[i] = (t_float *)(w[offset+i]); } out = (t_float *)(w[offset+i]); while (n--) { *out = 0.; for (j=0;jx_n;j++) { *out += *(in[j]++) * x->x_m[j]; } out++; } return (w+offset+1+i); } static void mixer_dsp(t_mixer *x, t_signal **sp) { int i; t_int** myvec = getbytes(sizeof(t_int)*(x->x_n + 3)); myvec[0] = (t_int*)x; myvec[1] = (t_int*)sp[0]->s_n; for (i=0;i < x->x_n+1;i++) myvec[2 + i] = (t_int*)sp[i]->s_vec; dsp_addv(mixer_perform, x->x_n + 3, (t_int*)myvec); freebytes(myvec,sizeof(t_int)*(x->x_n + 3)); } void mixer_tilde_setup(void) { mixer_class = class_new(gensym("mixer~"), (t_newmethod)mixer_new, 0, sizeof(t_mixer), 0, A_DEFFLOAT, A_DEFSYM,A_NULL); class_addmethod(mixer_class, nullfn, gensym("signal"), 0); class_addmethod(mixer_class, (t_method)mixer_dsp, gensym("dsp"), 0); class_addlist(mixer_class,mixer_list); } pd-ggee_0.26/VERSION0000644000076500007650000000000511467116403012557 0ustar hanshans0.26