Setting a unique name of a [pattr] object using a [poly~] instance number

    Jul 22 2011 | 1:23 pm
    I've got a [pattr] object in a patcher that is encapsulated in a [poly~] object to create multiple instances. However I would like to give the [pattr] object a name/argument that is the different for each instance of the patcher. I can't use the #0 patcher argument as I want the names to be the same each time the patchers are loaded up.
    Is there any way of getting the instance number of the patcher and applying that to the argument of the [pattr] object? I have done something similar in the past:
    [thispoly~] > [sprintf send %i-name] > [forward]
    ... to create a send object with a different name depending on the instance number of the patcher. Can this kind of thing be implemented with a [pattr] object?

    • Jul 22 2011 | 1:36 pm
      I presume you want the names to be the same every time so that you work with them outside the [poly~]...
      Stick a message box containing "#0-whatever" inside your poly patch, and connect it to an [in] and an [out].
      On initialisation, you could target each voice of the [poly] in turn, bang the [in], and get the symbol for each voice. I think could use [uzi] and [cycle] to make it work...
    • Jul 22 2011 | 11:16 pm
      Each instance of the patcher loaded in a poly~ will have a unique pattr path already.
      For example, create a top level patcher containing a poly~ whose scripting name is 'myPoly'
      Create a patcher (to be loaded by the poly~) that contains a pattr with the scripting name 'myPattr'
      Assuming the poly~ loads two instances of your patcher, the two pattr objects will have the paths:
      myPoly.1::myPattr myPoly.2::myPattr
    • Jul 25 2011 | 8:16 am
      Nice and tidy. Thanks for the tip :)