Skip to content

Instantly share code, notes, and snippets.

@deedos
Created November 21, 2019 18:28
Show Gist options
  • Save deedos/62506c4b6cbbb4d17e9d7ad2eb109536 to your computer and use it in GitHub Desktop.
Save deedos/62506c4b6cbbb4d17e9d7ad2eb109536 to your computer and use it in GitHub Desktop.
Experiment to integrate CasparCg and iScore through Node-Red
[{"id":"5d3f3e40.7465a","type":"osc","z":"ae0d439e.fdc38","name":"","path":"/","metadata":false,"x":190,"y":140,"wires":[["5943e4f1.33d88c"]]},{"id":"c69b475e.01c3b8","type":"udp in","z":"ae0d439e.fdc38","name":"","iface":"","port":"8888","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":60,"y":140,"wires":[["5d3f3e40.7465a"]]},{"id":"646fad9f.685084","type":"debug","z":"ae0d439e.fdc38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1010,"y":380,"wires":[]},{"id":"f40182b4.20455","type":"switch","z":"ae0d439e.fdc38","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"/opacity","vt":"str"},{"t":"eq","v":"/brightness","vt":"str"},{"t":"eq","v":"/perspective","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":510,"y":140,"wires":[["a49ba90d.c40af8"],["c7e6c4a7.ded258"],["239e3e4c.314232"]]},{"id":"b75a081e.54ae68","type":"amcp","z":"ae0d439e.fdc38","name":"","port":"5250","host":"localhost","x":1030,"y":140,"wires":[[]]},{"id":"a49ba90d.c40af8","type":"function","z":"ae0d439e.fdc38","name":"format AMCP OPACITY","func":"//var float = msg.payload\nvar command = \"MIXER 1-10 OPACITY \" + msg.payload\nmsg.payload = command\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":140,"wires":[["b75a081e.54ae68"]]},{"id":"1d168cf4.c83ba3","type":"inject","z":"ae0d439e.fdc38","name":"","topic":"","payload":"PLAY 1-10 AMB ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":760,"y":220,"wires":[["b75a081e.54ae68"]]},{"id":"90b43362.0030c","type":"debug","z":"ae0d439e.fdc38","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1050,"y":100,"wires":[]},{"id":"d7ef1561.cf1198","type":"function-npm","z":"ae0d439e.fdc38","name":"MIXER Js library","func":"const tslib_1 = require(\"tslib\");\nconst {CasparCG, AMCP} = require(\"casparcg-connection\");\n\nvar connection = new CasparCG({\n host: '127.0.0.1',\n //autoReconnect: true,\n //debug: true, \n queueMode: 2, // mode: 1 = SALVO mode, default\n //onConnectionStatus: (e) => {\n //console.log(\"Status: \",e);\n //}\n});\n\nconnection.do(new AMCP.CustomCommand(\n 'MIXER 1-10 BRIGHTNESS ' + msg.payload + ' \\r\\n')\n );\n////connection.mixerFill(1, 1, 0, 0, 0.5, 0.5, 25, 'INOUTSINE', true);\n\n\nreturn msg;","outputs":1,"noerr":0,"x":730,"y":100,"wires":[["90b43362.0030c"]]},{"id":"5943e4f1.33d88c","type":"function","z":"ae0d439e.fdc38","name":"Rate Limiter 100ms","func":"var interval = 100; // minimum interval between messages (ms)\ncontext.lastTime = context.lastTime || 0;\n\nvar now = Date.now();\n\nif (now-context.lastTime > interval) {\n context.lastTime = now;\n return msg;\n} else {\n return null;\n}\n\n// (1000*60*10)","outputs":1,"noerr":0,"x":350,"y":140,"wires":[["f40182b4.20455"]]},{"id":"c7e6c4a7.ded258","type":"function","z":"ae0d439e.fdc38","name":"format AMCP BRIGHTNESS","func":"//var float = msg.payload\nvar command = \"MIXER 1-10 BRIGHTNESS \" + msg.payload\nmsg.payload = command\nreturn msg;","outputs":1,"noerr":0,"x":760,"y":180,"wires":[["b75a081e.54ae68"]]},{"id":"2d14dc88.ab8554","type":"inject","z":"ae0d439e.fdc38","name":"","topic":"","payload":"MIXER 1-10 PERSPECTIVE 0.4 0.4 0.6 0.4 1 1 0 1 ","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":750,"y":260,"wires":[["b75a081e.54ae68"]]},{"id":"86be5812.e04d48","type":"inject","z":"ae0d439e.fdc38","name":"","topic":"","payload":"CLEAR 1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":740,"y":320,"wires":[["b75a081e.54ae68"]]},{"id":"239e3e4c.314232","type":"function","z":"ae0d439e.fdc38","name":"format AMCP PERSPECTIVE","func":"//var float = msg.payload\nvar command = \"MIXER 1-10 PERSPECTIVE \" + msg.payload[0] + ' ' + msg.payload[1] + ' ' + msg.payload[2] + ' ' + msg.payload[3] + ' ' + msg.payload[4] + ' ' + msg.payload[5] + ' ' + msg.payload[6] + ' ' + msg.payload[7]\nmsg.payload = command\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":380,"wires":[["646fad9f.685084","b75a081e.54ae68"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment