buttons seems to work clic/osc_send/osc_receive/save_load/
This commit is contained in:
parent
5def76b11b
commit
93259e9c60
3 changed files with 124 additions and 135 deletions
17
config.js
17
config.js
|
|
@ -15,7 +15,7 @@ nmPorts = {
|
|||
}
|
||||
|
||||
TABS = {
|
||||
|
||||
/*
|
||||
testingshits: {
|
||||
widgets:{
|
||||
button1: {
|
||||
|
|
@ -23,15 +23,16 @@ TABS = {
|
|||
target:'localhost:6666',
|
||||
path:'/osc/path/',
|
||||
color:'#555522'
|
||||
}, Basses: {
|
||||
title:'Basses',
|
||||
range:'db',
|
||||
target:nmPorts['MainMix'],
|
||||
path:'/strip/Basses/Gain/Gain%20(dB)/unscaled'
|
||||
},
|
||||
},
|
||||
Bassess: {
|
||||
title:'Bassess',
|
||||
range:'db',
|
||||
target:nmPorts['MainMix'],
|
||||
path:'SHIT'
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
*/
|
||||
MainMix: {
|
||||
|
||||
title:'MainMix',
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ document.title = 'INIT'
|
|||
|
||||
init = function() {
|
||||
|
||||
__faders__ = [];
|
||||
__buttons__ = [];
|
||||
__faders__ = {};
|
||||
__buttons__ = {};
|
||||
|
||||
parsetabs(TABS,false,false)
|
||||
|
||||
|
|
@ -76,8 +76,10 @@ function parsetabs(TABS,parent,sub) {
|
|||
var $widget = $('\
|
||||
<div class="widget">\
|
||||
<div class="title" '+color+'>'+title+'</div>\
|
||||
<div class="button-wrapper"><div class="button"></div></div>\
|
||||
<input value="'+dv+'"></input>\
|
||||
<div class="button-wrapper">\
|
||||
<div class="button" widgetId="'+widgetId+'" path="'+widgetData.path+'"></div>\
|
||||
</div>\
|
||||
<input disabled value="'+dv+'"></input>\
|
||||
</div>\
|
||||
');
|
||||
|
||||
|
|
@ -85,38 +87,43 @@ function parsetabs(TABS,parent,sub) {
|
|||
$widget.button = $widget.find('.button')
|
||||
|
||||
$widget.button
|
||||
.on('on',function(){
|
||||
.on('on',function(e,send){
|
||||
$(this).addClass('on');
|
||||
var t = widgetData.target?widgetData.target:defaultTarget,
|
||||
p = widgetData.path,
|
||||
a = widgetData.args?widgetData.args.on:1;
|
||||
sendOsc([t,p,a]);
|
||||
if (send) sendOsc([t,p,a]);
|
||||
$widget.input.val(a)
|
||||
})
|
||||
.on('off',function(){
|
||||
.on('off',function(e,send){
|
||||
$(this).removeClass('on');
|
||||
var t = widgetData.target?widgetData.target:defaultTarget,
|
||||
p = widgetData.path,
|
||||
a = widgetData.args?widgetData.args.off:0;
|
||||
sendOsc([t,p,a]);
|
||||
if (send) sendOsc([t,p,a]);
|
||||
$widget.input.val(a)
|
||||
})
|
||||
|
||||
.click(function(){
|
||||
switch($(this).hasClass('on')){
|
||||
case true:
|
||||
$(this).trigger('off')
|
||||
break
|
||||
case false:
|
||||
$(this).trigger('on')
|
||||
break
|
||||
var x = $widget.button.val()?'off':'on'
|
||||
$(this).trigger(x,true)
|
||||
});
|
||||
|
||||
$widget.button.val = function(v,send) {
|
||||
var send = send==undefined?true:false;
|
||||
if (v== undefined) {return $(this).hasClass('on')?1:0;}
|
||||
else {
|
||||
if (widgetData.args!=undefined) {
|
||||
if (v==widgetData.args.on) {$widget.button.trigger('on',send)}
|
||||
if (v==widgetData.args.off) {$widget.button.trigger('off',send)}
|
||||
} else {
|
||||
if (v==1) {$widget.button.trigger('on',send)}
|
||||
if (v==0) {$widget.button.trigger('off',send)}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
__buttons__[widgetId] = $widget.button
|
||||
|
||||
|
||||
__buttons__.push($widget)
|
||||
|
||||
|
||||
break
|
||||
|
||||
|
||||
|
|
@ -128,11 +135,12 @@ function parsetabs(TABS,parent,sub) {
|
|||
<div class="widget">\
|
||||
<div class="title" '+color+'>'+title+'</div>\
|
||||
<div class="fader-wrapper">\
|
||||
<div class="fader locked" path="'+widgetData.path+'" name="'+widgetId+'"></div>\
|
||||
<div class="fader locked" path="'+widgetData.path+'" widgetId="'+widgetId+'"></div>\
|
||||
</div>\
|
||||
<input value="0"></input>\
|
||||
</div>\
|
||||
');
|
||||
|
||||
$widget.fader = $widget.find('.fader')
|
||||
|
||||
var range = (widgetData.range=='db'||!widgetData.range)?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'max': 6}:widgetData.range;
|
||||
|
|
@ -161,7 +169,7 @@ function parsetabs(TABS,parent,sub) {
|
|||
var pips = pips();
|
||||
|
||||
|
||||
$widget.find('.fader')
|
||||
$widget.fader
|
||||
.noUiSlider({
|
||||
orientation:'vertical',
|
||||
direction: "rtl",
|
||||
|
|
@ -180,7 +188,7 @@ function parsetabs(TABS,parent,sub) {
|
|||
})
|
||||
.Link('lower').to($widget.find('input'))
|
||||
.on('slide',function(){
|
||||
if ($(this).hasClass('locked')) return;
|
||||
if ($widget.fader.hasClass('locked')) return;
|
||||
var t = widgetData.target?widgetData.target:defaultTarget,
|
||||
p = widgetData.path,
|
||||
a = widgetData.args,
|
||||
|
|
@ -190,7 +198,7 @@ function parsetabs(TABS,parent,sub) {
|
|||
sendOsc([t,p,a,v]);
|
||||
})
|
||||
.on('set',function(){
|
||||
if ($(this).hasClass('locked')) return;
|
||||
if ($widget.fader.hasClass('locked')) return;
|
||||
var t = widgetData.target?widgetData.target:defaultTarget,
|
||||
p = widgetData.path,
|
||||
a = widgetData.args,
|
||||
|
|
@ -200,10 +208,15 @@ function parsetabs(TABS,parent,sub) {
|
|||
|
||||
sendOsc([t,p,a,v]);
|
||||
});
|
||||
// store reference for state saving/loading
|
||||
__faders__.push($widget)
|
||||
|
||||
|
||||
break
|
||||
// store reference for state saving/loading
|
||||
if (__faders__[widgetId]!=undefined) {
|
||||
|
||||
}
|
||||
__faders__[widgetId] = $widget.fader
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
$tabContent.append($widget);
|
||||
|
|
@ -217,10 +230,9 @@ function parsetabs(TABS,parent,sub) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Synchronize faders that share the same name
|
||||
// Synchronize faders that share the same widgetId
|
||||
$(".fader").each(function(){
|
||||
$(".fader[name='"+$(this).attr('name')+"']").not(this).Link('lower').to($(this), crossUpdate);
|
||||
$(".fader[widgetId='"+$(this).attr('widgetId')+"']").not(this).Link('lower').to($(this), crossUpdate);
|
||||
}).removeClass('locked');
|
||||
function crossUpdate ( value, handle, slider ) {
|
||||
$(this).val( value );
|
||||
|
|
@ -314,8 +326,11 @@ function sendOsc(argsPack){
|
|||
|
||||
function saveState() {
|
||||
data = []
|
||||
$.each(__faders__,function(i,strip) {
|
||||
data.push('strip:'+strip.fader.attr('name')+':'+strip.fader.val())
|
||||
$.each(__faders__,function(i,fader) {
|
||||
data.push('fader:'+i+':'+fader.val())
|
||||
})
|
||||
$.each(__buttons__,function(i,button) {
|
||||
data.push('button:'+i+':'+button.val())
|
||||
})
|
||||
document.title = 'Save,'+data.join(';')
|
||||
}
|
||||
|
|
@ -331,8 +346,12 @@ loadPreset = function(preset){
|
|||
$.each(preset.split(';'),function(i,d) {
|
||||
var data = d.split(':')
|
||||
setTimeout(function(){
|
||||
if (data[0] == 'strip') {
|
||||
$('.fader[name="'+data[1]+'"]').val(data[2]).trigger('set')
|
||||
if (data[0] == 'fader') {
|
||||
__faders__[data[1]].val(data[2]).trigger('set')
|
||||
|
||||
}
|
||||
if (data[0] == 'button') {
|
||||
__buttons__[data[1]].val(data[2])
|
||||
|
||||
}
|
||||
},i)
|
||||
|
|
@ -342,7 +361,11 @@ loadPreset = function(preset){
|
|||
|
||||
receiveOsc = function(argsPack){
|
||||
argsPack = argsPack.split(',')
|
||||
$('.fader[path="'+argsPack[0]+'"]').addClass('locked').val(argsPack.pop()).removeClass('locked')
|
||||
var id = $('[path="'+argsPack[0]+'"]').attr('widgetId');
|
||||
$('[path="'+argsPack[0]+'"]').addClass('locked');
|
||||
if (__faders__[id]!=undefined) __faders__[id].val(argsPack.pop())
|
||||
if (__buttons__[id]!=undefined) __buttons__[id].val(argsPack.pop(),false)
|
||||
$('[path="'+argsPack[0]+'"]').removeClass('locked');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,91 +1,56 @@
|
|||
strip:Drums:-0.003999999999990678
|
||||
strip:Basses:-0.23199999999999932
|
||||
strip:Guitars:-10.719999999999999
|
||||
strip:MxSynths:-12.467999999999996
|
||||
strip:MxDrums:-18.471999999999994
|
||||
strip:Vocals:-15.736000000000004
|
||||
strip:FOH:-9.884
|
||||
strip:Kick:-4.564000000000007
|
||||
strip:Snare:-0.23199999999999932
|
||||
strip:Toms:-3.2720000000000056
|
||||
strip:OH-L:-24.248000000000005
|
||||
strip:OH-R:-39.599999999999994
|
||||
strip:Drums:-0.003999999999990678
|
||||
strip:Bass_ORL:-2.6640000000000015
|
||||
strip:Oct_Bass_ORL:-0.003999999999990678
|
||||
strip:FX_Bass_ORL:0.9840000000000089
|
||||
strip:Bass_Dag:3.9479999999999933
|
||||
strip:Oct_Bass_Dag:-0.003999999999990678
|
||||
strip:FX_Bass_Dag:-4.0319999999999965
|
||||
strip:Basses:-0.23199999999999932
|
||||
strip:Guitar_ORL:2.352000000000004
|
||||
strip:FX_Gtr_ORL:-0.003999999999990678
|
||||
strip:FX_Gtr_ORL_1:-0.003999999999990678
|
||||
strip:FX_Gtr_ORL_2:-0.003999999999990678
|
||||
strip:Guitar_Dag:-0.23199999999999932
|
||||
strip:FX_Gtr_Dag:-0.003999999999990678
|
||||
strip:FX_Gtr_Dag_1:-0.003999999999990678
|
||||
strip:FX_Gtr_Dag_2:-0.003999999999990678
|
||||
strip:Scape_Gtr_Dag:-0.003999999999990678
|
||||
strip:Guitars:-10.719999999999999
|
||||
strip:MxBass:-27.060000000000002
|
||||
strip:MxChords:-11.555999999999997
|
||||
strip:MxLead:-6.464000000000006
|
||||
strip:MxCtLead:-2.5120000000000005
|
||||
strip:MxClassical:-6.540000000000006
|
||||
strip:MxSynths:-12.467999999999996
|
||||
strip:MxKicks:-5.780000000000001
|
||||
strip:MxSnares:-6.160000000000004
|
||||
strip:MxCymbs:-3.5
|
||||
strip:MxCont:-0.003999999999990678
|
||||
strip:MxSamples:-0.9920000000000044
|
||||
strip:MxDrums:-18.471999999999994
|
||||
strip:Vx_ORL:1.9719999999999942
|
||||
strip:FX_Vx_ORL:-0.003999999999990678
|
||||
strip:FX_Vx_ORL_1:-0.003999999999990678
|
||||
strip:FX_Vx_ORL_2:-0.003999999999990678
|
||||
strip:Vx_Dag:1.8960000000000008
|
||||
strip:FX_Vx_Dag:-0.003999999999990678
|
||||
strip:FX_Vx_Dag_1:-0.003999999999990678
|
||||
strip:FX_Vx_Dag_2:-0.003999999999990678
|
||||
strip:Scape_Vx_Dag:2.9599999999999937
|
||||
strip:Vx_Jeannot:-0.003999999999990678
|
||||
strip:Vocals:-15.736000000000004
|
||||
strip:Tom1:-1.524000000000001
|
||||
strip:Tom2:-68.404
|
||||
strip:Tom3:-0.5360000000000014
|
||||
strip:Toms:-3.2720000000000056
|
||||
strip:FOH:-9.884
|
||||
strip:MonitorsJeannot:-0.003999999999990678
|
||||
strip:MonitorsORL:-0.003999999999990678
|
||||
strip:MonitorsDag:-0.003999999999990678
|
||||
strip:mjDrums:-7.224000000000004
|
||||
strip:mjBasses:-0.9920000000000044
|
||||
strip:mjGuitars:-9.199999999999996
|
||||
strip:mjMxDrums:-7.756
|
||||
strip:mjMxSynths:-11.707999999999998
|
||||
strip:mjVocals:-13.0
|
||||
strip:mjMetronome:-11.100000000000001
|
||||
strip:MonitorsJeannot:-0.003999999999990678
|
||||
strip:moDrums:2.9599999999999937
|
||||
strip:moBasses:-1.1439999999999912
|
||||
strip:moGuitars:-7.072000000000003
|
||||
strip:moMxDrums:-10.339999999999996
|
||||
strip:moMxSynths:-14.823999999999998
|
||||
strip:moVocals:-9.047999999999995
|
||||
strip:moBassORL:-70.0
|
||||
strip:moGuitarORL:-70.0
|
||||
strip:moVxORL:-70.0
|
||||
strip:moMetronome:-6.996000000000002
|
||||
strip:MonitorsORL:-0.003999999999990678
|
||||
strip:mdDrums:-0.003999999999990678
|
||||
strip:mdBasses:-1.2199999999999989
|
||||
strip:mdGuitars:-7.984000000000002
|
||||
strip:mdMxDrums:-15.204
|
||||
strip:mdMxSynths:-13.988
|
||||
strip:mdVocals:-12.924
|
||||
strip:mdBassDag:-70.0
|
||||
strip:mdGuitarDag:-70.0
|
||||
strip:mdVoixDag:-70.0
|
||||
strip:mdMetronome:-0.003999999999990678
|
||||
strip:MonitorsDag:-0.003999999999990678
|
||||
fader:Bassess:4.89
|
||||
fader:Drums:0.00
|
||||
fader:Basses:-40.16
|
||||
fader:Guitars:0.00
|
||||
fader:MxSynths:0.00
|
||||
fader:MxDrums:0.00
|
||||
fader:Vocals:0.00
|
||||
fader:Acoustics:0.00
|
||||
fader:FOH:0.00
|
||||
fader:Kick:0.00
|
||||
fader:Snare:0.00
|
||||
fader:Toms:0.00
|
||||
fader:OH_L:0.00
|
||||
fader:OH_R:0.00
|
||||
fader:Tom1:0.00
|
||||
fader:Tom2:0.00
|
||||
fader:Tom3:0.00
|
||||
fader:Bass_ORL:0.00
|
||||
fader:Oct_Bass_ORL:0.00
|
||||
fader:FX_Bass_ORL:0.00
|
||||
fader:Bass_Dag:0.00
|
||||
fader:Oct_Bass_Dag:0.00
|
||||
fader:FX_Bass_Dag:0.00
|
||||
fader:Guitar_ORL:0.00
|
||||
fader:FX_Gtr_ORL_1:0.00
|
||||
fader:FX_Gtr_ORL_2:0.00
|
||||
fader:FX_Gtr_ORL:0.00
|
||||
fader:Guitar_Dag:0.00
|
||||
fader:FX_Gtr_Dag_1:0.00
|
||||
fader:FX_Gtr_Dag_2:0.00
|
||||
fader:FX_Gtr_Dag:0.00
|
||||
fader:Scape_Gtr_Dag:0.00
|
||||
fader:MxBass:0.00
|
||||
fader:MxChords:0.00
|
||||
fader:MxLead:0.00
|
||||
fader:MxCtLead:0.00
|
||||
fader:MxClassical:0.00
|
||||
fader:MxKicks:0.00
|
||||
fader:MxSnares:0.00
|
||||
fader:MxCymbs:0.00
|
||||
fader:MxCont:0.00
|
||||
fader:MxSamples:0.00
|
||||
fader:PianoToy:0.00
|
||||
fader:Cymbalum:0.00
|
||||
fader:GuitarAc:0.00
|
||||
fader:Vx_ORL:0.00
|
||||
fader:FX_Vx_ORL_1:0.00
|
||||
fader:FX_Vx_ORL_2:0.00
|
||||
fader:FX_Vx_ORL:0.00
|
||||
fader:Vx_Dag:0.00
|
||||
fader:FX_Vx_Dag_1:0.00
|
||||
fader:FX_Vx_Dag_2:0.00
|
||||
fader:FX_Vx_Dag:0.00
|
||||
fader:Scape_Vx_Dag:0.00
|
||||
fader:Vx_Jeannot:0.00
|
||||
button:button1:0
|
||||
Loading…
Add table
Add a link
Reference in a new issue