diff --git a/config.json b/config.json index f1d0586..d353e8f 100644 --- a/config.json +++ b/config.json @@ -28,35 +28,31 @@ }, "animations": [ { - "animationId": "dnb", - "duration": 350, + "animationId": "greenwall", + "duration": 64, "name": "This is DnB", "timeline": [{ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 0, 0] }, - { "time": 50, "value": [100, 0, 0] }, - { "time": 100, "value": [0, 0, 0] }, - { "time": 150, "value": [0, 100, 0] }, - { "time": 200, "value": [0, 0, 0] }, - { "time": 250, "value": [0, 0, 100] }, - { "time": 300, "value": [0, 0, 0] } + { "time": 0, "value": [0, 255, 0], "modV": true }, + { "time": 64, "value": [0, 0, 0] } ] } ] }, + { - "animationId": "crazy", - "duration": 1000, - "name": "This is a crazy animation", + "animationId": "whateverwall", + "duration": 64, + "name": "This is DnB", "timeline": [{ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 255, 0], "modV": true }, - { "time": 500, "value": [255, 0, 0], "modV": true }, - { "time": 1000, "value": [0, 0, 0] } + { "time": 0, "value": [255, 255, 255], "modV": false }, + { "time": 48, "value": [255, 255, 255], "modV": false }, + { "time": 64, "value": [0, 0, 0] } ] }, { @@ -64,73 +60,98 @@ "value": 0, "keyframes": [ { "time": 0, "value": 255, "modV": false }, - { "time": 500, "value": 255, "modV": false }, - { "time": 1000, "value": 0 } + { "time": 64, "value": 0 } ] } ] }, + { - "animationId": "funny", - "duration": 200, - "name": "This is a funny animation", + "animationId": "yellow", + "duration": 128, + "name": "yellow", "timeline": [{ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 0, 0], "modV": true }, - { "time": 50, "value": [0, 0, 0] } + { "time": 0, "value": [255, 234, 0], "modV": true }, + { "time": 128, "value": [0, 0, 0] } ] - }, - { - "name": "uv", - "value": 0, + } + ] + }, + + { + "animationId": "green", + "duration": 128, + "name": "Single color", + "timeline": [{ + "name": "color", + "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": 255, "modV": false }, - { "time": 200, "value": 0 } + { "time": 0, "value": [0, 255, 0], "modV": true }, + { "time": 128, "value": [0, 0, 0] } ] } ] }, + { - "animationId": "evenmorefun", + "animationId": "blue", "duration": 128, - "name": "This is a funny animation", + "name": "Single color", + "timeline": [{ + "name": "color", + "value": [0, 0, 0], + "keyframes": [ + { "time": 0, "value": [0, 0, 255], "modV": true }, + { "time": 128, "value": [0, 0, 0] } + ] + } + ] + }, + + { + "animationId": "purple", + "duration": 128, + "name": "Single color", "timeline": [{ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 0, 0], "modV": true }, + { "time": 0, "value": [255, 0, 255], "modV": true }, { "time": 128, "value": [0, 0, 0] } ] } ] }, + { "animationId": "allthelight", - "duration": 800, + "duration": 384, "name": "This is a funny animation", "timeline": [{ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 0, 0], "modV": true }, - { "time": 800, "value": [0, 0, 0] } + { "time": 0, "value": [255, 0, 0], "modV": true }, + { "time": 384, "value": [0, 0, 0] } ] }, { - "name": "uv", + "name": "strobe", "value": 0, "keyframes": [ - { "time": 0, "value": 255, "modV": false }, - { "time": 800, "value": 0 } + { "time": 0, "value": "on" }, + { "time": 384, "value": "off" } ] } ] }, + { "animationId": "uvbaby", - "duration": 800, + "duration": 128, "name": "This is a funny animation", "timeline": [ { @@ -138,8 +159,8 @@ "value": 0, "keyframes": [ { "time": 0, "value": 255, "modV": false }, - { "time": 700, "value": 0 }, - { "time": 800, "value": 0 } + { "time": 64, "value": 255 }, + { "time": 128, "value": 0 } ] }, { @@ -152,6 +173,7 @@ } ] }, + { "animationId": "clockwise", "duration": 600, @@ -160,8 +182,8 @@ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 0, 0], "modV": true }, - { "time": 400, "value": [0, 0, 0], "modV": true }, + { "time": 0, "value": [255, 0, 0], "modV": true }, + { "time": 400, "value": [255, 0, 0], "modV": true }, { "time": 600, "value": [0, 0, 0] } ] }, @@ -177,7 +199,7 @@ "name": "rotate", "value": 0, "keyframes": [ - { "time": 0, "value": "clockwise(50)" }, + { "time": 0, "value": "clockwise(20)" }, { "time": 600, "value": "stop" } ] }, @@ -199,8 +221,8 @@ "name": "color", "value": [0, 0, 0], "keyframes": [ - { "time": 0, "value": [0, 0, 0], "modV": true }, - { "time": 400, "value": [0, 0, 0], "modV": true }, + { "time": 0, "value": [255, 0, 255], "modV": true }, + { "time": 400, "value": [255, 0, 255], "modV": true }, { "time": 600, "value": [0, 0, 0] } ] }, @@ -216,7 +238,7 @@ "name": "rotate", "value": 0, "keyframes": [ - { "time": 0, "value": "counterClockwise(50)" }, + { "time": 0, "value": "counterClockwise(20)" }, { "time": 600, "value": "stop" } ] }, @@ -230,52 +252,7 @@ } ] }, - { - "animationId": "livejs_logo", - "duration": 600, - "name": "This is a funny animation", - "timeline": [{ - "name": "color", - "value": [0, 0, 0], - "keyframes": [ - { "time": 0, "value": [255, 0, 0], "modV": true }, - { "time": 600, "value": [0, 0, 0] } - ] - }, - { - "name": "brightness", - "value": 0, - "keyframes": [ - { "time": 0, "value": "default(1)" }, - { "time": 600, "value": 0 } - ] - }, - { - "name": "pan", - "value": 0, - "keyframes": [ - { "time": 0, "value": -270 }, - { "time": 600, "value": -270 } - ] - }, - { - "name": "tilt", - "value": 0, - "keyframes": [ - { "time": 0, "value": 110 }, - { "time": 600, "value": 130 } - ] - }, - { - "name": "gobo", - "value": 0, - "keyframes": [ - { "time": 0, "value": "spiraltunnel" }, - { "time": 500, "value": "spiraltunnel" } - ] - } - ] - }, + { "animationId": "fogfogfog", "duration": 5000, @@ -291,6 +268,7 @@ } ] }, + { "animationId": "bubblebubblebubble", "duration": 5000, @@ -316,110 +294,116 @@ ] } ], + "scenes": [ { - "sceneId": "scene1", + "sceneId": "left_1", "name": "This is my awesome first scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button3" + "partId": "button1" }, "layers": [ { "layerId": "layer1", - "devices": ["fungeneration_ledspot_1", "fungeneration_ledspot_2", "fungeneration_ledspot_3", "fungeneration_ledspot_4", "cameo_ledspot_1", "cameo_ledspot_2"], + "devices": ["fungeneration_ledspot_2"], "animations": [ { "start": 0, - "animationId": "allthelight" + "animationId": "yellow" } ] } ] }, + { - "sceneId": "scene2", - "name": "This is my awesome second scene", + "sceneId": "left_2", + "name": "This is my awesome first scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button1" + "partId": "button2" }, "layers": [ { "layerId": "layer1", - "devices": ["fungeneration_ledspot_1", "fungeneration_ledspot_2", "fungeneration_ledspot_3", "fungeneration_ledspot_4"], + "devices": ["fungeneration_ledspot_3"], "animations": [ { "start": 0, - "animationId": "funny" + "animationId": "blue" } ] } ] }, + { - "sceneId": "scene3", - "name": "This is my awesome second scene", + "sceneId": "left_3", + "name": "This is my awesome first scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button2" + "partId": "button3" }, "layers": [ { "layerId": "layer1", - "devices": ["cameo_ledspot_1", "cameo_ledspot_2"], + "devices": ["cameo_ledspot_1"], "animations": [ { "start": 0, - "animationId": "funny" + "animationId": "purple" } ] } ] }, + { - "sceneId": "scene4", - "name": "This is my awesome second scene", + "sceneId": "right_1", + "name": "This is my awesome first scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button5" + "partId": "button6" }, "layers": [ { "layerId": "layer1", - "devices": ["adj_planet"], + "devices": ["fungeneration_ledspot_1"], "animations": [ { "start": 0, - "animationId": "clockwise" + "animationId": "blue" } ] } ] }, + { - "sceneId": "scene5", - "name": "This is my awesome second scene", + "sceneId": "right_2", + "name": "This is my awesome first scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button6" + "partId": "button5" }, "layers": [ { "layerId": "layer1", - "devices": ["adj_planet"], + "devices": ["fungeneration_ledspot_4"], "animations": [ { "start": 0, - "animationId": "counterClockwise" + "animationId": "purple" } ] } ] }, + { - "sceneId": "scene6", - "name": "This is my awesome second scene", + "sceneId": "right_3", + "name": "This is my awesome first scene", "midi": { "controllerId": "korgnanopad2", "partId": "button4" @@ -427,18 +411,22 @@ "layers": [ { "layerId": "layer1", - "devices": ["cameo_pixbar_1"], + "devices": ["cameo_ledspot_2"], "animations": [ { "start": 0, - "animationId": "crazy" + "animationId": "yellow" } ] } ] }, + + + + { - "sceneId": "scene7", + "sceneId": "sphereClockwise", "name": "This is my awesome second scene", "midi": { "controllerId": "korgnanopad2", @@ -447,52 +435,108 @@ "layers": [ { "layerId": "layer1", - "devices": ["fungeneration_ledspot_1"], + "devices": ["adj_planet"], "animations": [ { "start": 0, - "animationId": "evenmorefun" + "animationId": "clockwise" } ] - }, + } + ] + }, + + { + "sceneId": "sphereCounterClockwise", + "name": "This is my awesome second scene", + "midi": { + "controllerId": "korgnanopad2", + "partId": "button8" + }, + "layers": [ { - "layerId": "layer2", - "devices": ["fungeneration_ledspot_2"], + "layerId": "layer1", + "devices": ["adj_planet"], "animations": [ { - "start": 64, - "animationId": "evenmorefun" + "start": 0, + "animationId": "counterClockwise" } ] - }, + } + ] + }, + + { + "sceneId": "greenwall", + "name": "This is my awesome second scene", + "midi": { + "controllerId": "korgnanopad2", + "partId": "button10" + }, + "layers": [ { - "layerId": "layer3", - "devices": ["fungeneration_ledspot_3"], + "layerId": "layer1", + "devices": ["cameo_pixbar_1"], "animations": [ { - "start": 128, - "animationId": "evenmorefun" + "start": 0, + "animationId": "greenwall" } ] - }, + } + ] + }, + + { + "sceneId": "whateverwall", + "name": "This is my awesome second scene", + "midi": { + "controllerId": "korgnanopad2", + "partId": "button11" + }, + "layers": [ { - "layerId": "layer4", - "devices": ["fungeneration_ledspot_4"], + "layerId": "layer1", + "devices": ["cameo_pixbar_1"], + "animations": [ + { + "start": 0, + "animationId": "whateverwall" + } + ] + } + ] + }, + + { + "sceneId": "whateverwall2", + "name": "This is my awesome second scene", + "midi": { + "controllerId": "korgnanopad2", + "partId": "button12" + }, + "layers": [ + { + "layerId": "layer1", + "devices": ["cameo_pixbar_1"], "animations": [ { - "start": 192, - "animationId": "evenmorefun" + "start": 0, + "animationId": "whateverwall" } ] } ] }, + + { "sceneId": "scene8", "name": "This is my awesome second scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button8" + "partId": "button16" }, "layers": [ { @@ -507,12 +551,13 @@ } ] }, + { "sceneId": "scene9", "name": "This is my awesome second scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button9" + "partId": "button13" }, "layers": [ { @@ -522,38 +567,52 @@ "fungeneration_ledspot_2", "fungeneration_ledspot_3", "fungeneration_ledspot_4", + "cameo_ledspot_1", + "cameo_ledspot_2", "cameo_pixbar_1", "adj_planet" ], "animations": [ { "start": 0, - "animationId": "uvbaby" + "animationId": "allthelight" } ] } ] }, + { - "sceneId": "scene10", + "sceneId": "superuv", "name": "This is my awesome second scene", "midi": { "controllerId": "korgnanopad2", - "partId": "button10" + "partId": "button14" }, "layers": [ { "layerId": "layer1", - "devices": [], + "devices": [ + "fungeneration_ledspot_1", + "fungeneration_ledspot_2", + "fungeneration_ledspot_3", + "fungeneration_ledspot_4", + "cameo_ledspot_1", + "cameo_ledspot_2", + "cameo_pixbar_1", + "adj_planet" + ], "animations": [ { "start": 0, - "animationId": "bubblebubblebubble" + "animationId": "uvbaby" } ] } ] } + + ], "devices": { "dmx": [ @@ -561,8 +620,8 @@ "deviceId": "cameo_pixbar_1", "type": "CameoPixBar600PRO", "name": "Cameo PixBar 600 PRO", - "universe": 2, - "address": 1, + "universe": 1, + "address": 155, "parts": [ { "type": "led", @@ -646,7 +705,7 @@ "deviceId": "adj_planet", "type": "AdjStarburst", "name": "ADJ Starburst", - "universe": 2, + "universe": 1, "address": 76 } ], @@ -730,6 +789,48 @@ "y": 1, "x": 2, "partId": "button10" + }, + { + "note": 40, + "type": "button", + "y": 1, + "x": 2, + "partId": "button11" + }, + { + "note": 42, + "type": "button", + "y": 1, + "x": 2, + "partId": "button12" + }, + { + "note": 44, + "type": "button", + "y": 1, + "x": 2, + "partId": "button13" + }, + { + "note": 46, + "type": "button", + "y": 1, + "x": 2, + "partId": "button14" + }, + { + "note": 48, + "type": "button", + "y": 1, + "x": 2, + "partId": "button15" + }, + { + "note": 50, + "type": "button", + "y": 1, + "x": 2, + "partId": "button16" } ] } diff --git a/server-bin/core/Animation.js b/server-bin/core/Animation.js index 741d6dc..4cde5af 100644 --- a/server-bin/core/Animation.js +++ b/server-bin/core/Animation.js @@ -1,34 +1,256 @@ "use strict"; -/** - * A single animation with different sequences - * Saves the state of the animation - */ - Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +var _color = require('color'); + +var _color2 = _interopRequireDefault(_color); + +var _KeytimeDeluxe = require('./KeytimeDeluxe'); + +var _KeytimeDeluxe2 = _interopRequireDefault(_KeytimeDeluxe); + +var _ModVService = require('./ModVService'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/** + * A list of keyframes used to light up a list of devices to create an animation. + * + * @param {String} animationId - Identifier + * @param {Object} deviceManager - Reference to the DMX device manager + * @param {Array} devices - List of DMX devices that will be used to show the keyframes of this animation + * @param {Number} duration - How long does the animation run + * @param {Number} start - When does the animation start in dependence of the progress of the parent Scene + * @param {Number} speed - A factor to control the speed @TODO: USE IT! + * @param {Array|Object} timeline - A list of keyframes + * + * @TODO: Relative duration: Every keyframe is relative to the animation duration + * @TODO: Absolute duration: Every keyframe has it's own duration + */ var Animation = function () { function Animation(param) { _classCallCheck(this, Animation); + + this.animationId = param.animationId; + this.deviceManager = param.deviceManager; + this.devices = param.devices || undefined; + this.duration = param.duration; + this.start = param.start || 0; + this.speed = param.speed || 1; + + // Progress in terms of time + this.progress = 0; + + // Keyframes are raw + if (param.timeline instanceof Array) { + this.timeline = new _KeytimeDeluxe2.default(param.timeline); + // Keyframes are an instance of keytime + } else { + this.timeline = param.timeline; + } + + // The values of the animation in terms of the point in time + this.values = []; + + // Is this animation running? + this.isPlaying = false; } + /* + * Play animation. + */ + + _createClass(Animation, [{ - key: "play", - value: function play() {} + key: 'play', + value: function play(delta) { + this.isPlaying = true; + } + + /* + * Stop playback. + */ + + }, { + key: 'stop', + value: function stop() { + this.isPlaying = false; + this.progress = 0; + + // @TODO: Is this really ok? If we reset the device, all other animations for this device will also die :/ + // Reset all devices + // this.devices.forEach((element, index, array) => { + // this.deviceManager.get(element).color = new Color(this.timeline.value).rgb().string(); + // }); + } + + /* + * Run the animation for the associated devices. + * + * @BUG: When the animation is retriggered while it is running, the last color that was send to the device stays forever at the device. + */ + + }, { + key: 'run', + value: function run(progressScene, delta) { + var _this = this; + + if (this.isPlaying) { + + // The scene is started + if (progressScene >= this.start && progressScene <= this.start + this.duration + 2 * delta) { + + // If animationProgress is smaller than duration we know that duration is not reached yet + if (this.progress + delta <= this.duration + delta) { + // So we add the delta to animationProgress + this.progress += delta; + + this.updateTimeline(); + + // Get the values from the timeline based on the progress of this animation + this.values = this.timeline.values(this.progress); + + // Set the values for every device + this.devices.forEach(function (element, index, array) { + + var device = _this.deviceManager.get(element); + + if (_this.values.hasOwnProperty('color')) { + var color = new _color2.default(_this.values.color).rgb().string(); + + device.color = color; + + if (device.hasOwnProperty('led1')) { + device.led1.color = color; + device.led2.color = color; + device.led3.color = color; + device.led4.color = color; + device.led5.color = color; + device.led6.color = color; + device.led7.color = color; + device.led8.color = color; + device.led9.color = color; + device.led10.color = color; + device.led11.color = color; + device.led12.color = color; + } + } + + if (_this.values.hasOwnProperty('uv')) { + device.uv = _this.values.uv; + + if (device.hasOwnProperty('led1')) { + device.led1.uv = _this.values.uv; + device.led2.uv = _this.values.uv; + device.led3.uv = _this.values.uv; + device.led4.uv = _this.values.uv; + device.led5.uv = _this.values.uv; + device.led6.uv = _this.values.uv; + device.led7.uv = _this.values.uv; + device.led8.uv = _this.values.uv; + device.led9.uv = _this.values.uv; + device.led10.uv = _this.values.uv; + device.led11.uv = _this.values.uv; + device.led12.uv = _this.values.uv; + } + } + + if (_this.values.hasOwnProperty('rotate')) { + device.rotate = _this.values.rotate; + } + + if (_this.values.hasOwnProperty('strobe')) { + device.strobe = _this.values.strobe; + } + + if (_this.values.hasOwnProperty('brightness')) { + device.brightness = _this.values.brightness; + } + + if (_this.values.hasOwnProperty('pan')) { + device.pan = _this.values.pan; + } + + if (_this.values.hasOwnProperty('tilt')) { + device.tilt = _this.values.tilt; + } + + if (_this.values.hasOwnProperty('amount')) { + device.amount = _this.values.amount; + } + + if (_this.values.hasOwnProperty('led')) {} + + if (_this.values.hasOwnProperty('motor')) { + device.motor = _this.values.motor; + } + + if (_this.values.hasOwnProperty('fan')) { + device.fan = _this.values.fan; + } + + if (_this.values.hasOwnProperty('gobo')) { + device.gobo = _this.values.gobo; + } + + if (_this.values.hasOwnProperty('yellow')) { + device.yellow = _this.values.yellow; + } + }); + } else { + this.stop(); + console.log('Animation', '-', this.animationId, 'stopped'); + } + } + } + } + + /* + * Update the timeline to get the colors provided by modV + * + * @TODO: Check if config.global.useModV is enabled + */ + }, { - key: "pause", + key: 'updateTimeline', + value: function updateTimeline() { + + // Iterate over all properties from the given timeline + this.timeline.properties.forEach(function (property, index, array) { + + // Iterate over all frames of the current keyframe for the given property + property.keyframes.frames.forEach(function (frame, index, array) { + + if (frame.hasOwnProperty('modV') && frame.modV) { + frame.value = _ModVService.modVService.globalColor; + } + }); + }); + } + + // @TODO: Implement + + }, { + key: 'pause', value: function pause() {} + + // @TODO: Implement + }, { - key: "restart", - value: function restart() {} + key: 'reset', + value: function reset() {} + + // @TODO: Implement + }, { - key: "reverse", + key: 'reverse', value: function reverse() {} }]); diff --git a/server-bin/core/AnimationManager.js b/server-bin/core/AnimationManager.js index de8b466..a9cdbd7 100644 --- a/server-bin/core/AnimationManager.js +++ b/server-bin/core/AnimationManager.js @@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var _Animation = require("./Animation"); var _Animation2 = _interopRequireDefault(_Animation); @@ -13,12 +15,52 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** - * Initialize all animations + * Handle all animations and keep a reference to them. */ -var AnimationManager = function AnimationManager(param) { - _classCallCheck(this, AnimationManager); +var AnimationManager = function () { + function AnimationManager(param) { + _classCallCheck(this, AnimationManager); + + // A list of animations + this.list = new Map(); + + // Handle devices + this.deviceManager = param.deviceManager; + + this.config = param.config; + } + + _createClass(AnimationManager, [{ + key: "register", + value: function register() { + var _this = this; + + this.config.animations.forEach(function (element, index, array) { + + var animation = new _Animation2.default({ + animationId: element.animationId, + duration: element.duration, + timeline: element.timeline, + deviceManager: _this.deviceManager, + devices: element.devices + }); + + _this.add(element.animationId, animation); + }); + } + }, { + key: "add", + value: function add(animationId, animation) { + this.list.set(animationId, animation); + } + }, { + key: "get", + value: function get(animationId) { + return this.list.get(animationId); + } + }]); - this.config = param.config; -}; + return AnimationManager; +}(); exports.default = AnimationManager; \ No newline at end of file diff --git a/server-bin/core/DmxUsbInterface.js b/server-bin/core/DmxUsbInterface.js new file mode 100644 index 0000000..2d2f0c5 --- /dev/null +++ b/server-bin/core/DmxUsbInterface.js @@ -0,0 +1,38 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var fivetwelve = require('fivetwelve/es5'); +var Serialport = require('serialport'); +if (process.env.NODE_ENV === 'development') { + Serialport = require('virtual-serialport'); +} + +/** + * Manages the connection to a DMX USB interface (e.g. Enttec DMX USB PRO Mk2) to control DMX devices. + * + */ + +var DmxUsbInterface = function DmxUsbInterface(param) { + _classCallCheck(this, DmxUsbInterface); + + this.config = param.config; + + // Load the driver + var fivetwelve_driver = require(this.config.dmxInterface.driver); + + // USB connection to the DMX interface + var usbProSerialport = new Serialport(this.config.dmxInterface.serialport.path); + + // Initialize the driver using the serial connection + var driver = new fivetwelve_driver(usbProSerialport); + + // Create the output by using the driver and set the amount of universes that are controlled by this interface + this.output = fivetwelve.default(driver, this.config.dmxInterface.universeAmount); +}; + +exports.default = DmxUsbInterface; \ No newline at end of file diff --git a/server-bin/core/EventService.js b/server-bin/core/EventService.js new file mode 100644 index 0000000..d16081e --- /dev/null +++ b/server-bin/core/EventService.js @@ -0,0 +1,51 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.eventService = undefined; + +var _eventemitter = require("eventemitter2"); + +var _eventemitter2 = _interopRequireDefault(_eventemitter); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +/** + * Handles events between services in a kindof "pub/sub" style, well, nope, but still :/ + * You can import the instance of EventService into your Class and listen to "global" events. + * + * @example + * import { eventService } from './EventService'; + * + * class MyClass { + * constructor() { + * // Listen to eventName + * eventService.on("eventName", (eventData) => {}); + * + * // Send a event with name "eventName" that contains the data from "eventData" + * eventService.emit("eventName", eventData); + * } + * } + * + */ +var EventService = function (_EventEmitter) { + _inherits(EventService, _EventEmitter); + + function EventService(param) { + _classCallCheck(this, EventService); + + return _possibleConstructorReturn(this, (EventService.__proto__ || Object.getPrototypeOf(EventService)).call(this)); + } + + return EventService; +}(_eventemitter2.default); + +exports.default = EventService; +var eventService = exports.eventService = new EventService(); \ No newline at end of file diff --git a/server-bin/core/ExpressServer.js b/server-bin/core/ExpressServer.js index 2c8f849..b2303a3 100644 --- a/server-bin/core/ExpressServer.js +++ b/server-bin/core/ExpressServer.js @@ -42,6 +42,10 @@ var _http = require('http'); var _http2 = _interopRequireDefault(_http); +var _EventService = require('./EventService'); + +var _ModVService = require('./ModVService'); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -93,21 +97,51 @@ var ExpressServer = function () { res.render('index', { title: 'VisionLord', mydata: JSON.stringify(_this.config) }); }); - // WebSocket route - this.app.ws(this.config.server.websocket.path, function (ws, req) { - console.log('WebSocket opened'); + // WebSocket: MIDI + this.app.ws(this.config.server.websocket.path.midi, function (ws, req) { + // There is a new connection + console.log(_this.config.server.websocket.path.midi, '-', 'opened 😍'); + + // Welcome the client + ws.send(JSON.stringify({ 'type': 'welcome', 'message': '❤️' })); + + // Receive a message from the client + ws.on('message', function (message) { + var data = JSON.parse(message); + + console.log(_this.config.server.websocket.path.midi, '-', data); - ws.send("❤️"); + _EventService.eventService.emit('MidiController', data); + }); + + ws.on('error', function (msg) { + console.error(msg); + }); - ws.on('message', function (msg) { - console.log('message', msg); + ws.on('close', function () { + console.log(_this.config.server.websocket.path.midi, '-', 'closed 😱'); + console.log(_this.config.log.separator); }); + }); // WebSocket: /midi + + + // WebSocket: modV + this.app.ws(this.config.server.websocket.path.modV, function (ws, req) { + // There is a new connection + console.log(_this.config.server.websocket.path.modV, '-', 'opened 😍'); + + // Welcome the client + ws.send(JSON.stringify({ 'type': 'welcome', 'message': '❤️' })); - ws.on('text', function (msg) { - console.log('text', msg); - // ws.send(msg); - // msg = JSON.parse(msg); - // console.log(JSON.stringify(msg)); + // Receive a message from the client + ws.on('message', function (message) { + var data = JSON.parse(message); + + console.log(_this.config.server.websocket.path.modV, '-', data); + + _ModVService.modVService.globalColor = data.average; + + // eventService.emit('modV', data); }); ws.on('error', function (msg) { @@ -115,10 +149,11 @@ var ExpressServer = function () { }); ws.on('close', function () { - console.log('WebSocket closed'); + console.log(_this.config.server.websocket.path.modV, '-', 'closed 😱'); console.log(_this.config.log.separator); }); - }); + }); // WebSocket: /midi + // Catch 404 and forward to error handler this.app.use(function (req, res, next) { diff --git a/server-bin/core/KeytimeDeluxe.js b/server-bin/core/KeytimeDeluxe.js new file mode 100644 index 0000000..61e7ff0 --- /dev/null +++ b/server-bin/core/KeytimeDeluxe.js @@ -0,0 +1,50 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _lerpArray = require('lerp-array'); + +var _lerpArray2 = _interopRequireDefault(_lerpArray); + +var _keytime2 = require('keytime'); + +var _keytime3 = _interopRequireDefault(_keytime2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var KeytimeDeluxe = function (_keytime) { + _inherits(KeytimeDeluxe, _keytime); + + function KeytimeDeluxe(data) { + _classCallCheck(this, KeytimeDeluxe); + + return _possibleConstructorReturn(this, (KeytimeDeluxe.__proto__ || Object.getPrototypeOf(KeytimeDeluxe)).call(this, data)); + } + + _createClass(KeytimeDeluxe, [{ + key: 'interpolate', + value: function interpolate(property, frame1, frame2, t) { + // Custom interpolation :D + if (typeof frame1.value === 'string') { + return frame1.value; + } + + // Default interpolation + return (0, _lerpArray2.default)(frame1.value, frame2.value, t); + } + }]); + + return KeytimeDeluxe; +}(_keytime3.default); + +exports.default = KeytimeDeluxe; \ No newline at end of file diff --git a/server-bin/core/Layer.js b/server-bin/core/Layer.js new file mode 100644 index 0000000..ab88da5 --- /dev/null +++ b/server-bin/core/Layer.js @@ -0,0 +1,145 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _Animation = require('./Animation'); + +var _Animation2 = _interopRequireDefault(_Animation); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Handle animations. + */ +var Layer = function () { + function Layer(param) { + _classCallCheck(this, Layer); + + this.layerId = param.id; + + this.animationConfigs = param.animations; + + // Reference to all animations + this.animationManager = param.animationManager; + + // Reference to DMX devices + this.devices = param.devices; + + // List of animations in this layer + this.animations = []; + + // Is this Layer playing? + this.isPlaying = false; + + this.register(); + } + + /* + * Initialize animations that are part of this layer. + */ + + + _createClass(Layer, [{ + key: 'register', + value: function register() { + var _this = this; + + this.animationConfigs.forEach(function (element, index, array) { + + var instance = _this.animationManager.get(element.animationId); + + var animation = new _Animation2.default({ + animationId: element.animationId, + duration: instance.duration, + start: element.start, + timeline: instance.timeline, + deviceManager: instance.deviceManager, + devices: _this.devices + }); + + _this.add(animation); + }); + } + + /* + * Add animation to the list of animations. + */ + + }, { + key: 'add', + value: function add(animation) { + this.animations.push(animation); + } + + /* + * Play animations. + */ + + }, { + key: 'play', + value: function play() { + this.isPlaying = true; + + // Run all animations + this.animations.forEach(function (element, index, array) { + // @TODO: Move this into this.stop() + element.stop(); + element.play(); + }); + } + + /* + * Stop the playback. + */ + + }, { + key: 'stop', + value: function stop() { + this.isPlaying = false; + } + + /* + * Run the animations based on the progress of the parent Scene "progressScene" and + * the "delta" between the last iteration and now. + */ + + }, { + key: 'run', + value: function run(progressScene, delta) { + var _this2 = this; + + if (this.isPlaying) { + + this.count = 0; + + // Run all animations + this.animations.forEach(function (element, index, array) { + + // Start the animation if the start time is reached & duration is not reached yet + element.run(progressScene, delta); + + // The animation is not stopped yet + if (element.isPlaying) { + _this2.count++; + } + }); + + // All animations are stopped + if (this.count === 0) { + this.stop(); + console.log('Layer', '-', this.layerId, 'stopped'); + } + } + } + }]); + + return Layer; +}(); + +exports.default = Layer; \ No newline at end of file diff --git a/server-bin/core/ModVService.js b/server-bin/core/ModVService.js new file mode 100644 index 0000000..97cc717 --- /dev/null +++ b/server-bin/core/ModVService.js @@ -0,0 +1,77 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.modVService = undefined; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _randomColor = require('random-color'); + +var _randomColor2 = _interopRequireDefault(_randomColor); + +var _EventService = require('./EventService'); + +var _Observable = require('rxjs/Observable'); + +require('rxjs/add/observable/fromEvent'); + +require('rxjs/add/operator/filter'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Provide colors from modV. + */ +var ModVService = function () { + function ModVService(param) { + _classCallCheck(this, ModVService); + + this.globalColor = (0, _randomColor2.default)().rgbArray(); + + // this.random(); + } + + _createClass(ModVService, [{ + key: 'random', + value: function random() { + var _this = this; + + setInterval(function () { + _this.globalColor = (0, _randomColor2.default)().rgbArray(); + }, 120); + } + + // @TODO: Implement + + }, { + key: 'listen', + value: function listen() { + // var source = Observable + // .fromEvent(eventService, 'MidiController') + // + // // Only allow the MIDI controller that was attachted to this scene + // .filter((data, idx, obs) => { + // return data.controllerId === this.midi.controllerId; + // }) + // + // // Only allow a specific input element (button or knob) from the MIDI controller + // .filter((data, idx, obs) => { + // return data.partId === this.midi.partId; + // }); + // + // source.subscribe(data => { + // this.stop(); + // this.play(); + // }); + } + }]); + + return ModVService; +}(); + +exports.default = ModVService; +var modVService = exports.modVService = new ModVService(); \ No newline at end of file diff --git a/server-bin/core/Render.js b/server-bin/core/Render.js new file mode 100644 index 0000000..54a2bee --- /dev/null +++ b/server-bin/core/Render.js @@ -0,0 +1,76 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _Animation = require("./Animation"); + +var _Animation2 = _interopRequireDefault(_Animation); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/* + * Handle the rendering of all animations in a specific timeline / scene. + */ +var Render = function () { + function Render(param) { + _classCallCheck(this, Render); + + this.config = param.config; + this.dmxUsbInterface = param.dmxUsbInterface; + + // Reference to all scenes + this.sceneManager = param.sceneManager; + + // Time between now and last time loop was called + this.delta = 0; + + // The last time loop was called + this.lastTime = 0; + } + + /** + * Start rendering all elements in "list" by using the desired fps + */ + + + _createClass(Render, [{ + key: "start", + value: function start(fps) { + // @TODO: Is this correct? Don't we need to just call loop? + this.dmxUsbInterface.output.requestDmxFrame(this.loop.bind(this)); + + // Start the DMX output with the specified fps + this.dmxUsbInterface.output.start(1000 / fps); + } + }, { + key: "loop", + value: function loop(time) { + var _this = this; + + // Delta between the current call and the last time loop was called + this.delta = time - this.lastTime; + + // Iterate over all scenes + this.sceneManager.list.forEach(function (element, key) { + // Run each scene + element.run(_this.delta); + }); + + // Save the current time into lastTime so we can calculate the delta for the next call of loop + this.lastTime = time; + + // Call loop again + this.dmxUsbInterface.output.requestDmxFrame(this.loop.bind(this)); + } + }]); + + return Render; +}(); + +exports.default = Render; \ No newline at end of file diff --git a/server-bin/core/Scene.js b/server-bin/core/Scene.js index dc0f89a..193c567 100644 --- a/server-bin/core/Scene.js +++ b/server-bin/core/Scene.js @@ -1,17 +1,172 @@ "use strict"; -/** - * A set of animations & DMX devices that can be controlled by using MIDI devices. - */ - Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _Layer = require('./Layer'); + +var _Layer2 = _interopRequireDefault(_Layer); + +var _EventService = require('./EventService'); + +var _Observable = require('rxjs/Observable'); + +require('rxjs/add/observable/fromEvent'); + +require('rxjs/add/operator/filter'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -var Scene = function Scene(param) { - _classCallCheck(this, Scene); -}; +/** + * A set of animations & DMX devices that can be controlled by using MIDI devices. + * + * - Control a set of animations + * - Each animation is in it's own layer + * - Each animation gets initialized in a scene + * - A scene can be played / paused / restarted + * - A scene is coupled to a MIDI input + * - Creates the connection between DMX devices, animations & MIDI devices + * - Each animation in each layer can start at any point in time + * - Manages the status of playback for each animation + */ +var Scene = function () { + function Scene(param) { + _classCallCheck(this, Scene); + + this.id = param.id; + this.name = param.name; + + this.config = param.config; + + // Reference to all animations + this.animationManager = param.animationManager; + + // The layers of this scene + this.layers = []; + + // Reference to the MIDI device that is associated with the scene + this.midi = this.config.midi; + + // The progress in terms of time of this scene + this.progress = 0; + + // Is this scene playing? + this.isPlaying = false; + + this.count = 0; + + this.register(); + + this.listen(); + } + + _createClass(Scene, [{ + key: 'register', + value: function register() { + var _this = this; + + this.config.layers.forEach(function (element, index, array) { + + var layer = new _Layer2.default({ + id: element.layerId, + animations: element.animations, + animationManager: _this.animationManager, + devices: element.devices + }); + + _this.add(element.layerId, layer); + }); + } + }, { + key: 'add', + value: function add(layerId, layer) { + this.layers.push(layer); + } + }, { + key: 'play', + value: function play() { + this.isPlaying = true; + + this.layers.forEach(function (element, index, array) { + // @TODO: Move this into this.stop() + element.stop(); + element.play(); + }); + } + }, { + key: 'stop', + value: function stop() { + this.isPlaying = false; + this.progress = 0; + } + + /* + * - Iterate over all layers and run them + * - Keep track of the progress + */ + + }, { + key: 'run', + value: function run(delta) { + var _this2 = this; + + if (this.isPlaying) { + + this.progress += delta; + + this.count = 0; + + this.layers.forEach(function (element, index, array) { + element.run(_this2.progress, delta); + + if (element.isPlaying === true) { + _this2.count++; + } + }); + + if (this.count === 0) { + this.stop(); + + console.log('Scene', '-', this.id, 'stopped'); + } + } + } + + /* + * Listen to events to start this Scene. + */ + + }, { + key: 'listen', + value: function listen() { + var _this3 = this; + + // @TODO: Does this make any sense at this position / class? + var source = _Observable.Observable.fromEvent(_EventService.eventService, 'MidiController') + + // Only allow the MIDI controller that was attachted to this scene + .filter(function (data, idx, obs) { + return data.controllerId === _this3.midi.controllerId; + }) + + // Only allow a specific input element (button or knob) from the MIDI controller + .filter(function (data, idx, obs) { + return data.partId === _this3.midi.partId; + }); + + source.subscribe(function (data) { + _this3.stop(); + _this3.play(); + }); + } + }]); + + return Scene; +}(); exports.default = Scene; \ No newline at end of file diff --git a/server-bin/core/SceneManager.js b/server-bin/core/SceneManager.js new file mode 100644 index 0000000..0166486 --- /dev/null +++ b/server-bin/core/SceneManager.js @@ -0,0 +1,65 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _Scene = require("./Scene"); + +var _Scene2 = _interopRequireDefault(_Scene); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/** + * Handle all scenes. + * @TODO: Listen to MIDI events and start scenes accordingly + */ +var SceneManager = function () { + function SceneManager(param) { + _classCallCheck(this, SceneManager); + + this.list = new Map(); + this.config = param.config; + + // Reference to all animations + this.animationManager = param.animationManager; + } + + _createClass(SceneManager, [{ + key: "register", + value: function register() { + var _this = this; + + // Initialize all scenes + this.config.scenes.forEach(function (element, index, array) { + + var scene = new _Scene2.default({ + config: element, + id: element.sceneId, + name: element.name, + animationManager: _this.animationManager + }); + + _this.add(element.sceneId, scene); + }); + } + }, { + key: "add", + value: function add(sceneId, scene) { + this.list.set(sceneId, scene); + } + }, { + key: "get", + value: function get(sceneId) { + return this.list.get(sceneId); + } + }]); + + return SceneManager; +}(); + +exports.default = SceneManager; \ No newline at end of file diff --git a/server-bin/device/DeviceManager.js b/server-bin/device/DeviceManager.js index 5450d29..d65c0ae 100644 --- a/server-bin/device/DeviceManager.js +++ b/server-bin/device/DeviceManager.js @@ -72,6 +72,16 @@ var DeviceManager = function () { value: function get(deviceId) { return this.list.get(deviceId).instance; } + }, { + key: 'reset', + value: function reset() { + this.list.forEach(function (element, key, map) { + + if (typeof element.reset === 'function') { + element.reset(); + } + }); + } }]); return DeviceManager; diff --git a/server-bin/device/DmxDevice.js b/server-bin/device/DmxDevice.js index 3b5992a..4d2949a 100644 --- a/server-bin/device/DmxDevice.js +++ b/server-bin/device/DmxDevice.js @@ -1,5 +1,7 @@ 'use strict'; +// @TODO: Automatically import every device from the "dmx"-folder + Object.defineProperty(exports, "__esModule", { value: true }); @@ -22,6 +24,22 @@ var _AdjStarburst = require('./dmx/AdjStarburst'); var _AdjStarburst2 = _interopRequireDefault(_AdjStarburst); +var _FunGenerationSeParQuadLedRgbUv = require('./dmx/FunGenerationSeParQuadLedRgbUv'); + +var _FunGenerationSeParQuadLedRgbUv2 = _interopRequireDefault(_FunGenerationSeParQuadLedRgbUv); + +var _MiniLed = require('./dmx/MiniLed'); + +var _MiniLed2 = _interopRequireDefault(_MiniLed); + +var _StairvilleAF = require('./dmx/StairvilleAF150'); + +var _StairvilleAF2 = _interopRequireDefault(_StairvilleAF); + +var _EuroliteB = require('./dmx/EuroliteB100'); + +var _EuroliteB2 = _interopRequireDefault(_EuroliteB); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -64,6 +82,11 @@ var DmxDevice = function () { */ } + /* + * @TODO: Automatically create the mapping, maybe with eval? 😐 + */ + + _createClass(DmxDevice, [{ key: 'createMapping', value: function createMapping() { @@ -71,6 +94,10 @@ var DmxDevice = function () { this.deviceMapping.set('CameoFlat1RGBW', _CameoFlat1RGBW2.default); this.deviceMapping.set('CameoWookie200RGY', _CameoWookie200RGY2.default); this.deviceMapping.set('AdjStarburst', _AdjStarburst2.default); + this.deviceMapping.set('FunGenerationSeParQuadLedRgbUv', _FunGenerationSeParQuadLedRgbUv2.default); + this.deviceMapping.set('MiniLed', _MiniLed2.default); + this.deviceMapping.set('StairvilleAF150', _StairvilleAF2.default); + this.deviceMapping.set('EuroliteB100', _EuroliteB2.default); } }]); diff --git a/server-bin/device/dmx/AdjStarburst.js b/server-bin/device/dmx/AdjStarburst.js index ff2cae4..c2a610e 100644 --- a/server-bin/device/dmx/AdjStarburst.js +++ b/server-bin/device/dmx/AdjStarburst.js @@ -40,7 +40,7 @@ var AdjStarburst = function (_fivetwelve$DmxDevice) { off: { range: [0, 30] }, clockwise: { range: [31, 140], values: [0, 255] }, stop: { range: [141, 145] }, - counterClockwise: { range: [146, 255], values: [0, 255] } + counterClockwise: { range: [146, 255], values: [255, 0] } }) } }))); diff --git a/server-bin/device/dmx/CameoPixBar600PRO.js b/server-bin/device/dmx/CameoPixBar600PRO.js index f016eee..fa456f2 100644 --- a/server-bin/device/dmx/CameoPixBar600PRO.js +++ b/server-bin/device/dmx/CameoPixBar600PRO.js @@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var _RgbWAUvParam = require('./../../util/RgbWAUvParam'); var _RgbWAUvParam2 = _interopRequireDefault(_RgbWAUvParam); @@ -32,18 +34,102 @@ var CameoPixBar600PRO = function (_fivetwelve$DmxDevice) { dimmer: new fivetwelve.param.RangeParam(1, { min: 0, max: 255 }), strobe: new fivetwelve.param.RangeParam(2, { min: 0, max: 255 }), - led1: { rgbwauv: new _RgbWAUvParam2.default(3) }, - led2: { rgbwauv: new _RgbWAUvParam2.default(9) }, - led3: { rgbwauv: new _RgbWAUvParam2.default(15) }, - led4: { rgbwauv: new _RgbWAUvParam2.default(21) }, - led5: { rgbwauv: new _RgbWAUvParam2.default(27) }, - led6: { rgbwauv: new _RgbWAUvParam2.default(33) }, - led7: { rgbwauv: new _RgbWAUvParam2.default(39) }, - led8: { rgbwauv: new _RgbWAUvParam2.default(45) }, - led9: { rgbwauv: new _RgbWAUvParam2.default(51) }, - led10: { rgbwauv: new _RgbWAUvParam2.default(57) }, - led11: { rgbwauv: new _RgbWAUvParam2.default(63) }, - led12: { rgbwauv: new _RgbWAUvParam2.default(69) } + led1: { + color: new fivetwelve.param.RgbParam([3, 4, 5]), + white: new fivetwelve.param.RangeParam(6, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(7, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(8, { min: 0, max: 255 }) + }, + + led2: { + color: new fivetwelve.param.RgbParam([9, 10, 11]), + white: new fivetwelve.param.RangeParam(12, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(13, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(14, { min: 0, max: 255 }) + }, + + led3: { + color: new fivetwelve.param.RgbParam([15, 16, 17]), + white: new fivetwelve.param.RangeParam(18, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(19, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(20, { min: 0, max: 255 }) + }, + + led4: { + color: new fivetwelve.param.RgbParam([21, 22, 23]), + white: new fivetwelve.param.RangeParam(24, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(25, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(26, { min: 0, max: 255 }) + }, + + led5: { + color: new fivetwelve.param.RgbParam([27, 28, 29]), + white: new fivetwelve.param.RangeParam(30, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(31, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(32, { min: 0, max: 255 }) + }, + + led6: { + color: new fivetwelve.param.RgbParam([33, 34, 35]), + white: new fivetwelve.param.RangeParam(36, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(37, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(38, { min: 0, max: 255 }) + }, + + led7: { + color: new fivetwelve.param.RgbParam([39, 40, 41]), + white: new fivetwelve.param.RangeParam(42, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(43, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(44, { min: 0, max: 255 }) + }, + + led8: { + color: new fivetwelve.param.RgbParam([45, 46, 47]), + white: new fivetwelve.param.RangeParam(48, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(49, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(50, { min: 0, max: 255 }) + }, + + led9: { + color: new fivetwelve.param.RgbParam([51, 52, 53]), + white: new fivetwelve.param.RangeParam(54, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(55, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(56, { min: 0, max: 255 }) + }, + + led10: { + color: new fivetwelve.param.RgbParam([57, 58, 59]), + white: new fivetwelve.param.RangeParam(60, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(61, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(62, { min: 0, max: 255 }) + }, + + led11: { + color: new fivetwelve.param.RgbParam([63, 64, 65]), + white: new fivetwelve.param.RangeParam(66, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(67, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(68, { min: 0, max: 255 }) + }, + + led12: { + color: new fivetwelve.param.RgbParam([69, 70, 71]), + white: new fivetwelve.param.RangeParam(72, { min: 0, max: 255 }), + amber: new fivetwelve.param.RangeParam(73, { min: 0, max: 255 }), + uv: new fivetwelve.param.RangeParam(74, { min: 0, max: 255 }) + } + + // led1: { rgbwauv: new RgbWAUvParam(3) }, + // led2: { rgbwauv: new RgbWAUvParam(9) }, + // led3: { rgbwauv: new RgbWAUvParam(15) }, + // led4: { rgbwauv: new RgbWAUvParam(21) }, + // led5: { rgbwauv: new RgbWAUvParam(27) }, + // led6: { rgbwauv: new RgbWAUvParam(33) }, + // led7: { rgbwauv: new RgbWAUvParam(39) }, + // led8: { rgbwauv: new RgbWAUvParam(45) }, + // led9: { rgbwauv: new RgbWAUvParam(51) }, + // led10: { rgbwauv: new RgbWAUvParam(57) }, + // led11: { rgbwauv: new RgbWAUvParam(63) }, + // led12: { rgbwauv: new RgbWAUvParam(69) }, } }))); @@ -53,6 +139,27 @@ var CameoPixBar600PRO = function (_fivetwelve$DmxDevice) { return _this; } + _createClass(CameoPixBar600PRO, [{ + key: 'reset', + value: function reset() { + console.log('asdf'); + var defaultColor = 'rgb(0, 255, 0)'; + + this.led1.color = defaultColor; + this.led2.color = defaultColor; + this.led3.color = defaultColor; + this.led4.color = defaultColor; + this.led5.color = defaultColor; + this.led6.color = defaultColor; + this.led7.color = defaultColor; + this.led8.color = defaultColor; + this.led9.color = defaultColor; + this.led10.color = defaultColor; + this.led11.color = defaultColor; + this.led12.color = defaultColor; + } + }]); + return CameoPixBar600PRO; }(fivetwelve.DmxDevice); diff --git a/server-bin/device/dmx/EuroliteB100.js b/server-bin/device/dmx/EuroliteB100.js new file mode 100644 index 0000000..026b441 --- /dev/null +++ b/server-bin/device/dmx/EuroliteB100.js @@ -0,0 +1,43 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var fivetwelve = require('fivetwelve/es5'); + +var EuroliteB100 = function (_fivetwelve$DmxDevice) { + _inherits(EuroliteB100, _fivetwelve$DmxDevice); + + function EuroliteB100(options) { + _classCallCheck(this, EuroliteB100); + + var _this = _possibleConstructorReturn(this, (EuroliteB100.__proto__ || Object.getPrototypeOf(EuroliteB100)).call(this, Object.assign({}, options, { + params: { + motor: new fivetwelve.param.MappedParam(1, { + off: [0, 127], + on: [128, 255] + }), + fan: new fivetwelve.param.MappedParam(2, { + off: [0, 127], + on: [128, 255] + }) + } + }))); + + _this.layout = {}; + _this.layout.width = 1; + _this.layout.height = 1; + return _this; + } + + return EuroliteB100; +}(fivetwelve.DmxDevice); + +exports.default = EuroliteB100; \ No newline at end of file diff --git a/server-bin/device/dmx/FunGenerationSeParQuadLedRgbUv.js b/server-bin/device/dmx/FunGenerationSeParQuadLedRgbUv.js new file mode 100644 index 0000000..58d09eb --- /dev/null +++ b/server-bin/device/dmx/FunGenerationSeParQuadLedRgbUv.js @@ -0,0 +1,39 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var fivetwelve = require('fivetwelve/es5'); + +var FunGenerationSeParQuadLedRgbUv = function (_fivetwelve$DmxDevice) { + _inherits(FunGenerationSeParQuadLedRgbUv, _fivetwelve$DmxDevice); + + function FunGenerationSeParQuadLedRgbUv(options) { + _classCallCheck(this, FunGenerationSeParQuadLedRgbUv); + + var _this = _possibleConstructorReturn(this, (FunGenerationSeParQuadLedRgbUv.__proto__ || Object.getPrototypeOf(FunGenerationSeParQuadLedRgbUv)).call(this, Object.assign({}, options, { + params: { + color: new fivetwelve.param.RgbParam([1, 2, 3]), + uv: new fivetwelve.param.RangeParam(4, { min: 0, max: 255 }), + dimmer: new fivetwelve.param.RangeParam(5, { min: 0, max: 255 }), + strobe: new fivetwelve.param.RangeParam(6, { min: 0, max: 255 }) + } + }))); + + _this.layout = {}; + _this.layout.width = 1; + _this.layout.height = 1; + return _this; + } + + return FunGenerationSeParQuadLedRgbUv; +}(fivetwelve.DmxDevice); + +exports.default = FunGenerationSeParQuadLedRgbUv; \ No newline at end of file diff --git a/server-bin/device/dmx/MiniLed.js b/server-bin/device/dmx/MiniLed.js new file mode 100755 index 0000000..5e10f99 --- /dev/null +++ b/server-bin/device/dmx/MiniLed.js @@ -0,0 +1,78 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var fivetwelve = require('fivetwelve/es5'); + +var MiniLed = function (_fivetwelve$DmxDevice) { + _inherits(MiniLed, _fivetwelve$DmxDevice); + + function MiniLed(options) { + _classCallCheck(this, MiniLed); + + return _possibleConstructorReturn(this, (MiniLed.__proto__ || Object.getPrototypeOf(MiniLed)).call(this, Object.assign(options, { + params: { + pan: new fivetwelve.param.HiResParam([1, 2], { min: -270, max: 270 }), + tilt: new fivetwelve.param.HiResParam([3, 4], { min: -115, max: 90 }), + speed: new fivetwelve.param.RangeParam(5), + brightness: new fivetwelve.param.MultiRangeParam(6, { + default: { range: [8, 134], values: [1, 0] }, + strobe: { range: [135, 239], values: [0, 1] } + }), + // strobe: new param.RangeParam(6, {rangeStart: 135, rangeEnd: 239}), + color: new fivetwelve.param.RgbParam([7, 8, 9]), + colorPreset: new fivetwelve.param.MappedParam(10, MiniLed.FIXED_COLORS), + colorSpeed: new fivetwelve.param.RangeParam(11), + // left out here: movement macros + gobo: new fivetwelve.param.MappedParam(13, MiniLed.GOBOS) + // left out: gobo-shake, gobo-wheel-rotate + } + }))); + } + + return MiniLed; +}(fivetwelve.DmxDevice); + +exports.default = MiniLed; + + +MiniLed.FIXED_COLORS = { + white: [8, 21], + red: [22, 34], + green: [35, 49], + blue: [50, 63], + cyan: [64, 77], + magenta: [78, 91], + yellow: [92, 105], + purple: [106, 119], + orange: [120, 133], + chartreuse: [134, 147], + pink: [148, 161], + brown: [162, 175], + gold: [176, 189], + crimson: [190, 203], + violet: [204, 217], + crape: [218, 231], + changing: [232, 255] +}; + +MiniLed.GOBOS = { + clear: [0, 7], + flower: [8, 15], + spiral: [16, 23], + arrowCircle: [24, 31], + hearts: [32, 39], + flowers: [40, 47], + shards: [48, 55], + spiraltunnel: [56, 63], + bars: [64, 71], + flowers2: [72, 79] +}; \ No newline at end of file diff --git a/server-bin/device/dmx/StairvilleAF150.js b/server-bin/device/dmx/StairvilleAF150.js new file mode 100644 index 0000000..e94bd97 --- /dev/null +++ b/server-bin/device/dmx/StairvilleAF150.js @@ -0,0 +1,36 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var fivetwelve = require('fivetwelve/es5'); + +var StairvilleAF150 = function (_fivetwelve$DmxDevice) { + _inherits(StairvilleAF150, _fivetwelve$DmxDevice); + + function StairvilleAF150(options) { + _classCallCheck(this, StairvilleAF150); + + var _this = _possibleConstructorReturn(this, (StairvilleAF150.__proto__ || Object.getPrototypeOf(StairvilleAF150)).call(this, Object.assign({}, options, { + params: { + amount: new fivetwelve.param.RangeParam(1, { min: 0, max: 255 }) + } + }))); + + _this.layout = {}; + _this.layout.width = 1; + _this.layout.height = 1; + return _this; + } + + return StairvilleAF150; +}(fivetwelve.DmxDevice); + +exports.default = StairvilleAF150; \ No newline at end of file diff --git a/server-bin/index.js b/server-bin/index.js index 3ae3add..dbcf231 100644 --- a/server-bin/index.js +++ b/server-bin/index.js @@ -4,6 +4,10 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs); +var _DmxUsbInterface = require('./core/DmxUsbInterface'); + +var _DmxUsbInterface2 = _interopRequireDefault(_DmxUsbInterface); + var _ExpressServer = require('./core/ExpressServer'); var _ExpressServer2 = _interopRequireDefault(_ExpressServer); @@ -16,83 +20,42 @@ var _AnimationManager = require('./core/AnimationManager'); var _AnimationManager2 = _interopRequireDefault(_AnimationManager); -var _randomColor = require('random-color'); +var _SceneManager = require('./core/SceneManager'); -var _randomColor2 = _interopRequireDefault(_randomColor); +var _SceneManager2 = _interopRequireDefault(_SceneManager); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _Render = require('./core/Render'); -var fivetwelve = require('fivetwelve/es5'); -var fivetwelve_driver_usbpro = require('fivetwelve-driver-usbpro/es5'); -var Serialport = require('serialport'); -if (process.env.NODE_ENV == 'development') { - Serialport = require('virtual-serialport'); -} +var _Render2 = _interopRequireDefault(_Render); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Load the config +// @TODO: Transform this into a ConfigService so the config can be injected into other classes var config = JSON.parse(_fs2.default.readFileSync('./config.json', 'utf8')); -// USB connection to Enttec DMX USB PRO Mk2 -var usbProSerialport = new Serialport(config.serialport.path); -// Initialize the driver using the serial connection -var driver = new fivetwelve_driver_usbpro(usbProSerialport); -// Create the output using the driver and initialize 2 universes -var output = fivetwelve.default(driver, 2); +// Connect to the USB DMX interface +var dmxUsbInterface = new _DmxUsbInterface2.default({ config: config }); // Initialize all devices -var deviceManager = new _DeviceManager2.default({ config: config, output: output }); +var deviceManager = new _DeviceManager2.default({ config: config, output: dmxUsbInterface.output }); deviceManager.register(); -var animationManager = new _AnimationManager2.default({ config: config }); - -// Set initial values for the devices -deviceManager.get('cameo_laser').pattern = 19; -deviceManager.get('cameo_laser').colors = 'original'; -deviceManager.get('cameo_laser').zoom = 'manual(0)'; -deviceManager.get('cameo_laser').xAxisRolling = 'manual(0)'; -deviceManager.get('cameo_laser').yAxisRolling = 'manual(0)'; -deviceManager.get('cameo_laser').zAxisRolling = 'manual(0)'; -deviceManager.get('cameo_laser').xAxisMoving = 'manual(0)'; -deviceManager.get('cameo_laser').yAxisMoving = 'speed(10)'; - -// Has to be "on", otherwise you don't see anything at all -deviceManager.get('adj_planet').strobe = 'on'; -deviceManager.get('adj_planet').uv = 255; -deviceManager.get('adj_planet').dimmer = 255; -deviceManager.get('adj_planet').color = 'rgb(0, 0, 0)'; - -var pixbar_active = 1; -var pixbar_animation_color = [255, 0, 0]; - -// @TODO: The "animation loop" should be part of in AnimationManager or Timeline or something like that - -// Animation loop -output.requestDmxFrame(function loop(time) { - - // Set a random color for each device - // deviceManager.get('cameo_ledspot_1').color = randomColor().rgbString(); - // deviceManager.get('cameo_ledspot_2').color = randomColor().rgbString(); - deviceManager.get('adj_planet').color = (0, _randomColor2.default)().rgbString(); - - for (var i = 1; i <= 12; i++) { - deviceManager.get('cameopixbar600_1')['led' + i].rgbwauv = [0, 0, 0, 0, 0, 255]; +// Initialize all animations +var animationManager = new _AnimationManager2.default({ config: config, deviceManager: deviceManager }); +animationManager.register(); - if (i === pixbar_active) { - deviceManager.get('cameopixbar600_1')['led' + i].rgbwauv = [pixbar_animation_color[0], pixbar_animation_color[1], pixbar_animation_color[2], 0, 0, 0]; - } - } - pixbar_active = ++pixbar_active % 13; +// Initialize all scenes +var sceneManager = new _SceneManager2.default({ config: config, animationManager: animationManager }); +sceneManager.register(); - output.requestDmxFrame(loop); -}); +// Manage playback of all animations, scenes, timelines +var render = new _Render2.default({ config: config, dmxUsbInterface: dmxUsbInterface, sceneManager: sceneManager }); +render.start(config.global.fps); -// Start the DMX output with the specified fps -output.start(1000 / config.global.fps); +deviceManager.reset(); console.log("Started VisionLord in", process.env.NODE_ENV, "mode with", config.global.fps, "fps"); console.log(config.log.separator); -var expressServer = new _ExpressServer2.default({ - port: config.server.port, - config: config -}); \ No newline at end of file +var expressServer = new _ExpressServer2.default({ port: config.server.port, config: config }); \ No newline at end of file diff --git a/server-bin/util/RgbWAUvParam.js b/server-bin/util/RgbWAUvParam.js index 1d65f85..2f5b0a6 100644 --- a/server-bin/util/RgbWAUvParam.js +++ b/server-bin/util/RgbWAUvParam.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -38,7 +38,7 @@ var RgbWAUvParam = function (_fivetwelve$param$Dmx) { } _createClass(RgbWAUvParam, [{ - key: 'setValue', + key: "setValue", value: function setValue(device, color) { this.color = color; @@ -47,7 +47,7 @@ var RgbWAUvParam = function (_fivetwelve$param$Dmx) { } } }, { - key: 'getValue', + key: "getValue", value: function getValue(device) { var channelValues = []; diff --git a/server/core/Animation.js b/server/core/Animation.js index d4d1a0c..35de496 100644 --- a/server/core/Animation.js +++ b/server/core/Animation.js @@ -175,6 +175,10 @@ export default class Animation { device.gobo = this.values.gobo; } + if (this.values.hasOwnProperty('yellow')) { + device.yellow = this.values.yellow; + } + }); } else { diff --git a/server/core/ModVService.js b/server/core/ModVService.js index c7b67a2..75a8359 100644 --- a/server/core/ModVService.js +++ b/server/core/ModVService.js @@ -14,7 +14,7 @@ export default class ModVService { this.globalColor = randomColor().rgbArray(); - this.random(); + // this.random(); } random() {