Hello,
I scripted a very simple linear envelope sequencer to drive a Max/MSP patch and would like to be able to lock some parts so I’m not able to change them while editing, I would also like to be able to constrain a curve in a predefined rectangle… Is there a way to do that?
All the best,
Matthieu
here’s my current code :
function onConfigure() {
title("TEST1");
ask("Enveloppes", "Nombre", "qEnv", 6);
ask("Enveloppes", "Durée (s)", "dur", 60);
ask("Nom du Groupe", "nom", "grpName", "Seq-1");
}
function onCreate() {
for(var index = 0 ; index < qEnv ; index++){
addPlayer(index, dur, grpName);
addEnvCurve(index, dur, grpName);
}
}
function addPlayer(index, dur, grpName) {
var startyTop = index*5 + 2;
var endyBottom = index*5 - 2;
run("add curve auto");
run("setPointAt current 0 0 " + index*5 + " 0");
run("setPointAt current 1 " + dur + " " + index*5 + " 0");
run("setPointAt current 2 " + dur + " " + startyTop + " 0");
run("setPointAt current 3 " + dur + " " + endyBottom + " 0");
run("setGroup current "+ grpName);
run("add cursor auto")
run("setWidth current 4");
run("setCurve current lastCurve");
run("setSpeed current 1");
run("setPattern current 0 0 1 0");
run("setMessage current 20, osc://ip_out:57120/cursor collision_curve_label collision_value_y");
run("setGroup current "+ grpName);
}
function addEnvCurve(index, dur, grpName) {
var endyBottom = index*5 - 2;
var label = index+1;
run("add curve auto");
run("setPointAt current 0 0 " + endyBottom + " 0");
run("setPointAt current 1 " + dur + " " + endyBottom + " 0");
run("setColor current 85 255 127 255");
run("setLabel current Env"+ label);
run("setGroup current "+ grpName);
}