2012-09-08 12:43:04 +00:00
|
|
|
var events = require('events')
|
2012-12-05 09:42:09 +00:00
|
|
|
, config = require('./config.js')
|
2012-09-08 12:43:04 +00:00
|
|
|
, web = require('./web.js')
|
|
|
|
, setup = require('./setup.js').setup
|
|
|
|
, devices = require('./devices.js').devices
|
|
|
|
;
|
|
|
|
|
2012-09-01 12:17:39 +00:00
|
|
|
|
2012-09-08 12:43:04 +00:00
|
|
|
var dmx = new events.EventEmitter();
|
2012-09-01 12:17:39 +00:00
|
|
|
|
2012-12-05 09:42:09 +00:00
|
|
|
dmx.config = config;
|
2012-09-08 12:43:04 +00:00
|
|
|
dmx.setup = setup;
|
|
|
|
dmx.devices = devices;
|
|
|
|
dmx.drivers = {};
|
|
|
|
|
|
|
|
|
|
|
|
dmx.update = function(universe, update) {
|
|
|
|
dmx.drivers[universe].update(update);
|
|
|
|
dmx.emit('update', universe, update);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(var universe in setup.universes) {
|
|
|
|
dmx.drivers[universe] = require('./drivers/' + setup.universes[universe].output.driver + '.js').init(setup.universes[universe].output.device);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-05 09:42:09 +00:00
|
|
|
web.init(dmx);
|