<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="_c74_vig.xsl" type="text/xsl"?>
<vignette name="The ParameterInfoProvider Object" package="Max" rankfactor="2">
  <h1>The ParameterInfoProvider Object</h1>
  <p>
    The ParameterInfoProvider object provides a list of named <link type="vignette" name="live_parameters">Parameter</link> objects within a patcher hierarchy, as well as information about specific Parameter objects. It can also notify when Parameter objects are added or removed from a patcher hierarchy.
  </p>
  <h2>ParameterInfoProvider Constructor</h2>
  <code language="javascript">var pip = new ParameterInfoProvider(function);
  </code>
  <p>
    The <m>function</m> argument specifies the function you want to execute to receive change notifications. The function may have a single argument, which is a <a href="#jsparameterinfoproviderdata">ParameterInfoProviderData</a> object.
  </p>
  <p>
    <b>Example:</b>
  </p>
  <code language="javascript">
    function paramschanged(data)
    {
      post("something was added or removed, getting new list\n");
      if (data.added.length) {
        post(data.added.join(', ') + ' added\n')
      }
      if (data.removed.length) {
        post(data.removed.join(', ') + ' removed\n')
      }
    }

    pip = new ParameterInfoProvider(paramschanged);
  </code>
  <jsproperty_list name="ParameterInfoProvider"/>
  <jsmethod_list name="ParameterInfoProvider">
    <jsmethod name="getnames">
      <description>
        Returns an Array value containing the names of Parameter objects in this patcher hierarchy.
    </description>
    </jsmethod>
    <jsmethod name="getinfo">
      <arglist>
        <arg name="parameter_name" type="string"/>
      </arglist>
      <description>
      Returns a JS Object containing a variety of information about the specified Parameter, such as its type, range. The exact contents of the Object will vary depending on the type of the Parameter and will need to be enumerated. The Object always contains a property <m>maxobject</m> which is the <link type="vignette" name="jsmaxobj">Maxobj</link> for the Max object hosting the Parameter.
      <code language="javascript">
        var pip = new ParameterInfoProvider();
        var info = pip.getinfo("live.dial"); // the Parameter named 'live.dial'
        // iterating the contents
        for (var i in info) {
          post(i + ": " + info[i] + "\n");
        }
        // prints to the Max Console (for a default live.dial object)
        // js: longname: live.dial 
        // js: shortname: live.dial 
        // js: scriptname: live.dial 
        // js: type: float 
        // js: visibility: automated 
        // js: min: 0 
        // js: max: 127 
        // js: exponent: 1 
        // js: maxobject: [object Maxobj] 
      </code>
    </description>
    </jsmethod>
  </jsmethod_list>

  <a name="jsparameterinfoproviderdata"/>
  <h2>ParameterInfoProviderData</h2>
  <p>The ParameterInfoProviderData object is the argument to your ParameterInfoProvider's function</p>
  <jsproperty_list name="ParameterInfoProviderData">
    <jsproperty name="provider" get="1" set="0" type="ParameterInfoProvider">
      <description>
        The ParameterInfoProvider which called the function.
      </description>
    </jsproperty>
    <jsproperty name="added" get="1" set="0" type="Array">
      <description>
        The names of any Parameters which were added.
      </description>
    </jsproperty>
    <jsproperty name="removed" get="1" set="0" type="Array">
      <description>
        The names of any Parameters which were removed.
      </description>
    </jsproperty>
  </jsproperty_list>
</vignette>
