Check if a track object corresponds to the Master Track in Ableton Live


/ Published in: JavaScript
Save to your folder(s)

Returns true if the given track is the Master Track.
Problem with this approach is that always a javascript error is triggered, even when surrounded by try/catch, but it works.


Copy this code and paste it in your HTML
  1. // Returns true if the given track is the Master Track
  2. function isMasterTrack(track)
  3. {
  4. var api = new LiveAPI();
  5. var path = track.path.split("\"")[1]; // remove quotes from path
  6. api.path = path + " mixer_device";
  7. // post(api.type); // type is 'Track' for all normal tracks, Returns and MasterTrack so I try another way:
  8. var val = api.get("cue_volume"); // this parameter only exists when in the Master Track.
  9. if (typeof val == "object") {
  10. return true;
  11. }
  12. return false;
  13. // Problem with this approach is that always a javascript error is triggered, even when surrounded by try/catch, but it works.
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.