diff --git a/externals/mrpeach/net/udpreceive~-help.pd b/externals/mrpeach/net/udpreceive~-help.pd index c7ed70ac30b39cd6e1e7914be95411c9ba52f780..d0eb6ea51fcbd6653fa4fc8b0b2a0d4a4ef210df 100644 --- a/externals/mrpeach/net/udpreceive~-help.pd +++ b/externals/mrpeach/net/udpreceive~-help.pd @@ -1,65 +1,72 @@ -#N canvas 221 129 767 415 10; -#N canvas 874 257 494 344 META 0; -#X text 12 155 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan +#N canvas 221 129 832 415 10; +#N canvas 872 257 494 344 META 0; +#X text 12 188 HELP_PATCH_AUTHORS "pd meta" information added by Jonathan Wilkes for Pd version 0.42.; #X text 12 25 LICENSE GPL v2 or later; -#X text 12 135 AUTHOR Martin Peach; #X text 12 5 KEYWORDS control network; #X text 12 45 DESCRIPTION receive datagrams over a udp connection and outputs them as a signal; -#X restore 695 379 pd META; -#X obj 522 267 print udpreceive~; -#X symbolatom 177 354 10 0 0 0 - - -; -#X floatatom 211 288 5 0 0 0 - - -; -#X floatatom 246 267 7 0 0 0 - - -; -#X floatatom 280 332 9 0 0 0 - - -; -#X obj 177 313 prepend set; -#X text 147 287 channels:; -#X text 131 353 format:; -#X text 231 331 bitrate:; -#X text 182 266 framesize:; -#X floatatom 315 289 9 0 0 0 - - -; -#X floatatom 349 267 9 0 0 0 - - -; -#X floatatom 384 310 5 0 0 0 - - -; -#X floatatom 418 289 5 0 0 0 - - -; -#X text 258 288 overflow:; -#X text 289 266 underflow:; -#X text 323 309 queuesize:; -#X text 370 288 average:; -#X msg 35 58 info; -#X msg 15 38 reset; -#X text 68 57 status info to rightmost outlet; -#X text 53 37 reset underflow & overflow counters; -#X floatatom 210 169 3 0 0 0 - - -; -#X floatatom 233 169 3 0 0 0 - - -; -#X floatatom 256 169 3 0 0 0 - - -; -#X floatatom 279 169 3 0 0 0 - - -; -#X floatatom 303 169 5 0 0 0 - - -; -#X obj 210 143 unpack 0 0 0 0 0; -#X text 173 168 from:; -#X obj 82 152 dac~ 1 2; -#X floatatom 453 332 9 0 0 0 - - -; -#X text 401 331 packets:; -#X text 348 142 To communicate \, a [udpreceive~] and [udpsend~] pair +#X text 12 161 AUTHOR Martin Peach with additional features by Ivica +Ico Bukvic; +#X text 11 76 INLET_0 signal port reset info buffer; +#X text 11 99 OUTLET_N incoming signal over network (variable); +#X text 11 124 OUTLET_R last three outlets are for signal level \, +object status \, and incoming data packet address info; +#X restore 753 382 pd META; +#X obj 580 270 print udpreceive~; +#X symbolatom 235 357 10 0 0 0 - - -; +#X floatatom 269 291 5 0 0 0 - - -; +#X floatatom 304 270 7 0 0 0 - - -; +#X floatatom 338 335 9 0 0 0 - - -; +#X obj 235 316 prepend set; +#X text 205 290 channels:; +#X text 189 356 format:; +#X text 289 334 bitrate:; +#X text 240 269 framesize:; +#X floatatom 373 292 9 0 0 0 - - -; +#X floatatom 407 270 9 0 0 0 - - -; +#X floatatom 442 313 5 0 0 0 - - -; +#X floatatom 476 292 5 0 0 0 - - -; +#X text 316 291 overflow:; +#X text 347 269 underflow:; +#X text 381 312 queuesize:; +#X text 428 291 average:; +#X msg 93 61 info; +#X msg 73 41 reset; +#X text 126 60 status info to rightmost outlet; +#X text 111 40 reset underflow & overflow counters; +#X floatatom 268 172 3 0 0 0 - - -; +#X floatatom 291 172 3 0 0 0 - - -; +#X floatatom 314 172 3 0 0 0 - - -; +#X floatatom 337 172 3 0 0 0 - - -; +#X floatatom 361 172 5 0 0 0 - - -; +#X obj 268 146 unpack 0 0 0 0 0; +#X text 231 171 from:; +#X obj 140 155 dac~ 1 2; +#X floatatom 511 335 9 0 0 0 - - -; +#X text 459 334 packets:; +#X text 406 145 To communicate \, a [udpreceive~] and [udpsend~] pair must have the same number of channels and the same blocksize. Also [udpsend~] must [connect( to the port on which [udpreceive~] is listening. ; -#X msg 56 79 buffer 2; -#X text 118 78 set number of frames to buffer before playback; -#X obj 177 230 route format channels framesize bitrate overflow underflow +#X msg 113 81 buffer 2; +#X text 176 81 set number of frames to buffer before playback; +#X obj 235 233 route format channels framesize bitrate overflow underflow queuesize average packets tag_errors; -#X floatatom 487 310 9 0 0 0 - - -; -#X text 421 309 tag errors:; -#X obj 144 181 env~; -#X floatatom 144 204 9 0 0 0 - - -; -#X text 204 193 The rightmost signal outlet outputs 1 if the stream +#X floatatom 545 313 9 0 0 0 - - -; +#X text 479 312 tag errors:; +#X obj 202 184 env~; +#X floatatom 202 207 9 0 0 0 - - -; +#X text 262 196 The rightmost signal outlet outputs 1 if the stream is valid \, else 0; -#X text 420 77 Arguments: port \, channels \, blocksize \, multicast_address. +#X text 478 80 Arguments: port \, channels \, blocksize \, multicast_address. Blocksize should match [udpsend~]. multicast_address is optional. Arguments must be in that order.; -#X obj 81 121 udpreceive~ 9999 2 512; -#X text 221 120 receives 2 channels on port 9999 Same blocksize as +#X obj 139 124 udpreceive~ 9999 2 512; +#X text 279 123 receives 2 channels on port 9999 Same blocksize as udpsend~; +#X msg 53 21 port 9000; +#X text 114 20 change port after creation; #X connect 6 0 2 0; #X connect 19 0 43 0; #X connect 20 0 43 0; @@ -86,3 +93,4 @@ udpsend~; #X connect 43 2 39 0; #X connect 43 3 36 0; #X connect 43 4 28 0; +#X connect 45 0 43 0; diff --git a/externals/mrpeach/net/udpreceive~.c b/externals/mrpeach/net/udpreceive~.c index 86a7f082b2dbb7491f1f7b43468d55f451875ec3..2c18ba7d7305b64f95b3705927a3bbb92d1b61ed 100644 --- a/externals/mrpeach/net/udpreceive~.c +++ b/externals/mrpeach/net/udpreceive~.c @@ -389,6 +389,11 @@ static int udpreceive_tilde_createsocket(t_udpreceive_tilde* x, char *address, i return 1; } +static int udpreceive_tilde_setsocket(t_udpreceive_tilde* x, t_float portno) +{ + udpreceive_tilde_createsocket(x, x->x_addr_name, (int)portno); +} + /* Queue is 1 to 16 frames long */ #define QUEUESIZE (int)((x->x_framein + DEFAULT_AUDIO_BUFFER_FRAMES - x->x_frameout) % DEFAULT_AUDIO_BUFFER_FRAMES) /* Block is a set of sample vectors inside a frame, one vector per channel */ @@ -795,6 +800,7 @@ void udpreceive_tilde_setup(void) class_addmethod(udpreceive_tilde_class, (t_method)udpreceive_tilde_dsp, gensym("dsp"), 0); class_addmethod(udpreceive_tilde_class, (t_method)udpreceive_tilde_reset, gensym("reset"), A_DEFFLOAT, 0); class_addmethod(udpreceive_tilde_class, (t_method)udpreceive_tilde_reset, gensym("buffer"), A_DEFFLOAT, 0); + class_addmethod(udpreceive_tilde_class, (t_method)udpreceive_tilde_setsocket, gensym("port"), A_DEFFLOAT, 0); post("udpreceive~ v%s, (c) 2004 Olaf Matthes, 2010 Martin Peach", VERSION); ps_format = gensym("format");