Skip to content

Instantly share code, notes, and snippets.

@rob-gordon
Created March 7, 2015 18:15
Show Gist options
  • Select an option

  • Save rob-gordon/41fc61d5cf55863a1b3a to your computer and use it in GitHub Desktop.

Select an option

Save rob-gordon/41fc61d5cf55863a1b3a to your computer and use it in GitHub Desktop.
max4live-js-api: Find Track Device By Name
function findTrackDeviceByName(name) {
var track = new LiveAPI('this_device canonical_parent'),
devices = track.get('devices'),
deviceID;
for (var i = devices.length - 1; i >= 0; i = i - 2) {
if ((new LiveAPI('id '+devices[i])).get('name') == name) {
deviceID = devices[i];
break;
}
}
return deviceID;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment