[PD] array indirection
Chuckk Hubbard
badmuthahubbard at gmail.com
Mon Dec 10 20:21:47 CET 2007
Well-done, that looks like the perfect solution. I did notice these
functions mentioned in the code, with xmargin and ymargin as arguments
of a longer function call, but I hadn't followed up to see what else
went in the message.
I believe this is your answer, Phil.
Another one for msg-docs, I think.
-Chuckk
On Dec 10, 2007 1:11 PM, Jean-Yves GRATIUS <jygratius at freesurf.fr> wrote:
>
>
> Hi,
> I have tried to change graph-on-parents settings by message for displaying
> different arrays, it seems to work..
> I did'nt test it with large tables.
> (included patch : switchingGOPtables.pd).
>
> Jean Yves Gratius <http://jy.gratius.free.fr>
>
>
> Chuckk Hubbard a écrit :
>
>
> On Dec 9, 2007 10:50 PM, Phil Stone <pkstone at ucdavis.edu> wrote:
>
> Hi Chuck,
>
> I think you're right; there's no way to avoid the copying. It's good to
> dream, though. :-)
>
> I have done some experimenting, and I think I'm on to something. If
> you create a graph from the put menu, then right-click and select
> Open; and then Put an array on the opened subpatch, you can see the
> red outline where you can decide what will be graphed-on the parent
> graph.
>
> It would not be too hard to send editmode and mouse movement messages
> to that canvas to move arrays around inside it; and it probably would
> actually be more efficient than copying. But I also notice that the
> graph subpatch has, in its options, an x and y margin, which moves the
> red outline. IF it's possible to change these values with messages,
> it could be trivial to move that red outline to cover several
> well-placed arrays, meaning that the graph would indeed switch arrays
> like you want.
> I started to look at the Pd code to see if I can find such a message
> mentioned; if I find it I'll let you know.
>
> -Chuckk
>
>
>
>
> Chuckk Hubbard wrote:
>
> It would be possible, if not CPU-efficient, to have them all hidden in
> table objects, and simply use tabread and tabwrite to copy them to the
> skeleton array when you want to switch. You would only need one
> tabread and tabwrite pair, just different ways to specify the target
> of tabread.
> I would envision binding the tab key to page through them.
>
> But it is possible to put several arrays in one graph which makes me
> wonder if there might even be a pure GUI way to do it. Kind of makes
> me want to take a look...
>
> -Chuckk
>
> On Dec 8, 2007 10:26 PM, Phil Stone <pkstone at ucdavis.edu> wrote:
>
>
> This probably fits into the category of a wish for PD; I think there's
> no way to do it currently, but I'd love to be proven wrong!
>
> I'd like to be able to change the data an array points to rather than
> actually change the data in the array. The scenario which me think of
> this is, I'd like to have a display of a currently-selected waveform
> (which could be one of many pre-allocated arrays). It would be
> wonderful to have a level of indirection where the display-array can be
> given a new address [object reference?] to one of the various
> pre-allocated arrays, after which it redraws itself.
>
> I suppose this unleashes all the evils of pointers (multiple references
> to memory, etc.), but it would a serious advantage, performance-wise,
> for the scenario I'm envisioning.
>
> I also think it would be very cool if arrays could act as buttons...but
> that's a different subject.
>
>
> Phil Stone
> pkstonemusic.com
>
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
>
>
>
>
>
>
>
>
>
>
> #N canvas 303 9 704 687 10;
> #N canvas 0 524 610 502 subpatch 0;
> #X obj 201 120 cnv 15 200 150 empty empty empty 20 12 0 14 -233017
> -66577 0;
> #X obj 200 321 cnv 15 200 150 empty empty empty 20 12 0 14 -233017
> -66577 0;
> #N canvas 0 0 450 300 graph4 0;
> #X array table2 100 float 1;
> #A 0 0 0 0 0.0714288 0.157143 0.171429 0.257144 0.314287 0.342858 0.400002
> 0.457145 0.514288 0.557145 0.600002 0.657145 0.700003 0.714288 0.757146
> 0.757146 0.771431 0.785717 0.785717 0.785717 0.800003 0.800003 0.814289
> 0.814289 0.814289 0.814289 0.814289 0.814289 0.814289 0.814289 0.814289
> 0.800003 0.757146 0.614288 0.514287 0.414287 0.378573 0.342858 0.257144
> 0.200001 -0.471431 -0.500002 -0.600002 -0.600002 -0.600002 -0.600002
> -0.600002 -0.600002 -0.585717 -0.571431 -0.557145 -0.542859 -0.514288
> -0.500002 -0.485716 -0.47143 -0.450002 -0.428573 -0.414287 -0.400002
> -0.392859 -0.385716 -0.357144 -0.328573 -0.285715 -0.200001 0.114286
> 0.142858 0.228572 0.242858 0.27143 0.300001 0.314287 0.328573 0.328573
> 0.328573 0.328573 0.328573 0.328573 0.328573 0.328573 0.328573 0.300001
> 0.257144 0.171429 0.142858 0.128572 0.114286 0.128572 0.171429 0.228572
> 0.242858 0.257144 0.257144 0 0 0;
> #X coords 0 1 99 -1 200 140 1;
> #X restore 200 330 graph;
> #N canvas 0 0 450 300 graph3 0;
> #X array table1 100 float 1;
> #A 0 0 0 0 0 0 0 0 0 0.0142856 0.0571424 0.071428 0.114285 0.157142
> 0.164284 0.171427 0.214284 0.271426 0.299998 0.35714 0.399997 0.442854
> 0.471425 0.499996 0.528567 0.557138 0.557138 0.528567 0.499996 0.478568
> 0.457139 0.421425 0.385711 0.371426 0.35714 0.342854 0.314283 0.285712
> 0.249998 0.214284 0.195237 0.176189 0.157142 0.0999992 0.0571424 -0.171427
> -0.121428 -0.071428 -0.0214284 0.0285712 0.0607138 0.0928564 0.124999
> 0.157142 0.190475 0.223808 0.257141 0.28095 0.304759 0.328569 0.342854
> 0.35714 0.371426 0.385711 0.399997 0.414282 0.428568 0.428568 0.428568
> 0.371426 0.328569 0.257141 0.22857 0.171427 0.157142 0.142856 0.114285
> 0.0999992 0.114285 0.12857 0.142856 0.164284 0.185713 0.22857 0.249998
> 0.271426 0.285712 0.299998 0.314283 0.321426 0.328569 0.35714 0.371426
> 0.378568 0.385711 0.385711 0 0 0 0 0;
> #X coords 0 1 99 -1 200 140 1;
> #X restore 200 130 graph;
> #X coords 0 -1 1 1 200 170 1 200 100;
> #X restore 71 139 pd subpatch;
> #X obj 61 534 s pd-subpatch;
> #X text 31 432 this controls graph-on-parent;
> #X msg 157 496 donecanvasdialog 1 -10 1 0 -1 1 1 200 170 200 300;
> #X msg 157 460 donecanvasdialog 1 -10 1 0 -1 1 1 200 170 200 100;
> #X text 64 370 message format :;
> #X text 189 372 donecanvasdialog <X units per pixel> <Y units per pixel>
> <graphOnParent> <X range from> <Y range from> <X range to> <Y range
> to> <x size> <y size> <x margin> <y margin>;
> #X text 480 477 <- click here to switch;
> #X text 145 598 from help/manuals/pd-msg/1.msg_and_patch/0.all_msg.pd
> ;
> #X connect 3 0 1 0;
> #X connect 4 0 1 0;
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
--
http://www.badmuthahubbard.com
More information about the Pd-list
mailing list