preparing next feature : differents widgets (strip, button, switch, xy pad?)

This commit is contained in:
jean-emmanuel 2015-04-09 13:52:18 +02:00 • committed by Jean-Emmanuel
parent 84d2ed54b9
commit ff7fb651ec
4 changed files with 271 additions and 184 deletions

View file

@ -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',

View file

@ -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;
}

View file

@ -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 = $('\
<div class="strip">\
<div class="title" '+color+'>'+title+'</div>\
<div class="fader-wrapper"><div class="fader locked" path="'+stripData.path+'" name="'+stripId+'"></div></div>\
<input value="0"></input>\
</div>\
');
$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 = $('\
<div class="widget button">\
<div class="title" '+color+'>'+title+'</div>\
<div class="button-inner-wrapper"><div class="push"></div></div>\
<input value="OFF"></input>\
</div>\
');
$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 = $('\
<div class="widget strip">\
<div class="title" '+color+'>'+title+'</div>\
<div class="strip-inner-wrapper">\
<div class="fader locked" path="'+widgetData.path+'" name="'+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;
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<range.max){
autopips.push(0);
}
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();
$widget.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($widget.find('input'))
.on('slide',function(){
if ($(this).hasClass('locked')) return;
var p = widgetData.path,
n = widgetData.args,
t = widgetData.target?widgetData.target:defaultTarget,
v = widgetData.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 = widgetData.path,
t = widgetData.target?widgetData.target:defaultTarget,
a = widgetData.args,
v = widgetData.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]);
});
// store reference for state saving/loading
__strips__.push($widget)
}
$tabContent.append($widget);
});// widgets parsed
}
@ -151,7 +179,7 @@ function parsetabs(TABS,parent,sub) {
// Synchronize strips that share the same name
// Synchronize faders that share the same name
$(".fader").each(function(){
$(".fader[name='"+$(this).attr('name')+"']").not(this).Link('lower').to($(this), crossUpdate);
}).removeClass('locked');

View file

@ -22,7 +22,7 @@ input::-webkit-selection{
html {
html, body {
height:100%;
}
#__container__ {
@ -58,6 +58,10 @@ html {
.scrollable .nicescroll-rails-hr {
display:block!important;
}
.nicescroll-rails-vr {
display:none!important;
}
a {
@ -82,7 +86,7 @@ a.on, a:active {
}
.main {
box-shadow:0 0 8px 0 #111, 0 0 200px 0 #111;
box-shadow:0 0 8px 0 #111;
position:fixed;
z-index:3;
white-space:nowrap;
@ -154,17 +158,23 @@ a.on, a:active {
.tab.on {
display:block;
}
.strip {
width:100px;
border:1px solid rgba(0,0,0,0.2);
padding:35px 0px;
.widget {
display:inline-block;
background:#333;
height:100%;
position:relative;
font-size:13px;
border:1px solid rgba(0,0,0,0.2);
padding:33px 0;
}
.strip .title {
.widget .title {
font-variant:small-caps;
border-bottom:1px solid #2A2A2A;
border-left:0;
@ -176,21 +186,12 @@ a.on, a:active {
left:0;
right:0;
text-overflow:ellipsis;
overflow:hidden
}
.strip .fader-wrapper {
padding:20px 10px;
overflow:hidden;
height:100%;
height:35px;
}
.strip .fader{
height:100%;
width:18px;
}
.strip input {
.widget input {
width:100%;
height:35px;
border:0;
border-top:1px solid #2A2A2A;
border-left:0;
@ -205,97 +206,52 @@ a.on, a:active {
left:0;
right:0;
}
.strip input:focus {
.widget input:focus {
background:#353535;
}
.noUi-background {
background:#222;
border:1px solid rgba(255,255,255,0.2);
border-radius:0px;
box-shadow:0 0 0;
/* BUTTON */
.button {
width:100px;
}
}
.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;
.button-inner-wrapper {
height:100%;
left:-5000px;
width:10000px;
}
overflow:hidden;
.noUi-connect {
background:rgba(20,240,250,.4);
border:0;
border-radius:0;
}
.noUi-vertical .noUi-handle {
top:-18px;
aheight:60px;
.push {
width:100%;
height:100%;
position:relative;
}
.noUi-vertical .noUi-dragable:after {
.push:after {
content:"";
position:absolute;
height:10000px;
top:-5000px;
width:500px;
left:-250px;
width:20px;
height:20px;
top:50%;left:50%;
margin:-10px 0 0 -10px;
box-shadow:0 0 0 1px rgba(255,255,255,0.2);;
background:#222;
}
.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;
.push:active:after {
background:rgba(20,240,250,.4);
}
/* STRIP (vertical fader) */
.strip {
width:100px;
}
.strip-inner-wrapper {
padding:20px 10px;
overflow:hidden;
height:100%;
}
.strip .fader{
height:100%;
width:18px;
}