Page 1 of 1
JS API : Calling get("volume") on a MixerDevice
Posted: Sat Nov 28, 2009 12:12 pm
by mdk
If you do this :
Code: Select all
autowatch = 1;
var firstTrackMixer = new LiveAPI(this.patcher, null, ["live_set","tracks",0,"mixer_device"]);
post("FTM " + firstTrackMixer.children + "\n");
var volume = firstTrackMixer.get("volume");
post("Volume " + volume + "\n");
post("VolumeType " + volume.type + "\n");
post("VolumeInfo " + volume.info + "\n");
for(var i in volume) {
post(i + " : " + volume[i] + "\n");
}
I get this output :
Code: Select all
js: FTM canonical_parent,panning,sends,volume
js: Volume id,1
js: VolumeType undefined
js: VolumeInfo undefined
js: 0 : id
js: 1 : 1
Which looks like im getting back an array containing [id,1].
Shouldnt it return the actual DeviceParameter object?
Re: JS API : Calling get("volume") on a MixerDevice
Posted: Sat Nov 28, 2009 1:17 pm
by mdk
so i tried using it as an ID to create a new object :
Code: Select all
autowatch = 1;
var firstTrackMixer = new LiveAPI(this.patcher, null, ["live_set","tracks",0,"mixer_device"]);
var volumeID = firstTrackMixer.get("volume");
post("VolumeID : " + volumeID + "\n");
var volume = new LiveAPI(this.patcher, null, volumeID);
output :
Code: Select all
js: VolumeID : id,2
jsliveapi: set path: invalid path
so thats an invalid path, similarly just passing in a number as an ID fails :
Code: Select all
var test = new LiveAPI(this.patcher, null, 1);
for(var i in test) {
post(i + " : " + test[i] + "\n");
}
invalid path again.
I've tried all the variations I can think of with using an ID : ["id","1"], "id:1", "id,1", 1, "1" etc.. and nothing works.
whats the magic incantation im missing?
Re: JS API : Calling get("volume") on a MixerDevice
Posted: Sat Nov 28, 2009 1:39 pm
by mdk
im on a roll now..
why does asking for the path of an API object give you a string wrapped in quotes?
Code: Select all
autowatch = 1;
var firstTrackMixer = new LiveAPI(this.patcher, null, ["live_set","tracks",0,"mixer_device"]);
post("FTM Path : " + firstTrackMixer.path + "\n");
var volumePath = firstTrackMixer.path.substring(1,firstTrackMixer.path.length - 1) + " volume";
post("Volume Path : " + volumePath + "\n");
var volume = new LiveAPI(this.patcher, null, volumePath);
post("Volume " + volume + "\n");
post("VolumeType " + volume.type + "\n");
as you can see i can substring the bit i want, but thats not nice code
basically I want to find a way to navigate the LOM from parent to child, ideally without having to construct absolute paths each time.
Re: JS API : Calling get("volume") on a MixerDevice
Posted: Tue Dec 08, 2009 12:15 am
by pukunui
Does this help?
Code: Select all
autowatch = 1;
function mixer_nav()
{
var firstTrackMixer = new LiveAPI(this.patcher, null, ["live_set","tracks",0,"mixer_device"]);
firstTrackMixer.goto("volume");
post(firstTrackMixer.get("value"));
firstTrackMixer.goto("up");
post(firstTrackMixer.path);
}