How to set the new output_routing_type with javascript
I'm updating a plugin and I'm trying to set the output of a track using a dictionary. I tried this:
var routing_dict = new Dict(); routing_type.replace("output_routing_type::identifier","11"); routing_type.replace("output_routing_type::display_name","Master");
var track = new LiveAPI("this_device canonical_parent")
track.set("output_routing_type", routing_dict);
I also tried stringifying the dict to turn it into a JSON string, which is what you the api returns when you get("output_routing_type");
I"m sure I"m just missing something obvious
i know nothing about javascript but perhaps this will be of help to you:
https://cycling74.com/forums/%C2%ABdict%C2%BB-is-it-possible-to-retrieve-a-%C2%ABsub%C2%BBdictionary-using-a-contained-value
do you know if the deprecated commands have stopped working in live 10?
also it would be good to know if updating to the new commands solves some problems, such as updating when a track is renamed.
Ok so I figured it out what api.set("output_routing_type") is expecting. It expects a JSON string inside of an empty array. If you don't put the JSON string into an array, they you will get an invalid syntax error. Heres a little sample code
var track = new LiveAPI("this_device canonical_parent");
//create an object with this labeling. I think the identifier number
//will change from project to project
var json = {"output_routing_type":{"identifier":13,"display_name":"Master"}};
//turn the object into a json string and place it into an Array //holder
var array_holder = [JSON.stringify(json)];
// now you can set the output with a JSON string inside of the
//array holder;
track.set("output_routing_type",array_holder);
@Mark the depreciated commands do still work in 10 but I think the new commands do solve that problem because the "identifier" will point to the same track no matter what it is named or how they are reordered. In fact as far as I can tell the "display_name" property can be anything as long as the identifier is correct and it will still point to the correct track.