pd-ext13_0.17.1/0000755000076500007650000000000011466062673011720 5ustar hanshanspd-ext13_0.17.1/kalashnikov.c0000644000076500007650000000276711466062316014404 0ustar hanshans#include "ext13.h" #include "m_pd.h" #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------------- kalashnikov ------------------------------ */ static t_class *kalashnikov_class; typedef struct _kalashnikov { t_object x_obj; t_float x_f; t_outlet *x_out2; t_outlet *x_out3; } t_kalashnikov; static void *kalashnikov_new(t_floatarg f) { t_kalashnikov *x = (t_kalashnikov *)pd_new(kalashnikov_class); x->x_f = f; outlet_new(&x->x_obj, &s_bang); x->x_out3 = outlet_new(&x->x_obj, &s_float); x->x_out2 = outlet_new(&x->x_obj, &s_bang); floatinlet_new(&x->x_obj, &x->x_f); return (x); } static void kalashnikov_bang(t_kalashnikov *x) { int count; for (count=x->x_f;count>0;count--){ outlet_bang(x->x_obj.ob_outlet); outlet_float(x->x_out3, x->x_f-count); } outlet_bang(x->x_out2); } static void kalashnikov_float(t_kalashnikov *x, t_float f) { int count; x->x_f=f; for (count=f;count>0;count--){ outlet_bang(x->x_obj.ob_outlet); outlet_float(x->x_out3, f-count); } outlet_bang(x->x_out2); } void kalashnikov_setup(void) { kalashnikov_class = class_new(gensym("kalashnikov"), (t_newmethod)kalashnikov_new, 0, sizeof(t_kalashnikov), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)kalashnikov_new, gensym("uzi"), A_DEFFLOAT, 0); class_addbang(kalashnikov_class, kalashnikov_bang); class_addfloat(kalashnikov_class, kalashnikov_float); } pd-ext13_0.17.1/pipewrite~-help.pd0000644000076500007650000000153711466062316015401 0ustar hanshans#N canvas 303 26 450 397 10; #X msg 102 140 1; #X msg 81 90 0; #X obj 226 21 loadbang; #X msg 226 47 \; pd dsp 1; #X obj 63 67 osc~ 440; #X msg 94 117 open /usr/local/pd/ext13/doc/pipein.wav; #X obj 246 231 dac~; #X obj 63 179 pipewrite~ 2; #X obj 142 65 osc~ 480; #X obj 224 192 piperead~ 2; #X msg 165 140 open /usr/local/pd/ext13/doc/pipein.wav; #X msg 227 164 1; #X msg 261 166 0; #X text 26 256 pipewrite/read: argument: number of channels you can create a pipe/fifo from within a shell with mknod pipename p and use this construct to send signals to another program/process. useful if you run more than one pd or mpeg-players \, ...; #X connect 0 0 7 0; #X connect 1 0 7 0; #X connect 2 0 3 0; #X connect 4 0 7 0; #X connect 5 0 7 0; #X connect 8 0 7 1; #X connect 9 0 6 0; #X connect 9 1 6 1; #X connect 10 0 9 0; #X connect 11 0 9 0; #X connect 12 0 9 0; pd-ext13_0.17.1/scramble~-help.pd0000644000076500007650000000520611466062316015156 0ustar hanshans#N canvas 259 13 723 441 10; #X obj 324 367 dac~; #X obj 324 331 scramble~ 2; #X floatatom 422 124 0 0 0; #X obj 299 241 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 1; #X msg 50 36 \; pd dsp 1; #X obj 44 11 loadbang; #X msg 22 69 \; pd meters 1; #X obj 342 262 adc~; #X msg 140 285 threshold \$1; #X floatatom 140 262 0 0 0; #X msg 332 121 open \$1; #X obj 324 145 sfread~ 2; #X obj 230 104 del 100; #X msg 230 80 bang; #X msg 237 20 open /usr/local/media/audios/klima_gegengelesen_cato-ok.wav ; #X msg 296 42 open /usr/local/media/audios/restorak.wav; #X obj 334 96 openpanel; #X msg 333 74 bang; #X obj 512 158 openpanel; #X msg 511 123 bang; #X msg 591 162 start; #X msg 594 137 stop; #X msg 515 194 open \$1; #X obj 422 101 cpuload 100; #X obj 513 229 mp3play~; #X floatatom 587 199 5 0 0; #X msg 146 157 grains \$1; #X floatatom 146 133 0 0 0; #X floatatom 27 130 0 0 0; #X msg 27 153 min_length \$1; #X floatatom 18 255 0 0 0; #X msg 18 278 direction \$1; #X msg 141 206 autofollow; #X floatatom 241 199 0 0 0; #X msg 242 221 buffer \$1; #X text 176 135 # of grains; #X text 26 113 minimum low period; #X text 209 180 ringbuffer size (882000); #X text 6 202 -1 back only; #X text 11 214 1 forw. only; #X text 11 231 0 both directions; #X text 136 244 threshold; #X text 110 183 autothreshold; #X floatatom 22 309 0 0 0; #X msg 22 332 pitch \$1; #X msg 107 353 flush; #X floatatom 372 375 0 0 0; #X floatatom 396 355 0 0 0; #X floatatom 169 373 0 0 0; #X msg 169 396 normalize \$1; #X msg 271 402 analize \$1; #X obj 273 374 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X floatatom 400 198 5 0 0; #X msg 400 223 autopitch \$1; #X connect 1 0 0 0; #X connect 1 1 0 1; #X connect 1 2 46 0; #X connect 1 3 47 0; #X connect 3 0 1 0; #X connect 5 0 4 0; #X connect 5 0 6 0; #X connect 7 0 1 0; #X connect 7 1 1 1; #X connect 8 0 1 0; #X connect 9 0 8 0; #X connect 10 0 11 0; #X connect 11 0 1 0; #X connect 11 1 1 1; #X connect 12 0 11 0; #X connect 13 0 12 0; #X connect 14 0 11 0; #X connect 14 0 13 0; #X connect 15 0 11 0; #X connect 15 0 13 0; #X connect 16 0 10 0; #X connect 17 0 16 0; #X connect 18 0 22 0; #X connect 19 0 18 0; #X connect 20 0 24 0; #X connect 21 0 24 0; #X connect 22 0 24 0; #X connect 23 0 2 0; #X connect 24 0 1 0; #X connect 24 1 1 1; #X connect 25 0 24 1; #X connect 26 0 1 0; #X connect 27 0 26 0; #X connect 28 0 29 0; #X connect 29 0 1 0; #X connect 30 0 31 0; #X connect 31 0 1 0; #X connect 32 0 1 0; #X connect 33 0 34 0; #X connect 34 0 1 0; #X connect 43 0 44 0; #X connect 44 0 1 0; #X connect 45 0 1 0; #X connect 48 0 49 0; #X connect 49 0 1 0; #X connect 50 0 1 0; #X connect 51 0 50 0; #X connect 52 0 53 0; #X connect 53 0 1 0; pd-ext13_0.17.1/ossmixer-help.pd0000644000076500007650000000353711466062316015046 0ustar hanshans#N canvas 572 217 606 552 10; #X obj 188 331 ossmixer; #X msg 251 228 bang; #X msg 66 95 get pcm; #X msg 80 67 get main; #X msg 62 122 get igain; #X floatatom 37 167 5 0 0; #X text 232 479 altpcm \, reclev \, igain \, ogain; #X msg 37 192 set main \$1; #X text 35 451 possible channels:; #X floatatom 36 220 5 0 0; #X msg 36 242 set igain \$1; #X msg 230 130 get_source; #X msg 311 217 set_source line; #X msg 312 240 set_source mic; #X msg 314 263 set_source cd; #X floatatom 35 267 5 0 0; #X msg 35 289 set pcm \$1; #X symbolatom 239 359 10 0 0; #X floatatom 223 386 5 0 0; #X obj 158 387 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 158 358 sel source; #X floatatom 199 96 5 0 0; #X text 15 36 you will have to do mutings manually (read \, set 0 \, set x); #X text 146 67 get value of channel; #X text 252 98 get value of current channel; #X text 249 212 nop; #X text 307 131 get recording source; #X text 316 281 set rec. source; #X text 7 166 s; #X text 8 180 e; #X text 8 195 t; #X text 7 220 v; #X text 7 231 a; #X text 7 245 l; #X text 7 258 u; #X text 7 271 e; #X text 35 466 main \, treble \, bass \, synth \, pcm \, speaker \, line \, line1 \, line2 \, line3 \, mic \, cd \, imix \,; #X text 130 421 right outlet: channel name; #X text 130 408 left outlet: "source" or value; #X msg 252 173 set_device 1; #X text 350 175 /dev/mixer1 /dev/mixer2...; #X text 15 6 a simple mixer for /dev/mixerX; #X text 16 21 only stereo (no seperate L/R); #X connect 0 0 20 0; #X connect 0 1 17 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 7 0; #X connect 7 0 0 0; #X connect 9 0 10 0; #X connect 10 0 0 0; #X connect 11 0 0 0; #X connect 12 0 0 0; #X connect 13 0 0 0; #X connect 14 0 0 0; #X connect 15 0 16 0; #X connect 16 0 0 0; #X connect 20 0 19 0; #X connect 20 1 18 0; #X connect 21 0 0 0; #X connect 39 0 0 0; pd-ext13_0.17.1/cdplayer-help.pd0000644000076500007650000000143011466062316014766 0ustar hanshans#N canvas 0 337 450 300 10; #X obj 58 179 cdplayer; #X obj 151 235 metro 100; #X obj 151 261 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 151 203 1; #X obj 151 175 loadbang; #X msg 65 98 pause; #X msg 44 75 resume; #X msg 79 125 stop; #X msg 84 148 eject; #X text 22 7 cdplayer is an object for atapi-cd-roms under linux; #X text 100 76 resume; #X text 112 96 pause playing; #X text 113 124 stop (no resume); #X text 132 149 eject; #X text 185 261 <- cdplayer does not block; #X text 208 278 because of forking; #X floatatom 21 28 5 0 0; #X msg 21 51 play \$1; #X text 81 50 play a track; #X connect 1 0 2 0; #X connect 3 0 1 0; #X connect 4 0 3 0; #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 16 0 17 0; #X connect 17 0 0 0; pd-ext13_0.17.1/streamout13~.c0000644000076500007650000002403111466062316014443 0ustar hanshans#include "m_pd.h" #include "stream13.h" #include #include #ifdef _WIN32 #include #else #include #include #include #include #include #define SOCKET_ERROR -1 #endif #ifdef __APPLE__ #include #endif /* these pragmas are only used for MSVC, not MinGW or Cygwin */ #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* Utility functions */ 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 } /* ------------------------ streamout13~ ----------------------------- */ /* #define A1 (4 * (3.14159265/2)) #define A3 (64 * (2.5 - 3.14159265)) #define A5 (1024 * ((3.14159265/2) - 1.5)) */ static t_class *streamout13_class; typedef struct _streamout13 { t_object x_obj; int x_fd; int x_protocol; int x_format; int x_realformat; t_symbol* hostname; int portno; int x_n; short* cbuf; int nsamples; int blockspersend; int blockssincesend; int newblockspersend; } t_streamout13; static void streamout13_connect(t_streamout13 *x, t_symbol *hostname, t_floatarg fportno) { struct sockaddr_in server; struct hostent *hp; int sockfd; int portno = fportno; x->hostname = hostname; x->portno = (int) fportno; if (x->x_fd >= 0) { error("streamout13_connect: already connected - reconnecting"); sys_closesocket(x->x_fd); x->x_fd = -1; outlet_float(x->x_obj.ob_outlet, 0); } /* create a socket */ sockfd = socket(AF_INET, x->x_protocol, 0); if (sockfd < 0) { post("streamout13: 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(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 void streamout13_disconnect(t_streamout13 *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 streamout13_tempbuf(t_streamout13 *x,int size) { int fullsize = size * x->x_n; if (!x->cbuf) x->cbuf = getbytes(fullsize*sizeof(t_float)*x->blockspersend+4); else x->cbuf = resizebytes(x->cbuf,x->nsamples*sizeof(short),fullsize*sizeof(t_float)*x->blockspersend+4); x->nsamples = size; x->blockssincesend=0; } static t_int *streamout13_perform(t_int *w) { t_streamout13* x = (t_streamout13*) (w[1]); int n = (int)(w[2]); int i,j,res = 0; int offset = 3; int sent = 0; int length ; char* buf = (char *)(w[2]); short* cibuf; char* bp; #ifndef _WIN32 t_float *in[x->x_n]; #else t_float** in = (t_float**) malloc(x->x_n * sizeof(t_float*)); #endif for (i=0;i < x->x_n;i++) { in[i] = (t_float *)(w[offset+i]); } if (x->x_fd > 0){ if (n != x->nsamples) streamout13_tempbuf(x,n); /* format the buffer */ /* cibuf = x->cbuf + x->blockssincesend * n * x->x_n + 2; while (n--){ for (j=0;jx_n;j++){ *cibuf++ = (short) 32767.0 * *(in[j]++); } } */ switch (x->x_format) { case SF_FLOAT:{ t_float* fbuf = (t_float*) x->cbuf + x->blockssincesend * n * x->x_n + 1; while (n--){ for (j=0;jx_n;j++){ *fbuf++ = *(in[j]++); } } break; } case SF_16BIT: { short* sbuf =(short*) x->cbuf + x->blockssincesend * n * x->x_n + 2; /*2 extra bytes for format & grain */ while (n--){ for (j=0;jx_n;j++){ *sbuf++ = (short) 32767.0 * *(in[j]++); } } break; } case SF_8BIT: { // signed char* cbuf = (signed char*) ibuf; signed char* cbuf = (signed char*) x->cbuf + x->blockssincesend * n * x->x_n + 4; while (n--) for (j=0;jx_n;j++){ *cbuf++ = (127.0 * *in[j]++); } } break; default: break; } if (!(x->blockssincesend < x->blockspersend - 1)){ x->blockssincesend=0; if (x->x_realformat !=x->x_format){ x->x_realformat = x->x_format; x->blockspersend = (int) (x->blockspersend * 4 / SF_SIZEOF(x->x_format)) ; x->nsamples=0; // post ("formatchange:%d",x->x_format); } if (x->blockspersend != (int) (x->newblockspersend * 4 / SF_SIZEOF(x->x_realformat)) ){ x->blockspersend = (int) (x->newblockspersend * 4 / SF_SIZEOF(x->x_realformat) ) ; x->nsamples=0; // post ("grainchange:%d",x->blockspersend); } cibuf=x->cbuf; *cibuf=(short)x->x_realformat; // *x->cbuf=(short)x->x_realformat; cibuf=x->cbuf + 1; *cibuf=x->blockspersend; // post ("out:cibuf:%d",*cibuf); /* send the buffer */ length = x->nsamples * x->x_n * x->blockspersend * SF_SIZEOF(x->x_realformat) + 4; // outlet_float(x->x_out2,length); // post ("out - length:%d",length); for (bp = buf, sent = 0; sent < length;) { res = send(x->x_fd, (char*) x->cbuf, length - sent , 0); if (res <= 0) { sys_sockerror("streamout13~-error"); streamout13_disconnect(x); break; } else { sent += res; bp += res; } } }else{ x->blockssincesend++; } } // post ("b-s-s:%d, length:%d, last:%d, prev:%d",x->blockssincesend,length,*cibuf,prev); #ifdef _WIN32 free(in); #endif return (w + 2 + i * 2); } static void streamout13_dsp(t_streamout13 *x, t_signal **sp) { /* dsp_add(streamout13_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); */ 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(streamout13_perform, x->x_n + 3, (t_int*)myvec); freebytes(myvec,sizeof(t_int)*(x->x_n + 3)); } static void streamout13_grain(t_streamout13 *x,t_floatarg grain) { if ((grain > 0) && (grain < 24)){ x->newblockspersend=(int) grain; post ("streamout13~:grainsize set to %d blocks",(int) grain); } } static void streamout13_format(t_streamout13 *x,t_symbol* form) { if (!strncmp(form->s_name,"float",5)) x->x_format = (int) SF_FLOAT; if (!strncmp(form->s_name,"16bit",5)) x->x_format = (int) SF_16BIT; if (!strncmp(form->s_name,"8bit",4)) x->x_format = (int) SF_8BIT; post ("streamout13~:format set to %s", form->s_name); } static void streamout13_host(t_streamout13 *x,t_symbol* host) { if (host != &s_){ x->hostname = host; if (x->x_fd >= 0) { streamout13_disconnect(x); streamout13_connect(x,x->hostname,(float) x->portno); } } } static void streamout13_float(t_streamout13* x,t_float arg) { if (arg == 0.0) streamout13_disconnect(x); else streamout13_connect(x,x->hostname,(float) x->portno); } static void *streamout13_new(t_symbol* hostname,t_floatarg portno,t_floatarg xn) { int i; t_streamout13 *x = (t_streamout13 *)pd_new(streamout13_class); outlet_new(&x->x_obj, &s_float); // x->x_out2 = outlet_new(&x->x_obj, &s_float); if (hostname == &s_) x->hostname = gensym("localhost"); else x->hostname = hostname; if (portno == 0.0) x->portno = 3000; else x->portno = portno; if (xn < 1) x->x_n = 1; else x->x_n = xn; for (i = 0 ;i < x->x_n - 1;i++){ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); /* post("creating ~input nr:%d",i);*/ } x->x_fd = -1; x->x_protocol = SOCK_DGRAM; x->x_format = SF_16BIT; x->x_realformat = SF_16BIT; x->cbuf = NULL; x->blockspersend=16; x->newblockspersend=8; x->blockssincesend=0; streamout13_tempbuf(x,64); return (x); } void streamout13_setup(void) { streamout13_class = class_new(gensym("streamout13~"), (t_newmethod) streamout13_new, 0, sizeof(t_streamout13), 0, A_DEFSYM, A_DEFFLOAT,A_DEFFLOAT, 0); class_addmethod(streamout13_class, (t_method) streamout13_connect,gensym("connect"), A_SYMBOL, A_DEFFLOAT, 0); class_addmethod(streamout13_class, (t_method) streamout13_disconnect, gensym("disconnect"), 0); class_addfloat(streamout13_class,streamout13_float); class_addmethod(streamout13_class, nullfn, gensym("signal"), 0); class_addmethod(streamout13_class, (t_method)streamout13_format,gensym("format"),A_SYMBOL,0); class_addmethod(streamout13_class, (t_method)streamout13_grain,gensym("grain"),A_DEFFLOAT,0); class_addmethod(streamout13_class, (t_method) streamout13_dsp, gensym("dsp"), 0); class_addmethod(streamout13_class, (t_method)streamout13_host,gensym("host"),A_DEFSYM,0); } void streamout13_tilde_setup() { streamout13_setup(); } pd-ext13_0.17.1/scramble~.c0000644000076500007650000005021511466062316014047 0ustar hanshans#include "m_pd.h" #include "ext13.h" #include #include #include #ifndef _WIN32 #include #include #include #include #else #include #endif /* ------------------------ scramble_tilde~ ----------------------------- */ static t_class *scramble_tilde_class; typedef struct _scramble_grain { t_float* L; t_float* R; int size; t_float maximum; struct _scramble_grain *next; }t_scramble_grain; typedef struct _scramble_tilde { t_object x_obj; int x_n; t_int x_channels; t_float play, analize; t_float dir, current_dir, pitch, actual_pitch, grain_r, autopitch; t_float valsum, valavg; int valsumcount, valsummax; int autofollow, playmode, semitones; t_scramble_grain *firstgrain; t_scramble_grain *workgrain; t_scramble_grain *ring; int grains, newgrains, w_grain, r_grain, n_grain, gotagrain, flush; int r_d, w_d, dist, mindist, lowptr, hiptr, lastlowptr; t_float lowval, hival, prevval, lowborder, normalize; int nsamples; t_outlet *trigger1; t_outlet *trigger2; } t_scramble_tilde; /* grain functions*/ static t_scramble_grain* scramble_tilde_newgrain(){ t_scramble_grain* thegrain; thegrain = getbytes( sizeof(t_scramble_grain)); thegrain->L = NULL; thegrain->R = NULL; thegrain->size = 0; thegrain->next = NULL; return (thegrain); } static t_scramble_grain* scramble_tilde_getgrain(t_scramble_grain* firstgrain, int n){ t_scramble_grain* thegrain = firstgrain; while (n--){ if (thegrain->next){ thegrain = thegrain->next; }else return (NULL); } return (thegrain); } static int scramble_tilde_getsomegrain(t_scramble_grain* firstgrain,int g){ t_scramble_grain* thegrain ; int r; do{ r = rand() % g; thegrain = scramble_tilde_getgrain(firstgrain, r); }while (thegrain->size == 0); return (r); } static void scramble_tilde_grainbuf(t_scramble_grain* grain, int c, int n){ if (!grain->size) grain->L = getbytes(n * sizeof(t_float)); else grain->L = resizebytes(grain->L, grain->size * sizeof(t_float), n * sizeof(t_float)); if (c == 2){ if (!grain->size) grain->R = getbytes(n * sizeof(t_float)); else grain->R = resizebytes(grain->R, grain->size * sizeof(t_float), n * sizeof(t_float)); } grain->size = n; } static void scramble_tilde_freegrain(t_scramble_grain* grain, int c){ if (grain->size){ freebytes(grain->L, grain->size * sizeof(t_float)); if (c == 2) freebytes(grain->R, grain->size * sizeof(t_float)); grain->size = 0; grain->next = NULL; } } t_int *scramble_tilde_perform(t_int *w) { t_scramble_tilde* x = (t_scramble_tilde*)(w[1]); int i; int erg=0; int n; t_float val, valL, valR, killval; #ifndef _WIN32 t_float* out[x->x_channels]; t_float* in[x->x_channels]; #else t_float** out = (t_float**)malloc(x->x_channels*sizeof(t_float*)); t_float** in = (t_float**)malloc(x->x_channels*sizeof(t_float*)); #endif float n_factor, frac, a, b, c, d, cminusb; int index; float *fp; t_atom at[2]; /* anything changed?*/ if (x->flush){ int i = x->grains; x->flush = 0; x->gotagrain = 0; while (i--) scramble_tilde_grainbuf(scramble_tilde_getgrain(x->firstgrain,i),x->x_channels,0); } if (x->newgrains){ int tmp = x->grains; if (x->newgrains > x->grains){ x->workgrain = scramble_tilde_getgrain(x->firstgrain,x->grains - 1); /*-1 ???*/ tmp = x->newgrains; x->newgrains -= x->grains; x->grains = tmp; while (x->newgrains--){ x->workgrain->next = scramble_tilde_newgrain(); x->workgrain = x->workgrain->next; } // post ("now %d grains",x->grains); }else{ if (x->newgrains < x->grains){ t_scramble_grain* tmpgrain; x->grains = x->newgrains; x->workgrain = scramble_tilde_getgrain(x->firstgrain,x->grains - 1); /* delete old grains */ while (x->workgrain->next){ tmpgrain = x->workgrain->next; scramble_tilde_freegrain(x->workgrain,x->x_channels); x->workgrain = tmpgrain; } /* reset readpointer if needed*/ if (x->r_grain >= x->grains){ x->r_grain = 0; x->grain_r = -1; } // post ("now %d grains",x->grains); } } x->newgrains=0; } if ((x->ring->size > x->x_n) || (x->ring->size < x->x_n) ){ // post ("scramble~: new size for ringbuffer:%d samples, %d channels, oldsize:%d",x->x_n,x->x_channels,x->ring->size); scramble_tilde_grainbuf(x->ring, x->x_channels ,x->x_n); x->x_n = x->ring->size; x->dist = 0; x->lowptr = x->r_d; x->lastlowptr = -1; x->lowval = x->lowborder; } for (i = 0; i < x->x_channels ;i++) in[i] = (t_float *)(w[2 + i]); for (i = 0;i < x->x_channels ;i++) out[i] = (t_float *)(w[2 + x->x_channels + i]); n = (int)(w[2 + x->x_channels * 2]);/*number of samples*/ // post ("n:%d",n); while (n--){ /*read from input*/ if (++x->r_d > x->x_n){ x->r_d = 0; } valL = *(t_float*)(x->ring->L + x->r_d) = *in[0]++; if (valL < 0) valL *= -1; if (x->x_channels == 2){ valR = *(t_float*)(x->ring->R + x->r_d) = *in[1]++; if (valR < 0) valR *= -1; val = valL + valR / 2.0; if (valL > x->hival){ x->hiptr = x->r_d; x->hival = valL; } if (valR > x->hival){ x->hiptr = x->r_d; x->hival = valR; } }else { val = valL; if (valL > x->hival){ x->hiptr = x->r_d; x->hival = valL; } } // if (val < 0) val *= -1; x->valsum += val; // if (x->valsumcount++ > x->mindist * 10){ if (x->valsumcount++ && (x->r_d == 0)){ x->valavg = x->valsum / x->valsumcount; x->valsumcount = 0; x->valsum = 0; if (x->autofollow && ( x->valavg > 0.003)) { x->lowborder = x->valavg; // post ("lowborder = %f",x->lowborder); } } if ((val < x->lowborder) && (x->prevval > x->lowborder)){ /* a new low-period */ x->dist = -1; x->lowptr = x->r_d; x->lowval = val; // post ("low"); } if ((x->r_d + 1) == x->lastlowptr){ /* one round without a point to cut */ x->lastlowptr = -1; x->lowval = x->lowborder; x->hival = 0; // post ("lastlowptr: reset"); } if (val < x->lowborder){x->dist++;} if (val <= x->lowval) { x->lowptr = x->r_d; x->lowval = val; /*found a point to cut*/ } if ((val > x->lowborder) && (x->prevval < x->lowborder) && ( x->dist < x->mindist)){ /*too short low-period*/ x->dist = 0; x->lowptr = x->r_d; x->lowval = x->lowborder; // post ("low too short"); } if ((val > x->lowborder) && (x->prevval < x->lowborder) && ( x->dist > x->mindist)){ /*found a low-period to cut */ if ((x->lastlowptr != -1) ){ int grainlen = 0; int i = 0; int wp = 1; /*first and last sample of grain should be 0.0*/ x->gotagrain = 1; /* how long is the new grain */ if (x->lastlowptr > x->lowptr){ grainlen = x->x_n - x->lastlowptr + x->lowptr; }else{ grainlen = x->lowptr - x->lastlowptr; } if (x->analize){ /*find and prepare the grain*/ if (++x->w_grain >= x->grains ) x->w_grain = 0; x->workgrain = scramble_tilde_getgrain (x->firstgrain, x->w_grain); scramble_tilde_grainbuf(x->workgrain, x->x_channels, grainlen + 2); *(t_float*)(x->workgrain->L) = 0.0; *(t_float*)(x->workgrain->L + x->workgrain->size -1) = 0.0; if (x->x_channels == 2){ *(t_float*)(x->workgrain->R) = 0.0; *(t_float*)(x->workgrain->R + x->workgrain->size -1) = 0.0; } x->workgrain->maximum = x->hival; /*notify the world*/ SETFLOAT(at, grainlen); SETFLOAT(at+1, x->w_grain + 1); outlet_list(x->trigger1, 0, 2, at); /*copy to the grain*/ i = x->lastlowptr; while (grainlen--){ if (++i >= x->x_n) i = 0; *(t_float*)(x->workgrain->L + wp ) = *(t_float*)(x->ring->L + i); if (x->x_channels == 2) *(t_float*)(x->workgrain->R + wp ) = *(t_float*)(x->ring->R + i); wp++; } }/*end if analize*/ // post ("copied: w_grain: %d",x->w_grain); }/* end lastlowptr != -1*/ x->dist = 0; x->hival = 0; x->lastlowptr = x->lowptr; }/*end found a low-period to cut */ x->prevval = val; }/*end while n-- (read from input)*/ /*--------------------playback--------------*/ n = (int)(w[2 + x->x_channels * 2]);/*number of samples*/ x->workgrain = scramble_tilde_getgrain (x->firstgrain, x->r_grain); if (x->normalize && x->workgrain) n_factor = x->normalize / x->workgrain->maximum; else n_factor = 1; while (n--){ int wgs; if (x->workgrain) wgs = x->workgrain->size - 2; else wgs = 0; if (( (x->grain_r >= wgs) || (x->grain_r < 1) || (x->workgrain == NULL) ) && x->play && x->gotagrain){ if (x->playmode < 2){ x->r_grain = scramble_tilde_getsomegrain(x->firstgrain, x->grains); x->workgrain = scramble_tilde_getgrain (x->firstgrain, x->r_grain); }else{ if (x->n_grain == -1){ x->play = 0; x->r_grain = 0; x->workgrain = NULL; }else{ x->r_grain = x->n_grain; x->workgrain = scramble_tilde_getgrain (x->firstgrain, x->r_grain); x->n_grain = -1; if ((x->r_grain == x->w_grain) || (x->workgrain == NULL)){ x->play = 0; x->r_grain = 0; x->workgrain = NULL; } else if (!x->workgrain->size){ x->play = 0; x->r_grain = 0; x->workgrain = NULL; } } }/*end if playmode < 2*/ if (x->workgrain){ if (((rand() % 200) / 100.0 - 1.0 ) < x->dir){ x->current_dir = 1; x->grain_r = 1; } else{ x->current_dir = -1; x->grain_r = x->workgrain->size -3; } if ( ( (x->autopitch >= 1.) && (x->semitones) ) || ( (x->autopitch) && (! x->semitones) ) ){ if (x->semitones){ int ap = (int)x->autopitch; int rauf = 0; int count ; if (rand() % 2 == 1){ rauf = 1;} /* post ("rauf:%d",rauf); */ x->actual_pitch = x->pitch; for (count = (rand() % ap); count >= 0; count--){ /*1.05946 = 12te wurzel aus 2 */ if (rauf){ x->actual_pitch = x->actual_pitch * 1.05946; }else{ x->actual_pitch = x->actual_pitch / 1.05946; } } }else{ if (((rand() % 200) / 100.0 - 1.0 ) > 0){ x->actual_pitch = x->pitch + x->pitch * ((rand() % 100 ) / 100.0 * x->autopitch); }else{ x->actual_pitch = x->pitch - x->pitch / ((rand() % 100 ) / 100.0 * x->autopitch); } }/*end if semitones*/ } else { x->actual_pitch = x->pitch; }/* end if autopitch*/ /* post ("x->actual_pitch:%f, x->autopitch:%f",x->actual_pitch,x->autopitch); */ if (x->normalize) n_factor = x->normalize / x->workgrain->maximum; else n_factor = 1; SETFLOAT(at, (x->workgrain->size - 2) / x->actual_pitch); SETFLOAT(at+1, x->r_grain + 1); outlet_list(x->trigger2, 0, 2, at); }/*end if workgrain !=NULL */ }/* end finding a new grain*/ if (x->play && x->gotagrain){ /*write graincontent to output*/ /* 4 point interpolation taken from ../src/d_array.c tabread4~ */ index = x->grain_r; if (index < 1) index = 1, frac = 0; else if (index > x->workgrain->size - 3) index = x->workgrain->size - 3, frac = 1; else frac = x->grain_r - index; fp = (t_float*)(x->workgrain->L + index); a = fp[-1]; b = fp[0]; c = fp[1]; d = fp[2]; cminusb = c-b; *out[0]++ = (b + frac * ( cminusb - 0.5f * (frac-1.) * ( (a - d + 3.0f * cminusb) * frac + (b - a - cminusb) ) )) * n_factor; if (x->x_channels == 2){ fp = (t_float*)(x->workgrain->R + index); a = fp[-1]; b = fp[0]; c = fp[1]; d = fp[2]; cminusb = c-b; *out[1]++ = (b + frac * ( cminusb - 0.5f * (frac-1.) * ( (a - d + 3.0f * cminusb) * frac + (b - a - cminusb) ) )) * n_factor; } x->grain_r += x->current_dir * x->actual_pitch; }else/* if play*/{ *out[0]++ = 0; if (x->x_channels == 2) *out[1]++ = 0; }/*end if play */ }/*end while n-- */ #ifdef _WIN32 free(in); free(out); #endif return (w + x->x_channels * 2 + 3); } static void scramble_tilde_dsp(t_scramble_tilde *x, t_signal **sp) { switch (x->x_channels) { case 1: dsp_add(scramble_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); // post ("1 channel"); break; case 2: dsp_add(scramble_tilde_perform, 6, x, sp[0]->s_vec, sp[1]->s_vec,sp[2]->s_vec, sp[3]->s_vec, sp[0]->s_n); // post ("2 channels"); break; } } static void scramble_tilde_free(t_scramble_tilde *x){ int n = x->grains - 1; while (n--){ scramble_tilde_freegrain (scramble_tilde_getgrain(x->firstgrain,n),x->x_channels); scramble_tilde_freegrain (x->ring,x->x_channels); } } static void *scramble_tilde_new(t_floatarg c,t_floatarg b) { t_scramble_tilde *x = (t_scramble_tilde *)pd_new(scramble_tilde_class); int i; // x->bufL = NULL; // x->bufR = NULL; x->x_channels = (t_int)c; if (x->x_channels > 2) { x->x_channels = 2; post ("maximum: 2 channels"); } if (x->x_channels < 1) x->x_channels = 1; outlet_new(&x->x_obj, gensym("signal")); if (x->x_channels == 2){ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); outlet_new(&x->x_obj, gensym("signal")); } x->trigger1 = outlet_new(&x->x_obj, &s_float); x->trigger2 = outlet_new(&x->x_obj, &s_float); x->dir = 1; x->pitch = 1; x->actual_pitch = 1; x->autopitch = 0; x->semitones = 1; x->autofollow = 1; x->playmode = 1; x->normalize = 0; x->analize = 1; x->flush = 0; x->x_n = (int)b; if (x->x_n >882000 ){x->x_n = 882000;} if (x->x_n < 88200 ){x->x_n = 88200;} /* x->rR = x->rL = x->wR = x->wL = NULL;*/ x->lowptr = 0; x->lastlowptr = x->r_d = x->grain_r = -1; x->mindist = 1024; x->lowborder = 0.35; // scramble_tilde_tempbuf(x,x->x_n); x->ring = scramble_tilde_newgrain(); scramble_tilde_grainbuf(x->ring,x->x_channels,x->x_n); x->valsum = x->valavg = x->valsumcount = 0; x->valsummax = 1024; /* the grains:*/ x->grains = 50; x->r_grain = 0; x->w_grain = x->n_grain = -1; x->firstgrain = x->workgrain = scramble_tilde_newgrain(); for (i = 1;i < x->grains;i++){ x->workgrain->next = scramble_tilde_newgrain(); x->workgrain = x->workgrain->next; } return (x); } void scramble_tilde_float(t_scramble_tilde* x, t_float n){ x->play = n; if (x->playmode == 2) { x->n_grain = (int)n - 1; x->grain_r = -1; } } void scramble_tilde_buffer(t_scramble_tilde* x, t_float n){ if (n > 64) x->x_n = (int)n; // post ("buffersize now:%d",x->x_n); } void scramble_tilde_threshold(t_scramble_tilde* x, t_float t){ if (t >0) { x->lowborder = t; x->autofollow = 0; }else{ post ("threshold must be a positive value (0.1 - 0.8 makes sense)"); } } void scramble_tilde_grains(t_scramble_tilde* x, t_float g){ if ((g > 1) && (g < 2048) ) x->newgrains = (int)g; else post ("scramble~: minimum # of grains must be 2 an maximum # is 2048"); } void scramble_tilde_mindist(t_scramble_tilde* x, t_float t){ if ((t > 0) && (t < x->x_n)) x->mindist = (int)t; else post ("scramble~: minimum distance must be positive value lower than buffersize"); } void scramble_tilde_direction(t_scramble_tilde* x, t_float d){ if (d > 1) d = 1; if (d < -1) d = -1; x->dir = d; } void scramble_tilde_autofollow(t_scramble_tilde* x){ x->autofollow = 1; } void scramble_tilde_pitch(t_scramble_tilde* x, t_float p){ if (p > 0) x->pitch = p; else post ("scramble~: pitch must be > 0"); } void scramble_tilde_autopitch(t_scramble_tilde* x, t_float p){ x->autopitch = p; } void scramble_tilde_semitones(t_scramble_tilde* x, t_float p){ x->semitones = (int)p; } void scramble_tilde_normalize(t_scramble_tilde* x, t_float n){ x->normalize = n; } void scramble_tilde_analize(t_scramble_tilde* x, t_float f){ x->analize = f; } void scramble_tilde_flush(t_scramble_tilde* x){ x->flush = 1; } void scramble_tilde_playmode(t_scramble_tilde* x, t_float p){ x->playmode = (int)p; if (x->playmode < 0) x->playmode = 0; if (x->playmode < 1) x->playmode = 2; switch (x->playmode){ case 0: post ("scramble~: playmode off"); break; case 1: post ("scramble~: active playmode"); break; case 2: post ("scramble~: passive playmode"); break; default: post ("scramble~: invalid playmode"); } } void scramble_tilde_setup(void) { scramble_tilde_class = class_new(gensym("scramble~"), (t_newmethod) scramble_tilde_new, 0, sizeof(t_scramble_tilde), 0, A_DEFFLOAT,A_DEFFLOAT, 0); class_addfloat(scramble_tilde_class,scramble_tilde_float); class_addmethod(scramble_tilde_class, nullfn, gensym("signal"), 0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_dsp, gensym("dsp"), 0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_buffer, gensym("buffer"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_threshold, gensym("threshold"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_grains, gensym("grains"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_mindist, gensym("min_length"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_direction, gensym("direction"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_autofollow, gensym("autofollow"),0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_pitch, gensym("pitch"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_autopitch, gensym("autopitch"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_semitones, gensym("semitones"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_flush, gensym("flush"), 0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_normalize, gensym("normalize"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_analize, gensym("analize"), A_DEFFLOAT,0); class_addmethod(scramble_tilde_class, (t_method) scramble_tilde_playmode, gensym("playmode"), A_DEFFLOAT,0); } pd-ext13_0.17.1/kalashnikov-help.pd0000644000076500007650000000113511466062316015477 0ustar hanshans#N canvas 304 321 450 300 10; #X msg 106 44 bang; #X floatatom 158 43 5 0 0; #X obj 254 180 print kalashnikov_done; #X obj 73 154 print uzi_index; #X obj 88 182 print uzi_done; #X obj 168 128 print kalashnikov_bang; #X obj 58 128 print uzi_bang; #X obj 211 154 print kalashnikov_index; #X obj 168 89 kalashnikov 2; #X obj 58 88 uzi 3; #X text 41 14 uzi aka kalashnikov is an easy way to serialize bangs ; #X connect 0 0 8 0; #X connect 0 0 9 0; #X connect 1 0 8 1; #X connect 1 0 9 1; #X connect 8 0 5 0; #X connect 8 1 7 0; #X connect 8 2 2 0; #X connect 9 0 6 0; #X connect 9 1 3 0; #X connect 9 2 4 0; pd-ext13_0.17.1/d_global13.h0000644000076500007650000000113111466062316013766 0ustar hanshanst_class *sigsend13_class; t_class *sigthrow13_class; t_class *sigreceive13_class; t_class *sigcatch13_class; typedef struct _sigsend13 { t_object x_obj; t_symbol *x_sym; int x_n; float *x_vec; } t_sigsend13; typedef struct _sigreceive13 { t_object x_obj; t_symbol *x_sym; t_float *x_wherefrom; int x_n; } t_sigreceive13; typedef struct _sigcatch13 { t_object x_obj; t_symbol *x_sym; int x_n; float *x_vec; } t_sigcatch13; typedef struct _sigthrow13 { t_object x_obj; t_symbol *x_sym; t_float *x_whereto; int x_n; } t_sigthrow13; pd-ext13_0.17.1/streamin13~-help.pd0000644000076500007650000000307011466062316015351 0ustar hanshans#N canvas 165 0 804 625 10; #X obj 18 107 streamin13~ 8008 4; #X obj 19 496 streamout13~ localhost 8008 4; #X text 15 13 streamin13~/out13~ :; #X text 14 27 like streamin~/out~ from ggee but; #X text 14 41 for multiple channels; #X text 15 55 and reduced udp-traffic; #X text 16 70 warning: not well tested; #X text 161 110 receives 4 channels in port 8808; #X obj 18 150 dac~ 1; #X obj 68 150 dac~ 2; #X obj 121 150 dac~ 3; #X obj 175 151 dac~ 4; #X obj 74 462 osc~ 440; #X obj 145 463 osc~ 880; #X obj 214 462 osc~ 990; #X obj 281 463 osc~ 220; #X text 245 497 sends 4 dsp-channels to localhost:8008; #X msg 19 202 connect foo.com 8008; #X msg 32 235 disconnect; #X text 175 203 to build up a connection and start sending; #X text 117 236 guess; #X msg 46 263 format float; #X msg 56 287 format 16bit; #X msg 72 311 format 8bit; #X text 165 284 format defines the resolution of the sent signal; #X text 168 302 float is the most expensive with the best resolution (32bit); #X text 181 337 change the hostname you are sending to; #X msg 85 337 host bar.org; #X msg 101 364 grain 512; #X text 185 363 the number of samples sent at a time; #X text 347 462 the signals to send; #X floatatom 19 528 5 0 0; #X text 72 530 status: 1 = connected 0 = disconnected; #X connect 0 0 8 0; #X connect 0 1 9 0; #X connect 0 2 10 0; #X connect 0 3 11 0; #X connect 1 0 31 0; #X connect 12 0 1 0; #X connect 13 0 1 1; #X connect 14 0 1 2; #X connect 15 0 1 3; #X connect 17 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 1 0; #X connect 27 0 1 0; #X connect 28 0 1 0; pd-ext13_0.17.1/throw13~.c0000644000076500007650000000465411466062316013574 0ustar hanshans/* Copyright (c) 1997-1999 Miller Puckette source modified by dieb13. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ /* catch13~ ... = original objects with set-message for changing - bad hack - but works somehow*/ #include "m_pd.h" #include "d_global13.h" #define DEFSENDVS 64 /* LATER get send to get this from canvas */ /* ----------------------------- throw13~ ----------------------------- */ void *sigthrow13_new(t_symbol *s) { t_sigthrow13 *x = (t_sigthrow13 *)pd_new(sigthrow13_class); if (!*s->s_name) s = gensym("throw13~"); x->x_sym = s; x->x_whereto = 0; x->x_n = DEFSENDVS; return (x); } t_int *sigthrow13_perform(t_int *w) { t_sigthrow13 *x = (t_sigthrow13 *)(w[1]); t_float *in = (t_float *)(w[2]); int n = (int)(w[3]); t_float *out = x->x_whereto; if (out) { while (n--) { /* TB: denormal handling in pd >0.37-2 */ #ifdef PD_BIGORSMALL *out += (PD_BIGORSMALL(*in) ? 0 : *in); out++; in++; #else *out++ += *in++; #endif } } return (w+4); } void sigthrow13_set(t_sigthrow13 *x, t_symbol *s) { t_sigcatch13 *catcher = (t_sigcatch13 *)pd_findbyclass((x->x_sym = s), sigcatch13_class); if (catcher) { if (catcher->x_n == x->x_n) x->x_whereto = catcher->x_vec; else { pd_error(x, "throw13~ %s: vector size mismatch", x->x_sym->s_name); x->x_whereto = 0; } } else { pd_error(x, "throw13~ %s: no matching catch", x->x_sym->s_name); x->x_whereto = 0; } } void sigthrow13_dsp(t_sigthrow13 *x, t_signal **sp) { if (sp[0]->s_n != x->x_n) { pd_error(x, "throw13~ %s: vector size mismatch", x->x_sym->s_name); } else { sigthrow13_set(x, x->x_sym); dsp_add(sigthrow13_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); } } void sigthrow13_setup(void) { sigthrow13_class = class_new(gensym("throw13~"), (t_newmethod)sigthrow13_new, 0, sizeof(t_sigthrow13), 0, A_DEFSYM, 0); class_addcreator((t_newmethod)sigthrow13_new, gensym("t13~"), A_DEFSYM, 0); class_addmethod(sigthrow13_class, (t_method)sigthrow13_set, gensym("set"), A_SYMBOL, 0); class_addmethod(sigthrow13_class, nullfn, gensym("signal"), 0); class_addmethod(sigthrow13_class, (t_method)sigthrow13_dsp, gensym("dsp"), 0); } void throw13_tilde_setup() { sigthrow13_setup(); } pd-ext13_0.17.1/ext13-help.pd0000644000076500007650000000641011466062316014132 0ustar hanshans#N canvas 165 0 804 625 10; #X obj 59 150 send13~ foo; #X obj 52 176 receive13~ foo; #X msg 236 122 set barfuss; #X text 13 82 send13~ \, receive13~ and catch13~ \, throw13~ are equivalent to s~ r~ catch~ throw~ \, but accept set messages.; #X obj 15 323 filesize; #X msg 15 297 symbol /boot/vmlinuz; #X obj 15 350 print; #X text 81 324 =; #X obj 99 325 fsize; #X text 140 153 =; #X text 163 143 =; #X obj 363 148 c13~; #X obj 353 195 t13~; #X text 334 195 =; #X text 348 145 =; #X text 14 275 filesize gives you: guess what; #X floatatom 255 292 4 0 0; #X msg 255 341 set \$1; #X msg 255 365 5; #X obj 255 317 ftos 3; #X text 255 241 ftos: float to symbol; #X floatatom 292 293 4 0 0; #X text 254 256 right argument for number of digits; #X text 13 23 most of them are not well done/tested and need more work for seriuos usage.; #X text 13 9 ext13: some extrnals i wrote for my own needs; #X obj 16 562 piperead~; #X obj 16 589 pipewrite~; #X text 13 524 like sfread and sfwrite \, but non-blocking; #X text 13 540 good for use with external programs (e.g. mpg123 > pipe) ; #X obj 14 392 strippath; #X text 13 372 strip a path from a filename; #X obj 15 451 wavinfo; #X obj 44 198 receive13~ foo; #X obj 427 574 openpatch; #X text 499 575 =; #X obj 520 576 opa; #X msg 485 548 symbol /usr/local/pd/ext13/; #X msg 427 526 symbol help.pd; #X text 427 508 that you can also use a message for the same result ; #X text 426 493 when i wrote this object \, i didn`t realize; #X msg 25 123 set furchtbar; #X text 157 176 =; #X obj 465 178 streamin13~ 8008 4; #X obj 465 203 streamout13~ localhost 8008 4; #X text 462 104 streamin13~/out13~ :; #X text 461 118 like streamin~/out~ from ggee but; #X text 461 132 for multiple channels; #X text 462 146 and reduced udp-traffic; #X text 463 161 warning: not well tested; #X obj 250 146 catch13~ bar; #X obj 245 168 throw13~ bar; #X obj 236 193 throw13~ bar; #X obj 543 318 mandelbrot; #X obj 543 340 mandelbrot~; #X text 542 244 mandelbrot & mandelbrot~; #X text 541 257 z = z*z +c; #X text 542 270 you can use it for gem; #X text 541 285 maybe you can also find another useful app \; ); #X text 255 271 useful in combination with makefilename; #X text 13 50 contact: dieb13@klingt.org; #X text 14 420 get #samples \, channels \, bitspersample \, samplerate of a wavfile; #X obj 422 397 adc~; #X obj 421 449 dac~; #X obj 421 423 scramble~ 2; #X text 511 423 big fun with spoken words or beats; #X obj 17 499 uzi; #X text 46 500 =; #X obj 62 500 kalashnikov; #X text 15 479 uzi like in max for multibang; #X obj 380 319 ossmixer; #X text 359 302 a simple oss mixer; #X obj 33 222 receive13 foo; #X text 133 221 =; #X obj 144 221 r13 foo; #X obj 168 176 r13~ foo; #X obj 158 151 s13~ foo; #X text 103 247 =; #X obj 25 246 send13 foo; #X obj 114 247 s13 foo; #X text 353 344 a simple atapi-cdplayer; #X obj 380 361 cdplayer; #X msg 327 326 eject; #X connect 2 0 49 0; #X connect 2 0 50 0; #X connect 2 0 51 0; #X connect 4 0 6 0; #X connect 5 0 4 0; #X connect 16 0 19 0; #X connect 17 0 18 0; #X connect 19 0 17 0; #X connect 21 0 19 1; #X connect 36 0 33 1; #X connect 37 0 33 0; #X connect 40 0 0 0; #X connect 40 0 1 0; #X connect 40 0 32 0; #X connect 40 0 71 0; #X connect 40 0 77 0; #X connect 61 0 63 0; #X connect 61 1 63 1; #X connect 63 0 62 0; #X connect 63 1 62 1; #X connect 81 0 80 0; pd-ext13_0.17.1/send13.c0000644000076500007650000000403611466062316013156 0ustar hanshans#include "m_pd.h" #include #include /* ------------------------- send13 ------------------------------ */ /* this is pd's biultin send13 plus the hack for "set" messages */ /* it's a pitty, but i don't know where this patch originally */ /* came from, so i can'z give correct credits... */ /* --------------------------------------------------------------- */ static t_class *send13_class; typedef struct _send13 { t_object x_obj; t_symbol *x_sym; } t_send13; static void send13_bang(t_send13 *x) { if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); } static void send13_set(t_send13 *x, t_symbol *s) { x->x_sym = s; } static void send13_float(t_send13 *x, t_float f) { if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); } static void send13_symbol(t_send13 *x, t_symbol *s) { if (x->x_sym->s_thing) pd_symbol(x->x_sym->s_thing, s); } static void send13_pointer(t_send13 *x, t_gpointer *gp) { if (x->x_sym->s_thing) pd_pointer(x->x_sym->s_thing, gp); } static void send13_list(t_send13 *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 send13_anything(t_send13 *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 *send13_new(t_symbol *s) { t_send13 *x = (t_send13 *)pd_new(send13_class); x->x_sym = s; return (x); } void send13_setup(void) { send13_class = class_new(gensym("send13"), (t_newmethod)send13_new, 0, sizeof(t_send13), 0, A_DEFSYM, 0); class_addcreator((t_newmethod)send13_new, gensym("s13"), A_DEFSYM, 0); class_addbang(send13_class, send13_bang); class_addfloat(send13_class, send13_float); class_addsymbol(send13_class, send13_symbol); class_addpointer(send13_class, send13_pointer); class_addlist(send13_class, send13_list); class_addanything(send13_class, send13_anything); class_addmethod(send13_class, (t_method)send13_set, gensym("set"), A_SYMBOL, 0); } pd-ext13_0.17.1/ftos-help.pd0000644000076500007650000000052611466062316014143 0ustar hanshans#N canvas 161 221 450 300 10; #X obj 174 130 ftos; #X msg 180 68 bang; #X floatatom 106 63 5 0 0 0 - - -; #X symbolatom 174 173 10 0 0 0 - - -; #X text 118 30 convert a float to a symbol; #X obj 160 203 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X connect 0 0 3 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 5 0; pd-ext13_0.17.1/filesize-help.pd0000644000076500007650000000020711466062316014776 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/wavinfo-help.pd0000644000076500007650000000110511466062316014633 0ustar hanshans#N canvas 71 22 450 300 12; #X obj 112 139 openpanel; #X obj 112 165 wavinfo; #X floatatom 45 228 20 0 0 3 samples - -; #X floatatom 195 228 5 0 0 3 channels - -; #X floatatom 262 229 5 0 0 3 sample_size - -; #X floatatom 347 229 5 0 0 3 bitrate - -; #X obj 112 109 bng 25 250 50 0 empty empty empty 17 7 0 10 -204786 -1 -1; #X text 24 52 open a .wav file to see get the information about it: ; #X text 22 36 [wavinfo] outputs information about a .wav file \,; #X connect 0 0 1 0; #X connect 1 0 2 0; #X connect 1 1 3 0; #X connect 1 2 4 0; #X connect 1 3 5 0; #X connect 6 0 0 0; pd-ext13_0.17.1/promiscous~-help.pd0000644000076500007650000000045511466062316015572 0ustar hanshans#N canvas 291 56 450 300 10; #X obj 89 151 dac~; #X text 15 19 promiscous~ converts all network traffic; #X text 15 41 from a given interface to signal.; #X text 15 196 pd must run with root permissions \, to catch the traffic ; #X obj 100 93 promiscous~ eth0; #X connect 4 0 0 0; #X connect 4 0 0 1; pd-ext13_0.17.1/receive13~.c0000644000076500007650000000615011466062316014044 0ustar hanshans/* Copyright (c) 1997-1999 Miller Puckette source modified by dieb13. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ /* catch13~ ... = original objects with set-message for changing - bad hack - but works somehow*/ #include "m_pd.h" #include "d_global13.h" #define DEFSENDVS 64 /* LATER get send to get this from canvas */ /* ----------------------------- receive13~ ----------------------------- */ void *sigreceive13_new(t_symbol *s) { t_sigreceive13 *x = (t_sigreceive13 *)pd_new(sigreceive13_class); if (!*s->s_name) s = gensym("receive13~"); x->x_n = DEFSENDVS; /* LATER find our vector size correctly */ x->x_sym = s; x->x_wherefrom = 0; outlet_new(&x->x_obj, &s_signal); return (x); } t_int *sigreceive13_perform(t_int *w) { t_sigreceive13 *x = (t_sigreceive13 *)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); t_float *in = x->x_wherefrom; if (in) { while (n--) *out++ = *in++; } else { while (n--) *out++ = 0; } return (w+4); } /* tb: vectorized */ t_int *sigreceive13_perf8(t_int *w) { t_sigreceive13 *x = (t_sigreceive13 *)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); t_float *in = x->x_wherefrom; if (in) { for (; n; n -= 8, in += 8, out += 8) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; out[4] = in[4]; out[5] = in[5]; out[6] = in[6]; out[7] = in[7]; } } else { for (; n; n -= 8, in += 8, out += 8) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 0; out[6] = 0; out[7] = 0; } } return (w+4); } void sigreceive13_set(t_sigreceive13 *x, t_symbol *s) { t_sigsend13 *sender = (t_sigsend13 *)pd_findbyclass((x->x_sym = s), sigsend13_class); if (sender) { if (sender->x_n == x->x_n) x->x_wherefrom = sender->x_vec; else { pd_error(x, "receive13~ %s: vector size mismatch", x->x_sym->s_name); x->x_wherefrom = 0; } } else { pd_error(x, "receive13~ %s: no matching send", x->x_sym->s_name); x->x_wherefrom = 0; } } void sigreceive13_dsp(t_sigreceive13 *x, t_signal **sp) { if (sp[0]->s_n != x->x_n) { pd_error(x, "receive13~ %s: vector size mismatch", x->x_sym->s_name); } else { sigreceive13_set(x, x->x_sym); if(sp[0]->s_n&7) dsp_add(sigreceive13_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); else dsp_add(sigreceive13_perf8, 3, x, sp[0]->s_vec, sp[0]->s_n); } } void sigreceive13_setup(void) { sigreceive13_class = class_new(gensym("receive13~"), (t_newmethod)sigreceive13_new, 0, sizeof(t_sigreceive13),0, A_DEFSYM, 0); class_addcreator((t_newmethod)sigreceive13_new, gensym("r13~"), A_DEFSYM, 0); class_addmethod(sigreceive13_class, (t_method)sigreceive13_set, gensym("set"), A_SYMBOL, 0); class_addmethod(sigreceive13_class, (t_method)sigreceive13_dsp, gensym("dsp"), 0); } void receive13_tilde_setup() { sigreceive13_setup(); } pd-ext13_0.17.1/ftos.c0000644000076500007650000000262711466062316013040 0ustar hanshans#include "ext13.h" #include "m_pd.h" #include #include #ifndef _WIN32 #include #endif #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------------- ftos ------------------------------ */ static t_class *ftos_class; typedef struct _ftos { t_object x_obj; t_symbol *x_s; t_symbol *x_fmt; t_float x_f; } t_ftos; static void *ftos_new(t_floatarg f) { t_ftos *x = (t_ftos *)pd_new(ftos_class); x->x_f=f; floatinlet_new(&x->x_obj, &x->x_f); outlet_new(&x->x_obj,0); x->x_s = gensym("0"); return (x); } static void ftos_bang(t_ftos *x) { outlet_symbol(x->x_obj.ob_outlet,x->x_s); } static void ftos_float(t_ftos *x, t_float f) { char result[MAXPDSTRING]; char fmt[MAXPDSTRING]; char num[MAXPDSTRING]; /* if (!f){f=2;} */ sprintf(num,"%d",(int)x->x_f); strcpy(fmt,"%."); strcat(fmt,num); strcat(fmt,"f"); x->x_fmt = gensym (fmt); sprintf(result,x->x_fmt->s_name,(float)f); x->x_s = gensym(result); ftos_bang(x); } void ftos_setup(void) { ftos_class = class_new(gensym("ftos"), (t_newmethod)ftos_new, 0, sizeof(t_ftos), 0, A_DEFFLOAT, 0); class_addbang(ftos_class, ftos_bang); class_addfloat(ftos_class, ftos_float); /* class_addfloat(ftos_class; ftos_float);*/ } pd-ext13_0.17.1/messages-help.pd0000644000076500007650000000020711466062316014773 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/receive13.c0000644000076500007650000000445211466062316013651 0ustar hanshans#include "m_pd.h" #include #include /* -------------------- receive13 ------------------------------ */ /* this is pd's biultin recieve plus the hack for "set" messages */ /* it's a pitty, but i don't know where this patch originally */ /* came from, so i can'z give correct credits... */ /* ------------------------------------------------------------- */ static t_class *receive13_class; typedef struct _receive13 { t_object x_obj; t_symbol *x_sym; } t_receive13; static void receive13_set(t_receive13 *x, t_symbol *s) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); x->x_sym = s; pd_bind(&x->x_obj.ob_pd, s); } static void receive13_bang(t_receive13 *x) { outlet_bang(x->x_obj.ob_outlet); } static void receive13_float(t_receive13 *x, t_float f) { outlet_float(x->x_obj.ob_outlet, f); } static void receive13_symbol(t_receive13 *x, t_symbol *s) { outlet_symbol(x->x_obj.ob_outlet, s); } static void receive13_pointer(t_receive13 *x, t_gpointer *gp) { outlet_pointer(x->x_obj.ob_outlet, gp); } static void receive13_list(t_receive13 *x, t_symbol *s, int argc, t_atom *argv) { outlet_list(x->x_obj.ob_outlet, s, argc, argv); } static void receive13_anything(t_receive13 *x, t_symbol *s, int argc, t_atom *argv) { outlet_anything(x->x_obj.ob_outlet, s, argc, argv); } static void *receive13_new(t_symbol *s) { t_receive13 *x = (t_receive13 *)pd_new(receive13_class); x->x_sym = s; pd_bind(&x->x_obj.ob_pd, s); outlet_new(&x->x_obj, 0); return (x); } static void receive13_free(t_receive13 *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); } void receive13_setup(void) { receive13_class = class_new(gensym("receive13"), (t_newmethod)receive13_new, (t_method)receive13_free, sizeof(t_receive13), 0, A_DEFSYM, 0); class_addcreator((t_newmethod)receive13_new, gensym("r13"), A_DEFSYM, 0); class_addbang(receive13_class, receive13_bang); class_addfloat(receive13_class, (t_method)receive13_float); class_addsymbol(receive13_class, receive13_symbol); class_addpointer(receive13_class, receive13_pointer); class_addlist(receive13_class, receive13_list); class_addanything(receive13_class, receive13_anything); class_addmethod(receive13_class, (t_method)receive13_set, gensym("set"), A_SYMBOL, 0); } pd-ext13_0.17.1/mandelbrot.c0000644000076500007650000000323311466062316014206 0ustar hanshans#include "ext13.h" #include "m_pd.h" #include #include #include #ifndef _WIN32 #include #endif #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------------- mandelbrot ------------------------------ */ static t_class *mandelbrot_class; typedef struct _mandelbrot { t_object x_obj; t_float cr; t_float ci; t_float k; t_float result; } t_mandelbrot; static void *mandelbrot_new(t_floatarg f) { t_mandelbrot *x = (t_mandelbrot *)pd_new(mandelbrot_class); x->k=f; if (! x->k) {x->k=100;} floatinlet_new(&x->x_obj, &x->ci); floatinlet_new(&x->x_obj, &x->k); outlet_new(&x->x_obj,0); return (x); } static void mandelbrot_bang(t_mandelbrot *x) { outlet_float(x->x_obj.ob_outlet,x->result); } static void mandelbrot_float(t_mandelbrot *x, t_float f) { int i = -2; t_float zr = 0; t_float zi = 0; t_float z2r = 0; t_float z2i = 0; x->cr = f; if ((x->cr < 0 ) && ( x->cr > -0.5) && (x->ci * x->ci < 0.25)){ x->result = x->k; }else{ while (((z2r + z2i) < 4 ) && (++i < x->k )) { z2r = zr * zr; z2i = zi * zi; zi = 2 * zr * zi + x->ci; zr = z2r - z2i + x->cr; } x->result = i; } outlet_float(x->x_obj.ob_outlet,x->result); } void mandelbrot_setup(void) { mandelbrot_class = class_new(gensym("mandelbrot"), (t_newmethod)mandelbrot_new, 0, sizeof(t_mandelbrot), 0, A_DEFFLOAT, 0); class_addbang(mandelbrot_class, mandelbrot_bang); class_addfloat(mandelbrot_class, mandelbrot_float); /* class_addfloat(mandelbrot_class; mandelbrot_float);*/ } pd-ext13_0.17.1/README.txt0000644000076500007650000000135511466062316013414 0ustar hanshansthis ist ext13, a collection of externals for pd most of the code comes from other pd-object or externals and is just modifyed. you can use, copy modify, distribute... blahblah there`s no warranty for anything. --------compile------------ ext13 is developed and tested in linux. if you need it for another platform, you have to do the work to port it to compile it to get a seperate file for each object (.pd_linux): make clean make make dist will make a tarball of a libdir which can be dropped into place anywhere in Pd's path. don`t forget to put the files in your pd-path or do a -lib /path/to/ext13 to be able to use it. ----------contact--------- d13@klingt.org ---------thanks to-------- miller puckete and guenther geiger pd-ext13_0.17.1/receive13-help.pd0000644000076500007650000000020711466062316014752 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/send13-help.pd0000644000076500007650000000040611466062316014262 0ustar hanshans#N canvas 0 0 450 300 10; #X obj 197 107 receive13 foo; #X obj 71 107 send13 foo; #X floatatom 197 141 5 0 0; #X floatatom 71 79 5 0 0; #X msg 197 67 set bar; #X msg 118 79 set bar; #X connect 0 0 2 0; #X connect 3 0 1 0; #X connect 4 0 0 0; #X connect 5 0 1 0; pd-ext13_0.17.1/piperead~.c0000644000076500007650000000720511466062316014051 0ustar hanshans#include "m_pd.h" #ifdef __gnu_linux__ #include #endif #include #include #include #include #include #include #include #include /* ------------------------ piperead_tilde~ ----------------------------- */ #ifdef _WIN32 #define BINREADMODE "rb" #else #define BINREADMODE "r" #endif static t_class *piperead_tilde_class; typedef struct _piperead_tilde { t_object x_obj; void* x_mapaddr; int x_fd; short x_sample; t_int x_play; t_int x_channels; int buflen; short buf[32768]; int readpointer; int writepointer; } t_piperead_tilde; void piperead_tilde_open(t_piperead_tilde *x,t_symbol *filename) { /* struct stat fstate;*/ char fname[MAXPDSTRING]; canvas_makefilename(canvas_getcurrent(), filename->s_name, fname, MAXPDSTRING); /* close the old file */ if (x->x_fd >= 0) close(x->x_fd); if ((x->x_fd = open(fname,( O_NONBLOCK | O_RDONLY))) < 0) { error("can't open %s",fname); return; } for (x->writepointer=0;x->writepointer<(x->buflen*0.9);x->writepointer++){ read (x->x_fd,&x->buf[x->writepointer],2); } /* post ("prebuffering done");*/ } #define MAX_CHANS 4 t_int *piperead_tilde_perform(t_int *w) { t_piperead_tilde* x = (t_piperead_tilde*)(w[1]); int c = x->x_channels; int i; int erg=0; int n; t_float* out[MAX_CHANS]; for (i=0;ix_play){ for (i=0;ireadpointer>x->buflen){ x->readpointer=0; } if (erg != EAGAIN){ if (++x->writepointer>x->buflen){ x->writepointer=0; } } *out[i]++ = x->buf[x->readpointer]/32768.; erg = read (x->x_fd,&x->buf[x->writepointer],2); } } else { for (i=0;ix_play=1; } else { x->x_play=0; } } static void piperead_tilde_dsp(t_piperead_tilde *x, t_signal **sp) { switch (x->x_channels) { case 1: dsp_add(piperead_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); break; case 2: dsp_add(piperead_tilde_perform, 5, x, sp[0]->s_vec, sp[1]->s_vec,sp[2]->s_vec, sp[0]->s_n); break; case 4: dsp_add(piperead_tilde_perform, 6, x, sp[0]->s_vec, sp[1]->s_vec,sp[2]->s_vec, sp[3]->s_vec,sp[4]->s_vec, sp[0]->s_n); break; } } static void *piperead_tilde_new(t_floatarg chan, t_floatarg buflen) { t_piperead_tilde *x = (t_piperead_tilde *)pd_new(piperead_tilde_class); t_int c = chan; t_int bl = buflen; if (c<1 || c > MAX_CHANS) c = 1; if (bl<8 || bl > 32767) bl = 256; x->x_fd = -1; x->x_channels = c; x->buflen=bl; x->x_play = 0; while (c--) { outlet_new(&x->x_obj, gensym("signal")); } return (x); } void piperead_tilde_setup(void) { piperead_tilde_class = class_new(gensym("piperead~"), (t_newmethod)piperead_tilde_new, 0, sizeof(t_piperead_tilde), 0,A_DEFFLOAT,A_DEFFLOAT,0); class_addmethod(piperead_tilde_class, nullfn, gensym("signal"), 0); class_addmethod(piperead_tilde_class, (t_method) piperead_tilde_dsp, gensym("dsp"), 0); class_addmethod(piperead_tilde_class, (t_method) piperead_tilde_open, gensym("open"), A_SYMBOL,A_NULL); class_addfloat(piperead_tilde_class, piperead_tilde_float); } pd-ext13_0.17.1/strippath-help.pd0000644000076500007650000000041011466062316015176 0ustar hanshans#N canvas 0 22 454 304 10; #X obj 113 163 ext13/strippath; #X symbolatom 113 196 0 0 0 0 - - -; #X msg 113 109 symbol /this/is/a/testfile.txt; #X msg 58 88 bang; #X obj 58 109 getdir; #X connect 0 0 1 0; #X connect 2 0 0 0; #X connect 3 0 4 0; #X connect 4 0 0 0; pd-ext13_0.17.1/catch13~.c0000644000076500007650000000510611466062316013504 0ustar hanshans/* Copyright (c) 1997-1999 Miller Puckette source modified by dieb13. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ /* catch13~ ... = original objects with set-message for changing - bad hack - but works somehow*/ #include "m_pd.h" #include "d_global13.h" #define DEFSENDVS 64 /* LATER get send to get this from canvas */ /* ----------------------------- catch13~ ----------------------------- */ void *sigcatch13_new(t_symbol *s) { t_sigcatch13 *x = (t_sigcatch13 *)pd_new(sigcatch13_class); if (!*s->s_name) s = gensym("catch~"); pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; x->x_n = DEFSENDVS; x->x_vec = (float *)getbytes(DEFSENDVS * sizeof(float)); outlet_new(&x->x_obj, &s_signal); return (x); } t_int *sigcatch13_perform(t_int *w) { t_float *in = (t_float *)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); while (n--) *out++ = *in, *in++ = 0; return (w+4); } /* tb: vectorized */ t_int *sigcatch13_perf8(t_int *w) { t_float *in = (t_float *)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); for (; n; n -= 8, in += 8, out += 8) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; out[4] = in[4]; out[5] = in[5]; out[6] = in[6]; out[7] = in[7]; in[0] = 0; in[1] = 0; in[2] = 0; in[3] = 0; in[4] = 0; in[5] = 0; in[6] = 0; in[7] = 0; } return (w+4); } void sigcatch13_set(t_sigcatch13 *x, t_symbol *s) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); x->x_sym = s; pd_bind(&x->x_obj.ob_pd, s); } void sigcatch13_dsp(t_sigcatch13 *x, t_signal **sp) { if (x->x_n == sp[0]->s_n) { if(sp[0]->s_n&7) dsp_add(sigcatch13_perform, 3, x->x_vec, sp[0]->s_vec, sp[0]->s_n); else dsp_add(sigcatch13_perf8, 3, x->x_vec, sp[0]->s_vec, sp[0]->s_n); } else error("sigcatch13 %s: unexpected vector size", x->x_sym->s_name); } void sigcatch13_free(t_sigcatch13 *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); freebytes(x->x_vec, x->x_n * sizeof(float)); } void sigcatch13_setup(void) { sigcatch13_class = class_new(gensym("catch13~"), (t_newmethod)sigcatch13_new, (t_method)sigcatch13_free, sizeof(t_sigcatch13), 0, A_DEFSYM, 0); class_addcreator((t_newmethod)sigcatch13_new, gensym("c13~"), A_DEFSYM, 0); class_addmethod(sigcatch13_class, (t_method)sigcatch13_set, gensym("set"), A_SYMBOL, 0); class_addmethod(sigcatch13_class, (t_method)sigcatch13_dsp, gensym("dsp"), 0); } void catch13_tilde_setup() { sigcatch13_setup(); } pd-ext13_0.17.1/openpatch.c0000644000076500007650000000340411466062316014040 0ustar hanshans#include "ext13.h" #include "m_pd.h" /* #ifndef PD_MAJOR_VERSION #include "s_stuff.h" #else #include "m_imp.h" #endif*/ #include #include #ifndef _WIN32 #include #endif #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------------- openpatch ------------------------------ */ static t_class *openpatch_class; typedef struct _openpatch { t_object x_obj; t_symbol *x_s; t_symbol *x_path; } t_openpatch; static void *openpatch_new(t_symbol *s) { t_openpatch *x = (t_openpatch *)pd_new(openpatch_class); x->x_s = s; x->x_path=gensym("./"); symbolinlet_new(&x->x_obj, &x->x_path); return (x); } static void openpatch_symbol(t_openpatch *x, t_symbol *s) { char *lastslash; char path[MAXPDSTRING], filename[MAXPDSTRING]; x->x_s = s; lastslash=strrchr (s->s_name,'/'); if (lastslash){ strncpy (path,s->s_name,lastslash-s->s_name+1); path[lastslash-s->s_name]=0; strcpy (filename,lastslash+1); filename[lastslash-s->s_name+1]=0; } else { strcpy (filename,s->s_name); sprintf (path,x->x_path->s_name); } post ("path:%s , name:%s",path,filename); glob_evalfile(0,gensym(filename),gensym(path)); } static void openpatch_bang(t_openpatch *x) { if (x->x_s){openpatch_symbol (x,x->x_s);} } void openpatch_setup(void) { openpatch_class = class_new(gensym("openpatch"), (t_newmethod)openpatch_new, 0, sizeof(t_openpatch), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)openpatch_new, gensym("opa"), A_DEFFLOAT, 0); class_addbang(openpatch_class, openpatch_bang); class_addsymbol(openpatch_class, openpatch_symbol); } pd-ext13_0.17.1/send13~.c0000644000076500007650000000424011466062316013351 0ustar hanshans/* Copyright (c) 1997-1999 Miller Puckette source modified by dieb13. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ /* catch13~ ... = original objects with set-message for changing - bad hack - but works somehow*/ #include "m_pd.h" #include "d_global13.h" #define DEFSENDVS 64 /* LATER get send to get this from canvas */ /* ----------------------------- send13~ ----------------------------- */ void *sigsend13_new(t_symbol *s) { t_sigsend13 *x = (t_sigsend13 *)pd_new(sigsend13_class); if (!*s->s_name) s = gensym("send13~"); pd_bind(&x->x_obj.ob_pd, s); x->x_sym = s; x->x_n = DEFSENDVS; x->x_vec = (float *)getbytes(DEFSENDVS * sizeof(float)); return (x); } t_int *sigsend13_perform(t_int *w) { t_float *in = (t_float *)(w[1]); t_float *out = (t_float *)(w[2]); int n = (int)(w[3]); while (n--) { /* TB: denormal handling in pd >0.37-2 */ #ifdef PD_BIGORSMALL *out = (PD_BIGORSMALL(*in) ? 0 : *in); out++; in++; #else *out++ = *in++; #endif }; return (w+4); } void sigsend13_set(t_sigsend13 *x, t_symbol *s) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); x->x_sym = s; pd_bind(&x->x_obj.ob_pd, s); } void sigsend13_dsp(t_sigsend13 *x, t_signal **sp) { if (x->x_n == sp[0]->s_n) dsp_add(sigsend13_perform, 3, sp[0]->s_vec, x->x_vec, sp[0]->s_n); else error("sigsend13 %s: unexpected vector size", x->x_sym->s_name); } void sigsend13_free(t_sigsend13 *x) { pd_unbind(&x->x_obj.ob_pd, x->x_sym); freebytes(x->x_vec, x->x_n * sizeof(float)); } void sigsend13_setup(void) { sigsend13_class = class_new(gensym("send13~"), (t_newmethod)sigsend13_new, (t_method)sigsend13_free, sizeof(t_sigsend13), 0, A_DEFSYM, 0); class_addmethod(sigsend13_class, (t_method)sigsend13_set, gensym("set"),A_SYMBOL, 0); class_addcreator((t_newmethod)sigsend13_new, gensym("s13~"), A_DEFSYM, 0); class_addmethod(sigsend13_class, nullfn, gensym("signal"), 0); class_addmethod(sigsend13_class, (t_method)sigsend13_dsp, gensym("dsp"), 0); } void send13_tilde_setup() { sigsend13_setup(); } pd-ext13_0.17.1/throw13~-help.pd0000644000076500007650000000020711466062316014671 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/CHANGES0000644000076500007650000000044511466062316012710 0ustar hanshans#this file starts with the changes for version 0.14 because i was too lazy before: 0.14 included --prefix option in configure/makefile ossmixer 0.15 send13 / receive13 (s13/r13) like s/r with "set" 0.16 cdplayer for linux-atapi-cdrom-playing 0.17 minor bugfixes in scramble~ pd-ext13_0.17.1/strippath.c0000644000076500007650000000322111466062316014072 0ustar hanshans#include "ext13.h" #include "m_pd.h" #include #include #ifndef _WIN32 #include #endif #include #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------------- strippath ------------------------------ */ static t_class *strippath_class; typedef struct _strippath { t_object x_obj; t_symbol *x_s; t_symbol *x_path; } t_strippath; static void *strippath_new(t_symbol *s) { t_strippath *x = (t_strippath *)pd_new(strippath_class); x->x_s = s; x->x_path=gensym("./"); symbolinlet_new(&x->x_obj, &x->x_path); outlet_new(&x->x_obj, &s_symbol); return (x); } static void strippath_symbol(t_strippath *x, t_symbol *s) { char *lastslash; char path[MAXPDSTRING], filename[MAXPDSTRING]; x->x_s = s; lastslash=strrchr (s->s_name,'/'); if (lastslash){ strncpy (path,s->s_name,lastslash-s->s_name+1); path[lastslash-s->s_name]=0; strcpy (filename,lastslash+1); // filename[lastslash-s->s_name+1]=0; } else { strcpy (filename,s->s_name); sprintf (path,x->x_path->s_name); } outlet_symbol(x->x_obj.ob_outlet,gensym(filename)); // post ("path:%s , name:%s",path,filename); } static void strippath_bang(t_strippath *x) { if (x->x_s){strippath_symbol (x,x->x_s);} } void strippath_setup(void) { strippath_class = class_new(gensym("strippath"), (t_newmethod)strippath_new, 0, sizeof(t_strippath), 0, A_DEFFLOAT, 0); class_addbang(strippath_class, strippath_bang); class_addsymbol(strippath_class, strippath_symbol); } pd-ext13_0.17.1/messages.c0000644000076500007650000000117411466062316013670 0ustar hanshans#include "m_pd.h" #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); 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-ext13_0.17.1/promiscous~.c0000644000076500007650000000750311466062316014464 0ustar hanshans#ifdef __gnu_linux__ // find a replacement for // then this will work on other UNIXes #include "m_pd.h" #include "ext13.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* ------------------------ promiscous_tilde~ ----------------------------- */ #define DEFAULT_NIC "eth0" //NIC static t_class *promiscous_tilde_class; typedef struct _promiscous_tilde { t_object x_obj; int opened; int sock; char* cbuf; t_symbol* interface; } t_promiscous_tilde; static int setnic_promisc(char *nic_name){ int sock; // socket desc struct ifreq f; struct sockaddr_ll sll; memset(&sll, 0, sizeof(sll)); sll.sll_family = AF_PACKET; sll.sll_protocol = htons(ETH_P_ALL); //if( (sock = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ALL))) < 0){ if( (sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0){ post("promiscous~ failed open socket, must be root (euid)"); return(-1); } //strcpy(f.ifr_name, nic_name); strncpy(f.ifr_name, nic_name, sizeof(f.ifr_name)); if (ioctl(sock, SIOCGIFINDEX, &f) < 0) { post ("promiscous~: error on setting if index"); } #ifdef DEBUG post("promiscous~: ifname : %s",f.ifr_name); post("promiscous~: ifindex: %d",f.ifr_ifindex); #endif sll.sll_ifindex = f.ifr_ifindex; if (bind(sock, (struct sockaddr *) &sll, sizeof(sll)) < 0) { post("promiscous~: couldnt bind to interface: %s", f.ifr_name); } if( ioctl(sock, SIOCGIFFLAGS, &f) < 0) { post("promiscous~ failed to get interface flags, continue anyway"); return(sock); } f.ifr_flags |= IFF_PROMISC; if( ioctl(sock, SIOCSIFFLAGS, &f) < 0) { post("promiscous~ failed to set promisous mode , continue anyway"); } return(sock); } t_int *promiscous_tilde_perform(t_int *w) { t_promiscous_tilde* x = (t_promiscous_tilde*)(w[1]); int n = (int)(w[3]);/*number of samples*/ int l = 0; int ll = 0; int r; int t; static unsigned char packet; fd_set fdset; struct timeval timeout; t_float* out = (t_float *)w[2]; int cptr[n]; if (x->opened){ timeout.tv_sec = 0; timeout.tv_usec = 0; FD_ZERO(&fdset); FD_SET(x->sock,&fdset); if (r = select(x->sock+1,&fdset,NULL,NULL,&timeout) && x->sock){ l = recv(x->sock, &cptr,n, 0); //l = read(x->sock, (char*) &cptr,n); }; if (l < 0) l = 0; while (l--){ t = cptr[n-l]; //post("sample: %d",t); //*out++ = t / 32767.; *out++ = (float) t / (float) pow(2, 32); ll++; } } while (ll < n){ *out++ = 0.; //post("sample: %f",*out); ll++; } return (w + 4); } static void promiscous_tilde_dsp(t_promiscous_tilde *x, t_signal **sp) { dsp_add(promiscous_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); } static void promiscous_tilde_free(t_promiscous_tilde *x){ /*LATER*/ } static void *promiscous_tilde_new(t_symbol *ifname) { t_promiscous_tilde *x = (t_promiscous_tilde *)pd_new(promiscous_tilde_class); outlet_new(&x->x_obj, gensym("signal")); if (*ifname->s_name) x->interface = ifname; else x->interface = gensym(DEFAULT_NIC); if((x->sock = setnic_promisc(x->interface->s_name))<0){ post ("could not open interface"); x->opened = 0; }else{ x->opened = 1; } return (x); } void promiscous_tilde_setup(void) { promiscous_tilde_class = class_new(gensym("promiscous~"), (t_newmethod) promiscous_tilde_new, 0, sizeof(t_promiscous_tilde), CLASS_NOINLET, A_DEFSYM, 0); class_addmethod(promiscous_tilde_class, (t_method) promiscous_tilde_dsp, gensym("dsp"), 0); } #endif pd-ext13_0.17.1/sfwrite13~.c0000644000076500007650000002007611466062316014110 0ustar hanshans/* original source (sfwrite~.c) by Guenter Geiger */ /* added buffering for write-actions to reduce disc-activity */ #include "m_pd.h" #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_TRUNC #endif #define MAX_CHANS 4 /* * ------------------------------------------- sfwrite13~ ------------------------------- */ #define BLOCKTIME 0.01 #define uint32 unsigned int #define uint16 unsigned short static t_class *sfwrite13_class; typedef struct _sfwrite13 { t_object x_obj; t_symbol* filename; int x_file; int do_close; short* cbuf; short* cbufptr; uint32 bufsize; t_int rec; t_int x_channels; uint32 size; t_int x_blocked; t_int x_blockwarn; } t_sfwrite13; 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 sfwrite13_tempbuf(t_sfwrite13 *x,int size) { post("channels:%d",x->x_channels); if (!x->cbuf){ x->cbuf = getbytes(x->x_channels * size*sizeof(short)); x->bufsize = size; }else{ x->cbuf = resizebytes(x->cbuf,x->bufsize * x->x_channels * sizeof(short), x->x_channels * size * sizeof(short)); x->bufsize = size; } x->cbufptr = x->cbuf; } static void sfwrite13_wave_setup(t_sfwrite13* 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 sfwrite13_dowrite(t_sfwrite13 *x) { double timebefore,timeafter,late; int ret; timebefore = sys_getrealtime(); if ((ret =write(x->x_file,x->cbuf,sizeof(short)*(x->cbufptr - x->cbuf))) < (signed int)sizeof(short)*(x->cbufptr - x->cbuf)) { post("sfwrite13: short write %d",ret); } timeafter = sys_getrealtime(); late = timeafter - timebefore; if (late > BLOCKTIME && x->x_blockwarn) { post("sfwrite13 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 += ret ; x->cbufptr = x->cbuf; } static void sfwrite13_close(t_sfwrite13 *x) { if (x->x_file > 0) { t_wave w; sfwrite13_dowrite(x); sfwrite13_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 sfwrite13_open(t_sfwrite13 *x,t_symbol *filename) { char fname[MAXPDSTRING]; if (filename == &s_) { post("sfwrite13: open without filename"); return; } canvas_makefilename(canvas_getcurrent(), filename->s_name, fname, MAXPDSTRING); x->x_blocked = 0; x->filename = filename; post("sfwrite13: filename = %s",x->filename->s_name); sfwrite13_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; x->do_close=0; } static void sfwrite13_block(t_sfwrite13 *x, t_floatarg f) { x->x_blockwarn = f; } static void sfwrite13_float(t_sfwrite13 *x, t_floatarg f) { int t = f; if (t) { post("sfwrite13: start", f); x->rec=1; } else { post("sfwrite13: stop", f); x->rec=0; x->do_close = 1; } } static t_int *sfwrite13_perform(t_int *w) { t_sfwrite13* x = (t_sfwrite13*)(w[1]); t_float * in[4]; int c = x->x_channels; int i,num,n; for (i=0;i < c;i++) { in[i] = (t_float *)(w[2+i]); } n = num = (int)(w[2+c]); if (x->rec && x->x_file) { while (n--) { for (i=0;icbufptr++ = (short)(*(in[i])++ * 32768.); } if ((x->cbufptr - x->cbuf) > (int)(x->bufsize )) {sfwrite13_dowrite(x);} } } if (x->do_close) { sfwrite13_close(x); } return (w+3+c); } static void sfwrite13_dsp(t_sfwrite13 *x, t_signal **sp) { switch (x->x_channels) { case 1: dsp_add(sfwrite13_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); break; case 2: dsp_add(sfwrite13_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); break; case 4: dsp_add(sfwrite13_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 sfwrite13_free(t_sfwrite13* x) { sfwrite13_close(x); } static void *sfwrite13_new(t_floatarg chan) { t_sfwrite13 *x = (t_sfwrite13 *)pd_new(sfwrite13_class); t_int c = chan; if (c<1 || c > MAX_CHANS) c = 1; 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); } sfwrite13_tempbuf(x,8192); return (x); } static void sfwrite13_buffersize(t_sfwrite13 *x,t_floatarg s){ sfwrite13_tempbuf(x,(int)s); } void sfwrite13_setup(void) { sfwrite13_class = class_new(gensym("sfwrite13~"), (t_newmethod)sfwrite13_new, (t_method)sfwrite13_free, sizeof(t_sfwrite13), 0,A_DEFFLOAT,0); class_addmethod(sfwrite13_class,nullfn,gensym("signal"), 0); class_addmethod(sfwrite13_class, (t_method) sfwrite13_dsp, gensym("dsp"), 0); class_addmethod(sfwrite13_class, (t_method) sfwrite13_open, gensym("open"), A_SYMBOL,A_NULL); class_addmethod(sfwrite13_class, (t_method) sfwrite13_close, gensym("close"), 0); class_addmethod(sfwrite13_class, (t_method) sfwrite13_block,gensym("block"),A_DEFFLOAT,0); class_addmethod(sfwrite13_class, (t_method) sfwrite13_buffersize,gensym("buffersize"),A_DEFFLOAT,0); class_addfloat(sfwrite13_class, sfwrite13_float); } void sfwrite13_tilde_setup() { void sfwrite13_setup(); } pd-ext13_0.17.1/LICENSE.txt0000644000076500007650000003574511466062316013553 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-ext13_0.17.1/mandelbrot-help.pd0000644000076500007650000000047111466062316015316 0ustar hanshans#N canvas 0 0 450 300 10; #X obj 184 89 mandelbrot; #X floatatom 186 117 0 0 0; #X floatatom 181 61 4 0 0; #X floatatom 217 29 4 0 0; #X floatatom 267 38 0 0 0; #X obj 296 106 cpuload; #X floatatom 298 140 4 0 0; #X connect 0 0 1 0; #X connect 2 0 0 0; #X connect 3 0 0 1; #X connect 4 0 0 2; #X connect 5 0 6 0; pd-ext13_0.17.1/ossmixer.c0000644000076500007650000002501511466062316013732 0ustar hanshans #ifdef __gnu_linux__ #include "ext13.h" #include "m_pd.h" #include #include #include #include #include #include #include #include #ifndef SOUND_MIXER_READ # define SOUND_MIXER_READ(x) MIXER_READ(x) #endif #ifndef SOUND_MIXER_WRITE # define SOUND_MIXER_WRITE(x) MIXER_WRITE(x) #endif /* -------------------------- ossmixer ------------------------------ */ static t_class *ossmixer_class; typedef struct _ossmixer { t_object x_obj; int channel; t_symbol* channel_name; t_symbol* device; t_outlet *x_out1; } t_ossmixer; static void *ossmixer_new(t_floatarg f) { char devicename[FILENAME_MAX]; int fd = -1; t_ossmixer *x = (t_ossmixer *)pd_new(ossmixer_class); outlet_new(&x->x_obj, &s_bang); x->x_out1 = outlet_new(&x->x_obj, &s_symbol); sprintf(devicename,"/dev/mixer%d",(int)f); // x->device = gensym(devicename); x->device = gensym ("/dev/mixer"); fd = open(x->device->s_name, O_WRONLY); if (fd < 0){ post ("ossmixer: could not open %s",x->device->s_name); x->device = gensym("/dev/mixer"); close (fd); }else{ post ("ossmixer: device set to %s",x->device->s_name); } close(fd); return (x); } static void ossmixer_set_device(t_ossmixer *x, t_floatarg f) { char devicename[FILENAME_MAX]; int fd = -1; sprintf(devicename,"/dev/mixer%d",(int)f); x->device = gensym(devicename); fd = open(x->device->s_name, O_WRONLY); if (fd < 0){ post ("ossmixer: could not open %s",x->device->s_name); x->device = gensym("/dev/mixer"); close (fd); }else{ post ("ossmixer: device set to %s",devicename); } } static void ossmixer_bang(t_ossmixer *x) { post ("ossmixer: what should a mixer do with a bang?"); } static void ossmixer_get(t_ossmixer *x, t_symbol* s) { int vol = -1; x->channel = -1; if (!strncmp(s->s_name,"main",4)) x->channel = (int) SOUND_MIXER_VOLUME; if (!strncmp(s->s_name,"treble",6)) x->channel = (int) SOUND_MIXER_TREBLE; if (!strncmp(s->s_name,"bass",4)) x->channel = (int) SOUND_MIXER_BASS; if (!strncmp(s->s_name,"synth",5)) x->channel = (int) SOUND_MIXER_SYNTH; if (!strncmp(s->s_name,"pcm",3)) x->channel = (int) SOUND_MIXER_PCM; if (!strncmp(s->s_name,"speaker",7)) x->channel = (int) SOUND_MIXER_SPEAKER; if (!strncmp(s->s_name,"line",4)) x->channel = (int) SOUND_MIXER_LINE; if (!strncmp(s->s_name,"line1",5)) x->channel = (int) SOUND_MIXER_LINE1; if (!strncmp(s->s_name,"line2",5)) x->channel = (int) SOUND_MIXER_LINE2; if (!strncmp(s->s_name,"line3",5)) x->channel = (int) SOUND_MIXER_LINE3; if (!strncmp(s->s_name,"mic",3)) x->channel = (int) SOUND_MIXER_MIC; if (!strncmp(s->s_name,"cd",2)) x->channel = (int) SOUND_MIXER_CD; if (!strncmp(s->s_name,"imix",4)) x->channel = (int) SOUND_MIXER_IMIX; if (!strncmp(s->s_name,"altpcm",6)) x->channel = (int) SOUND_MIXER_ALTPCM; if (!strncmp(s->s_name,"reclev",6)) x->channel = (int) SOUND_MIXER_RECLEV; if (!strncmp(s->s_name,"reclevel",8)) x->channel = (int) SOUND_MIXER_RECLEV; if (!strncmp(s->s_name,"igain",5)) x->channel = (int) SOUND_MIXER_IGAIN; if (!strncmp(s->s_name,"ogain",5)) x->channel = (int) SOUND_MIXER_OGAIN; /* braucht das wer? #define SOUND_MIXER_DIGITAL1 17 #define SOUND_MIXER_DIGITAL2 18 #define SOUND_MIXER_DIGITAL3 19 #define SOUND_MIXER_PHONEIN 20 #define SOUND_MIXER_PHONEOUT 21 #define SOUND_MIXER_VIDEO 22 #define SOUND_MIXER_RADIO 23 #define SOUND_MIXER_MONITOR 24 */ if (x->channel > -1){ int fd = -1; /* fd = open("/dev/mixer0", O_RDONLY);*/ fd = open(x->device->s_name, O_RDONLY); if (fd > 0){ int vol = 50; if (ioctl(fd, SOUND_MIXER_READ( x->channel ), &vol)==-1){ post("ossmixer: undefined mixer channel"); }else{ x->channel_name = s; vol = vol & 255; outlet_symbol (x->x_out1,s); outlet_float(x->x_obj.ob_outlet,(t_float)vol); } close(fd); }else{ post ("ossmixer: could not open device %s",x->device->s_name); } } } static void ossmixer_set(t_ossmixer *x, t_symbol* s, t_float f) { int vol = (int) f; if (vol < 0 ){ post ("ossmixer: minimum volume: 0"); vol = 0; } if (vol > 100 ){ post ("ossmixer: maximum volume: 100"); vol = 100; } x->channel = -1; if (!strncmp(s->s_name,"main",4)) x->channel = (int) SOUND_MIXER_VOLUME; if (!strncmp(s->s_name,"treble",6)) x->channel = (int) SOUND_MIXER_TREBLE; if (!strncmp(s->s_name,"bass",4)) x->channel = (int) SOUND_MIXER_BASS; if (!strncmp(s->s_name,"synth",5)) x->channel = (int) SOUND_MIXER_SYNTH; if (!strncmp(s->s_name,"pcm",3)) x->channel = (int) SOUND_MIXER_PCM; if (!strncmp(s->s_name,"speaker",7)) x->channel = (int) SOUND_MIXER_SPEAKER; if (!strncmp(s->s_name,"line",4)) x->channel = (int) SOUND_MIXER_LINE; if (!strncmp(s->s_name,"line1",5)) x->channel = (int) SOUND_MIXER_LINE1; if (!strncmp(s->s_name,"line2",5)) x->channel = (int) SOUND_MIXER_LINE2; if (!strncmp(s->s_name,"line3",5)) x->channel = (int) SOUND_MIXER_LINE3; if (!strncmp(s->s_name,"mic",3)) x->channel = (int) SOUND_MIXER_MIC; if (!strncmp(s->s_name,"cd",2)) x->channel = (int) SOUND_MIXER_CD; if (!strncmp(s->s_name,"imix",4)) x->channel = (int) SOUND_MIXER_IMIX; if (!strncmp(s->s_name,"altpcm",6)) x->channel = (int) SOUND_MIXER_ALTPCM; if (!strncmp(s->s_name,"reclev",6)) x->channel = (int) SOUND_MIXER_RECLEV; if (!strncmp(s->s_name,"reclevel",8)) x->channel = (int) SOUND_MIXER_RECLEV; if (!strncmp(s->s_name,"igain",5)) x->channel = (int) SOUND_MIXER_IGAIN; if (!strncmp(s->s_name,"ogain",5)) x->channel = (int) SOUND_MIXER_OGAIN; if (x->channel > -1){ int fd = -1; fd = open(x->device->s_name, O_WRONLY); if (fd > 0){ vol = vol | (vol << 8); if (ioctl(fd, SOUND_MIXER_WRITE( x->channel ), &vol)==-1){ post("ossmixer: undefined mixer channel"); }else{ x->channel_name = s; vol &= 255; outlet_symbol (x->x_out1,s); outlet_float(x->x_obj.ob_outlet,(t_float)vol); } close (fd); }else{ post ("ossmixer: could not open device %s",x->device->s_name); } } } static void ossmixer_get_source(t_ossmixer *x) { int fd = -1; int channel = -1; fd = open(x->device->s_name, O_WRONLY); if (fd > 0){ if ( ioctl(fd, SOUND_MIXER_READ_RECSRC, &channel) ){ post ("ossmixer: could not get recording source"); }else{ t_symbol* s_ch = gensym("no_source_found"); if (channel & SOUND_MASK_VOLUME) s_ch = gensym("main"); if (channel & SOUND_MASK_PCM) s_ch = gensym("pcm"); if (channel & SOUND_MASK_MIC) s_ch = gensym("mic"); if (channel & SOUND_MASK_CD) s_ch = gensym("cd"); if (channel & SOUND_MASK_SYNTH) s_ch = gensym("synth"); if (channel & SOUND_MASK_LINE) s_ch = gensym("line"); if (channel & SOUND_MASK_LINE1) s_ch = gensym("line1"); if (channel & SOUND_MASK_LINE2) s_ch = gensym("line2"); if (channel & SOUND_MASK_LINE3) s_ch = gensym("line3"); if (channel & SOUND_MASK_ALTPCM) s_ch = gensym("altpcm"); outlet_symbol (x->x_out1,s_ch); outlet_symbol (x->x_obj.ob_outlet,gensym("source")); } close (fd); }else{ post ("ossmixer: could not open mixer device"); } } static void ossmixer_set_source(t_ossmixer *x, t_symbol* s) { int channel = -1; if (!strncmp(s->s_name,"main",4)) channel = (int) SOUND_MASK_VOLUME; if (!strncmp(s->s_name,"treble",6)) channel = (int) SOUND_MASK_TREBLE; if (!strncmp(s->s_name,"bass",4)) channel = (int) SOUND_MASK_BASS; if (!strncmp(s->s_name,"synth",5)) channel = (int) SOUND_MASK_SYNTH; if (!strncmp(s->s_name,"pcm",3)) channel = (int) SOUND_MASK_PCM; if (!strncmp(s->s_name,"speaker",7)) channel = (int) SOUND_MASK_SPEAKER; if (!strncmp(s->s_name,"line",4)) channel = (int) SOUND_MASK_LINE; if (!strncmp(s->s_name,"line1",5)) channel = (int) SOUND_MASK_LINE1; if (!strncmp(s->s_name,"line2",5)) channel = (int) SOUND_MASK_LINE2; if (!strncmp(s->s_name,"line3",5)) channel = (int) SOUND_MASK_LINE3; if (!strncmp(s->s_name,"mic",3)) channel = (int) SOUND_MASK_MIC; if (!strncmp(s->s_name,"cd",2)) channel = (int) SOUND_MASK_CD; if (!strncmp(s->s_name,"imix",4)) channel = (int) SOUND_MASK_IMIX; if (!strncmp(s->s_name,"altpcm",6)) channel = (int) SOUND_MASK_ALTPCM; if (!strncmp(s->s_name,"reclev",6)) channel = (int) SOUND_MASK_RECLEV; if (!strncmp(s->s_name,"reclevel",8)) channel = (int) SOUND_MASK_RECLEV; if (!strncmp(s->s_name,"igain",5)) channel = (int) SOUND_MASK_IGAIN; if (!strncmp(s->s_name,"ogain",5)) channel = (int) SOUND_MASK_OGAIN; if(channel > -1){ int fd = -1; fd = open(x->device->s_name, O_WRONLY); if (fd > 0){ if ( ioctl(fd, SOUND_MIXER_WRITE_RECSRC, &channel) ){ post ("ossmixer: could not set recordiing source"); }else{ ossmixer_get_source(x); } close (fd); }else{ post ("ossmixer: could not open mixer device %s",x->device->s_name); } }else{ post ("ossmixer: channel unknown"); } } static void ossmixer_float(t_ossmixer *x, t_float f) { ossmixer_set (x, x->channel_name, f); } void ossmixer_setup(void) { ossmixer_class = class_new(gensym("ossmixer"), (t_newmethod)ossmixer_new, 0, sizeof(t_ossmixer), 0, A_DEFFLOAT, 0); class_addbang(ossmixer_class, ossmixer_bang); class_addfloat(ossmixer_class, ossmixer_float); class_addmethod(ossmixer_class, (t_method) ossmixer_get, gensym("get"), A_DEFSYM, 0); class_addmethod(ossmixer_class, (t_method) ossmixer_set, gensym("set"), A_DEFSYM, A_DEFFLOAT, 0); class_addmethod(ossmixer_class, (t_method) ossmixer_get_source, gensym("get_source"), A_DEFSYM, 0); class_addmethod(ossmixer_class, (t_method) ossmixer_set_source, gensym("set_source"), A_DEFSYM, 0); class_addmethod(ossmixer_class, (t_method) ossmixer_set_device, gensym("set_device"), A_DEFFLOAT, 0); } #endif pd-ext13_0.17.1/ext13.c0000644000076500007650000000320211466062316013017 0ustar hanshans#ifndef VERSION #define VERSION "0.17" #endif #include "m_pd.h" #ifndef __DATE__ #define __DATE__ "05/22/01" #endif typedef struct _ext13 { t_object x_obj; } t_ext13; static t_class* ext13_class; void kalashnikov_setup(); void filesize_setup(); void openpatch_setup(); void sigsend13_setup(); void sigcatch13_setup(); void sigthrow13_setup(); void sigreceive13_setup(); void strippath_setup(); void streamin13_setup(); void streamout13_setup(); void pipewrite_tilde_setup(); void piperead_tilde_setup(); void wavinfo_setup(); void ftos_setup(); void mandelbrot_setup(); void scramble_tile_setup(); void promiscous_tilde_setup(); void ossmixer_setup(); void send13_setup(); void receive13_setup(); void cdplayer_setup(); void sfwrite13_setup(); static void* ext13_new(t_symbol* s) { t_ext13 *x = (t_ext13 *)pd_new(ext13_class); return (x); } void ext13_setup(void) { ext13_class = class_new(gensym("ext13"), (t_newmethod)ext13_new, 0, sizeof(t_ext13), 0,0); kalashnikov_setup(); filesize_setup(); openpatch_setup(); sigsend13_setup(); sigcatch13_setup(); sigthrow13_setup(); sigreceive13_setup(); strippath_setup(); streamin13_setup(); streamout13_setup(); piperead_tilde_setup(); pipewrite_tilde_setup(); wavinfo_setup(); ftos_setup(); mandelbrot_tilde_setup(); scramble_tilde_setup(); promiscous_tilde_setup(); ossmixer_setup(); send13_setup(); receive13_setup(); cdplayer_setup(); sfwrite13_setup(); post("EXT13 by dieb13@klingt.org"); post("EXT13: version: "VERSION); post("EXT13: compiled: "__DATE__); } pd-ext13_0.17.1/mandelbrot~.c0000644000076500007650000000625011466062316014406 0ustar hanshans#include "m_pd.h" /* ----------------------------- mandelbrot~ ----------------------------- */ t_class *mandelbrot_tilde_class; typedef struct _mandelbrot_tilde { t_object x_obj; float k; float cr; float ci; } t_mandelbrot_tilde; void *mandelbrot_tilde_new(t_symbol *s, t_floatarg f) { t_mandelbrot_tilde *x = (t_mandelbrot_tilde *)pd_new(mandelbrot_tilde_class); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); floatinlet_new(&x->x_obj, &x->k); x->k = f; outlet_new(&x->x_obj, &s_signal); return (x); } static int mandelbrot_calc(t_float *cr, t_float *ci, int k) { int i = -2; t_float zr = 0; t_float zi = 0; t_float z2r = 0; t_float z2i = 0; while ((z2r + z2i < 4 ) && (++i < k )) { z2r = zr * zr; z2i = zi * zi; zi = 2 * zr * zi + *ci; zr = z2r - z2i + *cr; } return(i); } static int mandelbrot_calc8(float cr, float ci, int k) { int i = -2; t_float zr = 0; t_float zi = 0; t_float z2r = 0; t_float z2i = 0; while ((z2r + z2i < 4 ) && (++i < k )) { z2r = zr * zr; z2i = zi * zi; zi = 2 * zr * zi + ci; zr = z2r - z2i + cr; } return(i); } t_int *mandelbrot_tilde_perform(t_int *w) { t_mandelbrot_tilde *x = (t_mandelbrot_tilde *)(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 = (int)(w[5]); while (n--) *out++ = (t_float)mandelbrot_calc (in1++,in2++, x->k); return (w+6); } t_int *mandelbrot_tilde_perf8(t_int *w) { t_mandelbrot_tilde *x = (t_mandelbrot_tilde *)(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 = (int)(w[5]); 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] = mandelbrot_calc8(f0 ,g0,x->k); out[1] = mandelbrot_calc8(f1 ,g1,x->k); out[2] = mandelbrot_calc8(f2 ,g2,x->k); out[3] = mandelbrot_calc8(f3 ,g3,x->k); out[4] = mandelbrot_calc8(f4 ,g4,x->k); out[5] = mandelbrot_calc8(f5 ,g5,x->k); out[6] = mandelbrot_calc8(f6 ,g6,x->k); out[7] = mandelbrot_calc8(f7 ,g7,x->k); } return (w+6); } void dsp_add_mandelbrot_tilde(t_mandelbrot_tilde *x,t_sample *in1, t_sample *in2, t_sample *out, int n) { if (n&7) dsp_add(mandelbrot_tilde_perform, 5, x, in1, in2, out, n); else dsp_add(mandelbrot_tilde_perf8, 5, x, in1, in2, out, n); } void mandelbrot_tilde_dsp(t_mandelbrot_tilde *x, t_signal **sp) { dsp_add_mandelbrot_tilde(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); } void mandelbrot_tilde_setup(void) { mandelbrot_tilde_class = class_new(gensym("mandelbrot~"), (t_newmethod)mandelbrot_tilde_new, 0, sizeof(t_mandelbrot_tilde), 0, A_DEFFLOAT, 0); class_addmethod(mandelbrot_tilde_class, (t_method)mandelbrot_tilde_dsp, gensym("dsp"), 0); CLASS_MAINSIGNALIN(mandelbrot_tilde_class, t_mandelbrot_tilde, k); } pd-ext13_0.17.1/wavinfo.c0000644000076500007650000000754011466062316013535 0ustar hanshans#include "ext13.h" #include "m_pd.h" #include #include #include #include #include #include #include #include #include #ifndef _WIN32 #include #endif /*--*/ /* -------------------------- wavinfo ------------------------------ */ #define BLOCKTIME 0.001 #define uint32 unsigned int #define uint16 unsigned short 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 t_class *wavinfo_class; typedef struct _wavinfo { t_object x_obj; t_float x_samplerate; t_float x_bitspersample; t_float x_channels; t_float x_length; t_float x_nsamples; int x_fd; t_symbol *x_s; t_outlet *x_out0; t_outlet *x_out1; t_outlet *x_out2; t_outlet *x_out3; t_canvas* x_canvas; } t_wavinfo; static void *wavinfo_new(t_symbol *s) { t_wavinfo *x = (t_wavinfo *)pd_new(wavinfo_class); x->x_s = s; // outlet_new(&x->x_obj, &s_float); x->x_out0 = outlet_new(&x->x_obj, &s_float); x->x_out1 = outlet_new(&x->x_obj, &s_float); x->x_out2 = outlet_new(&x->x_obj, &s_float); x->x_out3 = outlet_new(&x->x_obj, &s_float); x->x_canvas = canvas_getcurrent(); return (x); } static void wavinfo_bang(t_wavinfo *x) { // outlet_float(x->x_obj.ob_outlet, x->x_f); } static void wavinfo_symbol(t_wavinfo *x, t_symbol *filename) { struct stat statbuf; t_wave* wavinfo; int result; char fname[MAXPDSTRING]; int ok=(stat(filename->s_name, &statbuf) >= 0); if (ok>0) { canvas_makefilename(x->x_canvas, filename->s_name,fname, MAXPDSTRING); if ((x->x_fd = open(fname,( O_NONBLOCK | O_RDONLY))) < 0) { error("can't open %s",fname); return; } wavinfo = getbytes(sizeof(t_wave)); result=read (x->x_fd,wavinfo,sizeof(t_wave)); if (result > 0){ if (strncmp(wavinfo->w_waveid,"WAVE",4)==0){ x->x_samplerate=(t_float)wavinfo->w_samplespersec; x->x_bitspersample=(t_float)wavinfo->w_nbitspersample; x->x_channels=(t_float)wavinfo->w_nchannels; x->x_length=(t_float)wavinfo->w_datachunksize; x->x_nsamples= x->x_length / (x->x_channels * x->x_bitspersample) * 8; outlet_float(x->x_out3,x->x_samplerate); outlet_float(x->x_out2,x->x_bitspersample); outlet_float(x->x_out1,x->x_channels); outlet_float(x->x_out0,x->x_nsamples); }else{ error("not a valid wave-file"); } }else{ error("could not read wav-header"); } close (x->x_fd); } else post ("wavinfo:file not found"); } void wavinfo_setup(void) { wavinfo_class = class_new(gensym("wavinfo"), (t_newmethod)wavinfo_new, 0, sizeof(t_wavinfo), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)wavinfo_new, gensym("fsize"), A_DEFFLOAT, 0); class_addbang(wavinfo_class, wavinfo_bang); class_addsymbol(wavinfo_class, wavinfo_symbol); } pd-ext13_0.17.1/sfwrite13~-help.pd0000644000076500007650000000020711466062316015211 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/ext13-meta.pd0000644000076500007650000000026311466062316014130 0ustar hanshans#N canvas 15 49 200 200 10; #N canvas 25 49 420 300 META 1; #X text 13 41 NAME ext13; #X text 10 25 AUTHOR d13@klingt.org; #X text 10 10 VERSION 0.17.1; #X restore 10 10 pd META; pd-ext13_0.17.1/filesize.c0000644000076500007650000000236411466062316013675 0ustar hanshans#include "ext13.h" #include "m_pd.h" #include #include #ifndef _WIN32 #include #endif #ifdef _MSC_VER #pragma warning( disable : 4244 ) #pragma warning( disable : 4305 ) #endif /* -------------------------- filesize ------------------------------ */ static t_class *filesize_class; typedef struct _filesize { t_object x_obj; t_float x_f; t_symbol *x_s; } t_filesize; static void *filesize_new(t_symbol *s) { t_filesize *x = (t_filesize *)pd_new(filesize_class); x->x_s = s; outlet_new(&x->x_obj, &s_float); return (x); } static void filesize_bang(t_filesize *x) { outlet_float(x->x_obj.ob_outlet, x->x_f); } static void filesize_symbol(t_filesize *x, t_symbol *s) { struct stat statbuf; int ok=(stat(s->s_name, &statbuf) >= 0); if (ok>0) outlet_float(x->x_obj.ob_outlet,x->x_f=statbuf.st_size); else post ("filesize:file not found"); } void filesize_setup(void) { filesize_class = class_new(gensym("filesize"), (t_newmethod)filesize_new, 0, sizeof(t_filesize), 0, A_DEFFLOAT, 0); class_addcreator((t_newmethod)filesize_new, gensym("fsize"), A_DEFFLOAT, 0); class_addbang(filesize_class, filesize_bang); class_addsymbol(filesize_class, filesize_symbol); } pd-ext13_0.17.1/Makefile0000644000076500007650000002551411466062316013361 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 = ext13 # add your .c source files, one object per file, to the SOURCES # variable, help files will be included automatically SOURCES = catch13~.c filesize.c ftos.c kalashnikov.c mandelbrot~.c mandelbrot.c messages.c openpatch.c piperead~.c pipewrite~.c receive13~.c receive13.c scramble~.c send13~.c send13.c sfwrite13~.c streamin13~.c streamout13~.c strippath.c throw13~.c wavinfo.c # For objects that only build on certain platforms, add those to the SOURCES # line for the right platforms. SOURCES_linux = cdplayer.c ossmixer.c promiscous~.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 = d_global13.h stream13.h ext13.h ext13.c ext13-help.pd CHANGES # NOTE: added -DNONBLOCK so things build on MinGW #------------------------------------------------------------------------------# # # 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 -D'O_NONBLOCK=1' 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-ext13_0.17.1/catch13~-help.pd0000644000076500007650000000020711466062316014610 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/pipewrite~.c0000644000076500007650000001721011466062316014265 0ustar hanshans#include #include "g_canvas.h" #ifdef __gnu_linux__ #include #endif #include #include #include #include #include /* * ------------------------------------------- pipewrite_tilde~ ------------------------------- */ #define MAX_CHANS 4 #define BLOCKTIME 0.001 #define uint32 unsigned int #define uint16 unsigned short #define THERATE 22050 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 t_class *pipewrite_tilde_class; typedef struct _pipewrite_tilde { t_object x_obj; t_symbol* filename; int x_file; int finalize; t_int rec; t_int x_channels; t_int size; t_glist * x_glist; t_int x_blocked; t_int x_blockwarn; short maxval; } t_pipewrite_tilde; static void pipewrite_tilde_wave_setup(t_pipewrite_tilde* 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 = THERATE; /* sample rate in hz */ w->w_navgbytespersec = THERATE * 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 = THERATE * 60 * 60 * 24 *365 /* x->size*/ ; /* length of data chunk */ } static void pipewrite_tilde_close(t_pipewrite_tilde *x) { if (x->x_file > 0) { t_wave w; pipewrite_tilde_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; x->size=0; } static void pipewrite_tilde_open(t_pipewrite_tilde *x,t_symbol *filename) { char fname[MAXPDSTRING]; t_wave w; if (filename == &s_) { post("pipewrite_tilde: open without filename"); return; } canvas_makefilename(glist_getcanvas(x->x_glist), filename->s_name, fname, MAXPDSTRING); x->finalize = 0; x->x_blocked = 0; x->filename = filename; x->maxval=0; x->size=0; post("pipewrite_tilde: filename = %s",x->filename->s_name); /* pipewrite_tilde_close(x); */ /* if ((x->x_file = open(fname,O_WRONLY | O_CREAT | O_NONBLOCK ,0664)) < 0)*/ if ((x->x_file = open(fname,O_WRONLY | O_CREAT | O_NONBLOCK ,0664)) < 0) { error("can't create %s",fname); return; } pipewrite_tilde_wave_setup(x,&w); write(x->x_file,&w,sizeof(w)); } static void pipewrite_tilde_block(t_pipewrite_tilde *x, t_floatarg f) { x->x_blockwarn = f; } static void pipewrite_tilde_float(t_pipewrite_tilde *x, t_floatarg f) { int t = f; if (t) { if ( !(x->x_file > 0)){ post ("pipewrite_tilde:dont have a file to record to"); }else{ post("pipewrite_tilde: start", f); x->rec=1; } } else { post("pipewrite_tilde: stop", f); x->rec=0; x->finalize=1; } } static short out[4*64]; static t_int *pipewrite_tilde_perform(t_int *w) { t_pipewrite_tilde* x = (t_pipewrite_tilde*)(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;i 1. ) { *(in[i]) = 1. ; } if (*(in[i]) < -1. ) { *(in[i]) = -1. ; } *tout++ = (*(in[i])++ * 32768.); /* if (abs(*tout)>abs(x->maxval)){ x->maxval=*tout; post("new maxval:%d, c:%d",x->maxval,c); } */ } } timebefore = sys_getrealtime(); if ((ret =write(x->x_file,out,sizeof(short)*num*c)) < sizeof(short)*num*c) { post("pipewrite_tilde: short write %d",ret); } timeafter = sys_getrealtime(); late = timeafter - timebefore; x->size +=ret; /* OK, we let only 10 ms block here */ if (late > BLOCKTIME && x->x_blockwarn) { post("pipewrite_tilde blocked %f ms",late*1000); x->x_blocked++; if (x->x_blocked > x->x_blockwarn) { /* x->rec = 0;*/ post("maximum blockcount %d reached, recording normalerweise stopped (set blockcount with \"block \"",x->x_blockwarn); } } } if (!x->rec && x->finalize){ pipewrite_tilde_close(x); x->finalize = 0; } return (w+3+c); } static void pipewrite_tilde_dsp(t_pipewrite_tilde *x, t_signal **sp) { switch (x->x_channels) { case 1: dsp_add(pipewrite_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n); break; case 2: dsp_add(pipewrite_tilde_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); break; case 4: dsp_add(pipewrite_tilde_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 pipewrite_tilde_free(t_pipewrite_tilde* x) { pipewrite_tilde_close(x); } static void *pipewrite_tilde_new(t_floatarg chan) { t_pipewrite_tilde *x = (t_pipewrite_tilde *)pd_new(pipewrite_tilde_class); t_int c = chan; if (c<1 || c > MAX_CHANS) c = 1; x->x_glist = (t_glist*) canvas_getcurrent(); x->x_channels = c--; post("channels:%d",x->x_channels); x->x_file=0; x->rec = 0; x->finalize = 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 pipewrite_tilde_setup(void) { pipewrite_tilde_class = class_new(gensym("pipewrite~"), (t_newmethod)pipewrite_tilde_new, (t_method)pipewrite_tilde_free, sizeof(t_pipewrite_tilde), 0,A_DEFFLOAT,0); class_addmethod(pipewrite_tilde_class,nullfn,gensym("signal"), 0); class_addmethod(pipewrite_tilde_class, (t_method) pipewrite_tilde_dsp, gensym("dsp"), 0); class_addmethod(pipewrite_tilde_class, (t_method) pipewrite_tilde_open, gensym("open"), A_SYMBOL,A_NULL); class_addmethod(pipewrite_tilde_class, (t_method) pipewrite_tilde_close, gensym("close"), 0); class_addmethod(pipewrite_tilde_class, (t_method)pipewrite_tilde_block,gensym("block"),A_DEFFLOAT,0); class_addfloat(pipewrite_tilde_class, pipewrite_tilde_float); } pd-ext13_0.17.1/send13~-help.pd0000644000076500007650000000020711466062316014457 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/piperead~-help.pd0000644000076500007650000000153711466062316015162 0ustar hanshans#N canvas 303 26 450 397 10; #X msg 102 140 1; #X msg 81 90 0; #X obj 226 21 loadbang; #X msg 226 47 \; pd dsp 1; #X obj 63 67 osc~ 440; #X msg 94 117 open /usr/local/pd/ext13/doc/pipein.wav; #X obj 246 231 dac~; #X obj 63 179 pipewrite~ 2; #X obj 142 65 osc~ 480; #X obj 224 192 piperead~ 2; #X msg 165 140 open /usr/local/pd/ext13/doc/pipein.wav; #X msg 227 164 1; #X msg 261 166 0; #X text 26 256 pipewrite/read: argument: number of channels you can create a pipe/fifo from within a shell with mknod pipename p and use this construct to send signals to another program/process. useful if you run more than one pd or mpeg-players \, ...; #X connect 0 0 7 0; #X connect 1 0 7 0; #X connect 2 0 3 0; #X connect 4 0 7 0; #X connect 5 0 7 0; #X connect 8 0 7 1; #X connect 9 0 6 0; #X connect 9 1 6 1; #X connect 10 0 9 0; #X connect 11 0 9 0; #X connect 12 0 9 0; pd-ext13_0.17.1/stream13.h0000644000076500007650000000034311466062316013522 0ustar hanshans/* (C) Guenter Geiger 1999 */ #define SF_FLOAT 1 #define SF_16BIT 2 #define SF_8BIT 3 #define SF_MP3 4 #define SF_SIZEOF(a) (a == SF_FLOAT ? sizeof(t_float) : \ a == SF_16BIT ? sizeof(short) : 1) pd-ext13_0.17.1/streamout13~-help.pd0000644000076500007650000000307011466062316015552 0ustar hanshans#N canvas 165 0 804 625 10; #X obj 18 107 streamin13~ 8008 4; #X obj 19 496 streamout13~ localhost 8008 4; #X text 15 13 streamin13~/out13~ :; #X text 14 27 like streamin~/out~ from ggee but; #X text 14 41 for multiple channels; #X text 15 55 and reduced udp-traffic; #X text 16 70 warning: not well tested; #X text 161 110 receives 4 channels in port 8808; #X obj 18 150 dac~ 1; #X obj 68 150 dac~ 2; #X obj 121 150 dac~ 3; #X obj 175 151 dac~ 4; #X obj 74 462 osc~ 440; #X obj 145 463 osc~ 880; #X obj 214 462 osc~ 990; #X obj 281 463 osc~ 220; #X text 245 497 sends 4 dsp-channels to localhost:8008; #X msg 19 202 connect foo.com 8008; #X msg 32 235 disconnect; #X text 175 203 to build up a connection and start sending; #X text 117 236 guess; #X msg 46 263 format float; #X msg 56 287 format 16bit; #X msg 72 311 format 8bit; #X text 165 284 format defines the resolution of the sent signal; #X text 168 302 float is the most expensive with the best resolution (32bit); #X text 181 337 change the hostname you are sending to; #X msg 85 337 host bar.org; #X msg 101 364 grain 512; #X text 185 363 the number of samples sent at a time; #X text 347 462 the signals to send; #X floatatom 19 528 5 0 0; #X text 72 530 status: 1 = connected 0 = disconnected; #X connect 0 0 8 0; #X connect 0 1 9 0; #X connect 0 2 10 0; #X connect 0 3 11 0; #X connect 1 0 31 0; #X connect 12 0 1 0; #X connect 13 0 1 1; #X connect 14 0 1 2; #X connect 15 0 1 3; #X connect 17 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 1 0; #X connect 27 0 1 0; #X connect 28 0 1 0; pd-ext13_0.17.1/receive13~-help.pd0000644000076500007650000000020711466062316015150 0ustar hanshans#N canvas 3 48 450 300 10; #X text 50 110 This is a placeholder help patch. You can help by making a real help patch for this object!; pd-ext13_0.17.1/ext13.h0000644000076500007650000000016311466062316013027 0ustar hanshans#ifndef __EXT13_H__ #define __EXT13_H__ #define BACKGROUND "-fill white" #define BACKGROUNDCOLOR "white" #endif pd-ext13_0.17.1/streamin13~.c0000644000076500007650000001725211466062316014251 0ustar hanshans /* Written by Guenter Geiger (C) 1999, adapted and changed to streamin13~ by d13@klingt.org */ #include "m_pd.h" #include "stream13.h" #include #include #ifdef _WIN32 #include #else #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 #define INBUFSIZE 8192 #define MAXDROPS 99 /* Utility functions */ 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 } /* ------------------------ streamin13~ ----------------------------- */ static t_class *streamin13_class; typedef struct _streamin13 { t_object x_obj; int x_connectsocket; int x_nconnections; int x_ndrops; int x_ndone; int x_fd; int x_format; int x_n; short* cbuf; int nsamples; // t_outlet *x_out2; int blocksperreceive; int blockssincereceive; } t_streamin13; static void streamin13_tempbuf(t_streamin13 *x,int size) { int fullsize = size * x->x_n; if (!x->cbuf) x->cbuf = getbytes(fullsize*sizeof(t_float)*x->blocksperreceive+4); else x->cbuf = resizebytes(x->cbuf,x->nsamples*sizeof(t_float),fullsize*sizeof(t_float)*x->blocksperreceive+4); x->nsamples = size; x->blockssincereceive=0; } static int streamin13_listen(t_streamin13 *x,int portno) { struct sockaddr_in server; int sockfd; static int on = 1; #ifndef _WIN32 shutdown(x->x_connectsocket,SHUT_RDWR); #else shutdown(x->x_connectsocket,SD_BOTH); #endif sys_closesocket(x->x_connectsocket); sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { sys_sockerror("streamin-socket"); x->x_connectsocket = 0; return (0); } server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; #if defined(__linux__) || defined(__APPLE__) if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) post("setsockopt failed\n"); #endif /* assign server port number */ server.sin_port = htons((u_short)portno); post("listening to port number %d", portno); /* name the socket */ if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) { sys_sockerror("streamin-bind"); sys_closesocket(sockfd); x->x_connectsocket = 0; }else { x->x_connectsocket = sockfd; x->x_nconnections = 0; x->x_ndrops = 0; x->x_format = SF_FLOAT; x->cbuf = NULL; x->blocksperreceive=16; x->blockssincereceive=0; streamin13_tempbuf(x,64); } return(0); } static void *streamin13_new(t_floatarg fportno ,t_floatarg xn) { int i; t_streamin13 *x = (t_streamin13 *)pd_new(streamin13_class); struct sockaddr_in server; streamin13_listen(x,(int)fportno); outlet_new(&x->x_obj, &s_signal); x->x_n = xn; for (i = 0 ;i < x->x_n - 1;i++){ outlet_new(&x->x_obj, gensym("signal")); } return (x); } static void streamin13_free(t_streamin13 *x) { /* LATER make me clean up open connections */ } static t_int *streamin13_perform(t_int *w) { t_streamin13* x = (t_streamin13*) (w[1]); int offset = 3; int i,j; int n = (int)(w[2]); struct timeval timeout; int packsize; int ret; int length; short* cbuf; #ifndef _WIN32 t_float *out[x->x_n]; #else t_float **out = (t_float**) malloc(x->x_n * sizeof(t_float*)); #endif #ifndef _WIN32 fd_set fdset; #endif for (i=0;i < x->x_n;i++) { out[i] = (t_float *)(w[offset+i]); } if (x->x_connectsocket){ timeout.tv_sec = 0; timeout.tv_usec = 0; if (n != x->nsamples) streamin13_tempbuf(x,n); // cbuf = x->cbuf + x->blockssincereceive * n * x->x_n; #ifndef _WIN32 FD_SET(x->x_connectsocket,&fdset); if (!select(x->x_connectsocket+1,&fdset,NULL,NULL,&timeout) || !FD_ISSET(x->x_connectsocket,&fdset)) { x->x_ndrops++; if (x->x_ndrops <= MAXDROPS) { /* post("streamin13: drop"); */ while (n--){ for (j=0;jx_n;j++){ *(out[j]++) = 0.0; } } } free(out); return (w+offset+1+i); } else { x->x_ndone++; } #endif if (x->x_ndrops > MAXDROPS) { post("streamin13: dropped %d signal vectors, received %d sigvecs.",x->x_ndrops,x->x_ndone); x->x_ndrops=0; x->x_ndone=0; } if (!(x->blockssincereceive < x->blocksperreceive -1)) { length=x->x_n * x->nsamples * SF_SIZEOF(x->x_format) * x->blocksperreceive +4; ret = recv(x->x_connectsocket, (char*) x->cbuf,length, 0); x->blockssincereceive=0; if (x->x_format != *x->cbuf){ x->x_format= (short) *x->cbuf; } cbuf = (short*) x->cbuf + 1; if (x->blocksperreceive != (short) *cbuf){ x->blocksperreceive=(short) *cbuf; streamin13_tempbuf(x,x->nsamples); } }else{ x->blockssincereceive++; } packsize=n * x->x_n * sizeof(short) * x->blocksperreceive + 2; switch (x->x_format) { case SF_FLOAT:{ t_float* fbuf = (t_float*) x->cbuf + x->blockssincereceive * n * x->x_n + 1; while (n--){ for (j=0;jx_n;j++){ *out[j]++ = *fbuf++; } } break; } case SF_16BIT: { cbuf = x->cbuf + x->blockssincereceive * n * x->x_n + 2; while (n--){ for (j=0;jx_n;j++){ *out[j]++ = (float) *cbuf++/32767.; } } break; } case SF_8BIT: { signed char* cbuf = (signed char*) x->cbuf + x->blockssincereceive * n * x->x_n + 4; while (n--){ for (j=0;jx_n;j++){ *out[j]++ = (float) *cbuf++/127.; } } break; } default: break; } } #ifdef _WIN32 free(out); #endif return (w+offset+1+i); } static void streamin13_dsp(t_streamin13 *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;i++) myvec[2 + i] = (t_int*)sp[i]->s_vec; dsp_addv(streamin13_perform, x->x_n + 3, (t_int*)myvec); freebytes(myvec,sizeof(t_int)*(x->x_n + 3)); } static void streamin13_port(t_streamin13 *x,t_floatarg port) { streamin13_listen(x, (int)port); } void streamin13_setup(void) { streamin13_class = class_new(gensym("streamin13~"), (t_newmethod) streamin13_new, (t_method) streamin13_free, sizeof(t_streamin13), A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, 0); class_addmethod(streamin13_class, nullfn, gensym("signal"), 0); class_addmethod(streamin13_class, (t_method) streamin13_dsp, gensym("dsp"), 0); class_addmethod(streamin13_class, (t_method)streamin13_port,gensym("port"),A_DEFFLOAT,0); } void streamin13_tilde_setup() { streamin13_setup(); } pd-ext13_0.17.1/cdplayer.c0000644000076500007650000001061311466062316013662 0ustar hanshans#ifdef __gnu_linux__ #include "ext13.h" #include "m_pd.h" #include #include #include #include #include #include #include #include /* -------------------------- cdplayer ------------------------------ */ static t_class *cdplayer_class; typedef struct _cdplayer { t_object x_obj; t_symbol* device; } t_cdplayer; static void *cdplayer_new() { char* devicename; int fd; t_cdplayer *x = (t_cdplayer *)pd_new(cdplayer_class); outlet_new(&x->x_obj, &s_bang); sprintf(devicename,"/dev/cdrom"); x->device = gensym(devicename); /* fd = open(x->device->s_name, O_RDONLY); if (fd < 0){ post ("cdplayer: could not open %s",x->device->s_name); } else close(fd); */ return (x); } static void cdplayer_play(t_cdplayer *x, t_floatarg f) { struct cdrom_tochdr header; struct cdrom_ti index; int cdrom; int childpid; int maxTrack; int t = (int)f; childpid = fork(); if (childpid < 0) { error ("cdplayer: could not fork!"); } if (!childpid){ cdrom = open(x->device->s_name,O_RDONLY); // Open device if (cdrom > -1){ ioctl(cdrom,CDROMREADTOCHDR,(void *) &header); // Get start and end tracks maxTrack = header.cdth_trk1; if (t < 1){ post ("track number must be 0 or higher"); } if (t > maxTrack){ post ("track number too high"); } index.cdti_trk0=t; // Set first track index.cdti_ind0=0; // Start of track index.cdti_trk1=t; // Set final track index.cdti_ind1=99; // End of track ioctl(cdrom,CDROMPLAYTRKIND,(void *) &index); // Play the tracks exit (0); }else{ error ("cdplayer: could not open %s",x->device->s_name); } close (cdrom); } } static void cdplayer_pause(t_cdplayer *x) { int cdrom; int childpid; childpid = fork(); if (childpid < 0) { error ("cdplayer: could not fork!"); } if (!childpid){ cdrom = open(x->device->s_name,O_RDONLY); if (cdrom > -1){ ioctl(cdrom,CDROMPAUSE,0); close (cdrom); exit (0); }else{ error ("cdplayer: could not open %s",x->device->s_name); } } } static void cdplayer_resume(t_cdplayer *x) { int cdrom; int childpid; childpid = fork(); if (childpid < 0) { error ("cdplayer: could not fork!"); } if (!childpid){ cdrom = open(x->device->s_name,O_RDONLY); if (cdrom > -1){ ioctl(cdrom,CDROMRESUME,0); close (cdrom); exit (0); }else{ error ("cdplayer: could not open %s",x->device->s_name); } } } static void cdplayer_stop(t_cdplayer *x) { int cdrom; int childpid; childpid = fork(); if (childpid < 0) { error ("cdplayer: could not fork!"); } if (!childpid){ cdrom = open(x->device->s_name,O_RDONLY); if (cdrom > -1){ ioctl(cdrom,CDROMSTOP,0); close (cdrom); exit (0); }else{ error ("cdplayer: could not open %s",x->device->s_name); } } } static void cdplayer_eject(t_cdplayer *x) { int cdrom; int childpid; childpid = fork(); if (childpid < 0) { error ("cdplayer: could not fork!"); } if (!childpid){ cdrom = open(x->device->s_name,O_RDONLY); if (cdrom > -1){ ioctl(cdrom,CDROMEJECT,0); close (cdrom); exit (0); }else{ error ("cdplayer: could not open %s",x->device->s_name); } } } static void cdplayer_float(t_cdplayer *x, t_float f) { cdplayer_play(x,f); } void cdplayer_setup(void) { cdplayer_class = class_new(gensym("cdplayer"), (t_newmethod)cdplayer_new, 0, sizeof(t_cdplayer), 0, 0); class_addfloat(cdplayer_class, cdplayer_float); class_addmethod(cdplayer_class, (t_method) cdplayer_play, gensym("play"), A_DEFFLOAT,0); class_addmethod(cdplayer_class, (t_method) cdplayer_pause, gensym("pause"), 0); class_addmethod(cdplayer_class, (t_method) cdplayer_resume, gensym("resume"), 0); class_addmethod(cdplayer_class, (t_method) cdplayer_stop, gensym("stop"), 0); class_addmethod(cdplayer_class, (t_method) cdplayer_eject, gensym("eject"), 0); } #endif pd-ext13_0.17.1/openpatch-help.pd0000644000076500007650000000045211466062316015147 0ustar hanshans#N canvas 19 591 373 232 10; #X obj 47 87 openpatch; #X text 120 88 =; #X obj 136 89 opa; #X msg 105 49 /tmp; #X msg 47 49 foo.pd; #X text 43 13 this would open /tmp/tst.pd; #X text 24 161 but you can also use; #X msg 176 160 \; pd open foo.pd /tmp/ 1 1 \;; #X connect 3 0 0 1; #X connect 4 0 0 0; pd-ext13_0.17.1/mandelbrot~-help.pd0000644000076500007650000000231711466062316015515 0ustar hanshans#N canvas 0 0 450 300 10; #X obj 114 209 env~; #X floatatom 115 237 4 0 0; #X floatatom 227 135 4 0 0; #X floatatom 118 19 4 0 0; #X floatatom 182 27 4 0 0; #X obj 113 170 mandelbrot~ 500; #X obj 172 211 snapshot~; #X floatatom 186 243 4 0 0; #X obj 258 164 ticker 15 15; #X obj 244 186 metro 100; #X obj 50 258 dac~; #X obj 113 107 line~; #X obj 163 110 line~; #X obj 266 99 snapshot~; #X floatatom 280 131 4 0 0; #X obj 352 52 ticker 15 15; #X obj 338 74 metro 100; #X msg 181 80 \$1 1000; #X msg 105 75 \$1 1000; #X obj 183 52 * 0.01; #X obj 111 51 * 0.01; #X obj 238 19 random 100; #X obj 42 215 /~ 50; #X obj 350 142 cpuload; #X floatatom 354 167 4 0 0; #X connect 0 0 1 0; #X connect 2 0 5 2; #X connect 2 0 22 1; #X connect 3 0 20 0; #X connect 4 0 19 0; #X connect 5 0 6 0; #X connect 5 0 0 0; #X connect 5 0 22 0; #X connect 6 0 7 0; #X connect 8 0 9 0; #X connect 9 0 6 0; #X connect 11 0 5 0; #X connect 12 0 5 1; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 15 0 16 0; #X connect 16 0 13 0; #X connect 16 0 21 0; #X connect 17 0 12 0; #X connect 18 0 11 0; #X connect 19 0 17 0; #X connect 20 0 18 0; #X connect 21 0 4 0; #X connect 21 0 3 0; #X connect 22 0 10 0; #X connect 22 0 10 1; #X connect 23 0 24 0;