JS API : Calling get("volume") on a MixerDevice

Learn about building and using Max for Live devices.
Post Reply
mdk
Posts: 914
Joined: Sun Jul 31, 2005 3:51 pm
Location: Skopje, Macedonia
Contact:

JS API : Calling get("volume") on a MixerDevice

Post by mdk » Sat Nov 28, 2009 12:12 pm

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?
Pr0k Records - Bandcamp Facebook Twitter

mdk
Posts: 914
Joined: Sun Jul 31, 2005 3:51 pm
Location: Skopje, Macedonia
Contact:

Re: JS API : Calling get("volume") on a MixerDevice

Post by mdk » Sat Nov 28, 2009 1:17 pm

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?
Pr0k Records - Bandcamp Facebook Twitter

mdk
Posts: 914
Joined: Sun Jul 31, 2005 3:51 pm
Location: Skopje, Macedonia
Contact:

Re: JS API : Calling get("volume") on a MixerDevice

Post by mdk » Sat Nov 28, 2009 1:39 pm

im on a roll now.. :D

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.
Pr0k Records - Bandcamp Facebook Twitter

pukunui
Posts: 405
Joined: Thu Jan 29, 2009 10:26 pm
Location: Los Angeles

Re: JS API : Calling get("volume") on a MixerDevice

Post by pukunui » Tue Dec 08, 2009 12:15 am

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);

}


Post Reply