Library for sending and receiving sACN (E1.31) lighting data
npm install stagehack-sacn
This library supports
* Multiple network interfaces
* Multicast and Unicast
* ETC Net3 (coming soon)
npm install stagehack-sacnjavascript
const ACNSender = require('stagehack-sACN').Sender;
ACNSender.Start([options]);
var universe = new ACNSender.Universe([universe], [priority]);
`
$3
* interfaces: Array of IPv4 network interfaces on the device to send from. ex: ['192.168.0.40, 10.0.0.5']
* cid: 16-character UUID to represent this device. ex: "036b2d4932174812"
* source: Plaintext name of this device. ex: "Tim's MacBook Pro"$3
* universe: Default: 1
* priority: Default: 100$3
`javascript
const ACNSender = require('stagehack-sACN').Sender;
ACNSender.Start({
interfaces: ["192.168.0.40"]
});var sender = new ACNSender.Universe(1, 100);
sender.on("ready", function(){
// send as an array
this.send([255, 0, 0, 255]);
// or send as key-value pairs
this.send({
4: 255,
11: 150,
301: 155
});
});
`Sender also provides
sender.getPossibleInterfaces() which returns a list of all IPv4 network interfaces on the device. Useful for populating a dropdown or other UI.Receiver
`javascript
const ACNReceiver = require('stagehack-sACN').Receiver;
ACNReceiver.Start();
var universe = new ACNReceiver.Universe([universe]);
`
$3
* universe: Default: 1$3
`javascript
receiver.on("packet", function(packet){
console.log(packet.getSlots());
});
`Packet
Setters:
* setUniverse: sets the Universe
* setPriority: sets the Priority
* setCID: sets the CID
* setSource: sets the Source
* setSlots: sets the SlotsGetters:
*
getUniverse: gets the Universe
* getPriority: gets the Priority
* getCID: gets the CID
* getSource: gets the Source
* getSlots: gets current Slots (length 1-512)
* getSequence: gets current Sequence
* getBuffer`: returns a Buffer of the complete sACN Packet