XCode : How to know a patch is in an iterator

benoitlahoz's picture

Hey !

For a custom plugin I'm currently programming, I need to know if a patch is inside an iterator or not.

I'm giving a unique name to the output objects (structures), to find them back in a stack, using their memory address. But for the iterated objects the memory address is always the same. So I'd like to append a number after it.

For example, my custom patch output a structure like this :

  • 0:"ID" ="bg087FF"
  • 1: "X" = 0.
  • 2: "Y" = 0.

In an iterator, all my objects will have "bg087FF" as ID. I would like my program to know if it is in an iterator, then append the current index after it.

I don't know if I'm understandable... :-/ Sorry for my poor English, once again.

Ben

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

smokris's picture
Re: XCode : How to know a patch is in an iterator

Add an input to your patch called "Index", and pass the output of Iterator Variables into it. (There's no other supported way to get the current iteration index.)

benoitlahoz's picture
Re: XCode : How to know a patch is in an iterator

Thanks Smokris. Too bad there's no other way to get it...

gtoledo3's picture
Re: XCode : How to know a patch is in an iterator

Another thing you can do is try to rig it so that it can go into external time base mode, if the values would be different at each time step. Then you can gather the results in a queue and let that build the structure for you. You'd still be hooking something to an iterator variables patch though.

I think you can assign a variable to a parent patch if it exists by referring to the parent patch's class, and then "do cool stuff", but I don't think that is going to get you that needed iterator variables info, since the parent patch (the iterator) doesn't deliver it.