diff --git a/config.js b/config.js index 5c949ad4..fa5db5e1 100644 --- a/config.js +++ b/config.js @@ -15,11 +15,27 @@ nmPorts = { } TABS = { - + /* + testingshits: { + widgets:{ + button1: { + type:'button', + target:'localhost:6666', + path:'/osc/path/', + color:'#555522' + }, Basses: { + title:'Basses', + range:'db', + target:nmPorts['MainMix'], + path:'/strip/Basses/Gain/Gain%20(dB)/unscaled' + }, + } + }, + */ MainMix: { title:'MainMix', - strips:{ + widgets:{ Drums: { title:'Drums', @@ -85,7 +101,7 @@ TABS = { tabs:{ Drumset: { title:'Drumset', - strips: { + widgets: { Kick: { title:'Kick', range:'db', @@ -133,7 +149,7 @@ TABS = { }, Toms: { - strips:{ + widgets:{ Tom1: { title:'Tom1', range:'db', @@ -168,7 +184,7 @@ TABS = { Basses: { title:'Basses', - strips:{ + widgets:{ Bass_ORL: { title:'Bass_ORL', @@ -224,7 +240,7 @@ TABS = { Guitars: { title:'Guitars', - strips:{ + widgets:{ Guitar_ORL: { title:'Guitar_ORL', @@ -300,7 +316,7 @@ TABS = { MxSynths: { title:'MxSynths', - strips:{ + widgets:{ MxBass: { title:'MxBass', @@ -348,7 +364,7 @@ TABS = { MxDrums: { title:'MxDrums', - strips:{ + widgets:{ MxKicks: { title:'MxKicks', @@ -396,7 +412,7 @@ TABS = { Acoustics: { title:'Acoustics', - strips:{ + widgets:{ PianoToy: { title:'PianoToy', @@ -430,7 +446,7 @@ TABS = { Vocals: { title:'Vocals', - strips:{ + widgets:{ Vx_ORL: { title:'Vx_ORL', diff --git a/lib/jquery.nouislider.css b/lib/jquery.nouislider.css index 9bf38bbb..66cc1a6f 100644 --- a/lib/jquery.nouislider.css +++ b/lib/jquery.nouislider.css @@ -263,3 +263,90 @@ .noUi-marker-vertical.noUi-marker-large { width: 15px; } + + + +/* Custom css (oschtmlgui) + * + */ +.noUi-background { + background:#222; + border:1px solid rgba(255,255,255,0.2); + border-radius:0px; + box-shadow:0 0 0; +} +} +.noUi-target { + box-shadow:0 0 0; +} +.noUi-base { + z-index:2; + +} +.noUi-handle { + border-radius:0; + box-shadow:0 0 0; + background:rgba(255,255,255,0.2); + border-color:rgba(255,255,255,0.4); +} +.noUi-handle:after { + display:none; +} + +.noUi-vertical .noUi-handle { + width:160%; + left:-30%; +} +.noUi-vertical .noUi-handle:before { + margin-top:2px; + background:rgba(255,255,255,0.3); + width:70%!important; + left:15%; +} + +.noUi-horizontal .noUi-handle:before { + background:rgba(255,255,255,0.4); + width:1px!important; + left:15px; + height:16px; + margin-top:-1px; +} +.noUi-horizontal .noUi-dragable:after { + content:""; + position:absolute; + height:100%; + left:-5000px; + width:10000px; +} + +.noUi-connect { + background:rgba(20,240,250,.4); + border:0; + border-radius:0; +} +.noUi-vertical .noUi-handle { + top:-18px; + aheight:60px; +} +.noUi-vertical .noUi-dragable:after { + content:""; + position:absolute; + height:10000px; + top:-5000px; + width:500px; + left:-250px; +} +.noUi-pips { + font-size:11px; + font-family:sans; +} +.noUi-value-vertical { + margin-top:-7px; +} +.noUi-marker-vertical.noUi-marker { + height:1px; +} +.noUi-marker-horizontal.noUi-marker { + width:1px; +} + diff --git a/lib/oschtmlgui.js b/lib/oschtmlgui.js index 4d39bb78..3e46a1ca 100644 --- a/lib/oschtmlgui.js +++ b/lib/oschtmlgui.js @@ -62,85 +62,113 @@ function parsetabs(TABS,parent,sub) { } else { - $.each(tabData.strips,function(stripId,stripData){// parse strips - var color = stripData.color?'style="background-color:'+stripData.color+'"':''; - var title = stripData.title || stripId; - var $strip = $('\ -
\ -
'+title+'
\ -
\ - \ -
\ - '); - $strip.fader = $strip.find('.fader') - - var range = stripData.range=='db'?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'max': 6}:stripData.range; - - var pips = function() { - if (stripData.range=='db') { - return [-70,-60,-50,-40,-30,-20,-10,-6,-3,0,3,6]; - } else { - var autopips = []; - var i=0; - for (key in range) { - //alert(range.key) - autopips[i]=range[key]; - i=i+1; - } - autopips.push((range.max-range.min)/2); - autopips.push((range.max-range.min)/4); - autopips.push((range.max-range.min)*.75); - return autopips; - } - } - var pips = pips(); + $.each(tabData.widgets,function(widgetId,widgetData){// parse widgets + + var color = widgetData.color?'style="background-color:'+widgetData.color+'"':''; + var title = widgetData.title || widgetId; + switch(widgetData.type) { + + case 'button': + var $widget = $('\ +
\ +
'+title+'
\ +
\ + \ +
\ + '); - $strip.find('.fader') - .noUiSlider({ - orientation:'vertical', - direction: "rtl", - behaviour: "none-drag", - connect: "lower", - //animate:false, - start: 0, - range: range - }) - .noUiSlider_pips({ - mode: 'values', - density: 1, - filter:function(v,t){return v==0?1:2;}, - values: pips, - format: wNumb({}) - }) - .Link('lower').to($strip.find('input')) - .on('slide',function(){ - if ($(this).hasClass('locked')) return; - var p = stripData.path, - n = stripData.args, - t = stripData.target?stripData.target:defaultTarget, - v = stripData.scale1? - Math.max(0,Math.round(10000*((Math.abs(range.min)/(range.max-range.min)) + $(this).val()/(range.max-range.min)))/10000) - : $(this).val(); - sendOsc([t,p,n,v]); - }) - .on('set',function(){ - if ($(this).hasClass('locked')) return; - var p = stripData.path, - t = stripData.target?stripData.target:defaultTarget, - a = stripData.args, - v = stripData.scale1? - Math.max(0,Math.round(10000*((Math.abs(range.min)/(range.max-range.min)) + $(this).val()/(range.max-range.min)))/10000) - : $(this).val(); - - sendOsc([t,p,a,v]); - }); + break + - // store reference for state saving/loading - __strips__.push($strip) - - $tabContent.append($strip); - });// strips parsed + + case 'strip': + default: + + var $widget = $('\ +
\ +
'+title+'
\ +
\ +
\ +
\ + \ +
\ + '); + $widget.fader = $widget.find('.fader') + + var range = (widgetData.range=='db'||!widgetData.range)?{'min': -70,'20%': -40,'45%': -20,'60%': -10,'max': 6}:widgetData.range; + + + var pips = function() { + if (widgetData.range=='db'||!widgetData.range) { + return [-70,-60,-50,-40,-30,-20,-10,-6,-3,0,3,6]; + } else { + var autopips = []; + var i=0; + for (key in range) { + //alert(range.key) + autopips[i]=range[key]; + i=i+1; + } + if (range.min<0