diff --git a/package.json b/package.json index bf1d7a7c..4ca4a9b5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.0.0-beta4", + "version": "1.0.0-beta5", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/resources/docs/docs/custom-module/examples.md b/resources/docs/docs/custom-module/examples.md new file mode 100644 index 00000000..ccca6191 --- /dev/null +++ b/resources/docs/docs/custom-module/examples.md @@ -0,0 +1,106 @@ +## Basic address routing + +```js +module.exports = { + + oscInFilter:function(data){ + + var {address, args, host, port} = data + + if (address === '/some_address') { + address = '/fader_1' + } + + return {address, args, host, port} + + }, + + oscOutFilter:function(data){ + + var {address, args, host, port, clientId} = data + + if (address === '/fader_1') { + address = '/some_address' + } + + return {address, args, host, port} + } + +} +``` + +## Arguments split / merge + +```js + +var xyValue = [0, 0] + +module.exports = { + + oscInFilter:function(data){ + + var {address, args, host, port} = data + + // split + if (address === '/some_xy_address') { + var arg1 = args[0].value, + arg2 = args[1].value + + receive('/fader_1', arg1) + receive('/fader_2', arg2) + + return // bypass original message + } + + return {address, args, host, port} + + }, + + oscOutFilter:function(data){ + + var {address, args, host, port, clientId} = data + + // merge + if (address === '/fader_1') { + + xyValue[0] = args[0].value + send(host, port, '/some_xy_address', ...xyValue) + return // bypass original message + + } else if (address === '/fader_2') { + + xyValue[1] = args[1].value + send(host, port, '/some_xy_address', ...xyValue) + return // bypass original message + + } + + return {address, args, host, port} + } + +} +``` + +## Reply + +```js + +module.exports = { + + oscInFilter:function(data){ + + var {address, args, host, port} = data + + if (address === '/knock_knock') { + + send(host, port, '/who_is_there') + + return // bypass original message + } + + return {address, args, host, port} + + }, + +} +``` diff --git a/resources/docs/docs/remote-control.md b/resources/docs/docs/remote-control.md index de3c752e..6a598334 100644 --- a/resources/docs/docs/remote-control.md +++ b/resources/docs/docs/remote-control.md @@ -115,7 +115,7 @@ Same as `/GET` but uses the widget's address instead of `/GET` to reply. ---- -#### `/SET target id value` +#### `/SET id value` Set a widget's value as if it was interacted with from the interface. This is likely to make it send its value. diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index bef02052..20b787cc 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -59,7 +59,7 @@ | property | type |default | description | | --- | --- | --- | --- | - |
address#
| `string` | "auto" | OSC address for sending messages, it must start with a / | + |
address#
| `string` | "auto" | OSC address for sending / receiving messages, it must start with a slash (`/`)

By default ("auto"), the widget's id is used: `/widget_id` | |
preArgs#
| `*`|
`array` | "" | A value or array of values that will be prepended to the OSC messages. | |
typeTags#
| `string` | "" | Defines the osc argument types, one letter per argument (including preArgs)
- If empty, the types are infered automatically from the values (with numbers casted to floats by default)
- If there are more arguments than type letters, the last type is used for the extra arguments

See http://opensoundcontrol.org/spec-1_0 for existing typetags | |
decimals#
| `integer` | 2 | Defines the number of decimals to send. | diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml index 7c21cac2..10b03382 100644 --- a/resources/mkdocs.yml +++ b/resources/mkdocs.yml @@ -50,6 +50,7 @@ nav: - Custom module: - docs/custom-module/custom-module.md - docs/custom-module/managing-big-modules.md + - docs/custom-module/examples.md - Customization: - docs/customization/themes.md - docs/customization/css-tips.md