From 44da95dcec51fa50fc8b22f7237e796ba3b5cea8 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 22 Mar 2016 16:52:34 +0100 Subject: [PATCH] new feature : preArgs option to prepend constant values in widgets' osc messages --- browser/js/app.js | 2 +- browser/js/app/callbacks.js | 24 +- browser/js/app/editor/purge.js | 10 + browser/js/app/parser.js | 13 +- browser/js/app/widgets/fader.js | 14 +- browser/js/app/widgets/knob.js | 10 +- browser/js/app/widgets/led.js | 3 +- browser/js/app/widgets/meter.js | 3 +- browser/js/app/widgets/multifader.js | 2 + browser/js/app/widgets/multipush.js | 2 + browser/js/app/widgets/multitoggle.js | 2 + browser/js/app/widgets/plot.js | 3 +- browser/js/app/widgets/push.js | 4 +- browser/js/app/widgets/rgb.js | 11 +- browser/js/app/widgets/switch.js | 5 +- browser/js/app/widgets/toggle.js | 5 +- browser/js/app/widgets/visualizer.js | 3 +- browser/js/app/widgets/xy.js | 14 +- examples/widgets.js | 375 ++++++++++++++++++++------ main/osc.js | 4 +- resources/docs/widgets-reference.md | 3 +- 21 files changed, 387 insertions(+), 125 deletions(-) diff --git a/browser/js/app.js b/browser/js/app.js index 8232e2fc..81ac09bf 100644 --- a/browser/js/app.js +++ b/browser/js/app.js @@ -2,7 +2,7 @@ WIDGETS = {} WIDGETS_LINKED = {} -WIDGETS_ID_BY_PATH = {} +WIDGETS_BY_PATH = {} SESSION = [] STATE = [] diff --git a/browser/js/app/callbacks.js b/browser/js/app/callbacks.js index 25443da0..e3091cc5 100644 --- a/browser/js/app/callbacks.js +++ b/browser/js/app/callbacks.js @@ -9,17 +9,25 @@ module.exports = { var data = data || event // fetch ids corresponding to the osc path - var path = data.path - var ids = WIDGETS_ID_BY_PATH[path] + var path = data.path, + pathref = path, + args = data.args - for (i in ids) { - var id = ids[i] - // update - if (WIDGETS[id]) { - for (j in WIDGETS[id]){ - WIDGETS[id][j].setValue(data.args,false,true) + if (typeof data.args == 'object') { + for (var i=data.args.length-1;i>=0;i--) { + var ref = path+'|--|--|'+data.args.slice(0,i).join('|--|--|') + if (WIDGETS_BY_PATH[ref]) { + pathref = ref + args = data.args.slice(i,data.args.length) + args = args.length==1?args[0]:args + continue } } + } else { + args = data.args + } + for (i in WIDGETS_BY_PATH[pathref]) { + if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,false,true) } diff --git a/browser/js/app/editor/purge.js b/browser/js/app/editor/purge.js index 881afc8f..3d82391d 100644 --- a/browser/js/app/editor/purge.js +++ b/browser/js/app/editor/purge.js @@ -55,4 +55,14 @@ module.exports = function() { delete WIDGETS_LINKED[i] } } + for (i in WIDGETS_BY_PATH) { + for (var j=WIDGETS_BY_PATH[i].length-1;j>=0;j--) { + if (!$b.find(WIDGETS_BY_PATH[i][j]).length) { + WIDGETS_BY_PATH[i].splice(j,1) + } + } + if (!WIDGETS_BY_PATH[i].length) { + delete WIDGETS_BY_PATH[i] + } + } } diff --git a/browser/js/app/parser.js b/browser/js/app/parser.js index d668b65d..95f93100 100644 --- a/browser/js/app/parser.js +++ b/browser/js/app/parser.js @@ -19,7 +19,7 @@ module.exports.tabs = function(data,parent,main,parentLabel){ // Reset Globals WIDGETS = {} WIDGETS_LINKED = {} - WIDGETS_ID_BY_PATH = {} + WIDGETS_BY_PATH = {} SESSION = data TABS['#container'] = { tab:$('#container') @@ -120,6 +120,10 @@ module.exports.widgets = function(data,parent) { delete widgetData.left } + if (widgetData.preArgs!=undefined) { + widgetData.preArgs = Array.isArray(widgetData.preArgs)?widgetData.preArgs:[widgetData.preArgs] + } + var width = parseFloat(widgetData.width)==widgetData.width?parseFloat(widgetData.width)+'rem' : widgetData.width, height = parseFloat(widgetData.height)==widgetData.height?parseFloat(widgetData.height)+'rem' : widgetData.height, left = parseFloat(widgetData.left)==widgetData.left?parseFloat(widgetData.left)+'rem' : widgetData.left, @@ -160,8 +164,11 @@ module.exports.widgets = function(data,parent) { } // store path vs widget id for faster cross-app sync - if (WIDGETS_ID_BY_PATH[widgetData.path]==undefined) WIDGETS_ID_BY_PATH[widgetData.path] = [] - WIDGETS_ID_BY_PATH[widgetData.path].push(widgetData.id) + if (widgetData.path)  { + var pathref = widgetData.preArgs&&widgetData.preArgs.length?widgetData.path+'|--|--|'+widgetData.preArgs.join('|--|--|'):widgetData.path + if (WIDGETS_BY_PATH[pathref]==undefined) WIDGETS_BY_PATH[pathref] = [] + WIDGETS_BY_PATH[pathref].push(widgetInner) + } parent[0].appendChild(widgetContainer[0]) } diff --git a/browser/js/app/widgets/fader.js b/browser/js/app/widgets/fader.js index 9160b699..f9c76c0f 100644 --- a/browser/js/app/widgets/fader.js +++ b/browser/js/app/widgets/fader.js @@ -32,6 +32,7 @@ module.exports.options = { precision:2, meter:false, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -56,7 +57,9 @@ module.exports.create = function(widgetData,container) { dimension = widgetData.horizontal?'width':'height', axe = dimension=='height'?'X':'Y', absolute = widgetData.absolute, - logScale = widgetData.logScale + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) + if (widgetData.horizontal) container.addClass('horizontal') @@ -73,7 +76,8 @@ module.exports.create = function(widgetData,container) { horizontal:widgetData.horizontal, range:widgetData.range, logScale:widgetData.logScale, - path:widgetData.path + '/meter' + path:widgetData.path + '/meter', + preArgs:widgetData.preArgs } var element = parsewidgets([data],fader) element[0].classList.add('not-editable') @@ -196,7 +200,7 @@ module.exports.create = function(widgetData,container) { } widget.setValue = function(v,send,sync) { var h, - v=clip(v,[rangeVals[0],rangeVals.slice(-1)[0]]) + v=clip(Math.round(v*roundFactor)/roundFactor,[rangeVals[0],rangeVals.slice(-1)[0]]) for (var i=0;i= rangeVals[i]) { h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]],widgetData.precision,logScale,true) @@ -216,11 +220,13 @@ module.exports.create = function(widgetData,container) { } widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + sendOsc({ target:widgetData.target, path:widgetData.path, precision:widgetData.precision, - args:v + args:args }) } diff --git a/browser/js/app/widgets/knob.js b/browser/js/app/widgets/knob.js index 0d5c7b26..dc365f72 100644 --- a/browser/js/app/widgets/knob.js +++ b/browser/js/app/widgets/knob.js @@ -31,6 +31,7 @@ module.exports.options = { logScale:false, precision:2, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -59,7 +60,8 @@ module.exports.create = function(widgetData,container) { unit = widgetData.unit?' '+widgetData.unit.trim(): '', absolute = widgetData.absolute, pan = widgetData.pan, - logScale = widgetData.logScale + logScale = widgetData.logScale, + roundFactor = Math.pow(10,widgetData.precision) var pipmin = Math.abs(range.min)>=1000?range.min/1000+'k':range.min, @@ -180,15 +182,17 @@ module.exports.create = function(widgetData,container) { input.val(v+unit) } widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + sendOsc({ target:widgetData.target, path:widgetData.path, precision:widgetData.precision, - args:v + args:args }) } widget.setValue = function(v,send,sync) { - var r = mapToScale(v,[range.min,range.max],[0,270],widgetData.precision,logScale,true) + var r = mapToScale(Math.round(v*roundFactor)/roundFactor,[range.min,range.max],[0,270],widgetData.precision,logScale,true) knob.rotation = r widget.updateUi(r) diff --git a/browser/js/app/widgets/led.js b/browser/js/app/widgets/led.js index 00f94951..ed09d935 100644 --- a/browser/js/app/widgets/led.js +++ b/browser/js/app/widgets/led.js @@ -19,6 +19,7 @@ module.exports.options = { range:{min:0,max:1}, logScale:false, + preArgs:[], path:'auto' } module.exports.create = function(widgetData,container) { @@ -38,6 +39,6 @@ module.exports.create = function(widgetData,container) { } widget.setValue(range.min) - + return widget } diff --git a/browser/js/app/widgets/meter.js b/browser/js/app/widgets/meter.js index c4386d82..08bf3cbf 100644 --- a/browser/js/app/widgets/meter.js +++ b/browser/js/app/widgets/meter.js @@ -23,7 +23,8 @@ module.exports.options = { range:{min:0,max:1}, logScale:false, - path:'auto' + path:'auto', + preArgs:[] } module.exports.create = function(widgetData,container) { diff --git a/browser/js/app/widgets/multifader.js b/browser/js/app/widgets/multifader.js index e2545c2e..7fb31df1 100644 --- a/browser/js/app/widgets/multifader.js +++ b/browser/js/app/widgets/multifader.js @@ -24,6 +24,7 @@ module.exports.options = { logScale:false, precision:2, path:'auto', + preArgs:[], target:[] } @@ -50,6 +51,7 @@ module.exports.create = function(widgetData,container) { logScale:widgetData.logScale, precision:widgetData.precision, path:widgetData.path + '/' + i, + preArgs:widgetData.preArgs, target:widgetData.target } var element = parsewidgets([data],widget) diff --git a/browser/js/app/widgets/multipush.js b/browser/js/app/widgets/multipush.js index 314c625c..aafd2bcc 100644 --- a/browser/js/app/widgets/multipush.js +++ b/browser/js/app/widgets/multipush.js @@ -22,6 +22,7 @@ module.exports.options = { off:0, precision:2, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -45,6 +46,7 @@ module.exports.create = function(widgetData,container) { off:widgetData.off, precision:widgetData.precision, path:widgetData.path + '/' + i, + preArgs:widgetData.preArgs, target:widgetData.target } var element = parsewidgets([data],widget) diff --git a/browser/js/app/widgets/multitoggle.js b/browser/js/app/widgets/multitoggle.js index b1ca2c7b..afad3c25 100644 --- a/browser/js/app/widgets/multitoggle.js +++ b/browser/js/app/widgets/multitoggle.js @@ -22,6 +22,7 @@ module.exports.options = { off:0, precision:2, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -45,6 +46,7 @@ module.exports.create = function(widgetData,container) { off:widgetData.off, precision:widgetData.precision, path:widgetData.path + '/' + i, + preArgs:widgetData.preArgs, target:widgetData.target } var element = parsewidgets([data],widget) diff --git a/browser/js/app/widgets/plot.js b/browser/js/app/widgets/plot.js index d592c2e5..ceb68688 100644 --- a/browser/js/app/widgets/plot.js +++ b/browser/js/app/widgets/plot.js @@ -25,7 +25,8 @@ module.exports.options = { separator3:'osc', - path:'auto' + path:'auto', + preArgs:[], } module.exports.create = function(widgetData,container) { diff --git a/browser/js/app/widgets/push.js b/browser/js/app/widgets/push.js index fd81b83a..ece428af 100644 --- a/browser/js/app/widgets/push.js +++ b/browser/js/app/widgets/push.js @@ -21,6 +21,7 @@ module.exports.options = { off:0, precision:2, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -73,11 +74,12 @@ module.exports.create = function(widgetData,container) { } widget.sendValue = function(v) { if (v===false) return + var args = widgetData.preArgs.concat(v) sendOsc({ target:widgetData.target, path:widgetData.path, precision:widgetData.precision, - args:v + args:args }) } widget.setValue() diff --git a/browser/js/app/widgets/rgb.js b/browser/js/app/widgets/rgb.js index 630cc98b..e340404b 100644 --- a/browser/js/app/widgets/rgb.js +++ b/browser/js/app/widgets/rgb.js @@ -27,6 +27,7 @@ module.exports.options = { precision:0, path:'auto', + preArgs:[], split:false, target:[] } @@ -210,31 +211,33 @@ module.exports.create = function(widgetData,container) { if (send) widget.sendValue(v) } widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + sendOsc({ target:split?false:widgetData.target, path:widgetData.path, - args:v, + args:args, precision:widgetData.precision, }) if (split) { sendOsc({ target:widgetData.target, path:split.r, - args:v[0], + args:widgetData.preArgs.concat(v[0]), precision:widgetData.precision, sync:false }) sendOsc({ target:widgetData.target, path:split.g, - args:v[1], + args:widgetData.preArgs.concat(v[1]), precision:widgetData.precision, sync:false }) sendOsc({ target:widgetData.target, path:split.b, - args:v[2], + args:widgetData.preArgs.concat(v[2]), precision:widgetData.precision, sync:false }) diff --git a/browser/js/app/widgets/switch.js b/browser/js/app/widgets/switch.js index 335a8f49..9d904169 100644 --- a/browser/js/app/widgets/switch.js +++ b/browser/js/app/widgets/switch.js @@ -21,6 +21,7 @@ module.exports.options = { values:{"Value 1":1,"Value 2":2}, precision:2, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -71,11 +72,13 @@ module.exports.create = function(widgetData,container) { } widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + sendOsc({ target:widgetData.target, path:widgetData.path, precision:widgetData.precision, - args:v + args:args }) } return widget diff --git a/browser/js/app/widgets/toggle.js b/browser/js/app/widgets/toggle.js index 643c9d79..552aed38 100644 --- a/browser/js/app/widgets/toggle.js +++ b/browser/js/app/widgets/toggle.js @@ -21,6 +21,7 @@ module.exports.options = { off:0, precision:2, path:'auto', + preArgs:[], target:[] } module.exports.create = function(widgetData,container) { @@ -71,11 +72,13 @@ module.exports.create = function(widgetData,container) { } widget.sendValue = function(v) { if (v===false) return + var args = widgetData.preArgs.concat(v) + sendOsc({ target:widgetData.target, path:widgetData.path, precision:widgetData.precision, - args:v + args:args }) } widget.setValue() diff --git a/browser/js/app/widgets/visualizer.js b/browser/js/app/widgets/visualizer.js index bea9d341..e1213af0 100644 --- a/browser/js/app/widgets/visualizer.js +++ b/browser/js/app/widgets/visualizer.js @@ -25,7 +25,8 @@ module.exports.options = { separator3:'osc', - path:'auto' + path:'auto', + preArgs:[], } module.exports.create = function(widgetData,container) { diff --git a/browser/js/app/widgets/xy.js b/browser/js/app/widgets/xy.js index 8ef40ff8..2e18cd04 100644 --- a/browser/js/app/widgets/xy.js +++ b/browser/js/app/widgets/xy.js @@ -30,6 +30,7 @@ module.exports.options = { logScaleY:false, precision:2, path:'auto', + preArgs:[], split:false, target:[] } @@ -55,7 +56,8 @@ module.exports.create = function(widgetData,container) { widgetData.split:{x:widgetData.path+'/x',y:widgetData.path+'/y'} :false; logScaleX = widgetData.logScaleX, - logScaleY = widgetData.logScaleY + logScaleY = widgetData.logScaleY, + roundFactor = Math.pow(10,widgetData.precision) if (widgetData.height!='auto') widget.addClass('manual-height') @@ -131,7 +133,7 @@ module.exports.create = function(widgetData,container) { if (!v || v.length!=2) return for (i in [0,1]) { - v[i] = clip(v[i],[range[['x','y'][i]].min,range[['x','y'][i]].max]) + v[i] = clip(Math.round(v[i]*roundFactor)/roundFactor,[range[['x','y'][i]].min,range[['x','y'][i]].max]) } var w = mapToScale(v[0],[range.x.min,range.x.max],[0,100],widgetData.precision,logScaleX,true) @@ -148,24 +150,26 @@ module.exports.create = function(widgetData,container) { if (send) widget.sendValue(v) } widget.sendValue = function(v) { + var args = widgetData.preArgs.concat(v) + sendOsc({ target:split?false:widgetData.target, path:widgetData.path, - args:v, + args:args, precision:widgetData.precision, }) if (split) { sendOsc({ target:widgetData.target, path:split.x, - args:v[0], + args:widgetData.preArgs.concat(v[0]), precision:widgetData.precision, sync:false }) sendOsc({ target:widgetData.target, path:split.y, - args:v[1], + args:widgetData.preArgs.concat(v[1]), precision:widgetData.precision, sync:false }) diff --git a/examples/widgets.js b/examples/widgets.js index 55d48d86..8458cdac 100644 --- a/examples/widgets.js +++ b/examples/widgets.js @@ -23,7 +23,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_1" + "path": "/knob_1", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -43,7 +46,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_1" + "path": "/switch_1", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -71,7 +76,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_1" + "path": "/fader_1", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -87,7 +96,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_1" + "path": "/toggle_1", + "color": "auto", + "preArgs": [] } ], "id": "strip_1", @@ -97,7 +108,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -121,7 +133,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_2" + "path": "/knob_2", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -141,7 +156,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_2" + "path": "/switch_2", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -169,7 +186,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_2" + "path": "/fader_2", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -185,7 +206,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_2" + "path": "/toggle_2", + "color": "auto", + "preArgs": [] } ], "id": "strip_2", @@ -195,7 +218,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -219,7 +243,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_3" + "path": "/knob_3", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -239,7 +266,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_3" + "path": "/switch_3", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -267,7 +296,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_3" + "path": "/fader_3", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -283,7 +316,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_3" + "path": "/toggle_3", + "color": "auto", + "preArgs": [] } ], "id": "strip_3", @@ -293,7 +328,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -317,7 +353,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_4" + "path": "/knob_4", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -337,7 +376,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_4" + "path": "/switch_4", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -365,7 +406,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_4" + "path": "/fader_4", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -381,7 +426,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_4" + "path": "/toggle_4", + "color": "auto", + "preArgs": [] } ], "id": "strip_4", @@ -391,7 +438,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -415,7 +463,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_5" + "path": "/knob_5", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -435,7 +486,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_5" + "path": "/switch_5", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -463,7 +516,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_5" + "path": "/fader_5", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -479,7 +536,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_5" + "path": "/toggle_5", + "color": "auto", + "preArgs": [] } ], "id": "strip_5", @@ -489,7 +548,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -513,7 +573,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_6" + "path": "/knob_6", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -533,7 +596,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_6" + "path": "/switch_6", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -561,7 +626,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_6" + "path": "/fader_6", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -577,7 +646,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_6" + "path": "/toggle_6", + "color": "auto", + "preArgs": [] } ], "id": "strip_6", @@ -587,7 +658,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -611,7 +683,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_7" + "path": "/knob_7", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -631,7 +706,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_7" + "path": "/switch_7", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -659,7 +736,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_7" + "path": "/fader_7", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -675,7 +756,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_7" + "path": "/toggle_7", + "color": "auto", + "preArgs": [] } ], "id": "strip_7", @@ -685,7 +768,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -709,7 +793,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_8" + "path": "/knob_8", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -729,7 +816,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_8" + "path": "/switch_8", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -757,7 +846,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_8" + "path": "/fader_8", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -773,7 +866,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_8" + "path": "/toggle_8", + "color": "auto", + "preArgs": [] } ], "id": "strip_8", @@ -783,7 +878,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -807,7 +903,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_9" + "path": "/knob_9", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -827,7 +926,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_9" + "path": "/switch_9", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -855,7 +956,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_9" + "path": "/fader_9", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -871,7 +976,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_9" + "path": "/toggle_9", + "color": "auto", + "preArgs": [] } ], "id": "strip_9", @@ -881,7 +988,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -905,7 +1013,10 @@ "max": 1 }, "precision": 2, - "path": "/knob_10" + "path": "/knob_10", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "label": false, @@ -925,7 +1036,9 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/switch_10" + "path": "/switch_10", + "color": "auto", + "preArgs": [] }, { "label": false, @@ -953,7 +1066,11 @@ "horizontal": false, "css": "", "precision": 2, - "path": "/fader_10" + "path": "/fader_10", + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "label": "Mute", @@ -969,7 +1086,9 @@ "on": 1, "off": 0, "precision": 2, - "path": "/toggle_10" + "path": "/toggle_10", + "color": "auto", + "preArgs": [] } ], "id": "strip_10", @@ -979,7 +1098,8 @@ "width": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" } ], "label": "Strips" @@ -1004,7 +1124,8 @@ "css": "", "precision": 0, "path": "/rgb_1", - "split": false + "split": false, + "preArgs": [] }, { "label": "Relative XY", @@ -1028,7 +1149,11 @@ }, "precision": 2, "path": "/xy_1", - "split": false + "split": false, + "color": "auto", + "logScaleX": false, + "logScaleY": false, + "preArgs": [] } ], "id": "strip_11", @@ -1037,7 +1162,8 @@ "top": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -1057,7 +1183,8 @@ "css": "", "precision": 0, "path": "/rgb_2", - "split": false + "split": false, + "preArgs": [] }, { "label": "Relative XY", @@ -1081,7 +1208,11 @@ }, "precision": 2, "path": "/xy_2", - "split": false + "split": false, + "color": "auto", + "logScaleX": false, + "logScaleY": false, + "preArgs": [] } ], "id": "strip_12", @@ -1090,7 +1221,8 @@ "top": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -1110,7 +1242,8 @@ "css": "", "precision": 0, "path": "/rgb_3", - "split": false + "split": false, + "preArgs": [] }, { "label": "Relative XY", @@ -1134,7 +1267,11 @@ }, "precision": 2, "path": "/xy_3", - "split": false + "split": false, + "color": "auto", + "logScaleX": false, + "logScaleY": false, + "preArgs": [] } ], "id": "strip_13", @@ -1143,7 +1280,8 @@ "top": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -1163,7 +1301,8 @@ "css": "", "precision": 0, "path": "/rgb_4", - "split": false + "split": false, + "preArgs": [] }, { "label": "Relative XY", @@ -1187,7 +1326,11 @@ }, "precision": 2, "path": "/xy_4", - "split": false + "split": false, + "color": "auto", + "logScaleX": false, + "logScaleY": false, + "preArgs": [] } ], "id": "strip_14", @@ -1196,7 +1339,8 @@ "top": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -1216,7 +1360,8 @@ "css": "", "precision": 0, "path": "/rgb_5", - "split": false + "split": false, + "preArgs": [] }, { "label": "Relative XY", @@ -1240,7 +1385,11 @@ }, "precision": 2, "path": "/xy_5", - "split": false + "split": false, + "color": "auto", + "logScaleX": false, + "logScaleY": false, + "preArgs": [] } ], "id": "strip_15", @@ -1249,7 +1398,8 @@ "top": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" }, { "type": "strip", @@ -1269,7 +1419,8 @@ "css": "", "precision": 0, "path": "/rgb_6", - "split": false + "split": false, + "preArgs": [] }, { "label": "Relative XY", @@ -1293,7 +1444,11 @@ }, "precision": 2, "path": "/xy_6", - "split": false + "split": false, + "color": "auto", + "logScaleX": false, + "logScaleY": false, + "preArgs": [] } ], "id": "strip_16", @@ -1302,7 +1457,8 @@ "top": "auto", "height": "auto", "horizontal": false, - "css": "" + "css": "", + "color": "auto" } ], "label": "Pads" @@ -1340,7 +1496,11 @@ }, "precision": 2, "path": "/fader_12", - "target": [] + "target": [], + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "type": "fader", @@ -1361,7 +1521,11 @@ }, "precision": 2, "path": "/fader_13", - "target": [] + "target": [], + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "type": "fader", @@ -1382,7 +1546,11 @@ }, "precision": 2, "path": "/fader_14", - "target": [] + "target": [], + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] }, { "type": "fader", @@ -1403,13 +1571,18 @@ }, "precision": 2, "path": "/fader_25", - "target": [] + "target": [], + "color": "auto", + "logScale": false, + "meter": false, + "preArgs": [] } ], "tabs": [], "id": "panel_1", "label": "auto", - "stretch": false + "stretch": false, + "color": "auto" }, { "type": "panel", @@ -1437,7 +1610,9 @@ "on": 1, "off": 0, "id": "push_5", - "label": "auto" + "label": "auto", + "color": "auto", + "preArgs": [] }, { "type": "push", @@ -1453,7 +1628,9 @@ "on": 1, "off": 0, "id": "push_3", - "label": "auto" + "label": "auto", + "color": "auto", + "preArgs": [] }, { "type": "push", @@ -1469,7 +1646,9 @@ "on": 1, "off": 0, "id": "push_1", - "label": "auto" + "label": "auto", + "color": "auto", + "preArgs": [] }, { "type": "push", @@ -1485,7 +1664,9 @@ "on": 1, "off": 0, "id": "push_2", - "label": "auto" + "label": "auto", + "color": "auto", + "preArgs": [] } ] }, @@ -1511,7 +1692,10 @@ "target": [], "pan": false, "left": "auto", - "top": "auto" + "top": "auto", + "color": "auto", + "logScale": false, + "preArgs": [] }, { "type": "knob", @@ -1532,7 +1716,10 @@ "precision": 2, "path": "/fader_22", "target": [], - "pan": false + "pan": false, + "color": "auto", + "logScale": false, + "preArgs": [] }, { "type": "knob", @@ -1553,7 +1740,10 @@ "precision": 2, "path": "/fader_23", "target": [], - "pan": false + "pan": false, + "color": "auto", + "logScale": false, + "preArgs": [] }, { "type": "knob", @@ -1574,7 +1764,10 @@ "precision": 2, "path": "/fader_24", "target": [], - "pan": false + "pan": false, + "color": "auto", + "logScale": false, + "preArgs": [] } ] }, @@ -1584,7 +1777,8 @@ ], "id": "panel_2", "label": "auto", - "stretch": false + "stretch": false, + "color": "auto" } ] } @@ -1610,7 +1804,10 @@ }, "precision": 2, "path": "/multifader_1", - "target": [] + "target": [], + "color": "auto", + "logScale": false, + "preArgs": [] }, { "type": "multipush", @@ -1629,7 +1826,9 @@ "off": 0, "precision": 2, "path": "/multipush_1", - "target": [] + "target": [], + "color": "auto", + "preArgs": [] }, { "type": "multitoggle", @@ -1647,9 +1846,11 @@ "on": 1, "off": 0, "precision": 2, - "path": "/multipush_1", - "target": [] + "target": [], + "color": "auto", + "preArgs": [], + "path": "/multitoggle_1" } ] } -] +] \ No newline at end of file diff --git a/main/osc.js b/main/osc.js index 66660d36..b64cd509 100644 --- a/main/osc.js +++ b/main/osc.js @@ -27,14 +27,14 @@ module.exports = function(ipc, settings) { if (typeof arg == 'number') { message.append({type:numberType,value:arg}) } else { - message.append({type:'string',value:arg}) + message.append({type:'string',value:String(arg)}) } } } else { if (typeof args == 'number') { message.append({type:numberType,value:args}) } else { - message.append({type:'string',value:args}) + message.append({type:'string',value:String(args)}) } } diff --git a/resources/docs/widgets-reference.md b/resources/docs/widgets-reference.md index 4aa55311..cd27fcd5 100644 --- a/resources/docs/widgets-reference.md +++ b/resources/docs/widgets-reference.md @@ -17,7 +17,8 @@ Every widget has the following properties: precision:2, // [integer] number of decimals : 0 to send integers target:false, // [array/string] List of target hosts ("ip:port" pairs), separated by spaces - path:false // [string] osc path, default to '/widget_id' + path:false, // [string] osc path, default to '/widget_id' + preArgs:[] // [array] list of constant values to prepend to the sent value(s) } ```