[PD] array indirection
Phil Stone
pkstone at ucdavis.edu
Mon Dec 10 22:44:24 CET 2007
A glorious hack, Jean-Yves! This should work well for what I am
envisioning. One strange thing, though: if you move the subpatch (that
displays the selected array), the other array is visible underneath it.
I wonder what's up with that?
Thanks for the solution, Jean-Yves (and Chuck for suggesting it was
possible in the first place).
Phil
Chuckk Hubbard wrote:
> 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
>>
More information about the Pd-list
mailing list