get min/max value for live parameter?
Is there a way to do this for parameters of live devices? I am trying to get min/max value and set number entries for these values rather than an arbitrary 0/100 scaled value so it is more transparent what the min and max are actually being set to.
I have not figured out a good way to do this yet - but I have not queried all of the properties of the live objects in Javascript - which might include some undocumented methods or properties...
I have some ugly javascript code which is used to convert MIDI CC values to Max UI objects as well as Live objects - it tries to deal with this exact situation, and this is what I am currently doing:
{
if (obj.understands("rawfloat")) {
obj.message("rawfloat", val / 127.0);
}
else if (obj.maxclass === "live.togle") {
obj.message("int", val > 63 ? 1 : 0);
} else {
var maxclass = obj.maxclass;
// are we dealing with a live. object
if (maxclass.indexOf("live.") > -1) {
obj.message("float", val / 127.0);
}
// if not, lets try to find the min/max values so we can scale accordingly
else {
var min = obj.getattr("min");
var range = obj.getattr("size");
var n = min + ((val / 127.0) * range);
obj.message("float", n);
}
}
}
Welp... that code formatting tag definitely didn't work as expected - and now the "edit" post button is gone... what is up with that - is there a time limit on editing posts?