get all devices on a track, including inside racks

    Mar 10 2013 | 3:00 pm
    Im trying to find all the devices on a track in m4l but its seems impossible. Is there a simple way of finding all devices on a track, including devices inside racks? I realise I can use "property devices" with, however this does not get devices inside racks.

    • Mar 10 2013 | 3:38 pm
      The attached works for me. Look in the Max window to see the iteration.
      Best, Jeremy
    • Mar 11 2013 | 9:33 am
      this is great, thx so much jeremy :)
    • Aug 23 2013 | 3:32 am
      Yes, this is very useful, thanks.
      I'm in the process of learning js, so I was wondering if you could provide some assistance for expanding on this.
      The ultimate goal (if possible that one js max object can handle), is to poll all the chains in a drumrack to find the "Transpose" parameter id for each one (if available) and output those parameter ids as a list. Then a midi control (a makeshift Pitchbend) can access the list to trigger the Transpose id for whichever chain it's part of is selected.
      This is where this js object is essential since this device will be shared and one can't be sure how many iterations it will take to get to the instrument. For example, I may have one or 2 midi effect racks put before an instrument rack containing a simpler or sampler (if there were no racks put before the instrument you could just get the id of parameter 11 for simpler/sampler to get Transpose.) The other cool thing having dynamic access to "Transpose" is that ANY device with a "Transpose" parameter can be accessed (To take that even further, it would be cool to to not only look for "Transpose", but also "Pitch", just to increase the chances of getting that control). There are plenty of other instruments like Operator or Tension that have "Tranpose" that could be in a drumrack pad.
      But, before I get ahead of myself, I'm at the stage where I need to only look for Instrument devices, so I put this instruction at line 18 (line 17 is: (if deviceApi) {)
      var deviceClass = deviceApi.get("class_display_name"); if (deviceClass = "Instrument Rack") {
      (and back to your code; I added a closing bracket at line 25, the line after "var j;"
      I tried similarly after the post section of the code but I was trying to get it where it was looking for devices and the "post" is after it's already found everything, right?
      Also, as a side note, I originally wanted to use device "type" so I could narrow the device look "1" ie instrument, but the out pust only gave "id -1" or "id -2". Do you know why that is?
      Anyway the result I get is the same as if none if any of that was added to the code. Obviously I'm missing at least a second half, but how far off am I from beingthe right direction?