pd-markex_0.85/0000755000076500007650000000000011466300520012073 5ustar hanshanspd-markex_0.85/reson~.c0000644000076500007650000001021711466300156013571 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ /* Original code by Miller Puckette */ /* a non-interpolating reson filter, not very carefully coded... */ /* 11/29/94 modified to do interpolation - M. Danks */ #include "m_pd.h" #include #define BUFSIZE 4096 typedef struct resonctl { float c_freq; float c_samprate; float c_feedback; int c_delayinsamps; float c_fraction; int c_phase; float *c_buf; } t_resonctl; typedef struct sigreson { t_object x_obj; /* header */ t_resonctl *x_ctl; /* pointer to state */ t_resonctl x_cspace; /* garage for state when not in a chain */ } t_sigreson; /* the DSP routine -- called for every n samples of input */ static t_int *cu_reson(t_int *w) { t_float *in1 = (t_float *)(w[1]); t_float *in2 = (t_float *)(w[2]); t_float *out = (t_float *)(w[3]); t_resonctl *x = (t_resonctl *)(w[4]); int n = (int)(w[5]); long i; int writephase = x->c_phase; for (i = 0; i < n; i++) { /* note two tricks: 1. input is read before output * is written, because the routine might be called * in-place; * 2 - a seed of 1E-20 is thrown in to avoid floating * underflow which slows the calculation down. */ int readphase, phase, delayinsamps; float fraction, f, g, freq, freqtemp; float ftemp; freq = *in2++; freqtemp = (freq < 1 ? 1 : freq); ftemp = x->c_samprate/freqtemp; if (ftemp >= BUFSIZE-1) ftemp = BUFSIZE - 1.f; else if (ftemp < 1.0) ftemp = 1.f; delayinsamps = (int)ftemp; fraction = ftemp - delayinsamps; readphase = writephase - delayinsamps; phase = readphase & (BUFSIZE-1); f = x->c_buf[phase] + fraction * (x->c_buf[(phase-1)& (BUFSIZE-1)] - x->c_buf[phase]); g = *in1++; *out++ = x->c_buf[(writephase++) & (BUFSIZE-1)] = g + x->c_feedback * f + 1E-20f; } x->c_phase = writephase & (BUFSIZE-1); return (w+6); } /* sets the reson frequency */ void sigreson_float(t_sigreson *x, t_floatarg f) { float ftemp; x->x_ctl->c_freq = (f < 1 ? 1 : f); ftemp = x->x_ctl->c_samprate/x->x_ctl->c_freq; if (ftemp >= BUFSIZE - 1) ftemp = BUFSIZE - 1.f; else if (ftemp < 1.0) ftemp = 1.f; x->x_ctl->c_delayinsamps = (int)ftemp; x->x_ctl->c_fraction = ftemp - x->x_ctl->c_delayinsamps; } /* routine which FTS calls to put you on the DSP chain or take you off. */ static void sigreson_dsp(t_sigreson *x, t_signal **sp) { x->x_ctl->c_samprate = sp[0]->s_sr; sigreson_float(x, x->x_ctl->c_freq); dsp_add(cu_reson, 5, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, x->x_ctl, sp[0]->s_n); } static void sigreson_ft1(t_sigreson *x, t_floatarg f) /* sets feedback */ { if (f > .99999) f = .99999f; else if (f < -.99999) f = -.99999f; x->x_ctl->c_feedback = (float)f; } static void sigreson_ff(t_sigreson *x) /* cleanup on free */ { free(x->x_ctl->c_buf); } static t_class *sigreson_class; void *sigreson_new(t_floatarg f, t_floatarg g) { t_sigreson *x = (t_sigreson *)pd_new(sigreson_class); outlet_new(&x->x_obj, &s_signal); /* things in "cspace" are things you'll actually use at DSP time */ x->x_cspace.c_phase = 0; if (!(x->x_cspace.c_buf = (float *)malloc(BUFSIZE * sizeof(float)))) { error("buffer alloc failed"); return (0); } x->x_cspace.c_samprate = 44100.f; /* just a plausible default */ /* control block is in the garage at startup */ x->x_ctl = &x->x_cspace; sigreson_float(x, (t_float)f); /* setup params */ sigreson_ft1(x, g); /* make a "float" inlet */ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1")); return (x); } void reson_tilde_setup(void) { sigreson_class = class_new(gensym("reson~"), (t_newmethod)sigreson_new, (t_method)sigreson_ff, sizeof(t_sigreson), 0, A_DEFFLOAT, A_DEFFLOAT, 0); class_addfloat(sigreson_class, (t_method)sigreson_float); class_addmethod(sigreson_class, (t_method)sigreson_ft1, gensym("ft1"), A_FLOAT, 0); class_addmethod(sigreson_class, (t_method)nullfn, &s_signal, A_NULL); class_addmethod(sigreson_class, (t_method)sigreson_dsp, gensym("dsp"), A_NULL); } pd-markex_0.85/tripleRand-help.pd0000644000076500007650000000116711466300156015464 0ustar hanshans#N canvas 132 108 604 504 10; #X obj 136 234 unpack 0 0 0; #X floatatom 136 280 4 0 0 0 - - -; #X floatatom 175 280 4 0 0 0 - - -; #X floatatom 215 280 4 0 0 0 - - -; #X text 138 24 tripleRine; #X text 84 395 [tripleRand] generates three distinct random numbers at once within the range specified.; #X obj 136 184 tripleRand 5; #X floatatom 215 146 5 0 0 0 - - -; #X obj 136 134 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X text 123 68 MarkEx object; #X msg 278 142 1 5 10; #X connect 0 0 1 0; #X connect 0 1 2 0; #X connect 0 2 3 0; #X connect 6 0 0 0; #X connect 7 0 6 1; #X connect 8 0 6 0; #X connect 10 0 6 1; pd-markex_0.85/vectorpack-help.pd0000644000076500007650000000021311466300156015510 0ustar hanshans#N canvas 407 449 450 300 10; #X text 138 59 MarkEx vector operation; #X text 133 181 (placeholder help patch); #X obj 177 112 vectorpack; pd-markex_0.85/alternate.c0000644000076500007650000000435211466300156014227 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- alternate ------------------------------ */ /* instance structure */ static t_class *alternate_class; typedef struct _alternate { t_object x_obj; /* obligatory object header */ int a_which; /* which outlet to go out 0 = left, 1 = right */ t_outlet *t_out1; /* the outlet */ t_outlet *t_out2; /* the other outlet */ } t_alternate; static void alternate_list(t_alternate *x, t_symbol *s, int argc, t_atom *argv) { static t_symbol *listSym = NULL; if (!listSym) listSym = gensym("list"); if (!x->a_which) outlet_list(x->t_out1, listSym, argc, argv); else outlet_list(x->t_out2, listSym, argc, argv); x->a_which++; x->a_which = (x->a_which > 1) ? 0 : x->a_which; } static void alternate_float(t_alternate *x, t_floatarg n) { if (!x->a_which) outlet_float(x->t_out1, n); else outlet_float(x->t_out2, n); x->a_which++; x->a_which = (x->a_which > 1) ? 0 : x->a_which; } static void alternate_bang(t_alternate *x) { if (!x->a_which) outlet_bang(x->t_out1); else outlet_bang(x->t_out2); x->a_which++; x->a_which = (x->a_which > 1) ? 0 : x->a_which; } static void alternate_reset(t_alternate *x) { x->a_which = 0; } static void *alternate_new(t_symbol *s) /* init vals in struc */ { t_alternate *x = (t_alternate *)pd_new(alternate_class); x->t_out1 = outlet_new(&x->x_obj, 0); x->t_out2 = outlet_new(&x->x_obj, 0); x->a_which = 0; return (x); } void alternate_setup(void) { alternate_class = class_new(gensym("alternate"), (t_newmethod)alternate_new, 0, sizeof(t_alternate), 0, A_NULL); class_addfloat(alternate_class, (t_method)alternate_float); class_addbang(alternate_class, (t_method)alternate_bang); class_addmethod(alternate_class, (t_method)alternate_reset, gensym("reset"), A_NULL); class_addmethod(alternate_class, (t_method)alternate_list, gensym("list"), A_GIMME, A_NULL); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(alternate_class, gensym("alternate-help.pd")); #endif } pd-markex_0.85/vector+-help.pd0000644000076500007650000000021011466300156014721 0ustar hanshans#N canvas 407 449 450 300 10; #X obj 177 112 vector+; #X text 138 59 MarkEx vector operation; #X text 133 181 (placeholder help patch); pd-markex_0.85/counter.c0000644000076500007650000001315711466300156013732 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- counter ------------------------------ */ /* instance structure */ static t_class *counter_class; typedef struct _counter { t_object x_obj; /* obligatory object header */ int c_current; /* current number */ int c_high; /* highest number */ int c_low; /* lowest number */ int c_updown; /* 0 = going up, 1 = going down */ int c_dir; /* counter dir. 1=up, 2=down, 3=up/down */ t_outlet *t_out1; /* the outlet */ t_outlet *t_out2; /* the outlet */ } t_counter; void counter_bang(t_counter *x) { int sendBang = 0; switch(x->c_dir) { // count up case 1: x->c_current++; if (x->c_current > x->c_high) x->c_current = x->c_low; else if (x->c_current < x->c_low) x->c_current = x->c_low; else if (x->c_current == x->c_high) sendBang = 1; break; // count down case 2: x->c_current--; if (x->c_current < x->c_low) x->c_current = x->c_high; else if (x->c_current > x->c_high) x->c_current = x->c_high; else if (x->c_current == x->c_low) sendBang = 1; break; // count up and down case 3: // going up if (x->c_updown == 0) { x->c_current++; if (x->c_current > x->c_high) { x->c_current = x->c_high - 1; x->c_updown = 1; } else if (x->c_current < x->c_low) x->c_current = x->c_low; else if (x->c_current == x->c_high) sendBang = 1; } // going down else if (x->c_updown == 1) { x->c_current--; if (x->c_current < x->c_low) { x->c_current = x->c_low + 1; x->c_updown = 0; } else if (x->c_current > x->c_high) x->c_current = x->c_high; else if (x->c_current == x->c_low) sendBang = 1; } else { error("up/down wrong"); return; } break; default: error("dir wrong"); return; } outlet_float(x->t_out1, (float)x->c_current); if (sendBang) outlet_bang(x->t_out2); } void counter_dir(t_counter *x, t_floatarg n) { if (n == 1 || n == 2 || n == 3) x->c_dir = (int)n; else error("bad dir"); } void counter_high(t_counter *x, t_floatarg n) { x->c_high = (int)n; } void counter_low(t_counter *x, t_floatarg n) { x->c_low = (int)n; } void counter_reset(t_counter *x, t_symbol *s, int argc, t_atom *argv) { if (!argc) { switch(x->c_dir) { case 1: x->c_current = x->c_low; break; case 2: x->c_current = x->c_high; break; case 3: if (x->c_updown == 0) x->c_current = x->c_low; else if (x->c_updown == 1) x->c_current = x->c_high; break; default: return; } } else { switch(argv[0].a_type) { case A_FLOAT : x->c_current = (int)argv[0].a_w.w_float; break; default : error ("counter: reset not float"); break; } } outlet_float(x->t_out1, (float)x->c_current); } void counter_clear(t_counter *x, t_symbol *s, int argc, t_atom *argv) { if (!argc) { switch(x->c_dir) { case 1: x->c_current = x->c_low - 1; break; case 2: x->c_current = x->c_high + 1; break; case 3: if (x->c_updown == 0) x->c_current = x->c_low - 1; else if (x->c_updown == 1) x->c_current = x->c_high + 1; break; default: break; } } else { switch(argv[0].a_type) { case A_FLOAT : x->c_current = (int)argv[0].a_w.w_float - 1; break; default : error ("counter: reset not float"); break; } } } void *counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in struc */ { t_counter *x = (t_counter *)pd_new(counter_class); x->t_out1 = outlet_new(&x->x_obj, 0); x->t_out2 = outlet_new(&x->x_obj, 0); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl3")); x->c_current = 0; x->c_updown = 0; if (h) { counter_low(x, f); counter_high(x, g); counter_dir(x, h); } else if (g) { x->c_dir = 1; counter_low(x, f); counter_high(x, g); } else if (f) { x->c_dir = x->c_low = 1; counter_high(x, f); } else { x->c_dir = x->c_low = 1; x->c_high = 10; } return (x); } void counter_setup(void) { counter_class = class_new(gensym("counter"), (t_newmethod)counter_new, 0, sizeof(t_counter), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); class_addbang(counter_class, (t_method)counter_bang); class_addmethod(counter_class, (t_method)counter_dir, gensym("fl1"), A_FLOAT, 0); class_addmethod(counter_class, (t_method)counter_low, gensym("fl2"), A_FLOAT, 0); class_addmethod(counter_class, (t_method)counter_high, gensym("fl3"), A_FLOAT, 0); class_addmethod(counter_class, (t_method)counter_reset, gensym("reset"), A_GIMME, 0); class_addmethod(counter_class, (t_method)counter_clear, gensym("clear"), A_GIMME, 0); #if PD_MINOR_VERSION < 37 #endif } pd-markex_0.85/vector-.c0000644000076500007650000000325311466300156013626 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- vector- ------------------------------ */ /* instance structure */ static t_class *vectorMinus_class; typedef struct _vectorMinus { t_object x_obj; t_float x_minus; t_atom *m_list; int m_num; t_outlet *t_out1; /* the outlet */ } t_vectorMinus; static void doVectorMinus(t_vectorMinus *x, t_symbol *s, int argc, t_atom *argv) { int i; if (argc > x->m_num) { x->m_list = (t_atom *)resizebytes(x->m_list, sizeof(t_atom) * x->m_num, sizeof(t_atom) * argc); x->m_num = argc; } for (i = 0; i < argc; i++) { float temp = atom_getfloat(&argv[i]); temp -= x->x_minus; SETFLOAT((&x->m_list[i]), temp); } outlet_list(x->t_out1, &s_list, argc, x->m_list); } static void *vectorMinus_new(t_floatarg n) { t_vectorMinus *x = (t_vectorMinus *)pd_new(vectorMinus_class); x->x_minus = (float)n; floatinlet_new(&x->x_obj, &x->x_minus); x->t_out1 = outlet_new(&x->x_obj, 0); x->m_num = 3; x->m_list = (t_atom *)getbytes(sizeof(t_atom) * x->m_num); return (x); } static void vectorMinus_setup(void) { vectorMinus_class = class_new(gensym("vector-"), (t_newmethod)vectorMinus_new, 0, sizeof(t_vectorMinus), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)vectorMinus_new, gensym("v-"), A_DEFFLOAT, 0); class_addmethod(vectorMinus_class, (t_method)doVectorMinus, &s_list, A_GIMME, A_NULL); } void setup_vector0x2d(void){ vectorMinus_setup(); } void setup_v0x2d(void){ vectorMinus_setup(); } pd-markex_0.85/strcat-help.pd0000644000076500007650000000051311466300156014652 0ustar hanshans#N canvas 330 185 454 304 10; #X obj 181 131 strcat foo; #X msg 147 58 symbol bar; #X symbolatom 181 182 0 0 0 0 - - -; #X text 16 255 [strcat] prepends its text to any symbol that is sent to it.; #X msg 173 79 symbol kneipe; #X msg 195 101 symbol d; #X connect 0 0 2 0; #X connect 1 0 0 0; #X connect 4 0 0 0; #X connect 5 0 0 0; pd-markex_0.85/oneshot.c0000644000076500007650000000277011466300156013731 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- oneshot ------------------------------ */ /* instance structure */ static t_class *oneshot_class; typedef struct _oneshot { t_object x_obj; /* obligatory object header */ int t_armed; /* if willing to pass data */ t_outlet *t_out1; /* the outlet */ } t_oneshot; static void oneshot_float(t_oneshot *x, t_floatarg n) { if (x->t_armed) { outlet_float(x->t_out1, n); x->t_armed = 0; } } static void oneshot_bang(t_oneshot *x) { if (x->t_armed) { outlet_bang(x->t_out1); x->t_armed = 0; } } static void oneshot_clear(t_oneshot *x) { x->t_armed = 1; } static void *oneshot_new(t_symbol *s) /* init vals in struc */ { t_oneshot *x = (t_oneshot *)pd_new(oneshot_class); x->t_out1 = outlet_new(&x->x_obj, 0); x->t_armed = 1; return (x); } void oneshot_setup(void) { oneshot_class = class_new(gensym("oneshot"), (t_newmethod)oneshot_new, 0, sizeof(t_oneshot), 0, A_NULL); class_addfloat(oneshot_class, (t_method)oneshot_float); class_addbang(oneshot_class, (t_method)oneshot_bang); class_addmethod(oneshot_class, (t_method)oneshot_clear, gensym("clear"), A_NULL); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(oneshot_class, gensym("oneshot-help.pd")); #endif } pd-markex_0.85/abs~-help.pd0000644000076500007650000000110511466300156014313 0ustar hanshans#N canvas 286 197 499 284 10; #X obj 19 108 sig~; #X obj 71 133 loadbang; #X obj 71 157 metro 100; #X obj 71 181 snapshot~; #X floatatom 19 87 5 0 0 0 - - -; #X floatatom 71 206 7 0 0 0 - - -; #X text 316 257 updated for Pd version 0.42.; #X obj 20 132 abs~; #X obj 21 14 abs~; #X text 60 14 - absolute value; #X text 82 33 Passes nonnegative values unchanged \, but replaces negative ones with their (positive) inverses.; #X text 81 66 (turn DSP on to test):; #X connect 0 0 7 0; #X connect 1 0 2 0; #X connect 2 0 3 0; #X connect 3 0 5 0; #X connect 4 0 0 0; #X connect 7 0 3 0; pd-markex_0.85/invert-help.pd0000644000076500007650000000035411466300156014664 0ustar hanshans#N canvas 151 485 600 500 10; #X text 124 68 GEM object; #X msg 170 156 1; #X obj 123 298 print out1; #X obj 123 219 invert; #X msg 123 155 0; #X text 139 22 invert; #X connect 1 0 3 0; #X connect 3 0 2 0; #X connect 4 0 3 0; pd-markex_0.85/tripleLine.c0000644000076500007650000000553111466300156014357 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- tripleLine ------------------------------ */ /* instance structure */ static t_class *tripleLine_class; typedef struct _tripleLine { t_object x_obj; /* obligatory object header */ t_clock *clock; float grain; float destTime; float curTime; float curVal[3]; float destVal[3]; float stepVal[3]; t_outlet *t_out1; /* the outlet */ } t_tripleLine; static void tripleTick(t_tripleLine *x) { t_atom argv[3]; int i; x->curTime += x->grain; if (x->curTime >= x->destTime) { for (i = 0; i < 3; i++) { x->curVal[i] = x->destVal[i]; SETFLOAT((&argv[i]), x->curVal[i]); } } else { for (i = 0; i < 3; i++) { x->curVal[i] += x->stepVal[i]; SETFLOAT((&argv[i]), x->curVal[i]); } clock_delay(x->clock, x->grain); } outlet_list(x->t_out1, &s_list, 3, argv); } static void setLineParameters(t_tripleLine *x, t_symbol *s, int argc, t_atom *argv) { float numCounts; int i; t_atom newargv[3]; float time = x->destTime; clock_unset(x->clock); if (argc == 4) time = atom_getfloat(&argv[3]); else if (argc != 3) { error("tripleLine: requires 3 or 4 args"); return; } x->destTime = time; numCounts = time / x->grain; if (x->destTime <= 0.) { x->curTime = 0; for (i = 0; i < 3; i++) { x->curVal[i] = x->destVal[i] = atom_getfloat(&argv[i]); SETFLOAT((&newargv[i]), x->curVal[i]); } outlet_list(x->t_out1, &s_list, 3, newargv); return; } else { for (i = 0; i < 3; i++) { x->destVal[i] = atom_getfloat(&argv[i]); x->stepVal[i] = (x->destVal[i] - x->curVal[i]) / numCounts; SETFLOAT((&newargv[i]), x->curVal[i]); } } x->curTime = 0; clock_delay(x->clock, x->grain); outlet_list(x->t_out1, &s_list, 3, newargv); } static void tripleLine_free(t_tripleLine *x) { clock_free(x->clock); } static void *tripleLine_new(t_floatarg time, t_floatarg grain) /* init vals in struc */ { int i; t_tripleLine *x = (t_tripleLine *)pd_new(tripleLine_class); x->curTime = 0; x->destTime = time; x->clock = clock_new(x, (t_method)tripleTick); for (i = 0; i < 3; i++) { x->curVal[i] = x->destVal[i] = x->stepVal[i] = 0.; } if (grain <= 0) grain = 50; x->grain = (float)grain; x->t_out1 = outlet_new(&x->x_obj, 0); return(x); } void tripleLine_setup(void) { tripleLine_class = class_new(gensym("tripleLine"), (t_newmethod)tripleLine_new, (t_method)tripleLine_free, sizeof(t_tripleLine), 0, A_DEFFLOAT, A_DEFFLOAT, 0); class_addmethod(tripleLine_class, (t_method)setLineParameters, &s_list, A_GIMME, A_NULL); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(tripleLine_class, gensym("tripleLine-help.pd")); #endif } pd-markex_0.85/README.txt0000644000076500007650000000052411466300156013577 0ustar hanshans ------------------------------ GEM and MARKEX ------------------------------ These are objects from GEM which don't have any dependencies besides libc. What is here is the entire contents of Gem/src/MarkEx except [hsv2rsb] and the vector lib. Hopefully they will be removed from Gem once they become a proper part of this repository. pd-markex_0.85/multiselect-help.pd0000644000076500007650000000271211466300156015707 0ustar hanshans#N canvas 320 324 492 389 10; #X text 13 14 [multiselect] is part of MarkEx \, which was formerly in GEM \, and was written by Mark Danks.; #X text 16 52 [multiselect] is like [select] \, except that you send a list of numbers into the right inlet to change the selection values instead of only one number as with [select].; #X text 16 94 If you send more values than there are outlets (i.e. \, more values that you created the object with) \, the extra numbers are ignored.; #X text 19 291 One use for [multiselect] is to filter notes so that they fit a particular scale and the notes in that scale can be changed on the fly.; #X obj 92 345 select; #X text 21 346 see also:; #X floatatom 155 209 0 0 0 0 - - -; #X msg 141 167 1; #X msg 110 167 54; #X msg 80 167 23; #X obj 155 239 multiselect 23 54 1; #X obj 155 259 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X floatatom 283 260 5 0 0 0 - - -; #X obj 197 259 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 240 259 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 171 167 57; #X msg 201 167 23; #X msg 232 167 5; #X msg 283 215 list 57 23 5; #X text 19 139 WARNING: changing the argument crashes Pd! I could not figure out how to get this to work.; #X connect 6 0 10 0; #X connect 7 0 6 0; #X connect 8 0 6 0; #X connect 9 0 6 0; #X connect 10 0 11 0; #X connect 10 1 13 0; #X connect 10 2 14 0; #X connect 10 3 12 0; #X connect 15 0 6 0; #X connect 16 0 6 0; #X connect 17 0 6 0; pd-markex_0.85/vector--help.pd0000644000076500007650000000021011466300156014723 0ustar hanshans#N canvas 407 449 450 300 10; #X text 138 59 MarkEx vector operation; #X text 133 181 (placeholder help patch); #X obj 177 112 vector-; pd-markex_0.85/vector0x2a.c0000644000076500007650000000336111466300156014244 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- vector* ------------------------------ */ /* instance structure */ static t_class *vectorMult_class; typedef struct _vectorMult { t_object x_obj; t_float x_mult; t_atom *m_list; int m_num; t_outlet *t_out1; /* the outlet */ } t_vectorMult; static void doVectorMult(t_vectorMult *x, t_symbol *s, int argc, t_atom *argv) { int i; if (argc > x->m_num) { x->m_list = (t_atom *)resizebytes(x->m_list, sizeof(t_atom) * x->m_num, sizeof(t_atom) * argc); x->m_num = argc; } for (i = 0; i < argc; i++) { float temp = atom_getfloat(&argv[i]); temp *= x->x_mult; SETFLOAT((&x->m_list[i]), temp); } outlet_list(x->t_out1, &s_list, argc, x->m_list); } static void *vectorMult_new(t_floatarg n) { t_vectorMult *x = (t_vectorMult *)pd_new(vectorMult_class); x->x_mult = (float)n; floatinlet_new(&x->x_obj, &x->x_mult); x->t_out1 = outlet_new(&x->x_obj, 0); x->m_num = 3; x->m_list = (t_atom *)getbytes(sizeof(t_atom) * x->m_num); return (x); } static void vectorMult_setup(void) { vectorMult_class = class_new(gensym("vector*"), (t_newmethod)vectorMult_new, 0, sizeof(t_vectorMult), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)vectorMult_new, gensym("v*"), A_DEFFLOAT, 0); class_addmethod(vectorMult_class, (t_method)doVectorMult, &s_list, A_GIMME, A_NULL); } void setup_vector0x2a(void){ vectorMult_setup(); } void vector0x2a_setup(void){ vectorMult_setup(); } void setup_v0x2a(void){ vectorMult_setup(); } void v0x2a_setup(void){ vectorMult_setup(); } pd-markex_0.85/vectorabs.c0000644000076500007650000000301211466300156014230 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- vectorabs ------------------------------ */ /* instance structure */ static t_class *vectorAbs_class; typedef struct _vectorAbs { t_object x_obj; t_atom *m_list; int m_num; t_outlet *t_out1; /* the outlet */ } t_vectorAbs; static void doVectorAbs(t_vectorAbs *x, t_symbol *s, int argc, t_atom *argv) { int i; if (argc > x->m_num) { x->m_list = (t_atom *)resizebytes(x->m_list, sizeof(t_atom) * x->m_num, sizeof(t_atom) * argc); x->m_num = argc; } for (i = 0; i < argc; i++) { float temp = atom_getfloat(&argv[i]); if (temp < 0.f) temp = temp * -1.f; SETFLOAT((&x->m_list[i]), temp); } outlet_list(x->t_out1, &s_list, argc, x->m_list); } static void *vectorAbs_new(void) { t_vectorAbs *x = (t_vectorAbs *)pd_new(vectorAbs_class); x->t_out1 = outlet_new(&x->x_obj, 0); x->m_num = 3; x->m_list = (t_atom *)getbytes(sizeof(t_atom) * x->m_num); return (x); } void vectorabs_setup(void) { vectorAbs_class = class_new(gensym("vectorabs"), (t_newmethod)vectorAbs_new, 0, sizeof(t_vectorAbs), 0, A_NULL); class_addcreator((t_newmethod)vectorAbs_new, gensym("vabs"), A_NULL); class_addmethod(vectorAbs_class, (t_method)doVectorAbs, &s_list, A_GIMME, A_NULL); } void vabs_setup(void){ vectorabs_setup(); } pd-markex_0.85/average-help.pd0000644000076500007650000000077711466300156015000 0ustar hanshans#N canvas 271 381 600 500 10; #X text 124 68 GEM object; #X obj 123 298 print out1; #X obj 123 220 average; #X floatatom 123 160 0 0 0; #X msg 184 162 bang; #X msg 247 164 reset 5; #X msg 345 168 clear; #X text 89 408 The initial argument is the number to average together. The default is 10 numbers.; #X obj 421 231 average 20; #X text 139 23 [average]; #X text 81 371 [average] together a series of numbers.; #X connect 2 0 1 0; #X connect 3 0 2 0; #X connect 4 0 2 0; #X connect 5 0 2 0; #X connect 6 0 2 0; pd-markex_0.85/oneshot-help.pd0000644000076500007650000000052211466300156015031 0ustar hanshans#N canvas 151 485 600 500 10; #X text 124 68 GEM object; #X obj 123 298 print out1; #X msg 123 155 bang; #X text 138 23 oneshot; #X obj 123 219 oneshot; #X msg 188 154 clear; #X text 61 385 oneshot blocks after the initial bang \, until a clear message is received.; #X connect 2 0 4 0; #X connect 4 0 1 0; #X connect 5 0 4 0; pd-markex_0.85/counter-help.pd0000644000076500007650000000225111466300156015032 0ustar hanshans#N canvas 597 145 600 590 10; #X text 124 68 GEM object; #X obj 123 298 print out1; #X text 138 23 counter; #X msg 123 97 bang; #X text 58 362 counter counts the number of bangs; #X obj 123 220 counter 0 5; #X msg 319 154 bang; #X text 58 394 The third argument is the direction 1 == up 2 == down 3 == up and down; #X obj 319 297 print out2; #X obj 319 219 counter 0 5 3; #X obj 195 265 print done1; #X obj 405 267 print done2; #X text 58 439 The right outlet sends a bang when the counter rolls over. The bang occurs after the left inlet sends the value.; #X msg 147 129 direction; #X msg 171 154 low value; #X msg 195 182 high value; #X msg 71 176 reset; #X msg 26 177 clear; #X text 58 524 A reset message will set the counter back to the starting value and send the value out the left outlet.; #X text 58 486 A clear message will set the counter back to the starting value.; #X text 331 189 count from 0 to 5 and back down to 0; #X connect 3 0 5 0; #X connect 5 0 1 0; #X connect 5 1 10 0; #X connect 6 0 9 0; #X connect 9 0 8 0; #X connect 9 1 11 0; #X connect 13 0 5 1; #X connect 14 0 5 2; #X connect 15 0 5 3; #X connect 16 0 5 0; #X connect 17 0 5 0; pd-markex_0.85/markex-meta.pd0000644000076500007650000000041311466300156014636 0ustar hanshans#N canvas 10 22 200 200 10; #N canvas 20 22 420 300 META 0; #X text 10 10 META this is a prototype of a libdir meta file; #X text 10 30 NAME markex; #X text 10 50 AUTHOR Mark Danks; #X text 10 70 LICENSE GNU GPL; #X text 11 90 VERSION 0.85; #X restore 10 10 pd META; pd-markex_0.85/average.c0000644000076500007650000000444011466300156013660 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- alternate ------------------------------ */ /* instance structure */ static t_class *average_class; typedef struct _average { t_object x_obj; /* obligatory object header */ int a_total; /* number of numbers to average */ int a_whichNum; /* which number are pointing at */ float a_numbers[100]; /* numbers to average, 100 maximum */ t_outlet *t_out1; /* the outlet */ } t_average; void average_bang(t_average *x) { float average = 0.0f; int n; for (n = 0; n < x->a_total; n++) average = average + x->a_numbers[n]; average = average / (float)x->a_total; outlet_float(x->t_out1, average); } void average_float(t_average *x, t_floatarg n) { if (x->a_whichNum >= x->a_total) x->a_whichNum = 0; x->a_numbers[x->a_whichNum] = n; x->a_whichNum++; average_bang(x); } void average_total(t_average *x, t_floatarg n) { x->a_total = (int)n; } void average_reset(t_average *x, t_floatarg newVal) { int n; for (n=0; n < 100; n ++) x->a_numbers[n] = newVal; } void average_clear(t_average *x) { int n; for ( n = 0; n < 100; n ++) x->a_numbers[n] = 0.0f; } void *average_new(t_floatarg f) /* init vals in struc */ { t_average *x = (t_average *)pd_new(average_class); x->t_out1 = outlet_new(&x->x_obj, 0); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1")); average_clear(x); if (f) x->a_total = (int)f; else x->a_total = 10; x->a_whichNum = 0; return (x); } void average_setup(void) { average_class = class_new(gensym("average"), (t_newmethod)average_new, 0, sizeof(t_average), 0, A_DEFFLOAT, 0); class_addbang(average_class, (t_method)average_bang); class_addfloat(average_class, (t_method)average_float); class_addmethod(average_class, (t_method)average_total, gensym("fl1"), A_FLOAT, 0); class_addmethod(average_class, (t_method)average_clear, gensym("clear"), A_NULL); class_addmethod(average_class, (t_method)average_reset, gensym("reset"), A_FLOAT, 0); #if PD_MINOR_VERSION < 37 #endif } pd-markex_0.85/abs~.c0000644000076500007650000000223211466300156013206 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" #include /* ------------------------- abs~ -------------------------- */ static t_class *abs_class; typedef struct _abs { t_object x_obj; } t_abs; static t_int *abs_perform(t_int *w) { //t_abs *x = (t_abs *)(w[1]); t_float *in = (t_float *)(w[2]); t_float *out = (t_float *)(w[3]); int n = (int)(w[4]); while (n--) { float f = *in++; if (f < 0) f = -f; *out++ = f; } return (w+5); } static void abs_dsp(t_abs *x, t_signal **sp) { dsp_add(abs_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } static void *abs_new(void) { t_abs *x = (t_abs *)pd_new(abs_class); outlet_new(&x->x_obj, &s_signal); return (x); } void abs_tilde_setup(void) { abs_class = class_new(gensym("abs~"), (t_newmethod)abs_new, 0, sizeof(t_abs), 0, A_NULL); class_addmethod(abs_class, (t_method)nullfn, &s_signal, A_NULL); class_addmethod(abs_class, (t_method)abs_dsp, gensym("dsp"), A_NULL); } pd-markex_0.85/invert.c0000644000076500007650000000207611466300156013560 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- invert ------------------------------ */ /* instance structure */ static t_class *invert_class; typedef struct _invert { t_object x_obj; /* obligatory object header */ t_outlet *t_out1; /* the outlet */ } t_invert; static void invert_float(t_invert *x, t_floatarg n) { if (n) outlet_float(x->t_out1, 0.f); else outlet_float(x->t_out1, 1.f); } static void *invert_new(t_symbol *s) /* init vals in struc */ { t_invert *x = (t_invert *)pd_new(invert_class); x->t_out1 = outlet_new(&x->x_obj, 0); return(x); } void invert_setup(void) { invert_class = class_new(gensym("invert"), (t_newmethod)invert_new, 0, sizeof(t_invert), 0, A_NULL); class_addfloat(invert_class, (t_method)invert_float); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(invert_class, gensym("invert-help.pd")); #endif } pd-markex_0.85/vector0x2f-help.pd0000644000076500007650000000021011466300156015346 0ustar hanshans#N canvas 407 449 450 300 10; #X text 138 59 MarkEx vector operation; #X text 133 181 (placeholder help patch); #X obj 177 112 vector/; pd-markex_0.85/randomF-help.pd0000644000076500007650000000051711466300156014744 0ustar hanshans#N canvas 749 231 604 504 10; #X text 124 68 GEM object; #X msg 123 155 bang; #X text 138 23 randomF; #X obj 123 223 randomF 0.5; #X text 60 385 randomF is a floating point random number generator ; #X floatatom 195 161 5 0 0 1 range - -; #X floatatom 123 289 5 0 0 0 - - -; #X connect 1 0 3 0; #X connect 3 0 6 0; #X connect 5 0 3 1; pd-markex_0.85/reson~-help.pd0000644000076500007650000000232111466300156014675 0ustar hanshans#N canvas 212 185 577 450 10; #X text 15 35 Bandpass filter controllable by center frequency and Q; #X obj 32 382 dac~; #X obj 32 343 *~ 0.2; #X floatatom 160 294 0 0 0 0 - - -; #X msg 133 227 200 \, 10000 4000; #X obj 31 210 noise~; #X text 36 226 input signal; #X text 133 211 center freq; #X text 88 250 gain; #X text 172 325 optional arguments set values of gain \, center frequency \, and Q (default 0 \, 0 \, 0.01); #X text 88 182 list sets gain \, cf \, q (works unless there are any signal inputs for filter parameters); #X text 42 316 filtered output; #X text 15 62 reson~ implements the following filter equation: y[n] = gain * (x[n] - r * x[n-2]) + c1 * y[n-1] + c2 * y[n-2] \, where r \, c1 \, and c2 are parameters calculated from the input center frequency and Q. Q is the filter bandwidth divided by center frequency. Inputs can be floats or signals. The specification is similar to the nres unit generator in cmusic.; #X obj 32 294 reson~ 1 200 23; #X obj 133 250 Line~ 200; #X floatatom 60 254 0 0 0 0 - - -; #X text 158 276 Q: Try range of 1-100; #X connect 2 0 1 0; #X connect 2 0 1 1; #X connect 3 0 13 3; #X connect 4 0 14 0; #X connect 5 0 13 0; #X connect 13 0 2 0; #X connect 14 0 13 2; #X connect 15 0 13 1; pd-markex_0.85/vector+.c0000644000076500007650000000320411466300156013620 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" // -------------------------- vector+ ------------------------------ // instance structure static t_class *vectorPlus_class; typedef struct _vectorPlus { t_object x_obj; t_float x_add; t_atom *m_list; int m_num; t_outlet *t_out1; // the outlet } t_vectorPlus; static void doVectorPlus(t_vectorPlus *x, t_symbol *s, int argc, t_atom *argv) { int i; if (argc > x->m_num) { x->m_list = (t_atom *)resizebytes(x->m_list, sizeof(t_atom) * x->m_num, sizeof(t_atom) * argc); x->m_num = argc; } for (i = 0; i < argc; i++) { float temp = atom_getfloat(&argv[i]); temp += x->x_add; SETFLOAT((&x->m_list[i]), temp); } outlet_list(x->t_out1, &s_list, argc, x->m_list); } static void *vectorPlus_new(t_floatarg n) { t_vectorPlus *x = (t_vectorPlus *)pd_new(vectorPlus_class); x->x_add = (float)n; floatinlet_new(&x->x_obj, &x->x_add); x->t_out1 = outlet_new(&x->x_obj, 0); x->m_num = 3; x->m_list = (t_atom *)getbytes(sizeof(t_atom) * x->m_num); return (x); } static void vectorPlus_setup(void) { vectorPlus_class = class_new(gensym("vector+"), (t_newmethod)vectorPlus_new, 0, sizeof(t_vectorPlus), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)vectorPlus_new, gensym("v+"), A_DEFFLOAT, 0); class_addmethod(vectorPlus_class, (t_method)doVectorPlus, &s_list, A_GIMME, A_NULL); } void setup_vector0x2b(void){ vectorPlus_setup(); } void setup_v0x2b(void){ vectorPlus_setup(); } pd-markex_0.85/LICENSE.txt0000644000076500007650000003574511466300156013741 0ustar hanshansGNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS pd-markex_0.85/hsv2rgb-help.pd0000644000076500007650000000133011466300156014725 0ustar hanshans#N canvas 344 338 481 346 10; #X obj 127 223 unpack 0 0 0; #X floatatom 206 245 5 0 0 1 Blue - -; #X floatatom 166 265 5 0 0 1 Green - -; #X floatatom 127 288 5 0 0 1 Red - -; #X obj 127 184 hsv2rgb; #X msg 167 119 0 1 1; #X msg 189 143 0.6 1 0.5; #X floatatom 182 48 5 0 1 1 Value - -; #X floatatom 145 30 5 0 1 1 Saturation - -; #X floatatom 127 12 5 0 1 1 Hue - -; #X obj 127 97 pack 0 0 0; #X obj 145 65 t b f; #X obj 182 65 t b f; #X connect 0 0 3 0; #X connect 0 1 2 0; #X connect 0 2 1 0; #X connect 4 0 0 0; #X connect 5 0 4 0; #X connect 6 0 4 0; #X connect 7 0 12 0; #X connect 8 0 11 0; #X connect 9 0 10 0; #X connect 10 0 4 0; #X connect 11 0 10 0; #X connect 11 1 10 1; #X connect 12 0 10 0; #X connect 12 1 10 2; pd-markex_0.85/rgb2hsv-help.pd0000644000076500007650000000164211466300156014733 0ustar hanshans#N canvas 172 190 432 490 10; #X text 89 388 convert between RGB colorspace and HSV colorspace; #X text 91 412 RGB is red \, green \, blue; #X text 91 434 HSV is hue \, saturation \, value (luminance); #X obj 123 218 rgb2hsv; #X msg 163 182 1 0 0; #X msg 155 156 0 0.2 0.5; #X obj 123 257 unpack 0 0 0; #X floatatom 202 279 5 0 0 1 Value - -; #X floatatom 162 299 5 0 0 1 Saturation - -; #X floatatom 123 322 5 0 0 1 Hue - -; #X floatatom 178 84 5 0 1 1 Blue - -; #X floatatom 141 67 5 0 1 1 Green - -; #X floatatom 123 49 5 0 1 1 Red - -; #X obj 123 122 pack 0 0 0; #X obj 141 103 t b f; #X obj 178 103 t b f; #X text 83 9 [rgb2hsv]; #X connect 3 0 6 0; #X connect 4 0 3 0; #X connect 5 0 3 0; #X connect 6 0 9 0; #X connect 6 1 8 0; #X connect 6 2 7 0; #X connect 10 0 15 0; #X connect 11 0 14 0; #X connect 12 0 13 0; #X connect 13 0 3 0; #X connect 14 0 13 0; #X connect 14 1 13 1; #X connect 15 0 13 0; #X connect 15 1 13 2; pd-markex_0.85/rgb2hsv.c0000644000076500007650000000551511466300156013627 0ustar hanshans//////////////////////////////////////////////////////// // // GEM - Graphics Environment for Multimedia // // mark@danks.org // // Copyright (c) 1997-1999 Mark Danks. // For information on usage and redistribution, and for a DISCLAIMER OF ALL // WARRANTIES, see the file, "LICENSE.txt" in this distribution. // ///////////////////////////////////////////////////////// #include "m_pd.h" #include static inline float FLOAT_CLAMP(float x) { return((x > 1.f) ? 1.f : ( (x < 0.f) ? 0.f : x)); } static inline float TRI_MAX(float v1, float v2, float v3) { if (v1 > v2 && v1 > v3) return(v1); if (v2 > v3) return(v2); return(v3); } static inline float TRI_MIN(float v1, float v2, float v3) { if (v1 < v2 && v1 < v3) return(v1); if (v2 < v3) return(v2); return(v3); } ///////////////////////////////////////////////////////// // // rgb2hsv // ///////////////////////////////////////////////////////// // instance structure static t_class *rgb2hsv_class; typedef struct _rgb2hsv { t_object x_obj; /* obligatory object header */ t_outlet *t_out1; /* the outlet */ }t_rgb2hsv; static void rgb2hsv_float(t_rgb2hsv *x, t_floatarg r, t_floatarg g, t_floatarg b) { t_atom argv[3]; float h=0, s, v; r = FLOAT_CLAMP(r); g = FLOAT_CLAMP(g); b = FLOAT_CLAMP(b); float max = TRI_MAX(r, g, b); float min = TRI_MIN(r, g, b); v = max; // the value // calculate saturation if (max != 0.0f) s = (max - min) / max; else s = 0.0f; if (s == 0.0f) { h = 0.0f; // hue is undefined if no saturation } // chromatic case - calculate hue else { float delta = max - min; if (r == max) // between magenta and cyan h = (g - b) / delta; else if (g == max) // between yellow and magenta h = 2.0f + (b - r) / delta; else if (b == max) // between cyan and yellow h = 4.0f + (r - g) / delta; // convert hue to degrees h *= 60.0f; // make sure hue is nonnegative if (h < 0.0) h += 360.f; // normalize hue h /= 360.f; } SETFLOAT(&argv[0], h); SETFLOAT(&argv[1], s); SETFLOAT(&argv[2], v); outlet_list(x->t_out1, &s_list, 3, argv); } static void rgb2hsv_list(t_rgb2hsv *x, t_symbol *s, int argc, t_atom *argv) { if (argc >= 3) { float r = atom_getfloat(&argv[0]); float g = atom_getfloat(&argv[1]); float b = atom_getfloat(&argv[2]); rgb2hsv_float(x, r, g, b); } } static void *rgb2hsv_new(void) // init vals in struct { t_rgb2hsv *x = (t_rgb2hsv *)pd_new(rgb2hsv_class); x->t_out1 = outlet_new(&x->x_obj, 0); return (x); } void rgb2hsv_setup(void) { rgb2hsv_class = class_new(gensym("rgb2hsv"), (t_newmethod)rgb2hsv_new, 0, sizeof(t_rgb2hsv), CLASS_DEFAULT, A_NULL); class_addlist(rgb2hsv_class, (t_method)rgb2hsv_list); } pd-markex_0.85/vectorpack.c0000644000076500007650000000315311466300156014407 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- vectorpack ------------------------------ */ static t_class *vectorPack_class; typedef struct _vectorPack { t_object x_obj; t_float x_val; t_atom *m_list; int m_num; t_outlet *t_out1; /* the outlet */ } t_vectorPack; static void doVectorPack(t_vectorPack *x, t_symbol *s, int argc, t_atom *argv) { int i; if ((argc + 1) > x->m_num) { x->m_list = (t_atom *)resizebytes(x->m_list, sizeof(t_atom) * x->m_num, sizeof(t_atom) * (argc + 1)); x->m_num = argc; } for (i = 0; i < argc; i++) { float temp = atom_getfloat(&argv[i]); SETFLOAT((&x->m_list[i]), temp); } SETFLOAT((&x->m_list[argc]), x->x_val); outlet_list(x->t_out1, &s_list, (argc + 1), x->m_list); } static void *vectorPack_new(t_floatarg n) { t_vectorPack *x = (t_vectorPack *)pd_new(vectorPack_class); x->x_val = (float)n; floatinlet_new(&x->x_obj, &x->x_val); x->t_out1 = outlet_new(&x->x_obj, 0); x->m_num = 4; x->m_list = (t_atom *)getbytes(sizeof(t_atom) * x->m_num); return (x); } void vectorpack_setup(void) { vectorPack_class = class_new(gensym("vectorpack"), (t_newmethod)vectorPack_new, 0, sizeof(t_vectorPack), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)vectorPack_new, gensym("vpack"), A_DEFFLOAT, 0); class_addmethod(vectorPack_class, (t_method)doVectorPack, &s_list, A_GIMME, A_NULL); } void vpack_setup(void){ vectorpack_setup(); } pd-markex_0.85/markex.c0000644000076500007650000000322111466300156013531 0ustar hanshans/* For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. MarkEx, Copyright (c) 1997-1999 Mark Danks */ #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif #include "m_pd.h" static t_class *MarkEx_class; static void *MarkEx_new(void) { t_object *x = (t_object *)pd_new(MarkEx_class); return (x); } void abs_tilde_setup(void); void alternate_setup(void); void average_setup(void); void counter_setup(void); void hsv2rgb_setup(void); void invert_setup(void); void multiselect_setup(void); void oneshot_setup(void); void randomF_setup(void); void reson_tilde_setup(void); void rgb2hsv_setup(void); void strcat_setup(void); void tripleLine_setup(void); void tripleRand_setup(void); void vectorabs_setup(void); void vectorpack_setup(void); void setup_vector0x2a(void); void setup_vector0x2f(void); void setup_vector0x2d(void); void setup_vector0x2b(void); /* ------------------------ setup routine ------------------------- */ void MarkEx_setup(void) { MarkEx_class = class_new(gensym("MarkEx"), MarkEx_new, 0, sizeof(t_object), CLASS_NOINLET, 0); abs_tilde_setup(); alternate_setup(); average_setup(); counter_setup(); hsv2rgb_setup(); invert_setup(); multiselect_setup(); oneshot_setup(); randomF_setup(); reson_tilde_setup(); rgb2hsv_setup(); strcat_setup(); tripleLine_setup(); tripleRand_setup(); vectorabs_setup(); vectorpack_setup(); setup_vector0x2a(); setup_vector0x2f(); setup_vector0x2d(); setup_vector0x2b(); post("MarkEx loaded! (c) 1997-1999 Mark Danks "); } pd-markex_0.85/multiselect.c0000644000076500007650000000510211466300156014574 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- multiselect ------------------------------ */ static t_class *multiselect_class; typedef struct _multiselectElem { t_float val; t_outlet *acceptOutlet; t_int active; } t_multiselectElem; typedef struct _multiselect { t_object x_obj; t_multiselectElem *x_elem; int x_num; t_outlet *x_rejectOutlet; t_inlet *x_inlet; } t_multiselect; static void multiselect_float(t_multiselect *x, t_floatarg f) { int i; int shotOut = 0; for (i = 0; i < x->x_num; i++) { if (x->x_elem[i].val == f && x->x_elem[i].active) { outlet_bang(x->x_elem[i].acceptOutlet); shotOut = 1; } } if (!shotOut) outlet_float(x->x_rejectOutlet, f); } static void multiselect_params(t_multiselect *x, t_symbol *s, int argc, t_atom *argv) { int n; freebytes(x->x_elem, x->x_num * sizeof(t_multiselectElem)); for (n = 0; n < argc; n++) { x->x_elem[n].val = atom_getfloatarg(n, argc, argv); x->x_elem[n].active = 1; } for (; n < x->x_num; n++) x->x_elem[n].active = 0; } static void multiselect_free(t_multiselect *x) { int i; for (i = 0; i < x->x_num; i++) { outlet_free(x->x_elem[i].acceptOutlet); } freebytes(x->x_elem, x->x_num * sizeof(t_multiselectElem)); inlet_free(x->x_inlet); } static void *multiselect_new(t_symbol *s, int argc, t_atom *argv) { int n; t_multiselect *x = (t_multiselect *)pd_new(multiselect_class); x->x_num = argc; x->x_elem = (t_multiselectElem *)getbytes(argc * sizeof(t_multiselectElem)); for (n = 0; n < argc; n++) { x->x_elem[n].val = atom_getfloatarg(n, argc, argv); x->x_elem[n].acceptOutlet = outlet_new(&x->x_obj, &s_bang); x->x_elem[n].active = 1; } x->x_rejectOutlet = outlet_new(&x->x_obj, &s_float); x->x_inlet = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_list, gensym("params")); return (x); } void multiselect_setup(void) { multiselect_class = class_new(gensym("multiselect"), (t_newmethod)multiselect_new, (t_method)multiselect_free, sizeof(t_multiselect), 0, A_GIMME, 0); class_addcreator((t_newmethod)multiselect_new, gensym("multisel"), A_GIMME, 0); class_addfloat(multiselect_class, multiselect_float); class_addmethod(multiselect_class, (t_method)multiselect_params, gensym("params"), A_GIMME, A_NULL); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(multiselect_class, gensym("multiselect-help.pd")); #endif } pd-markex_0.85/vector0x2a-help.pd0000644000076500007650000000021011466300156015341 0ustar hanshans#N canvas 407 449 450 300 10; #X text 138 59 MarkEx vector operation; #X text 133 181 (placeholder help patch); #X obj 177 112 vector*; pd-markex_0.85/Makefile0000644000076500007650000002502211466300156013541 0ustar hanshans## Pd library template version 1.0.3 # For instructions on how to use this template, see: # http://puredata.info/docs/developer/MakefileTemplate LIBRARY_NAME = markex # add your .c source files, one object per file, to the SOURCES # variable, help files will be included automatically SOURCES = abs~.c alternate.c average.c counter.c hsv2rgb.c invert.c multiselect.c oneshot.c randomF.c reson~.c rgb2hsv.c strcat.c tripleLine.c tripleRand.c vector+.c vector-.c vector0x2a.c vector0x2f.c vectorabs.c vectorpack.c # 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 = markex.c #------------------------------------------------------------------------------# # # things you might need to edit if you are using other C libraries # #------------------------------------------------------------------------------# CFLAGS = -DPD -I"$(PD_INCLUDE)" -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) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(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-markex_0.85/strcat.c0000644000076500007650000000331311466300156013544 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" #include /* -------------------------- strcat ------------------------------ */ /* instance structure */ static t_class *strcat_class; typedef struct _strcat { t_object x_obj; /* obligatory object header */ t_symbol *a_text; /* the first part of the text */ t_symbol *a_symbol; /* the last symbol sent out */ t_outlet *t_out1; /* the outlet */ } t_strcat; void strcat_sym(t_strcat *x, t_symbol *sym) { char temp[64]; sprintf(temp, "%s%s", x->a_text->s_name, sym->s_name); x->a_symbol = gensym(temp); outlet_symbol(x->t_out1, x->a_symbol); } void strcat_float(t_strcat *x, t_floatarg n) { char temp[64]; sprintf(temp, "%s%f", x->a_text->s_name, n); x->a_symbol = gensym(temp); outlet_symbol(x->t_out1, x->a_symbol); } void strcat_bang(t_strcat *x) { outlet_symbol(x->t_out1, x->a_symbol); } void *strcat_new(t_symbol *textname) /* init vals in struc */ { t_strcat *x = (t_strcat *)pd_new(strcat_class); x->t_out1 = outlet_new(&x->x_obj, 0); x->a_text = textname; x->a_symbol = textname; return (x); } void strcat_setup(void) { strcat_class = class_new(gensym("strcat"), (t_newmethod)strcat_new, 0, sizeof(t_strcat), 0, A_SYMBOL, 0); class_addsymbol(strcat_class, (t_method)strcat_sym); class_addfloat(strcat_class, (t_method)strcat_float); class_addbang(strcat_class, (t_method)strcat_bang); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(strcat_class, gensym("strcat-help.pd")); #endif } pd-markex_0.85/vectorabs-help.pd0000644000076500007650000000021211466300156015336 0ustar hanshans#N canvas 407 449 450 300 10; #X text 138 59 MarkEx vector operation; #X text 133 181 (placeholder help patch); #X obj 177 112 vectorabs; pd-markex_0.85/alternate-help.pd0000644000076500007650000000550311466300156015335 0ustar hanshans#N canvas 47 22 568 493 10; #X obj 4 439 cnv 15 550 20 empty \$0-pddp.cnv.footer empty 20 12 0 14 -228856 -66577 0; #X obj 4 -17 cnv 15 550 40 empty \$0-pddp.cnv.header alternate 3 12 0 18 -204280 -1 0; #X obj 3 239 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlet 15 12 0 13 -228856 -1 0; #N canvas 779 22 498 348 META 0; #X text 12 65 TEMPLATE template-help.pd v0.1; #X text 12 85 PLATFORM windows macosx gnulinux; #X text 12 25 KEYWORDS control alternate; #X text 12 45 LICENSE GPLv2 or later; #X text 12 105 DATATYPE any message; #X text 12 125 LIBRARY markex; #X restore 504 441 pd META; #X obj 3 299 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 15 12 0 13 -228856 -1 0; #X obj 3 389 cnv 3 550 3 empty \$0-pddp.cnv.argument argument 15 12 0 13 -228856 -1 0; #N canvas 309 454 609 478 guts 0; #X obj 117 95 textfile; #X msg 116 24 symbol template-HCS.pd; #X msg 116 54 read \$1 \, rewind \, bang; #X obj 117 141 trigger bang anything; #X obj 58 117 bang; #X obj 240 162 route #X; #X obj 240 183 route text; #X obj 240 250 route DESCRIPTION; #X obj 239 276 print; #X obj 140 277 print TEXT; #X connect 0 0 3 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 3 0 4 0; #X connect 3 1 5 0; #X connect 4 0 0 0; #X connect 5 0 6 0; #X connect 7 0 8 0; #X restore 453 441 pd guts; #X obj 488 -14 alternate; #X obj 437 5 pddp/pddplink http://pdpedia.org/en/markex/alternate -text pdpedia: alternate; #X text 15 6 description: alternates messages between its two outlets ; #X obj 74 351 cnv 17 3 25 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856 -162280 0; #X obj 74 321 cnv 17 3 25 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856 -162280 0; #X obj 315 152 cnv 10 57 16 empty \$0-pddp.cnv.highlight empty 20 12 0 14 -262126 -66577 0; #X obj 63 115 cnv 10 57 16 empty \$0-pddp.cnv.highlight empty 20 12 0 14 -262126 -66577 0; #X msg 309 56 1; #X obj 315 152 alternate; #X msg 262 55 bang; #X msg 349 123 reset; #X msg 342 56 symbol blah; #X obj 366 174 pddp/print; #X obj 315 201 pddp/print; #X obj 63 115 alternate; #X obj 63 143 bng 25 250 50 0 empty empty empty 0 -6 0 10 -262144 -1 -1; #X obj 114 143 bng 25 250 50 0 empty empty empty 0 -6 0 10 -262144 -1 -1; #X obj 63 80 bng 25 250 50 0 empty empty empty 0 -6 0 10 -204786 -1 -1; #X msg 352 83 1 2 3 4; #X text 105 257 any message can be send to [alternate] \, it will just pass it through to the outlets; #X text 102 407 [alternate] ignores all arguments; #X text 105 317 first message that was received on the inlet \, and all following messages that are numbered odd in the sequence; #X text 105 348 second message that was received on the inlet \, and all following messages that are numbered even in the sequence; #X connect 14 0 15 0; #X connect 15 0 20 0; #X connect 15 1 19 0; #X connect 16 0 15 0; #X connect 17 0 15 0; #X connect 18 0 15 0; #X connect 21 0 22 0; #X connect 21 1 23 0; #X connect 24 0 21 0; #X connect 25 0 15 0; pd-markex_0.85/tripleRand.c0000644000076500007650000000506711466300156014360 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" #include #ifndef __APPLE__ #include #endif #ifdef _WIN32 int random(void) { static int foo = 1489853723; foo = foo * (int)435898247 + (int)9382842987; return (foo & 0x7fffffff); } #endif /* -------------------------- tripleRand ------------------------------ */ /* instance structure */ static t_class *tripleRand_class; typedef struct _tripleRand { t_object x_obj; t_float x_range[3]; t_outlet *t_out1; /* the outlet */ } t_tripleRand; void setTripleRandVals(t_tripleRand *x, t_symbol *s, int argc, t_atom *argv) { if (argc < 1 || argc > 3) { error("tripleRand: Requires 1 - 3 values"); return; } if (argc >= 1) { x->x_range[0] = atom_getfloat(&argv[0]); if (x->x_range[0] < 0) x->x_range[0] = 0; x->x_range[2] = x->x_range[1] = x->x_range[0]; } if (argc >= 2) { x->x_range[1] = atom_getfloat(&argv[1]); if (x->x_range[1] < 0) x->x_range[1] = 0; x->x_range[2] = x->x_range[1]; } if (argc >= 3) { x->x_range[2] = atom_getfloat(&argv[2]); if (x->x_range[2] < 0) x->x_range[2] = 0; } } static void tripleRand_bang(t_tripleRand *x) { int i; t_atom argv[3]; for (i = 0; i < 3; i++) { float n = (float)((double)x->x_range[i] * (double)random() * (1. / 2147483648.)); if (n > x->x_range[i]) n = x->x_range[i] - 1; SETFLOAT((&argv[i]), (float)n); } outlet_list(x->t_out1, &s_list, 3, argv); } static void *tripleRand_new(t_floatarg arg1, t_floatarg arg2, t_floatarg arg3) { t_tripleRand *x = (t_tripleRand *)pd_new(tripleRand_class); if (arg1 < 0.f) x->x_range[0] = 0.f; else x->x_range[0] = (float)arg1; if (arg2 <= 0.f) x->x_range[1] = x->x_range[0]; else x->x_range[1] = (float)arg2; if (arg3 <= 0.f) x->x_range[2] = x->x_range[1]; else x->x_range[2] = (float)arg3; x->t_out1 = outlet_new(&x->x_obj, 0); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("newVals")); return (x); } void tripleRand_setup(void) { tripleRand_class = class_new(gensym("tripleRand"), (t_newmethod)tripleRand_new, 0, sizeof(t_tripleRand), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); class_addbang(tripleRand_class, (t_method)tripleRand_bang); class_addmethod(tripleRand_class, (t_method)setTripleRandVals, gensym("newVals"), A_GIMME, A_NULL); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(tripleRand_class, gensym("tripleRand-help.pd")); #endif } pd-markex_0.85/randomF.c0000644000076500007650000000266711466300156013645 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" #include #ifndef __APPLE__ #include #endif #ifdef _WIN32 int random(void) { static int foo = 1489853723; foo = foo * (int)435898247 + (int)9382842987; return (foo & 0x7fffffff); } #endif /* -------------------------- randomF ------------------------------ */ /* instance structure */ static t_class *randomF_class; typedef struct _randomF { t_object x_obj; t_float x_range; t_outlet *t_out1; /* the outlet */ } t_randomF; static void *randomF_new(t_floatarg n) { t_randomF *x = (t_randomF *)pd_new(randomF_class); x->x_range = (float)n; floatinlet_new(&x->x_obj, &x->x_range); x->t_out1 = outlet_new(&x->x_obj, 0); return (x); } static void randomF_bang(t_randomF *x) { double range = (x->x_range < 0 ? 0 : x->x_range); double n = (double)range * (double)random() * (1. / 2147483648.); if (n >= range) n = range - 1; outlet_float(x->t_out1, (float)n); } void randomF_setup(void) { randomF_class = class_new(gensym("randomF"), (t_newmethod)randomF_new, 0, sizeof(t_randomF), 0, A_DEFFLOAT, 0); class_addbang(randomF_class, (t_method)randomF_bang); #if PD_MINOR_VERSION < 37 class_sethelpsymbol(randomF_class, gensym("randomF-help.pd")); #endif } pd-markex_0.85/hsv2rgb.c0000644000076500007650000000550011466300156013621 0ustar hanshans//////////////////////////////////////////////////////// // // GEM - Graphics Environment for Multimedia // // mark@danks.org // // Copyright (c) 1997-1999 Mark Danks. // For information on usage and redistribution, and for a DISCLAIMER OF ALL // WARRANTIES, see the file, "LICENSE.txt" in this distribution. // ///////////////////////////////////////////////////////// #include "m_pd.h" #include static inline float FLOAT_CLAMP(float x) { return((x > 1.f) ? 1.f : ( (x < 0.f) ? 0.f : x)); } ///////////////////////////////////////////////////////// // // hsv2rgb // ///////////////////////////////////////////////////////// // instance structure static t_class *hsv2rgb_class; typedef struct _hsv2rgb { t_object x_obj; // obligatory object header t_outlet *t_out1; // the outlet }t_hsv2rgb; static void hsv2rgb_float(t_hsv2rgb *x, t_floatarg h, t_floatarg s, t_floatarg v) { t_atom argv[3]; float r=0, g=0, b=0; h = FLOAT_CLAMP(h); s = FLOAT_CLAMP(s); v = FLOAT_CLAMP(v); // convert hue to degrees h *= 360.f; if (s == 0.0) // black and white { r = g = b = v; } else { if (h == 360.0) // 360 == 0 degrees h = 0.0f; h /= 60.0f; // hue is now [0, 6] { int i = (int)floor(h); float f = h - i; // f is the fractional part of h float p = v * (1 - s); float q = v * (1 - s * f); float t = v * (1 - s * (1 - f)); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; case 5: r = v; g = p; b = q; break; } } } SETFLOAT(&argv[0], r); SETFLOAT(&argv[1], g); SETFLOAT(&argv[2], b); outlet_list(x->t_out1, &s_list, 3, argv); } static void hsv2rgb_list(t_hsv2rgb *x, t_symbol *sym, int argc, t_atom *argv) { if (argc >= 3) { float h = atom_getfloat(&argv[0]); float s = atom_getfloat(&argv[1]); float v = atom_getfloat(&argv[2]); hsv2rgb_float(x, h, s, v); } } static void *hsv2rgb_new(void) // init vals in struct { t_hsv2rgb *x = (t_hsv2rgb *)pd_new(hsv2rgb_class); x->t_out1 = outlet_new(&x->x_obj, 0); return (x); } void hsv2rgb_setup(void) { hsv2rgb_class = class_new(gensym("hsv2rgb"), (t_newmethod)hsv2rgb_new, 0, sizeof(t_hsv2rgb), CLASS_DEFAULT, A_NULL); class_addlist(hsv2rgb_class, (t_method)hsv2rgb_list); } pd-markex_0.85/vector0x2f.c0000644000076500007650000000317711466300156014256 0ustar hanshans/* * Copyright (c) 1997-1999 Mark Danks. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt" in this distribution. */ #include "m_pd.h" /* -------------------------- vector/ ------------------------------ */ /* instance structure */ static t_class *vectorDiv_class; typedef struct _vectorDiv { t_object x_obj; t_float x_div; t_atom *m_list; int m_num; t_outlet *t_out1; /* the outlet */ } t_vectorDiv; static void doVectorDiv(t_vectorDiv *x, t_symbol *s, int argc, t_atom *argv) { int i; if (argc > x->m_num) { x->m_list = (t_atom *)resizebytes(x->m_list, sizeof(t_atom) * x->m_num, sizeof(t_atom) * argc); x->m_num = argc; } for (i = 0; i < argc; i++) { float temp = atom_getfloat(&argv[i]); temp /= x->x_div; SETFLOAT((&x->m_list[i]), temp); } outlet_list(x->t_out1, &s_list, argc, x->m_list); } static void *vectorDiv_new(t_floatarg n) { t_vectorDiv *x = (t_vectorDiv *)pd_new(vectorDiv_class); x->x_div = (float)n; floatinlet_new(&x->x_obj, &x->x_div); x->t_out1 = outlet_new(&x->x_obj, 0); x->m_num = 3; x->m_list = (t_atom *)getbytes(sizeof(t_atom) * x->m_num); return (x); } static void vectorDiv_setup(void) { vectorDiv_class = class_new(gensym("vector/"), (t_newmethod)vectorDiv_new, 0, sizeof(t_vectorDiv), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)vectorDiv_new, gensym("v/"), A_DEFFLOAT, 0); class_addmethod(vectorDiv_class, (t_method)doVectorDiv, &s_list, A_GIMME, A_NULL); } void setup_vector0x2f(void){ vectorDiv_setup(); } void setup_v0x2f(void){ vectorDiv_setup(); } pd-markex_0.85/tripleLine-help.pd0000644000076500007650000000075611466300156015472 0ustar hanshans#N canvas 749 231 600 500 10; #X text 124 68 GEM object; #X text 138 24 tripleLine; #X obj 123 223 tripleLine; #X obj 123 273 unpack 0 0 0; #X floatatom 123 319; #X floatatom 168 348; #X floatatom 214 319; #X msg 123 157 1 0 0 2000; #X msg 234 158 0 1 0.1 2000; #X text 46 406 tripleLine is like the line object except that it works with 3 values at once.; #X connect 2 0 3 0; #X connect 3 0 4 0; #X connect 3 1 5 0; #X connect 3 2 6 0; #X connect 7 0 2 0; #X connect 8 0 2 0;