Created
March 7, 2015 18:15
-
-
Save rob-gordon/41fc61d5cf55863a1b3a to your computer and use it in GitHub Desktop.
max4live-js-api: Find Track Device By Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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