k-yle / sACN

💡 🎭 Send & Receive sACN data (DMX over IP) in node.js
https://npm.im/sacn
Apache License 2.0
28 stars 12 forks source link

Support merging from multiple controllers #2

Closed k-yle closed 6 months ago

k-yle commented 4 years ago

if the priority value is the same from two senders, the DMX slot data needs to be merged. ETC's implementation could be used.

hansSchall commented 2 years ago

I would suggest to implement this in its own class. Like this:

class ReceiverMerge extends Receiver{
    contructor(...){
        super(...);
        super.on("packet",this.mergePacket);
    }
    mergePacket(packet: Packet){
        // merge
    }
}

I'm currently working on a project where this feature might be usefull. I will try to code this the next days.

samkearney commented 2 years ago

+1 for adding a "merge receiver" layer on top of a basic receiver. This is the approach we (ETC) use in our C implementation. docs

hansSchall commented 2 years ago

Thats what I coded so far: There might be minor bugs. Haven't tested this much. But it should work.

https://gist.github.com/hansSchall/e30c980d638ba239a15a752383b1a365

I will be able to test it on Sunday.