thomasfredericks / OscBridge

A bridge between Serial SLIP, OSC UDP and OSC WebSocket
0 stars 0 forks source link

Only process RAW data #3

Closed thomasfredericks closed 5 months ago

thomasfredericks commented 5 months ago

Add a custom option to only emit raw events and not osc or message events in osc-transports.js.

    p.decodeOSC = function (data, packetInfo) {
        data = osc.byteArray(data);
        this.emit("raw", data, packetInfo);

        try {
            var packet = osc.readPacket(data, this.options);
            this.emit("osc", packet, packetInfo);
            osc.firePacketEvents(this, packet, undefined, packetInfo);
        } catch (err) {
            this.emit("error", err);
        }
    };
    // Unsupported, non-API function.
    osc.firePacketEvents = function (port, packet, timeTag, packetInfo) {
        if (packet.address) {
            port.emit("message", packet, timeTag, packetInfo);
        } else {
            osc.fireBundleEvents(port, packet, timeTag, packetInfo);
        }
    };
thomasfredericks commented 5 months ago

Using raw data makes things more complicated. Cancelled.