477 lines
9.9 KiB
JavaScript
477 lines
9.9 KiB
JavaScript
loadedInterfaceName = "Loupiottes2";
|
||
interfaceOrientation = "landscape";
|
||
|
||
|
||
control.sendRef = function(){
|
||
oscManager.sendOSC(["refresh","i",8080]);
|
||
window.setTimeout(control.sendRef,500);
|
||
}
|
||
|
||
control.refinit = function(){
|
||
if(control.timerinit!=true){
|
||
window.setTimeout(control.sendRef,1000);
|
||
control.timerinit=true;
|
||
}
|
||
}
|
||
|
||
control.regMode = "OFF";
|
||
control.regUniv = 0;
|
||
control.regPage = 0;
|
||
control.regPageCount=32;
|
||
|
||
control.modeFunc = function(p1){
|
||
|
||
if( control.regMode == "CIR")
|
||
{
|
||
oscManager.sendOSC(["/circuitTel/off","i",1]);
|
||
}
|
||
if( control.regMode == "UNI")
|
||
{
|
||
oscManager.sendOSC(["/universe/"+control.regUniv+"/off","i",1]);
|
||
}
|
||
|
||
if(p1 == "OFF"){
|
||
control.regMode = "OFF";
|
||
control.regUniv=0;
|
||
}
|
||
if(p1 == "CIR"){
|
||
control.regMode = "CIR";
|
||
control.regUniv=0;
|
||
}
|
||
if(p1 == "U+"){
|
||
control.regMode = "UNI";
|
||
control.regUniv++;
|
||
if(control.regUniv<1) control.regUniv=1;
|
||
}
|
||
if(p1 == "U-"){
|
||
control.regMode = "UNI";
|
||
control.regUniv--;
|
||
if(control.regUniv<1) control.regUniv=1;
|
||
}
|
||
|
||
if( control.regMode == "OFF")
|
||
lblMode.setValue("Mode : OFF");
|
||
|
||
if( control.regMode == "CIR")
|
||
lblMode.setValue("Mode : Circuit");
|
||
|
||
if( control.regMode == "UNI")
|
||
lblMode.setValue("Mode : Univers n°"+control.regUniv);
|
||
|
||
}
|
||
|
||
control.reglValChange = function(val){
|
||
if( control.regMode == "UNI")
|
||
{
|
||
var addr = "/universe/"+ control.regUniv + "/onval";
|
||
oscManager.sendOSC([addr,"f",val]);
|
||
}
|
||
if( control.regMode == "CIR")
|
||
{
|
||
var addr = "/circuitTel/onval";
|
||
oscManager.sendOSC([addr,"f",val]);
|
||
}
|
||
return false;
|
||
}
|
||
|
||
control.btnRegl = function(id,val)
|
||
{
|
||
if(val==0)return;
|
||
for(var i = 0;i<control.regPageCount;i++){
|
||
if(i!=id && mulButton.children[i].value !=0)
|
||
mulButton.children[i].setValue(0);
|
||
}
|
||
reglval.setValue(0);
|
||
id = id + control.regPageCount *control.regPage +1;
|
||
if( control.regMode == "UNI")
|
||
{
|
||
var addr = "/universe/"+ control.regUniv + "/on/" + (id);
|
||
oscManager.sendOSC([addr,"f",val]);
|
||
}
|
||
if( control.regMode == "CIR")
|
||
{
|
||
var addr = "/circuitTel/on/" + (id);
|
||
oscManager.sendOSC([addr,"f",val]);
|
||
}
|
||
}
|
||
|
||
|
||
control.changeRegPage = function(){
|
||
var base = control.regPage *control.regPageCount +1;
|
||
for(var i = 0;i<control.regPageCount;i++){
|
||
mulButton.children[i].label.setValue(base + i);
|
||
if(mulButton.children[i].value !=0)
|
||
mulButton.children[i].setValue(0);
|
||
}
|
||
}
|
||
|
||
control.pageUp= function(){
|
||
control.regPage++;
|
||
control.changeRegPage();
|
||
}
|
||
|
||
control.pageDown= function(){
|
||
control.regPage--;
|
||
if(control.regPage<0)control.regPage=0;
|
||
control.changeRegPage();
|
||
}
|
||
|
||
oscManager.delegate = {
|
||
processOSC : function(oscAddress, typetags, args) {
|
||
switch(oscAddress) {
|
||
case "/masterseq/curstep":
|
||
lblCurrStep.setValue(args[0]);
|
||
break;
|
||
case "/masterseq/nextstep":
|
||
lblGo.setValue("Suivant : "+args[0]);
|
||
break;
|
||
case "/masterseq/prevstep":
|
||
lblGoBack.setValue("Precedent : "+args[0]);
|
||
break;
|
||
case "/masterseq/time":
|
||
lblTime.setValue("T : "+args[0]);
|
||
break;
|
||
default:
|
||
oscManager.processOSC(oscAddress, typetags, args);
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
pages = [
|
||
|
||
[
|
||
|
||
{
|
||
"name": "refreshButton", "type": "Button",
|
||
"bounds": [0,.7,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "interfaceManager.refreshInterface()",
|
||
"label":"Refr"
|
||
},
|
||
|
||
{
|
||
"name": "btnMainPage", "type": "Button",
|
||
"bounds": [0,.1,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#FF0000",
|
||
"ontouchstart": "control.changePage(0)",
|
||
"label":"Main"
|
||
},
|
||
{
|
||
"name": "btnReglPage", "type": "Button",
|
||
"bounds": [0,.26,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "control.changePage(1)",
|
||
"label":"Reglage"
|
||
},
|
||
|
||
{
|
||
"name": "btnMastPage", "type": "Button",
|
||
"bounds": [0,.42,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "control.changePage(2)",
|
||
"label":"Masters"
|
||
},
|
||
|
||
{"name": "lbl2", "type": "Label",
|
||
"bounds": [0,0,.14,.1],
|
||
"value": "Pages :",
|
||
},
|
||
|
||
|
||
{
|
||
"name":"master",
|
||
"type":"Slider",
|
||
"address":"/master",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"isVertical" : true,
|
||
"x":.15, "y": 0,
|
||
"width":.1, "height":.9,
|
||
"startingValue":100
|
||
},
|
||
|
||
|
||
// --- Suivant
|
||
|
||
|
||
{
|
||
"name": "btnGo", "type": "Button", "address":"/masterseq/go",
|
||
"bounds": [.3,.56,.5,.15],
|
||
"mode": "momentary",
|
||
},
|
||
{"name": "lblGo", "type": "Label",
|
||
"bounds": [.325,.56,.45,.15],
|
||
"value": "Suivant : ", "align":"left"
|
||
},
|
||
|
||
// --- Precedent
|
||
|
||
{
|
||
"name": "btnGoBack", "type": "Button", "address":"/masterseq/goback",
|
||
"bounds": [.3,.26,.5,.15],
|
||
"mode": "momentary",
|
||
},
|
||
{"name": "lblGoBack", "type": "Label",
|
||
"bounds": [.325,.26,.45,.15],
|
||
"value": "Precedent : ", "align":"left"
|
||
},
|
||
|
||
{"name": "lblCurrStep", "type": "Label",
|
||
"size":25,
|
||
// "address":"/masterseq/curstep",
|
||
"bounds": [.325,.41,.45,.15],
|
||
"value": "Precedent : ", "align":"left"
|
||
},
|
||
|
||
{"name": "lblTime", "type": "Label",
|
||
"size":20,
|
||
"address":"/masterseq/time",
|
||
"bounds": [.74,.05,.2,.1],
|
||
"value": "0:00 s", "align":"right",
|
||
"backgroundColor": "#000022",
|
||
"oninit":"control.refinit()"
|
||
},
|
||
|
||
|
||
],
|
||
|
||
// ---------- PAGE 2 -----------
|
||
|
||
[
|
||
{
|
||
"name": "btnMainPage", "type": "Button",
|
||
"bounds": [0,.1,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "control.changePage(0)",
|
||
"label":"Main"
|
||
},
|
||
{
|
||
"name": "btnReglPage", "type": "Button",
|
||
"bounds": [0,.26,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#FF0000",
|
||
"ontouchstart": "control.changePage(1)",
|
||
"label":"Reglage"
|
||
},
|
||
|
||
{
|
||
"name": "btnMastPage", "type": "Button",
|
||
"bounds": [0,.42,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "control.changePage(2)",
|
||
"label":"Masters"
|
||
},
|
||
{"name": "lbl2", "type": "Label",
|
||
"bounds": [0,0,.14,.1],
|
||
"value": "Pages :",
|
||
},
|
||
|
||
{
|
||
"name":"master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"isVertical" : true,
|
||
"x":.15, "y": 0,
|
||
"width":.08, "height":.9,
|
||
"startingValue":100,
|
||
"color":"#FF3300"
|
||
},
|
||
|
||
{
|
||
"name":"reglval",
|
||
"type":"Slider",
|
||
"isVertical" : true,
|
||
"min" : -10,
|
||
"max" : 270,
|
||
"bounds": [.25,.3,.05,.58],
|
||
"onvaluechange":"control.reglValChange(this.value)",
|
||
"color":"#FFFF00"
|
||
},
|
||
|
||
{
|
||
"name" : "mulButton",
|
||
"type" : "MultiButton",
|
||
"bounds": [.4,.3,.59,.58],
|
||
"rows" : 4, "columns" : 8,
|
||
"shouldLabel":"true",
|
||
"ontouchstart": "control.btnRegl(this.childID, this.value)",
|
||
"stroke":"#FFFFFF", "color":"#8888FF"
|
||
},
|
||
|
||
{
|
||
"name": "btnMulPlus", "type": "Button",
|
||
"bounds": [.325,.3,.05,.1],
|
||
"mode": "momentary",
|
||
"ontouchstart":"control.pageUp()",
|
||
"label":"+"
|
||
},
|
||
|
||
{
|
||
"name": "btnMulMoins", "type": "Button",
|
||
"bounds": [.325,.78,.05,.1],
|
||
"mode": "momentary",
|
||
"label":"-",
|
||
"ontouchstart":"control.pageDown()"
|
||
},
|
||
|
||
{
|
||
"name": "btnROff", "type": "Button",
|
||
"bounds": [.4,.01,.12,.15],
|
||
"mode": "momentary",
|
||
"ontouchstart": "control.modeFunc('OFF')",
|
||
"label":"OFF"
|
||
},
|
||
|
||
{
|
||
"name": "btnRUminus", "type": "Button",
|
||
"bounds": [.52,.01,.12,.15],
|
||
"mode": "momentary",
|
||
"ontouchstart": "control.modeFunc('U-')",
|
||
"label":"Univ -"
|
||
},
|
||
{
|
||
"name": "btnRUplus", "type": "Button",
|
||
"bounds": [.64,.01,.12,.15],
|
||
"mode": "momentary",
|
||
"ontouchstart": "control.modeFunc('U+')",
|
||
"label":"Univ +"
|
||
},
|
||
{
|
||
"name": "btnRCirc", "type": "Button",
|
||
"bounds": [.76,.01,.12,.15],
|
||
"mode": "momentary",
|
||
"ontouchstart": "control.modeFunc('CIR')",
|
||
"label":"Circuit"
|
||
},
|
||
|
||
{"name": "lblMode", "type": "Label",
|
||
"bounds": [.4,.18,.5,.1],
|
||
"value": "Mode : OFF",
|
||
},
|
||
|
||
],
|
||
|
||
[
|
||
{
|
||
"name": "btnMainPage", "type": "Button",
|
||
"bounds": [0,.1,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "control.changePage(0)",
|
||
"label":"Main"
|
||
},
|
||
{
|
||
"name": "btnReglPage", "type": "Button",
|
||
"bounds": [0,.26,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#aaaaaa",
|
||
"ontouchstart": "control.changePage(1)",
|
||
"label":"Reglage"
|
||
},
|
||
|
||
{
|
||
"name": "btnMastPage", "type": "Button",
|
||
"bounds": [0,.42,.14,.15],
|
||
"mode": "momentary", "color": "#000000", "stroke": "#FF0000",
|
||
"ontouchstart": "control.changePage(2)",
|
||
"label":"Masters"
|
||
},
|
||
{"name": "lbl2", "type": "Label",
|
||
"bounds": [0,0,.14,.1],
|
||
"value": "Pages :",
|
||
},
|
||
|
||
{
|
||
"name":"master",
|
||
"address":"/master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"isVertical" : true,
|
||
"x":.15, "y": 0,
|
||
"width":.08, "height":.9,
|
||
"startingValue":100,
|
||
"color":"#FF3300"
|
||
},
|
||
|
||
{
|
||
"name":"seqm1",
|
||
"address":"/seq/1/master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"bounds":[.3,.05,.65,.1],
|
||
"startingValue":100,
|
||
"color":"#FFEE00"
|
||
},
|
||
|
||
{
|
||
"name":"seqm2",
|
||
"address":"/seq/2/master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"bounds":[.3,.20,.65,.1],
|
||
"startingValue":100,
|
||
"color":"#FFEE00"
|
||
},
|
||
|
||
{
|
||
"name":"seqm3",
|
||
"address":"/seq/3/master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"bounds":[.3,.35,.65,.1],
|
||
"startingValue":100,
|
||
"color":"#FFEE00"
|
||
},
|
||
|
||
{
|
||
"name":"seqm4",
|
||
"address":"/seq/4/master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"bounds":[.3,.50,.65,.1],
|
||
"startingValue":100,
|
||
"color":"#FFEE00"
|
||
},
|
||
|
||
{
|
||
"name":"seqm5",
|
||
"address":"/seq/5/master",
|
||
"type":"Slider",
|
||
"min" : -10,
|
||
"max" : 110,
|
||
"bounds":[.3,.65,.65,.1],
|
||
"startingValue":100,
|
||
"color":"#FFEE00"
|
||
},
|
||
|
||
{"name": "lblm1", "type": "Label",
|
||
"bounds":[.3,.05,.65,.1],
|
||
"value": "Sequenceur 1",
|
||
},
|
||
{"name": "lblm1", "type": "Label",
|
||
"bounds":[.3,.20,.65,.1],
|
||
"value": "Sequenceur 2",
|
||
},
|
||
{"name": "lblm1", "type": "Label",
|
||
"bounds":[.3,.35,.65,.1],
|
||
"value": "Sequenceur 3",
|
||
},
|
||
{"name": "lblm1", "type": "Label",
|
||
"bounds":[.3,.50,.65,.1],
|
||
"value": "Sequenceur 4",
|
||
},
|
||
{"name": "lblm1", "type": "Label",
|
||
"bounds":[.3,.65,.65,.1],
|
||
"value": "Sequenceur 5",
|
||
},
|
||
|
||
|
||
]
|
||
];
|
||
|
||
|
||
|