main/osc: first implementation of user custom module support

This commit is contained in:
jean-emmanuel 2016-11-01 18:38:11 +01:00
parent 589a5ed648
commit 5cdbf53f6a
4 changed files with 109 additions and 16 deletions

View file

@ -0,0 +1,35 @@
# Custom module
Using the `-c / --custom-module` command-line switch, users can load a javascript file to tune the way Open Stage Control behaves regarding osc.
It must be of the following form:
```js
(function(){
// Do whatever you want, initialize some variables, declare some functions, ...
return {
oscInFilter:function(data){
var {address, args, host, port} = data
// do what you want
// return data if you want the message to be processed (and sent)
return data
},
oscOutFilter:function(data){
// same as oscInFilter
}
}
})()
```
The module is executed in a restricted context, only a few globals are available :
- `console` object
- `sendOsc` function
- `receiveOsc` function

View file

@ -10,6 +10,7 @@ Prebuilt binaries for Linux, Windows and OS X can be found on the [release](http
Options:
-s, --sync synchronized hosts (ip:port pairs)
-l, --load session file to load
-c, --custom-module custom module file to load
-p, --port http port of the server (default to 8080)
-o, --osc-port osc input port
-d, --debug log received osc messages in the console