diff --git a/dist/osc-browser.js b/dist/osc-browser.js index 4e78d68..1780962 100644 --- a/dist/osc-browser.js +++ b/dist/osc-browser.js @@ -7,7 +7,7 @@ * Licensed under the MIT and GPL 3 licenses. */ -/* global require, module, process, Buffer, Long */ +/* global require, module, process, Buffer, Long, util */ var osc = osc || {}; @@ -55,6 +55,11 @@ var osc = osc || {}; osc.Long = typeof Long !== "undefined" ? Long : osc.isNode ? require("long") : undefined; + // Unsupported, non-API member. Can be removed when supported versions + // of Node.js expose TextDecoder as a global, as in the browser. + osc.TextDecoder = typeof TextDecoder !== "undefined" ? TextDecoder : + typeof util !== "undefined" && typeof (util.TextDecoder !== "undefined") ? util.TextDecoder : undefined; + /** * Wraps the specified object in a DataView. * @@ -164,7 +169,34 @@ var osc = osc || {}; idx = (idx + 3) & ~0x03; offsetState.idx = idx; - return String.fromCharCode.apply(null, charCodes); + var decoder = osc.isBufferEnv ? osc.readString.withBuffer : + osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw; + + return decoder(charCodes); + }; + + osc.readString.raw = function (charCodes) { + // If no Buffer or TextDecoder, resort to fromCharCode + // This does not properly decode multi-byte Unicode characters. + var str = ""; + var sliceSize = 10000; + + // Processing the array in chunks so as not to exceed argument + // limit, see https://bugs.webkit.org/show_bug.cgi?id=80797 + for (var i = 0; i < charCodes.length; i += sliceSize) { + str += String.fromCharCode.apply(null, charCodes.slice(i, i + sliceSize)); + } + + return str; + }; + + osc.readString.withTextDecoder = function (charCodes) { + var data = new Int8Array(charCodes); + return new osc.TextDecoder("utf-8").decode(data); + }; + + osc.readString.withBuffer = function (charCodes) { + return Buffer.from(charCodes).toString("utf-8"); }; /** diff --git a/dist/osc-browser.min.js b/dist/osc-browser.min.js index e7b4edb..0ab25b5 100644 --- a/dist/osc-browser.min.js +++ b/dist/osc-browser.min.js @@ -17,7 +17,8 @@ var osc = osc || {}; }, osc.isBuffer = function(e) { return osc.isBufferEnv && e instanceof Buffer; }, osc.Long = "undefined" != typeof Long ? Long : osc.isNode ? require("long") : void 0, - osc.dataView = function(e, t, r) { + osc.TextDecoder = "undefined" != typeof TextDecoder ? TextDecoder : "undefined" != typeof util && (util.TextDecoder, + 1) ? util.TextDecoder : void 0, osc.dataView = function(e, t, r) { return e.buffer ? new DataView(e.buffer, t, r) : e instanceof ArrayBuffer ? new DataView(e, t, r) : new DataView(new Uint8Array(e), t, r); }, osc.byteArray = function(e) { if (e instanceof Uint8Array) return e; @@ -39,7 +40,15 @@ var osc = osc || {}; } r.push(i); } - return n = n + 3 & -4, t.idx = n, String.fromCharCode.apply(null, r); + return n = n + 3 & -4, t.idx = n, (osc.isBufferEnv ? osc.readString.withBuffer : osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw)(r); + }, osc.readString.raw = function(e) { + for (var t = "", r = 0; r < e.length; r += 1e4) t += String.fromCharCode.apply(null, e.slice(r, r + 1e4)); + return t; + }, osc.readString.withTextDecoder = function(e) { + var t = new Int8Array(e); + return new osc.TextDecoder("utf-8").decode(t); + }, osc.readString.withBuffer = function(e) { + return Buffer.from(e).toString("utf-8"); }, osc.writeString = function(e) { for (var t = e + "\0", r = t.length, n = new Uint8Array(r + 3 & -4), i = 0; i < t.length; i++) { var s = t.charCodeAt(i); @@ -380,7 +389,7 @@ var osc = osc || {}; if (a <= e) return A; } else { if (e <= -u) return P; - if (u <= e + 1) return S; + if (u <= e + 1) return E; } return e < 0 ? l(-e, t).neg() : p(e % i | 0, e / i | 0, t); } @@ -403,13 +412,13 @@ var osc = osc || {}; } return s.unsigned = t, s; } - function y(e, t) { + function v(e, t) { return "number" == typeof e ? l(e, t) : "string" == typeof e ? h(e, t) : p(e.low, e.high, "boolean" == typeof t ? t : e.unsigned); } e.exports = n; - var v = null; + var y = null; try { - v = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 ])), {}).exports; + y = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 ])), {}).exports; } catch (e) {} Object.defineProperty(n.prototype, "__isLong__", { value: !0 @@ -417,7 +426,7 @@ var osc = osc || {}; var s = {}, o = {}; n.fromInt = r, n.fromNumber = l, n.fromBits = p; var f = Math.pow; - n.fromString = h, n.fromValue = y; + n.fromString = h, n.fromValue = v; var i = 4294967296, a = i * i, u = a / 2, w = r(1 << 24), m = r(0); n.ZERO = m; var c = r(0, !0); @@ -426,10 +435,10 @@ var osc = osc || {}; n.ONE = d; var b = r(1, !0); n.UONE = b; - var E = r(-1); - n.NEG_ONE = E; - var S = p(-1, 2147483647, !1); - n.MAX_VALUE = S; + var S = r(-1); + n.NEG_ONE = S; + var E = p(-1, 2147483647, !1); + n.MAX_VALUE = E; var A = p(-1, -1, !0); n.MAX_UNSIGNED_VALUE = A; var P = p(0, -2147483648, !1); @@ -478,7 +487,7 @@ var osc = osc || {}; }, B.isEven = function() { return 0 == (1 & this.low); }, B.equals = function(e) { - return g(e) || (e = y(e)), (this.unsigned === e.unsigned || this.high >>> 31 != 1 || e.high >>> 31 != 1) && this.high === e.high && this.low === e.low; + return g(e) || (e = v(e)), (this.unsigned === e.unsigned || this.high >>> 31 != 1 || e.high >>> 31 != 1) && this.high === e.high && this.low === e.low; }, B.eq = B.equals, B.notEquals = function(e) { return !this.eq(e); }, B.neq = B.notEquals, B.ne = B.notEquals, B.lessThan = function(e) { @@ -490,21 +499,21 @@ var osc = osc || {}; }, B.gt = B.greaterThan, B.greaterThanOrEqual = function(e) { return 0 <= this.comp(e); }, B.gte = B.greaterThanOrEqual, B.ge = B.greaterThanOrEqual, B.compare = function(e) { - if (g(e) || (e = y(e)), this.eq(e)) return 0; + if (g(e) || (e = v(e)), this.eq(e)) return 0; var t = this.isNegative(), r = e.isNegative(); return t && !r ? -1 : !t && r ? 1 : this.unsigned ? e.high >>> 0 > this.high >>> 0 || e.high === this.high && e.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(e).isNegative() ? -1 : 1; }, B.comp = B.compare, B.negate = function() { return !this.unsigned && this.eq(P) ? P : this.not().add(d); }, B.neg = B.negate, B.add = function(e) { - g(e) || (e = y(e)); + g(e) || (e = v(e)); var t = this.high >>> 16, r = 65535 & this.high, n = this.low >>> 16, i = 65535 & this.low, s = e.high >>> 16, o = 65535 & e.high, a = e.low >>> 16, u = 0, c = 0, h = 0, f = 0; return h += (f += i + (65535 & e.low)) >>> 16, c += (h += n + a) >>> 16, u += (c += r + o) >>> 16, u += t + s, p((h &= 65535) << 16 | (f &= 65535), (u &= 65535) << 16 | (c &= 65535), this.unsigned); }, B.subtract = function(e) { - return g(e) || (e = y(e)), this.add(e.neg()); + return g(e) || (e = v(e)), this.add(e.neg()); }, B.sub = B.subtract, B.multiply = function(e) { if (this.isZero()) return m; - if (g(e) || (e = y(e)), v) return p(v.mul(this.low, this.high, e.low, e.high), v.get_high(), this.unsigned); + if (g(e) || (e = v(e)), y) return p(y.mul(this.low, this.high, e.low, e.high), y.get_high(), this.unsigned); if (e.isZero()) return m; if (this.eq(P)) return e.isOdd() ? P : m; if (e.eq(P)) return this.isOdd() ? P : m; @@ -516,8 +525,8 @@ var osc = osc || {}; c += (h += r * u) >>> 16, h &= 65535, c += (h += n * a) >>> 16, h &= 65535, c += (h += i * o) >>> 16, c += t * u + r * a + n * o + i * s, p((f &= 65535) << 16 | (d &= 65535), (c &= 65535) << 16 | (h &= 65535), this.unsigned); }, B.mul = B.multiply, B.divide = function(e) { - if (g(e) || (e = y(e)), e.isZero()) throw Error("division by zero"); - if (v) return this.unsigned || -2147483648 !== this.high || -1 !== e.low || -1 !== e.high ? p((this.unsigned ? v.div_u : v.div_s)(this.low, this.high, e.low, e.high), v.get_high(), this.unsigned) : this; + if (g(e) || (e = v(e)), e.isZero()) throw Error("division by zero"); + if (y) return this.unsigned || -2147483648 !== this.high || -1 !== e.low || -1 !== e.high ? p((this.unsigned ? y.div_u : y.div_s)(this.low, this.high, e.low, e.high), y.get_high(), this.unsigned) : this; if (this.isZero()) return this.unsigned ? c : m; var t, r, n; if (this.unsigned) { @@ -525,7 +534,7 @@ var osc = osc || {}; if (e.gt(this.shru(1))) return b; n = c; } else { - if (this.eq(P)) return e.eq(d) || e.eq(E) ? P : e.eq(P) ? d : (t = this.shr(1).div(e).shl(1)).eq(m) ? e.isNegative() ? d : E : (r = this.sub(e.mul(t)), + if (this.eq(P)) return e.eq(d) || e.eq(S) ? P : e.eq(P) ? d : (t = this.shr(1).div(e).shl(1)).eq(m) ? e.isNegative() ? d : S : (r = this.sub(e.mul(t)), n = t.add(r.div(e))); if (e.eq(P)) return this.unsigned ? c : m; if (this.isNegative()) return e.isNegative() ? this.neg().div(e.neg()) : this.neg().div(e).neg(); @@ -539,15 +548,15 @@ var osc = osc || {}; } return n; }, B.div = B.divide, B.modulo = function(e) { - return g(e) || (e = y(e)), v ? p((this.unsigned ? v.rem_u : v.rem_s)(this.low, this.high, e.low, e.high), v.get_high(), this.unsigned) : this.sub(this.div(e).mul(e)); + return g(e) || (e = v(e)), y ? p((this.unsigned ? y.rem_u : y.rem_s)(this.low, this.high, e.low, e.high), y.get_high(), this.unsigned) : this.sub(this.div(e).mul(e)); }, B.mod = B.modulo, B.rem = B.modulo, B.not = function() { return p(~this.low, ~this.high, this.unsigned); }, B.and = function(e) { - return g(e) || (e = y(e)), p(this.low & e.low, this.high & e.high, this.unsigned); + return g(e) || (e = v(e)), p(this.low & e.low, this.high & e.high, this.unsigned); }, B.or = function(e) { - return g(e) || (e = y(e)), p(this.low | e.low, this.high | e.high, this.unsigned); + return g(e) || (e = v(e)), p(this.low | e.low, this.high | e.high, this.unsigned); }, B.xor = function(e) { - return g(e) || (e = y(e)), p(this.low ^ e.low, this.high ^ e.high, this.unsigned); + return g(e) || (e = v(e)), p(this.low ^ e.low, this.high ^ e.high, this.unsigned); }, B.shiftLeft = function(e) { return g(e) && (e = e.toInt()), 0 == (e &= 63) ? this : e < 32 ? p(this.low << e, this.high << e | this.low >>> 32 - e, this.unsigned) : p(0, this.low << e - 32, this.unsigned); }, B.shl = B.shiftLeft, B.shiftRight = function(e) { diff --git a/dist/osc-chromeapp.js b/dist/osc-chromeapp.js index 7c54729..6fe6043 100644 --- a/dist/osc-chromeapp.js +++ b/dist/osc-chromeapp.js @@ -7,7 +7,7 @@ * Licensed under the MIT and GPL 3 licenses. */ -/* global require, module, process, Buffer, Long */ +/* global require, module, process, Buffer, Long, util */ var osc = osc || {}; @@ -55,6 +55,11 @@ var osc = osc || {}; osc.Long = typeof Long !== "undefined" ? Long : osc.isNode ? require("long") : undefined; + // Unsupported, non-API member. Can be removed when supported versions + // of Node.js expose TextDecoder as a global, as in the browser. + osc.TextDecoder = typeof TextDecoder !== "undefined" ? TextDecoder : + typeof util !== "undefined" && typeof (util.TextDecoder !== "undefined") ? util.TextDecoder : undefined; + /** * Wraps the specified object in a DataView. * @@ -164,7 +169,34 @@ var osc = osc || {}; idx = (idx + 3) & ~0x03; offsetState.idx = idx; - return String.fromCharCode.apply(null, charCodes); + var decoder = osc.isBufferEnv ? osc.readString.withBuffer : + osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw; + + return decoder(charCodes); + }; + + osc.readString.raw = function (charCodes) { + // If no Buffer or TextDecoder, resort to fromCharCode + // This does not properly decode multi-byte Unicode characters. + var str = ""; + var sliceSize = 10000; + + // Processing the array in chunks so as not to exceed argument + // limit, see https://bugs.webkit.org/show_bug.cgi?id=80797 + for (var i = 0; i < charCodes.length; i += sliceSize) { + str += String.fromCharCode.apply(null, charCodes.slice(i, i + sliceSize)); + } + + return str; + }; + + osc.readString.withTextDecoder = function (charCodes) { + var data = new Int8Array(charCodes); + return new osc.TextDecoder("utf-8").decode(data); + }; + + osc.readString.withBuffer = function (charCodes) { + return Buffer.from(charCodes).toString("utf-8"); }; /** diff --git a/dist/osc-chromeapp.min.js b/dist/osc-chromeapp.min.js index 01f1acd..f26e575 100644 --- a/dist/osc-chromeapp.min.js +++ b/dist/osc-chromeapp.min.js @@ -10,102 +10,111 @@ var osc = osc || {}; unpackSingleArgs: !0 }, osc.isCommonJS = !("undefined" == typeof module || !module.exports), osc.isNode = osc.isCommonJS && "undefined" == typeof window, osc.isElectron = !("undefined" == typeof process || !process.versions || !process.versions.electron), - osc.isBufferEnv = osc.isNode || osc.isElectron, osc.isArray = function(t) { - return t && "[object Array]" === Object.prototype.toString.call(t); - }, osc.isTypedArrayView = function(t) { - return t.buffer && t.buffer instanceof ArrayBuffer; - }, osc.isBuffer = function(t) { - return osc.isBufferEnv && t instanceof Buffer; + osc.isBufferEnv = osc.isNode || osc.isElectron, osc.isArray = function(e) { + return e && "[object Array]" === Object.prototype.toString.call(e); + }, osc.isTypedArrayView = function(e) { + return e.buffer && e.buffer instanceof ArrayBuffer; + }, osc.isBuffer = function(e) { + return osc.isBufferEnv && e instanceof Buffer; }, osc.Long = "undefined" != typeof Long ? Long : osc.isNode ? require("long") : void 0, - osc.dataView = function(t, e, r) { - return t.buffer ? new DataView(t.buffer, e, r) : t instanceof ArrayBuffer ? new DataView(t, e, r) : new DataView(new Uint8Array(t), e, r); - }, osc.byteArray = function(t) { - if (t instanceof Uint8Array) return t; - var e = t.buffer ? t.buffer : t; - if (!(e instanceof ArrayBuffer || void 0 !== e.length && "string" != typeof e)) throw new Error("Can't wrap a non-array-like object as Uint8Array. Object was: " + JSON.stringify(t, null, 2)); - return new Uint8Array(e); - }, osc.nativeBuffer = function(t) { - return osc.isBufferEnv ? osc.isBuffer(t) ? t : Buffer.from(t.buffer ? t : new Uint8Array(t)) : osc.isTypedArrayView(t) ? t : new Uint8Array(t); - }, osc.copyByteArray = function(t, e, r) { - if (osc.isTypedArrayView(t) && osc.isTypedArrayView(e)) e.set(t, r); else for (var n = void 0 === r ? 0 : r, i = Math.min(e.length - r, t.length), s = 0, o = n; s < i; s++, - o++) e[o] = t[s]; - return e; - }, osc.readString = function(t, e) { - for (var r = [], n = e.idx; n < t.byteLength; n++) { - var i = t.getUint8(n); + osc.TextDecoder = "undefined" != typeof TextDecoder ? TextDecoder : "undefined" != typeof util && (util.TextDecoder, + 1) ? util.TextDecoder : void 0, osc.dataView = function(e, t, r) { + return e.buffer ? new DataView(e.buffer, t, r) : e instanceof ArrayBuffer ? new DataView(e, t, r) : new DataView(new Uint8Array(e), t, r); + }, osc.byteArray = function(e) { + if (e instanceof Uint8Array) return e; + var t = e.buffer ? e.buffer : e; + if (!(t instanceof ArrayBuffer || void 0 !== t.length && "string" != typeof t)) throw new Error("Can't wrap a non-array-like object as Uint8Array. Object was: " + JSON.stringify(e, null, 2)); + return new Uint8Array(t); + }, osc.nativeBuffer = function(e) { + return osc.isBufferEnv ? osc.isBuffer(e) ? e : Buffer.from(e.buffer ? e : new Uint8Array(e)) : osc.isTypedArrayView(e) ? e : new Uint8Array(e); + }, osc.copyByteArray = function(e, t, r) { + if (osc.isTypedArrayView(e) && osc.isTypedArrayView(t)) t.set(e, r); else for (var n = void 0 === r ? 0 : r, i = Math.min(t.length - r, e.length), s = 0, o = n; s < i; s++, + o++) t[o] = e[s]; + return t; + }, osc.readString = function(e, t) { + for (var r = [], n = t.idx; n < e.byteLength; n++) { + var i = e.getUint8(n); if (0 === i) { n++; break; } r.push(i); } - return n = n + 3 & -4, e.idx = n, String.fromCharCode.apply(null, r); - }, osc.writeString = function(t) { - for (var e = t + "\0", r = e.length, n = new Uint8Array(r + 3 & -4), i = 0; i < e.length; i++) { - var s = e.charCodeAt(i); + return n = n + 3 & -4, t.idx = n, (osc.isBufferEnv ? osc.readString.withBuffer : osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw)(r); + }, osc.readString.raw = function(e) { + for (var t = "", r = 0; r < e.length; r += 1e4) t += String.fromCharCode.apply(null, e.slice(r, r + 1e4)); + return t; + }, osc.readString.withTextDecoder = function(e) { + var t = new Int8Array(e); + return new osc.TextDecoder("utf-8").decode(t); + }, osc.readString.withBuffer = function(e) { + return Buffer.from(e).toString("utf-8"); + }, osc.writeString = function(e) { + for (var t = e + "\0", r = t.length, n = new Uint8Array(r + 3 & -4), i = 0; i < t.length; i++) { + var s = t.charCodeAt(i); n[i] = s; } return n; - }, osc.readPrimitive = function(t, e, r, n) { - var i = t[e](n.idx, !1); + }, osc.readPrimitive = function(e, t, r, n) { + var i = e[t](n.idx, !1); return n.idx += r, i; - }, osc.writePrimitive = function(t, e, r, n, i) { + }, osc.writePrimitive = function(e, t, r, n, i) { var s; - return i = void 0 === i ? 0 : i, e ? s = new Uint8Array(e.buffer) : (s = new Uint8Array(n), - e = new DataView(s.buffer)), e[r](i, t, !1), s; - }, osc.readInt32 = function(t, e) { - return osc.readPrimitive(t, "getInt32", 4, e); - }, osc.writeInt32 = function(t, e, r) { - return osc.writePrimitive(t, e, "setInt32", 4, r); - }, osc.readInt64 = function(t, e) { - var r = osc.readPrimitive(t, "getInt32", 4, e), n = osc.readPrimitive(t, "getInt32", 4, e); + return i = void 0 === i ? 0 : i, t ? s = new Uint8Array(t.buffer) : (s = new Uint8Array(n), + t = new DataView(s.buffer)), t[r](i, e, !1), s; + }, osc.readInt32 = function(e, t) { + return osc.readPrimitive(e, "getInt32", 4, t); + }, osc.writeInt32 = function(e, t, r) { + return osc.writePrimitive(e, t, "setInt32", 4, r); + }, osc.readInt64 = function(e, t) { + var r = osc.readPrimitive(e, "getInt32", 4, t), n = osc.readPrimitive(e, "getInt32", 4, t); return osc.Long ? new osc.Long(n, r) : { high: r, low: n, unsigned: !1 }; - }, osc.writeInt64 = function(t, e, r) { + }, osc.writeInt64 = function(e, t, r) { var n = new Uint8Array(8); - return n.set(osc.writePrimitive(t.high, e, "setInt32", 4, r), 0), n.set(osc.writePrimitive(t.low, e, "setInt32", 4, r + 4), 4), + return n.set(osc.writePrimitive(e.high, t, "setInt32", 4, r), 0), n.set(osc.writePrimitive(e.low, t, "setInt32", 4, r + 4), 4), n; - }, osc.readFloat32 = function(t, e) { - return osc.readPrimitive(t, "getFloat32", 4, e); - }, osc.writeFloat32 = function(t, e, r) { - return osc.writePrimitive(t, e, "setFloat32", 4, r); - }, osc.readFloat64 = function(t, e) { - return osc.readPrimitive(t, "getFloat64", 8, e); - }, osc.writeFloat64 = function(t, e, r) { - return osc.writePrimitive(t, e, "setFloat64", 8, r); - }, osc.readChar32 = function(t, e) { - var r = osc.readPrimitive(t, "getUint32", 4, e); + }, osc.readFloat32 = function(e, t) { + return osc.readPrimitive(e, "getFloat32", 4, t); + }, osc.writeFloat32 = function(e, t, r) { + return osc.writePrimitive(e, t, "setFloat32", 4, r); + }, osc.readFloat64 = function(e, t) { + return osc.readPrimitive(e, "getFloat64", 8, t); + }, osc.writeFloat64 = function(e, t, r) { + return osc.writePrimitive(e, t, "setFloat64", 8, r); + }, osc.readChar32 = function(e, t) { + var r = osc.readPrimitive(e, "getUint32", 4, t); return String.fromCharCode(r); - }, osc.writeChar32 = function(t, e, r) { - var n = t.charCodeAt(0); - if (!(void 0 === n || n < -1)) return osc.writePrimitive(n, e, "setUint32", 4, r); - }, osc.readBlob = function(t, e) { - var r = osc.readInt32(t, e), n = r + 3 & -4, i = new Uint8Array(t.buffer, e.idx, r); - return e.idx += n, i; - }, osc.writeBlob = function(t) { - var e = (t = osc.byteArray(t)).byteLength, r = new Uint8Array(4 + (e + 3 & -4)), n = new DataView(r.buffer); - return osc.writeInt32(e, n), r.set(t, 4), r; - }, osc.readMIDIBytes = function(t, e) { - var r = new Uint8Array(t.buffer, e.idx, 4); - return e.idx += 4, r; - }, osc.writeMIDIBytes = function(t) { - t = osc.byteArray(t); - var e = new Uint8Array(4); - return e.set(t), e; - }, osc.readColor = function(t, e) { - var r = new Uint8Array(t.buffer, e.idx, 4), n = r[3] / 255; - return e.idx += 4, { + }, osc.writeChar32 = function(e, t, r) { + var n = e.charCodeAt(0); + if (!(void 0 === n || n < -1)) return osc.writePrimitive(n, t, "setUint32", 4, r); + }, osc.readBlob = function(e, t) { + var r = osc.readInt32(e, t), n = r + 3 & -4, i = new Uint8Array(e.buffer, t.idx, r); + return t.idx += n, i; + }, osc.writeBlob = function(e) { + var t = (e = osc.byteArray(e)).byteLength, r = new Uint8Array(4 + (t + 3 & -4)), n = new DataView(r.buffer); + return osc.writeInt32(t, n), r.set(e, 4), r; + }, osc.readMIDIBytes = function(e, t) { + var r = new Uint8Array(e.buffer, t.idx, 4); + return t.idx += 4, r; + }, osc.writeMIDIBytes = function(e) { + e = osc.byteArray(e); + var t = new Uint8Array(4); + return t.set(e), t; + }, osc.readColor = function(e, t) { + var r = new Uint8Array(e.buffer, t.idx, 4), n = r[3] / 255; + return t.idx += 4, { r: r[0], g: r[1], b: r[2], a: n }; - }, osc.writeColor = function(t) { - var e = Math.round(255 * t.a); - return new Uint8Array([ t.r, t.g, t.b, e ]); + }, osc.writeColor = function(e) { + var t = Math.round(255 * e.a); + return new Uint8Array([ e.r, e.g, e.b, t ]); }, osc.readTrue = function() { return !0; }, osc.readFalse = function() { @@ -114,18 +123,18 @@ var osc = osc || {}; return null; }, osc.readImpulse = function() { return 1; - }, osc.readTimeTag = function(t, e) { - var r = osc.readPrimitive(t, "getUint32", 4, e), n = osc.readPrimitive(t, "getUint32", 4, e); + }, osc.readTimeTag = function(e, t) { + var r = osc.readPrimitive(e, "getUint32", 4, t), n = osc.readPrimitive(e, "getUint32", 4, t); return { raw: [ r, n ], native: 0 === r && 1 === n ? Date.now() : osc.ntpToJSTime(r, n) }; - }, osc.writeTimeTag = function(t) { - var e = t.raw ? t.raw : osc.jsToNTPTime(t.native), r = new Uint8Array(8), n = new DataView(r.buffer); - return osc.writeInt32(e[0], n, 0), osc.writeInt32(e[1], n, 4), r; - }, osc.timeTag = function(t, e) { - t = t || 0; - var r = (e = e || Date.now()) / 1e3, n = Math.floor(r), i = r - n, s = Math.floor(t), o = i + (t - s); + }, osc.writeTimeTag = function(e) { + var t = e.raw ? e.raw : osc.jsToNTPTime(e.native), r = new Uint8Array(8), n = new DataView(r.buffer); + return osc.writeInt32(t[0], n, 0), osc.writeInt32(t[1], n, 4), r; + }, osc.timeTag = function(e, t) { + e = e || 0; + var r = (t = t || Date.now()) / 1e3, n = Math.floor(r), i = r - n, s = Math.floor(e), o = i + (e - s); if (1 < o) { var a = Math.floor(o); s += a, o = o - a; @@ -133,140 +142,140 @@ var osc = osc || {}; return { raw: [ n + s + osc.SECS_70YRS, Math.round(osc.TWO_32 * o) ] }; - }, osc.ntpToJSTime = function(t, e) { - return 1e3 * (t - osc.SECS_70YRS + e / osc.TWO_32); - }, osc.jsToNTPTime = function(t) { - var e = t / 1e3, r = Math.floor(e), n = e - r; + }, osc.ntpToJSTime = function(e, t) { + return 1e3 * (e - osc.SECS_70YRS + t / osc.TWO_32); + }, osc.jsToNTPTime = function(e) { + var t = e / 1e3, r = Math.floor(t), n = t - r; return [ r + osc.SECS_70YRS, Math.round(osc.TWO_32 * n) ]; - }, osc.readArguments = function(t, e, r) { - var n = osc.readString(t, r); + }, osc.readArguments = function(e, t, r) { + var n = osc.readString(e, r); if (0 !== n.indexOf(",")) throw new Error("A malformed type tag string was found while reading the arguments of an OSC message. String was: " + n, " at offset: " + r.idx); var i = n.substring(1).split(""), s = []; - return osc.readArgumentsIntoArray(s, i, n, t, e, r), s; - }, osc.readArgument = function(t, e, r, n, i) { - var s = osc.argumentTypes[t]; - if (!s) throw new Error("'" + t + "' is not a valid OSC type tag. Type tag string was: " + e); + return osc.readArgumentsIntoArray(s, i, n, e, t, r), s; + }, osc.readArgument = function(e, t, r, n, i) { + var s = osc.argumentTypes[e]; + if (!s) throw new Error("'" + e + "' is not a valid OSC type tag. Type tag string was: " + t); var o = s.reader, a = osc[o](r, i); return n.metadata && (a = { - type: t, + type: e, value: a }), a; - }, osc.readArgumentsIntoArray = function(t, e, r, n, i, s) { - for (var o = 0; o < e.length; ) { - var a, c = e[o]; + }, osc.readArgumentsIntoArray = function(e, t, r, n, i, s) { + for (var o = 0; o < t.length; ) { + var a, c = t[o]; if ("[" === c) { - var u = e.slice(o + 1), h = u.indexOf("]"); + var u = t.slice(o + 1), h = u.indexOf("]"); if (h < 0) throw new Error("Invalid argument type tag: an open array type tag ('[') was found without a matching close array tag ('[]'). Type tag was: " + r); var f = u.slice(0, h); a = osc.readArgumentsIntoArray([], f, r, n, i, s), o += h + 2; } else a = osc.readArgument(c, r, n, i, s), o++; - t.push(a); + e.push(a); } - return t; - }, osc.writeArguments = function(t, e) { - var r = osc.collectArguments(t, e); + return e; + }, osc.writeArguments = function(e, t) { + var r = osc.collectArguments(e, t); return osc.joinParts(r); - }, osc.joinParts = function(t) { - for (var e = new Uint8Array(t.byteLength), r = t.parts, n = 0, i = 0; i < r.length; i++) { + }, osc.joinParts = function(e) { + for (var t = new Uint8Array(e.byteLength), r = e.parts, n = 0, i = 0; i < r.length; i++) { var s = r[i]; - osc.copyByteArray(s, e, n), n += s.length; + osc.copyByteArray(s, t, n), n += s.length; } - return e; - }, osc.addDataPart = function(t, e) { - e.parts.push(t), e.byteLength += t.length; - }, osc.writeArrayArguments = function(t, e) { - for (var r = "[", n = 0; n < t.length; n++) { - var i = t[n]; - r += osc.writeArgument(i, e); + return t; + }, osc.addDataPart = function(e, t) { + t.parts.push(e), t.byteLength += e.length; + }, osc.writeArrayArguments = function(e, t) { + for (var r = "[", n = 0; n < e.length; n++) { + var i = e[n]; + r += osc.writeArgument(i, t); } return r += "]"; - }, osc.writeArgument = function(t, e) { - if (osc.isArray(t)) return osc.writeArrayArguments(t, e); - var r = t.type, n = osc.argumentTypes[r].writer; + }, osc.writeArgument = function(e, t) { + if (osc.isArray(e)) return osc.writeArrayArguments(e, t); + var r = e.type, n = osc.argumentTypes[r].writer; if (n) { - var i = osc[n](t.value); - osc.addDataPart(i, e); + var i = osc[n](e.value); + osc.addDataPart(i, t); } - return t.type; - }, osc.collectArguments = function(t, e, r) { - osc.isArray(t) || (t = void 0 === t ? [] : [ t ]), r = r || { + return e.type; + }, osc.collectArguments = function(e, t, r) { + osc.isArray(e) || (e = void 0 === e ? [] : [ e ]), r = r || { byteLength: 0, parts: [] - }, e.metadata || (t = osc.annotateArguments(t)); - for (var n = ",", i = r.parts.length, s = 0; s < t.length; s++) { - var o = t[s]; + }, t.metadata || (e = osc.annotateArguments(e)); + for (var n = ",", i = r.parts.length, s = 0; s < e.length; s++) { + var o = e[s]; n += osc.writeArgument(o, r); } var a = osc.writeString(n); return r.byteLength += a.byteLength, r.parts.splice(i, 0, a), r; - }, osc.readMessage = function(t, e, r) { - e = e || osc.defaults; - var n = osc.dataView(t, t.byteOffset, t.byteLength); + }, osc.readMessage = function(e, t, r) { + t = t || osc.defaults; + var n = osc.dataView(e, e.byteOffset, e.byteLength); r = r || { idx: 0 }; var i = osc.readString(n, r); - return osc.readMessageContents(i, n, e, r); - }, osc.readMessageContents = function(t, e, r, n) { - if (0 !== t.indexOf("/")) throw new Error("A malformed OSC address was found while reading an OSC message. String was: " + t); - var i = osc.readArguments(e, r, n); + return osc.readMessageContents(i, n, t, r); + }, osc.readMessageContents = function(e, t, r, n) { + if (0 !== e.indexOf("/")) throw new Error("A malformed OSC address was found while reading an OSC message. String was: " + e); + var i = osc.readArguments(t, r, n); return { - address: t, + address: e, args: 1 === i.length && r.unpackSingleArgs ? i[0] : i }; - }, osc.collectMessageParts = function(t, e, r) { + }, osc.collectMessageParts = function(e, t, r) { return r = r || { byteLength: 0, parts: [] - }, osc.addDataPart(osc.writeString(t.address), r), osc.collectArguments(t.args, e, r); - }, osc.writeMessage = function(t, e) { - if (e = e || osc.defaults, !osc.isValidMessage(t)) throw new Error("An OSC message must contain a valid address. Message was: " + JSON.stringify(t, null, 2)); - var r = osc.collectMessageParts(t, e); + }, osc.addDataPart(osc.writeString(e.address), r), osc.collectArguments(e.args, t, r); + }, osc.writeMessage = function(e, t) { + if (t = t || osc.defaults, !osc.isValidMessage(e)) throw new Error("An OSC message must contain a valid address. Message was: " + JSON.stringify(e, null, 2)); + var r = osc.collectMessageParts(e, t); return osc.joinParts(r); - }, osc.isValidMessage = function(t) { - return t.address && 0 === t.address.indexOf("/"); - }, osc.readBundle = function(t, e, r) { - return osc.readPacket(t, e, r); - }, osc.collectBundlePackets = function(t, e, r) { + }, osc.isValidMessage = function(e) { + return e.address && 0 === e.address.indexOf("/"); + }, osc.readBundle = function(e, t, r) { + return osc.readPacket(e, t, r); + }, osc.collectBundlePackets = function(e, t, r) { r = r || { byteLength: 0, parts: [] - }, osc.addDataPart(osc.writeString("#bundle"), r), osc.addDataPart(osc.writeTimeTag(t.timeTag), r); - for (var n = 0; n < t.packets.length; n++) { - var i = t.packets[n], s = (i.address ? osc.collectMessageParts : osc.collectBundlePackets)(i, e); + }, osc.addDataPart(osc.writeString("#bundle"), r), osc.addDataPart(osc.writeTimeTag(e.timeTag), r); + for (var n = 0; n < e.packets.length; n++) { + var i = e.packets[n], s = (i.address ? osc.collectMessageParts : osc.collectBundlePackets)(i, t); r.byteLength += s.byteLength, osc.addDataPart(osc.writeInt32(s.byteLength), r), r.parts = r.parts.concat(s.parts); } return r; - }, osc.writeBundle = function(t, e) { - if (!osc.isValidBundle(t)) throw new Error("An OSC bundle must contain 'timeTag' and 'packets' properties. Bundle was: " + JSON.stringify(t, null, 2)); - e = e || osc.defaults; - var r = osc.collectBundlePackets(t, e); + }, osc.writeBundle = function(e, t) { + if (!osc.isValidBundle(e)) throw new Error("An OSC bundle must contain 'timeTag' and 'packets' properties. Bundle was: " + JSON.stringify(e, null, 2)); + t = t || osc.defaults; + var r = osc.collectBundlePackets(e, t); return osc.joinParts(r); - }, osc.isValidBundle = function(t) { - return void 0 !== t.timeTag && void 0 !== t.packets; - }, osc.readBundleContents = function(t, e, r, n) { - for (var i = osc.readTimeTag(t, r), s = []; r.idx < n; ) { - var o = osc.readInt32(t, r), a = r.idx + o, c = osc.readPacket(t, e, r, a); + }, osc.isValidBundle = function(e) { + return void 0 !== e.timeTag && void 0 !== e.packets; + }, osc.readBundleContents = function(e, t, r, n) { + for (var i = osc.readTimeTag(e, r), s = []; r.idx < n; ) { + var o = osc.readInt32(e, r), a = r.idx + o, c = osc.readPacket(e, t, r, a); s.push(c); } return { timeTag: i, packets: s }; - }, osc.readPacket = function(t, e, r, n) { - var i = osc.dataView(t, t.byteOffset, t.byteLength); + }, osc.readPacket = function(e, t, r, n) { + var i = osc.dataView(e, e.byteOffset, e.byteLength); n = void 0 === n ? i.byteLength : n, r = r || { idx: 0 }; var s = osc.readString(i, r), o = s[0]; - if ("#" === o) return osc.readBundleContents(i, e, r, n); - if ("/" === o) return osc.readMessageContents(s, i, e, r); + if ("#" === o) return osc.readBundleContents(i, t, r, n); + if ("/" === o) return osc.readMessageContents(s, i, t, r); throw new Error("The header of an OSC packet didn't contain an OSC address or a #bundle string. Header was: " + s); - }, osc.writePacket = function(t, e) { - if (osc.isValidMessage(t)) return osc.writeMessage(t, e); - if (osc.isValidBundle(t)) return osc.writeBundle(t, e); - throw new Error("The specified packet was not recognized as a valid OSC message or bundle. Packet was: " + JSON.stringify(t, null, 2)); + }, osc.writePacket = function(e, t) { + if (osc.isValidMessage(e)) return osc.writeMessage(e, t); + if (osc.isValidBundle(e)) return osc.writeBundle(e, t); + throw new Error("The specified packet was not recognized as a valid OSC message or bundle. Packet was: " + JSON.stringify(e, null, 2)); }, osc.argumentTypes = { i: { reader: "readInt32", @@ -324,10 +333,10 @@ var osc = osc || {}; reader: "readMIDIBytes", writer: "writeMIDIBytes" } - }, osc.inferTypeForArgument = function(t) { - switch (typeof t) { + }, osc.inferTypeForArgument = function(e) { + switch (typeof e) { case "boolean": - return t ? "T" : "F"; + return e ? "T" : "F"; case "string": return "s"; @@ -339,78 +348,78 @@ var osc = osc || {}; return "N"; case "object": - if (null === t) return "N"; - if (t instanceof Uint8Array || t instanceof ArrayBuffer) return "b"; - if ("number" == typeof t.high && "number" == typeof t.low) return "h"; + if (null === e) return "N"; + if (e instanceof Uint8Array || e instanceof ArrayBuffer) return "b"; + if ("number" == typeof e.high && "number" == typeof e.low) return "h"; } - throw new Error("Can't infer OSC argument type for value: " + JSON.stringify(t, null, 2)); - }, osc.annotateArguments = function(t) { - for (var e = [], r = 0; r < t.length; r++) { - var n, i = t[r]; + throw new Error("Can't infer OSC argument type for value: " + JSON.stringify(e, null, 2)); + }, osc.annotateArguments = function(e) { + for (var t = [], r = 0; r < e.length; r++) { + var n, i = e[r]; if ("object" == typeof i && i.type && void 0 !== i.value) n = i; else if (osc.isArray(i)) n = osc.annotateArguments(i); else { n = { type: osc.inferTypeForArgument(i), value: i }; } - e.push(n); + t.push(n); } - return e; + return t; }, osc.isCommonJS && (module.exports = osc); -}(), function(t, e) { - "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Long = e() : t.Long = e(); +}(), function(e, t) { + "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.Long = t() : e.Long = t(); }("undefined" != typeof self ? self : this, function() { - return i = {}, n.m = r = [ function(t, e) { - function n(t, e, r) { - this.low = 0 | t, this.high = 0 | e, this.unsigned = !!r; + return i = {}, n.m = r = [ function(e, t) { + function n(e, t, r) { + this.low = 0 | e, this.high = 0 | t, this.unsigned = !!r; } - function l(t) { - return !0 === (t && t.__isLong__); + function l(e) { + return !0 === (e && e.__isLong__); } - function r(t, e) { + function r(e, t) { var r, n, i; - return e ? (i = 0 <= (t >>>= 0) && t < 256) && (n = o[t]) ? n : (r = p(t, (0 | t) < 0 ? -1 : 0, !0), - i && (o[t] = r), r) : (i = -128 <= (t |= 0) && t < 128) && (n = s[t]) ? n : (r = p(t, t < 0 ? -1 : 0, !1), - i && (s[t] = r), r); + return t ? (i = 0 <= (e >>>= 0) && e < 256) && (n = o[e]) ? n : (r = p(e, (0 | e) < 0 ? -1 : 0, !0), + i && (o[e] = r), r) : (i = -128 <= (e |= 0) && e < 128) && (n = s[e]) ? n : (r = p(e, e < 0 ? -1 : 0, !1), + i && (s[e] = r), r); } - function g(t, e) { - if (isNaN(t)) return e ? u : w; - if (e) { - if (t < 0) return u; - if (a <= t) return P; + function g(e, t) { + if (isNaN(e)) return t ? u : y; + if (t) { + if (e < 0) return u; + if (a <= e) return P; } else { - if (t <= -c) return A; - if (c <= t + 1) return S; + if (e <= -c) return A; + if (c <= e + 1) return E; } - return t < 0 ? g(-t, e).neg() : p(t % i | 0, t / i | 0, e); + return e < 0 ? g(-e, t).neg() : p(e % i | 0, e / i | 0, t); } - function p(t, e, r) { - return new n(t, e, r); + function p(e, t, r) { + return new n(e, t, r); } - function h(t, e, r) { - if (0 === t.length) throw Error("empty string"); - if ("NaN" === t || "Infinity" === t || "+Infinity" === t || "-Infinity" === t) return w; - if (e = "number" == typeof e ? (r = e, !1) : !!e, (r = r || 10) < 2 || 36 < r) throw RangeError("radix"); + function h(e, t, r) { + if (0 === e.length) throw Error("empty string"); + if ("NaN" === e || "Infinity" === e || "+Infinity" === e || "-Infinity" === e) return y; + if (t = "number" == typeof t ? (r = t, !1) : !!t, (r = r || 10) < 2 || 36 < r) throw RangeError("radix"); var n; - if (0 < (n = t.indexOf("-"))) throw Error("interior hyphen"); - if (0 === n) return h(t.substring(1), e, r).neg(); - for (var i = g(f(r, 8)), s = w, o = 0; o < t.length; o += 8) { - var a = Math.min(8, t.length - o), c = parseInt(t.substring(o, o + a), r); + if (0 < (n = e.indexOf("-"))) throw Error("interior hyphen"); + if (0 === n) return h(e.substring(1), t, r).neg(); + for (var i = g(f(r, 8)), s = y, o = 0; o < e.length; o += 8) { + var a = Math.min(8, e.length - o), c = parseInt(e.substring(o, o + a), r); if (a < 8) { var u = g(f(r, a)); s = s.mul(u).add(g(c)); } else s = (s = s.mul(i)).add(g(c)); } - return s.unsigned = e, s; + return s.unsigned = t, s; } - function m(t, e) { - return "number" == typeof t ? g(t, e) : "string" == typeof t ? h(t, e) : p(t.low, t.high, "boolean" == typeof e ? e : t.unsigned); + function m(e, t) { + return "number" == typeof e ? g(e, t) : "string" == typeof e ? h(e, t) : p(e.low, e.high, "boolean" == typeof t ? t : e.unsigned); } - t.exports = n; + e.exports = n; var v = null; try { v = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11 ])), {}).exports; - } catch (t) {} + } catch (e) {} Object.defineProperty(n.prototype, "__isLong__", { value: !0 }), n.isLong = l; @@ -418,18 +427,18 @@ var osc = osc || {}; n.fromInt = r, n.fromNumber = g, n.fromBits = p; var f = Math.pow; n.fromString = h, n.fromValue = m; - var i = 4294967296, a = i * i, c = a / 2, y = r(1 << 24), w = r(0); - n.ZERO = w; + var i = 4294967296, a = i * i, c = a / 2, w = r(1 << 24), y = r(0); + n.ZERO = y; var u = r(0, !0); n.UZERO = u; var d = r(1); n.ONE = d; var b = r(1, !0); n.UONE = b; - var E = r(-1); - n.NEG_ONE = E; - var S = p(-1, 2147483647, !1); - n.MAX_VALUE = S; + var S = r(-1); + n.NEG_ONE = S; + var E = p(-1, 2147483647, !1); + n.MAX_VALUE = E; var P = p(-1, -1, !0); n.MAX_UNSIGNED_VALUE = P; var A = p(0, -2147483648, !1); @@ -439,18 +448,18 @@ var osc = osc || {}; return this.unsigned ? this.low >>> 0 : this.low; }, I.toNumber = function() { return this.unsigned ? (this.high >>> 0) * i + (this.low >>> 0) : this.high * i + (this.low >>> 0); - }, I.toString = function(t) { - if ((t = t || 10) < 2 || 36 < t) throw RangeError("radix"); + }, I.toString = function(e) { + if ((e = e || 10) < 2 || 36 < e) throw RangeError("radix"); if (this.isZero()) return "0"; if (this.isNegative()) { if (this.eq(A)) { - var e = g(t), r = this.div(e), n = r.mul(e).sub(this); - return r.toString(t) + n.toInt().toString(t); + var t = g(e), r = this.div(t), n = r.mul(t).sub(this); + return r.toString(e) + n.toInt().toString(e); } - return "-" + this.neg().toString(t); + return "-" + this.neg().toString(e); } - for (var i = g(f(t, 6), this.unsigned), s = this, o = ""; ;) { - var a = s.div(i), c = (s.sub(a.mul(i)).toInt() >>> 0).toString(t); + for (var i = g(f(e, 6), this.unsigned), s = this, o = ""; ;) { + var a = s.div(i), c = (s.sub(a.mul(i)).toInt() >>> 0).toString(e); if ((s = a).isZero()) return c + o; for (;c.length < 6; ) c = "0" + c; o = "" + c + o; @@ -465,8 +474,8 @@ var osc = osc || {}; return this.low >>> 0; }, I.getNumBitsAbs = function() { if (this.isNegative()) return this.eq(A) ? 64 : this.neg().getNumBitsAbs(); - for (var t = 0 != this.high ? this.high : this.low, e = 31; 0 < e && 0 == (t & 1 << e); e--) ; - return 0 != this.high ? e + 33 : e + 1; + for (var e = 0 != this.high ? this.high : this.low, t = 31; 0 < t && 0 == (e & 1 << t); t--) ; + return 0 != this.high ? t + 33 : t + 1; }, I.isZero = function() { return 0 === this.high && 0 === this.low; }, I.eqz = I.isZero, I.isNegative = function() { @@ -477,274 +486,274 @@ var osc = osc || {}; return 1 == (1 & this.low); }, I.isEven = function() { return 0 == (1 & this.low); - }, I.equals = function(t) { - return l(t) || (t = m(t)), (this.unsigned === t.unsigned || this.high >>> 31 != 1 || t.high >>> 31 != 1) && this.high === t.high && this.low === t.low; - }, I.eq = I.equals, I.notEquals = function(t) { - return !this.eq(t); - }, I.neq = I.notEquals, I.ne = I.notEquals, I.lessThan = function(t) { - return this.comp(t) < 0; - }, I.lt = I.lessThan, I.lessThanOrEqual = function(t) { - return this.comp(t) <= 0; - }, I.lte = I.lessThanOrEqual, I.le = I.lessThanOrEqual, I.greaterThan = function(t) { - return 0 < this.comp(t); - }, I.gt = I.greaterThan, I.greaterThanOrEqual = function(t) { - return 0 <= this.comp(t); - }, I.gte = I.greaterThanOrEqual, I.ge = I.greaterThanOrEqual, I.compare = function(t) { - if (l(t) || (t = m(t)), this.eq(t)) return 0; - var e = this.isNegative(), r = t.isNegative(); - return e && !r ? -1 : !e && r ? 1 : this.unsigned ? t.high >>> 0 > this.high >>> 0 || t.high === this.high && t.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(t).isNegative() ? -1 : 1; + }, I.equals = function(e) { + return l(e) || (e = m(e)), (this.unsigned === e.unsigned || this.high >>> 31 != 1 || e.high >>> 31 != 1) && this.high === e.high && this.low === e.low; + }, I.eq = I.equals, I.notEquals = function(e) { + return !this.eq(e); + }, I.neq = I.notEquals, I.ne = I.notEquals, I.lessThan = function(e) { + return this.comp(e) < 0; + }, I.lt = I.lessThan, I.lessThanOrEqual = function(e) { + return this.comp(e) <= 0; + }, I.lte = I.lessThanOrEqual, I.le = I.lessThanOrEqual, I.greaterThan = function(e) { + return 0 < this.comp(e); + }, I.gt = I.greaterThan, I.greaterThanOrEqual = function(e) { + return 0 <= this.comp(e); + }, I.gte = I.greaterThanOrEqual, I.ge = I.greaterThanOrEqual, I.compare = function(e) { + if (l(e) || (e = m(e)), this.eq(e)) return 0; + var t = this.isNegative(), r = e.isNegative(); + return t && !r ? -1 : !t && r ? 1 : this.unsigned ? e.high >>> 0 > this.high >>> 0 || e.high === this.high && e.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(e).isNegative() ? -1 : 1; }, I.comp = I.compare, I.negate = function() { return !this.unsigned && this.eq(A) ? A : this.not().add(d); - }, I.neg = I.negate, I.add = function(t) { - l(t) || (t = m(t)); - var e = this.high >>> 16, r = 65535 & this.high, n = this.low >>> 16, i = 65535 & this.low, s = t.high >>> 16, o = 65535 & t.high, a = t.low >>> 16, c = 0, u = 0, h = 0, f = 0; - return h += (f += i + (65535 & t.low)) >>> 16, u += (h += n + a) >>> 16, c += (u += r + o) >>> 16, - c += e + s, p((h &= 65535) << 16 | (f &= 65535), (c &= 65535) << 16 | (u &= 65535), this.unsigned); - }, I.subtract = function(t) { - return l(t) || (t = m(t)), this.add(t.neg()); - }, I.sub = I.subtract, I.multiply = function(t) { - if (this.isZero()) return w; - if (l(t) || (t = m(t)), v) return p(v.mul(this.low, this.high, t.low, t.high), v.get_high(), this.unsigned); - if (t.isZero()) return w; - if (this.eq(A)) return t.isOdd() ? A : w; - if (t.eq(A)) return this.isOdd() ? A : w; - if (this.isNegative()) return t.isNegative() ? this.neg().mul(t.neg()) : this.neg().mul(t).neg(); - if (t.isNegative()) return this.mul(t.neg()).neg(); - if (this.lt(y) && t.lt(y)) return g(this.toNumber() * t.toNumber(), this.unsigned); - var e = this.high >>> 16, r = 65535 & this.high, n = this.low >>> 16, i = 65535 & this.low, s = t.high >>> 16, o = 65535 & t.high, a = t.low >>> 16, c = 65535 & t.low, u = 0, h = 0, f = 0, d = 0; + }, I.neg = I.negate, I.add = function(e) { + l(e) || (e = m(e)); + var t = this.high >>> 16, r = 65535 & this.high, n = this.low >>> 16, i = 65535 & this.low, s = e.high >>> 16, o = 65535 & e.high, a = e.low >>> 16, c = 0, u = 0, h = 0, f = 0; + return h += (f += i + (65535 & e.low)) >>> 16, u += (h += n + a) >>> 16, c += (u += r + o) >>> 16, + c += t + s, p((h &= 65535) << 16 | (f &= 65535), (c &= 65535) << 16 | (u &= 65535), this.unsigned); + }, I.subtract = function(e) { + return l(e) || (e = m(e)), this.add(e.neg()); + }, I.sub = I.subtract, I.multiply = function(e) { + if (this.isZero()) return y; + if (l(e) || (e = m(e)), v) return p(v.mul(this.low, this.high, e.low, e.high), v.get_high(), this.unsigned); + if (e.isZero()) return y; + if (this.eq(A)) return e.isOdd() ? A : y; + if (e.eq(A)) return this.isOdd() ? A : y; + if (this.isNegative()) return e.isNegative() ? this.neg().mul(e.neg()) : this.neg().mul(e).neg(); + if (e.isNegative()) return this.mul(e.neg()).neg(); + if (this.lt(w) && e.lt(w)) return g(this.toNumber() * e.toNumber(), this.unsigned); + var t = this.high >>> 16, r = 65535 & this.high, n = this.low >>> 16, i = 65535 & this.low, s = e.high >>> 16, o = 65535 & e.high, a = e.low >>> 16, c = 65535 & e.low, u = 0, h = 0, f = 0, d = 0; return f += (d += i * c) >>> 16, h += (f += n * c) >>> 16, f &= 65535, h += (f += i * a) >>> 16, u += (h += r * c) >>> 16, h &= 65535, u += (h += n * a) >>> 16, h &= 65535, u += (h += i * o) >>> 16, - u += e * c + r * a + n * o + i * s, p((f &= 65535) << 16 | (d &= 65535), (u &= 65535) << 16 | (h &= 65535), this.unsigned); - }, I.mul = I.multiply, I.divide = function(t) { - if (l(t) || (t = m(t)), t.isZero()) throw Error("division by zero"); - if (v) return this.unsigned || -2147483648 !== this.high || -1 !== t.low || -1 !== t.high ? p((this.unsigned ? v.div_u : v.div_s)(this.low, this.high, t.low, t.high), v.get_high(), this.unsigned) : this; - if (this.isZero()) return this.unsigned ? u : w; - var e, r, n; + u += t * c + r * a + n * o + i * s, p((f &= 65535) << 16 | (d &= 65535), (u &= 65535) << 16 | (h &= 65535), this.unsigned); + }, I.mul = I.multiply, I.divide = function(e) { + if (l(e) || (e = m(e)), e.isZero()) throw Error("division by zero"); + if (v) return this.unsigned || -2147483648 !== this.high || -1 !== e.low || -1 !== e.high ? p((this.unsigned ? v.div_u : v.div_s)(this.low, this.high, e.low, e.high), v.get_high(), this.unsigned) : this; + if (this.isZero()) return this.unsigned ? u : y; + var t, r, n; if (this.unsigned) { - if (t.unsigned || (t = t.toUnsigned()), t.gt(this)) return u; - if (t.gt(this.shru(1))) return b; + if (e.unsigned || (e = e.toUnsigned()), e.gt(this)) return u; + if (e.gt(this.shru(1))) return b; n = u; } else { - if (this.eq(A)) return t.eq(d) || t.eq(E) ? A : t.eq(A) ? d : (e = this.shr(1).div(t).shl(1)).eq(w) ? t.isNegative() ? d : E : (r = this.sub(t.mul(e)), - n = e.add(r.div(t))); - if (t.eq(A)) return this.unsigned ? u : w; - if (this.isNegative()) return t.isNegative() ? this.neg().div(t.neg()) : this.neg().div(t).neg(); - if (t.isNegative()) return this.div(t.neg()).neg(); - n = w; + if (this.eq(A)) return e.eq(d) || e.eq(S) ? A : e.eq(A) ? d : (t = this.shr(1).div(e).shl(1)).eq(y) ? e.isNegative() ? d : S : (r = this.sub(e.mul(t)), + n = t.add(r.div(e))); + if (e.eq(A)) return this.unsigned ? u : y; + if (this.isNegative()) return e.isNegative() ? this.neg().div(e.neg()) : this.neg().div(e).neg(); + if (e.isNegative()) return this.div(e.neg()).neg(); + n = y; } - for (r = this; r.gte(t); ) { - e = Math.max(1, Math.floor(r.toNumber() / t.toNumber())); - for (var i = Math.ceil(Math.log(e) / Math.LN2), s = i <= 48 ? 1 : f(2, i - 48), o = g(e), a = o.mul(t); a.isNegative() || a.gt(r); ) a = (o = g(e -= s, this.unsigned)).mul(t); + for (r = this; r.gte(e); ) { + t = Math.max(1, Math.floor(r.toNumber() / e.toNumber())); + for (var i = Math.ceil(Math.log(t) / Math.LN2), s = i <= 48 ? 1 : f(2, i - 48), o = g(t), a = o.mul(e); a.isNegative() || a.gt(r); ) a = (o = g(t -= s, this.unsigned)).mul(e); o.isZero() && (o = d), n = n.add(o), r = r.sub(a); } return n; - }, I.div = I.divide, I.modulo = function(t) { - return l(t) || (t = m(t)), v ? p((this.unsigned ? v.rem_u : v.rem_s)(this.low, this.high, t.low, t.high), v.get_high(), this.unsigned) : this.sub(this.div(t).mul(t)); + }, I.div = I.divide, I.modulo = function(e) { + return l(e) || (e = m(e)), v ? p((this.unsigned ? v.rem_u : v.rem_s)(this.low, this.high, e.low, e.high), v.get_high(), this.unsigned) : this.sub(this.div(e).mul(e)); }, I.mod = I.modulo, I.rem = I.modulo, I.not = function() { return p(~this.low, ~this.high, this.unsigned); - }, I.and = function(t) { - return l(t) || (t = m(t)), p(this.low & t.low, this.high & t.high, this.unsigned); - }, I.or = function(t) { - return l(t) || (t = m(t)), p(this.low | t.low, this.high | t.high, this.unsigned); - }, I.xor = function(t) { - return l(t) || (t = m(t)), p(this.low ^ t.low, this.high ^ t.high, this.unsigned); - }, I.shiftLeft = function(t) { - return l(t) && (t = t.toInt()), 0 == (t &= 63) ? this : t < 32 ? p(this.low << t, this.high << t | this.low >>> 32 - t, this.unsigned) : p(0, this.low << t - 32, this.unsigned); - }, I.shl = I.shiftLeft, I.shiftRight = function(t) { - return l(t) && (t = t.toInt()), 0 == (t &= 63) ? this : t < 32 ? p(this.low >>> t | this.high << 32 - t, this.high >> t, this.unsigned) : p(this.high >> t - 32, 0 <= this.high ? 0 : -1, this.unsigned); - }, I.shr = I.shiftRight, I.shiftRightUnsigned = function(t) { - if (l(t) && (t = t.toInt()), 0 == (t &= 63)) return this; - var e = this.high; - return t < 32 ? p(this.low >>> t | e << 32 - t, e >>> t, this.unsigned) : p(32 === t ? e : e >>> t - 32, 0, this.unsigned); + }, I.and = function(e) { + return l(e) || (e = m(e)), p(this.low & e.low, this.high & e.high, this.unsigned); + }, I.or = function(e) { + return l(e) || (e = m(e)), p(this.low | e.low, this.high | e.high, this.unsigned); + }, I.xor = function(e) { + return l(e) || (e = m(e)), p(this.low ^ e.low, this.high ^ e.high, this.unsigned); + }, I.shiftLeft = function(e) { + return l(e) && (e = e.toInt()), 0 == (e &= 63) ? this : e < 32 ? p(this.low << e, this.high << e | this.low >>> 32 - e, this.unsigned) : p(0, this.low << e - 32, this.unsigned); + }, I.shl = I.shiftLeft, I.shiftRight = function(e) { + return l(e) && (e = e.toInt()), 0 == (e &= 63) ? this : e < 32 ? p(this.low >>> e | this.high << 32 - e, this.high >> e, this.unsigned) : p(this.high >> e - 32, 0 <= this.high ? 0 : -1, this.unsigned); + }, I.shr = I.shiftRight, I.shiftRightUnsigned = function(e) { + if (l(e) && (e = e.toInt()), 0 == (e &= 63)) return this; + var t = this.high; + return e < 32 ? p(this.low >>> e | t << 32 - e, t >>> e, this.unsigned) : p(32 === e ? t : t >>> e - 32, 0, this.unsigned); }, I.shru = I.shiftRightUnsigned, I.shr_u = I.shiftRightUnsigned, I.toSigned = function() { return this.unsigned ? p(this.low, this.high, !1) : this; }, I.toUnsigned = function() { return this.unsigned ? this : p(this.low, this.high, !0); - }, I.toBytes = function(t) { - return t ? this.toBytesLE() : this.toBytesBE(); + }, I.toBytes = function(e) { + return e ? this.toBytesLE() : this.toBytesBE(); }, I.toBytesLE = function() { - var t = this.high, e = this.low; - return [ 255 & e, e >>> 8 & 255, e >>> 16 & 255, e >>> 24, 255 & t, t >>> 8 & 255, t >>> 16 & 255, t >>> 24 ]; + var e = this.high, t = this.low; + return [ 255 & t, t >>> 8 & 255, t >>> 16 & 255, t >>> 24, 255 & e, e >>> 8 & 255, e >>> 16 & 255, e >>> 24 ]; }, I.toBytesBE = function() { - var t = this.high, e = this.low; - return [ t >>> 24, t >>> 16 & 255, t >>> 8 & 255, 255 & t, e >>> 24, e >>> 16 & 255, e >>> 8 & 255, 255 & e ]; - }, n.fromBytes = function(t, e, r) { - return r ? n.fromBytesLE(t, e) : n.fromBytesBE(t, e); - }, n.fromBytesLE = function(t, e) { - return new n(t[0] | t[1] << 8 | t[2] << 16 | t[3] << 24, t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24, e); - }, n.fromBytesBE = function(t, e) { - return new n(t[4] << 24 | t[5] << 16 | t[6] << 8 | t[7], t[0] << 24 | t[1] << 16 | t[2] << 8 | t[3], e); + var e = this.high, t = this.low; + return [ e >>> 24, e >>> 16 & 255, e >>> 8 & 255, 255 & e, t >>> 24, t >>> 16 & 255, t >>> 8 & 255, 255 & t ]; + }, n.fromBytes = function(e, t, r) { + return r ? n.fromBytesLE(e, t) : n.fromBytesBE(e, t); + }, n.fromBytesLE = function(e, t) { + return new n(e[0] | e[1] << 8 | e[2] << 16 | e[3] << 24, e[4] | e[5] << 8 | e[6] << 16 | e[7] << 24, t); + }, n.fromBytesBE = function(e, t) { + return new n(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7], e[0] << 24 | e[1] << 16 | e[2] << 8 | e[3], t); }; - } ], n.c = i, n.d = function(t, e, r) { - n.o(t, e) || Object.defineProperty(t, e, { + } ], n.c = i, n.d = function(e, t, r) { + n.o(e, t) || Object.defineProperty(e, t, { configurable: !1, enumerable: !0, get: r }); - }, n.n = function(t) { - var e = t && t.__esModule ? function() { - return t.default; + }, n.n = function(e) { + var t = e && e.__esModule ? function() { + return e.default; } : function() { - return t; + return e; }; - return n.d(e, "a", e), e; - }, n.o = function(t, e) { - return Object.prototype.hasOwnProperty.call(t, e); + return n.d(t, "a", t), t; + }, n.o = function(e, t) { + return Object.prototype.hasOwnProperty.call(e, t); }, n.p = "", n(n.s = 0); - function n(t) { - if (i[t]) return i[t].exports; - var e = i[t] = { - i: t, + function n(e) { + if (i[e]) return i[e].exports; + var t = i[e] = { + i: e, l: !1, exports: {} }; - return r[t].call(e.exports, e, e.exports, n), e.l = !0, e.exports; + return r[e].call(t.exports, t, t.exports, n), t.l = !0, t.exports; } var r, i; -}), function(e, r) { +}), function(t, r) { "use strict"; - "object" == typeof exports ? (e.slip = exports, r(exports)) : "function" == typeof define && define.amd ? define([ "exports" ], function(t) { - return e.slip = t, e.slip, r(t); - }) : (e.slip = {}, r(e.slip)); -}(this, function(t) { + "object" == typeof exports ? (t.slip = exports, r(exports)) : "function" == typeof define && define.amd ? define([ "exports" ], function(e) { + return t.slip = e, t.slip, r(e); + }) : (t.slip = {}, r(t.slip)); +}(this, function(e) { "use strict"; - var a = t; - a.END = 192, a.ESC = 219, a.ESC_END = 220, a.ESC_ESC = 221, a.byteArray = function(t, e, r) { - return t instanceof ArrayBuffer ? new Uint8Array(t, e, r) : t; - }, a.expandByteArray = function(t) { - var e = new Uint8Array(2 * t.length); - return e.set(t), e; - }, a.sliceByteArray = function(t, e, r) { - var n = t.buffer.slice ? t.buffer.slice(e, r) : t.subarray(e, r); + var a = e; + a.END = 192, a.ESC = 219, a.ESC_END = 220, a.ESC_ESC = 221, a.byteArray = function(e, t, r) { + return e instanceof ArrayBuffer ? new Uint8Array(e, t, r) : e; + }, a.expandByteArray = function(e) { + var t = new Uint8Array(2 * e.length); + return t.set(e), t; + }, a.sliceByteArray = function(e, t, r) { + var n = e.buffer.slice ? e.buffer.slice(t, r) : e.subarray(t, r); return new Uint8Array(n); - }, a.encode = function(t, e) { - (e = e || {}).bufferPadding = e.bufferPadding || 4; - var r = (t = a.byteArray(t, e.offset, e.byteLength)).length + e.bufferPadding + 3 & -4, n = new Uint8Array(r), i = 1; + }, a.encode = function(e, t) { + (t = t || {}).bufferPadding = t.bufferPadding || 4; + var r = (e = a.byteArray(e, t.offset, t.byteLength)).length + t.bufferPadding + 3 & -4, n = new Uint8Array(r), i = 1; n[0] = a.END; - for (var s = 0; s < t.length; s++) { + for (var s = 0; s < e.length; s++) { i > n.length - 3 && (n = a.expandByteArray(n)); - var o = t[s]; + var o = e[s]; o === a.END ? (n[i++] = a.ESC, o = a.ESC_END) : o === a.ESC && (n[i++] = a.ESC, o = a.ESC_ESC), n[i++] = o; } return n[i] = a.END, a.sliceByteArray(n, 0, i + 1); - }, a.Decoder = function(t) { - t = "function" != typeof t ? t || {} : { - onMessage: t - }, this.maxMessageSize = t.maxMessageSize || 10485760, this.bufferSize = t.bufferSize || 1024, - this.msgBuffer = new Uint8Array(this.bufferSize), this.msgBufferIdx = 0, this.onMessage = t.onMessage, - this.onError = t.onError, this.escape = !1; + }, a.Decoder = function(e) { + e = "function" != typeof e ? e || {} : { + onMessage: e + }, this.maxMessageSize = e.maxMessageSize || 10485760, this.bufferSize = e.bufferSize || 1024, + this.msgBuffer = new Uint8Array(this.bufferSize), this.msgBufferIdx = 0, this.onMessage = e.onMessage, + this.onError = e.onError, this.escape = !1; }; - var e = a.Decoder.prototype; - return e.decode = function(t) { - var e; - t = a.byteArray(t); - for (var r = 0; r < t.length; r++) { - var n = t[r]; + var t = a.Decoder.prototype; + return t.decode = function(e) { + var t; + e = a.byteArray(e); + for (var r = 0; r < e.length; r++) { + var n = e[r]; if (this.escape) n === a.ESC_ESC ? n = a.ESC : n === a.ESC_END && (n = a.END); else { if (n === a.ESC) { this.escape = !0; continue; } if (n === a.END) { - e = this.handleEnd(); + t = this.handleEnd(); continue; } } this.addByte(n) || this.handleMessageMaxError(); } - return e; - }, e.handleMessageMaxError = function() { + return t; + }, t.handleMessageMaxError = function() { this.onError && this.onError(this.msgBuffer.subarray(0), "The message is too large; the maximum message size is " + this.maxMessageSize / 1024 + "KB. Use a larger maxMessageSize if necessary."), this.msgBufferIdx = 0, this.escape = !1; - }, e.addByte = function(t) { + }, t.addByte = function(e) { return this.msgBufferIdx > this.msgBuffer.length - 1 && (this.msgBuffer = a.expandByteArray(this.msgBuffer)), - this.msgBuffer[this.msgBufferIdx++] = t, this.escape = !1, this.msgBuffer.length < this.maxMessageSize; - }, e.handleEnd = function() { + this.msgBuffer[this.msgBufferIdx++] = e, this.escape = !1, this.msgBuffer.length < this.maxMessageSize; + }, t.handleEnd = function() { if (0 !== this.msgBufferIdx) { - var t = a.sliceByteArray(this.msgBuffer, 0, this.msgBufferIdx); - return this.onMessage && this.onMessage(t), this.msgBufferIdx = 0, t; + var e = a.sliceByteArray(this.msgBuffer, 0, this.msgBufferIdx); + return this.onMessage && this.onMessage(e), this.msgBufferIdx = 0, e; } }, a; -}), function(t) { +}), function(e) { "use strict"; - function e() {} - var r = e.prototype, n = t.EventEmitter; - function s(t, e) { - for (var r = t.length; r--; ) if (t[r].listener === e) return r; + function t() {} + var r = t.prototype, n = e.EventEmitter; + function s(e, t) { + for (var r = e.length; r--; ) if (e[r].listener === t) return r; return -1; } - function i(t) { + function i(e) { return function() { - return this[t].apply(this, arguments); + return this[e].apply(this, arguments); }; } - r.getListeners = function(t) { - var e, r, n = this._getEvents(); - if (t instanceof RegExp) for (r in e = {}, n) n.hasOwnProperty(r) && t.test(r) && (e[r] = n[r]); else e = n[t] || (n[t] = []); - return e; - }, r.flattenListeners = function(t) { - var e, r = []; - for (e = 0; e < t.length; e += 1) r.push(t[e].listener); + r.getListeners = function(e) { + var t, r, n = this._getEvents(); + if (e instanceof RegExp) for (r in t = {}, n) n.hasOwnProperty(r) && e.test(r) && (t[r] = n[r]); else t = n[e] || (n[e] = []); + return t; + }, r.flattenListeners = function(e) { + var t, r = []; + for (t = 0; t < e.length; t += 1) r.push(e[t].listener); return r; - }, r.getListenersAsObject = function(t) { - var e, r = this.getListeners(t); - return r instanceof Array && ((e = {})[t] = r), e || r; - }, r.addListener = function(t, e) { - if (!function t(e) { - return "function" == typeof e || e instanceof RegExp || !(!e || "object" != typeof e) && t(e.listener); - }(e)) throw new TypeError("listener must be a function"); - var r, n = this.getListenersAsObject(t), i = "object" == typeof e; - for (r in n) n.hasOwnProperty(r) && -1 === s(n[r], e) && n[r].push(i ? e : { - listener: e, + }, r.getListenersAsObject = function(e) { + var t, r = this.getListeners(e); + return r instanceof Array && ((t = {})[e] = r), t || r; + }, r.addListener = function(e, t) { + if (!function e(t) { + return "function" == typeof t || t instanceof RegExp || !(!t || "object" != typeof t) && e(t.listener); + }(t)) throw new TypeError("listener must be a function"); + var r, n = this.getListenersAsObject(e), i = "object" == typeof t; + for (r in n) n.hasOwnProperty(r) && -1 === s(n[r], t) && n[r].push(i ? t : { + listener: t, once: !1 }); return this; - }, r.on = i("addListener"), r.addOnceListener = function(t, e) { - return this.addListener(t, { - listener: e, + }, r.on = i("addListener"), r.addOnceListener = function(e, t) { + return this.addListener(e, { + listener: t, once: !0 }); - }, r.once = i("addOnceListener"), r.defineEvent = function(t) { - return this.getListeners(t), this; - }, r.defineEvents = function(t) { - for (var e = 0; e < t.length; e += 1) this.defineEvent(t[e]); + }, r.once = i("addOnceListener"), r.defineEvent = function(e) { + return this.getListeners(e), this; + }, r.defineEvents = function(e) { + for (var t = 0; t < e.length; t += 1) this.defineEvent(e[t]); return this; - }, r.removeListener = function(t, e) { - var r, n, i = this.getListenersAsObject(t); - for (n in i) i.hasOwnProperty(n) && -1 !== (r = s(i[n], e)) && i[n].splice(r, 1); + }, r.removeListener = function(e, t) { + var r, n, i = this.getListenersAsObject(e); + for (n in i) i.hasOwnProperty(n) && -1 !== (r = s(i[n], t)) && i[n].splice(r, 1); return this; - }, r.off = i("removeListener"), r.addListeners = function(t, e) { - return this.manipulateListeners(!1, t, e); - }, r.removeListeners = function(t, e) { - return this.manipulateListeners(!0, t, e); - }, r.manipulateListeners = function(t, e, r) { - var n, i, s = t ? this.removeListener : this.addListener, o = t ? this.removeListeners : this.addListeners; - if ("object" != typeof e || e instanceof RegExp) for (n = r.length; n--; ) s.call(this, e, r[n]); else for (n in e) e.hasOwnProperty(n) && (i = e[n]) && ("function" == typeof i ? s.call(this, n, i) : o.call(this, n, i)); + }, r.off = i("removeListener"), r.addListeners = function(e, t) { + return this.manipulateListeners(!1, e, t); + }, r.removeListeners = function(e, t) { + return this.manipulateListeners(!0, e, t); + }, r.manipulateListeners = function(e, t, r) { + var n, i, s = e ? this.removeListener : this.addListener, o = e ? this.removeListeners : this.addListeners; + if ("object" != typeof t || t instanceof RegExp) for (n = r.length; n--; ) s.call(this, t, r[n]); else for (n in t) t.hasOwnProperty(n) && (i = t[n]) && ("function" == typeof i ? s.call(this, n, i) : o.call(this, n, i)); return this; - }, r.removeEvent = function(t) { - var e, r = typeof t, n = this._getEvents(); - if ("string" == r) delete n[t]; else if (t instanceof RegExp) for (e in n) n.hasOwnProperty(e) && t.test(e) && delete n[e]; else delete this._events; + }, r.removeEvent = function(e) { + var t, r = typeof e, n = this._getEvents(); + if ("string" == r) delete n[e]; else if (e instanceof RegExp) for (t in n) n.hasOwnProperty(t) && e.test(t) && delete n[t]; else delete this._events; return this; - }, r.removeAllListeners = i("removeEvent"), r.emitEvent = function(t, e) { - var r, n, i, s, o = this.getListenersAsObject(t); - for (s in o) if (o.hasOwnProperty(s)) for (r = o[s].slice(0), i = 0; i < r.length; i++) !0 === (n = r[i]).once && this.removeListener(t, n.listener), - n.listener.apply(this, e || []) === this._getOnceReturnValue() && this.removeListener(t, n.listener); + }, r.removeAllListeners = i("removeEvent"), r.emitEvent = function(e, t) { + var r, n, i, s, o = this.getListenersAsObject(e); + for (s in o) if (o.hasOwnProperty(s)) for (r = o[s].slice(0), i = 0; i < r.length; i++) !0 === (n = r[i]).once && this.removeListener(e, n.listener), + n.listener.apply(this, t || []) === this._getOnceReturnValue() && this.removeListener(e, n.listener); return this; - }, r.trigger = i("emitEvent"), r.emit = function(t) { - var e = Array.prototype.slice.call(arguments, 1); - return this.emitEvent(t, e); - }, r.setOnceReturnValue = function(t) { - return this._onceReturnValue = t, this; + }, r.trigger = i("emitEvent"), r.emit = function(e) { + var t = Array.prototype.slice.call(arguments, 1); + return this.emitEvent(e, t); + }, r.setOnceReturnValue = function(e) { + return this._onceReturnValue = e, this; }, r._getOnceReturnValue = function() { return !this.hasOwnProperty("_onceReturnValue") || this._onceReturnValue; }, r._getEvents = function() { return this._events || (this._events = {}); - }, e.noConflict = function() { - return t.EventEmitter = n, e; + }, t.noConflict = function() { + return e.EventEmitter = n, t; }, "function" == typeof define && define.amd ? define(function() { - return e; - }) : "object" == typeof module && module.exports ? module.exports = e : t.EventEmitter = e; + return t; + }) : "object" == typeof module && module.exports ? module.exports = t : e.EventEmitter = t; }("undefined" != typeof window ? window : this || {}); osc = osc || require("./osc.js"); @@ -753,89 +762,89 @@ var slip = slip || require("slip"), EventEmitter = EventEmitter || require("even !function() { "use strict"; - osc.firePacketEvents = function(t, e, r, n) { - e.address ? t.emit("message", e, r, n) : osc.fireBundleEvents(t, e, r, n); - }, osc.fireBundleEvents = function(t, e, r, n) { - t.emit("bundle", e, r, n); - for (var i = 0; i < e.packets.length; i++) { - var s = e.packets[i]; - osc.firePacketEvents(t, s, e.timeTag, n); + osc.firePacketEvents = function(e, t, r, n) { + t.address ? e.emit("message", t, r, n) : osc.fireBundleEvents(e, t, r, n); + }, osc.fireBundleEvents = function(e, t, r, n) { + e.emit("bundle", t, r, n); + for (var i = 0; i < t.packets.length; i++) { + var s = t.packets[i]; + osc.firePacketEvents(e, s, t.timeTag, n); } - }, osc.fireClosedPortSendError = function(t, e) { - e = e || "Can't send packets on a closed osc.Port object. Please open (or reopen) this Port by calling open().", - t.emit("error", e); - }, osc.Port = function(t) { - this.options = t || {}, this.on("data", this.decodeOSC.bind(this)); + }, osc.fireClosedPortSendError = function(e, t) { + t = t || "Can't send packets on a closed osc.Port object. Please open (or reopen) this Port by calling open().", + e.emit("error", t); + }, osc.Port = function(e) { + this.options = e || {}, this.on("data", this.decodeOSC.bind(this)); }; - var t = osc.Port.prototype = Object.create(EventEmitter.prototype); - t.constructor = osc.Port, t.send = function(t) { - var e = Array.prototype.slice.call(arguments), r = this.encodeOSC(t), n = osc.nativeBuffer(r); - e[0] = n, this.sendRaw.apply(this, e); - }, t.encodeOSC = function(t) { - var e; - t = t.buffer ? t.buffer : t; + var e = osc.Port.prototype = Object.create(EventEmitter.prototype); + e.constructor = osc.Port, e.send = function(e) { + var t = Array.prototype.slice.call(arguments), r = this.encodeOSC(e), n = osc.nativeBuffer(r); + t[0] = n, this.sendRaw.apply(this, t); + }, e.encodeOSC = function(e) { + var t; + e = e.buffer ? e.buffer : e; try { - e = osc.writePacket(t, this.options); - } catch (t) { - this.emit("error", t); + t = osc.writePacket(e, this.options); + } catch (e) { + this.emit("error", e); } - return e; - }, t.decodeOSC = function(t, e) { - t = osc.byteArray(t), this.emit("raw", t, e); + return t; + }, e.decodeOSC = function(e, t) { + e = osc.byteArray(e), this.emit("raw", e, t); try { - var r = osc.readPacket(t, this.options); - this.emit("osc", r, e), osc.firePacketEvents(this, r, void 0, e); - } catch (t) { - this.emit("error", t); + var r = osc.readPacket(e, this.options); + this.emit("osc", r, t), osc.firePacketEvents(this, r, void 0, t); + } catch (e) { + this.emit("error", e); } - }, osc.SLIPPort = function(t) { - var e = this, r = this.options = t || {}; + }, osc.SLIPPort = function(e) { + var t = this, r = this.options = e || {}; r.useSLIP = void 0 === r.useSLIP || r.useSLIP, this.decoder = new slip.Decoder({ onMessage: this.decodeOSC.bind(this), - onError: function(t) { - e.emit("error", t); + onError: function(e) { + t.emit("error", e); } }); var n = r.useSLIP ? this.decodeSLIPData : this.decodeOSC; this.on("data", n.bind(this)); - }, (t = osc.SLIPPort.prototype = Object.create(osc.Port.prototype)).constructor = osc.SLIPPort, - t.encodeOSC = function(t) { - var e; - t = t.buffer ? t.buffer : t; + }, (e = osc.SLIPPort.prototype = Object.create(osc.Port.prototype)).constructor = osc.SLIPPort, + e.encodeOSC = function(e) { + var t; + e = e.buffer ? e.buffer : e; try { - var r = osc.writePacket(t, this.options); - e = slip.encode(r); - } catch (t) { - this.emit("error", t); + var r = osc.writePacket(e, this.options); + t = slip.encode(r); + } catch (e) { + this.emit("error", e); } - return e; - }, t.decodeSLIPData = function(t, e) { - this.decoder.decode(t, e); - }, osc.relay = function(t, e, r, n, i, s) { + return t; + }, e.decodeSLIPData = function(e, t) { + this.decoder.decode(e, t); + }, osc.relay = function(e, t, r, n, i, s) { r = r || "message", n = n || "send", i = i || function() {}, s = s ? [ null ].concat(s) : []; - function o(t) { - s[0] = t, t = i(t), e[n].apply(e, s); + function o(e) { + s[0] = e, e = i(e), t[n].apply(t, s); } - return t.on(r, o), { + return e.on(r, o), { eventName: r, listener: o }; - }, osc.relayPorts = function(t, e, r) { + }, osc.relayPorts = function(e, t, r) { var n = r.raw ? "raw" : "osc", i = r.raw ? "sendRaw" : "send"; - return osc.relay(t, e, n, i, r.transform); - }, osc.stopRelaying = function(t, e) { - t.removeListener(e.eventName, e.listener); - }, osc.Relay = function(t, e, r) { - (this.options = r || {}).raw = !1, this.port1 = t, this.port2 = e, this.listen(); - }, (t = osc.Relay.prototype = Object.create(EventEmitter.prototype)).constructor = osc.Relay, - t.open = function() { + return osc.relay(e, t, n, i, r.transform); + }, osc.stopRelaying = function(e, t) { + e.removeListener(t.eventName, t.listener); + }, osc.Relay = function(e, t, r) { + (this.options = r || {}).raw = !1, this.port1 = e, this.port2 = t, this.listen(); + }, (e = osc.Relay.prototype = Object.create(EventEmitter.prototype)).constructor = osc.Relay, + e.open = function() { this.port1.open(), this.port2.open(); - }, t.listen = function() { + }, e.listen = function() { this.port1Spec && this.port2Spec && this.close(), this.port1Spec = osc.relayPorts(this.port1, this.port2, this.options), this.port2Spec = osc.relayPorts(this.port2, this.port1, this.options); - var t = this.close.bind(this); - this.port1.on("close", t), this.port2.on("close", t); - }, t.close = function() { + var e = this.close.bind(this); + this.port1.on("close", e), this.port2.on("close", e); + }, e.close = function() { osc.stopRelaying(this.port1, this.port1Spec), osc.stopRelaying(this.port2, this.port2Spec), this.emit("close", this.port1, this.port2); }, "undefined" != typeof module && module.exports && (module.exports = osc); @@ -845,34 +854,34 @@ osc = osc || require("./osc.js"); !function() { "use strict"; - osc.WebSocket = "undefined" != typeof WebSocket ? WebSocket : require("ws"), osc.WebSocketPort = function(t) { - osc.Port.call(this, t), this.on("open", this.listen.bind(this)), this.socket = t.socket, + osc.WebSocket = "undefined" != typeof WebSocket ? WebSocket : require("ws"), osc.WebSocketPort = function(e) { + osc.Port.call(this, e), this.on("open", this.listen.bind(this)), this.socket = e.socket, this.socket && (1 === this.socket.readyState ? (osc.WebSocketPort.setupSocketForBinary(this.socket), this.emit("open", this.socket)) : this.open()); }; - var t = osc.WebSocketPort.prototype = Object.create(osc.Port.prototype); - t.constructor = osc.WebSocketPort, t.open = function() { + var e = osc.WebSocketPort.prototype = Object.create(osc.Port.prototype); + e.constructor = osc.WebSocketPort, e.open = function() { (!this.socket || 1 < this.socket.readyState) && (this.socket = new osc.WebSocket(this.options.url)), osc.WebSocketPort.setupSocketForBinary(this.socket); - var t = this; + var e = this; this.socket.onopen = function() { - t.emit("open", t.socket); + e.emit("open", e.socket); }; - }, t.listen = function() { - var e = this; - this.socket.onmessage = function(t) { - e.emit("data", t.data, t); - }, this.socket.onerror = function(t) { - e.emit("error", t); - }, this.socket.onclose = function(t) { - e.emit("close", t); - }, e.emit("ready"); - }, t.sendRaw = function(t) { - this.socket && 1 === this.socket.readyState ? this.socket.send(t) : osc.fireClosedPortSendError(this); - }, t.close = function(t, e) { - this.socket.close(t, e); - }, osc.WebSocketPort.setupSocketForBinary = function(t) { - t.binaryType = osc.isNode ? "nodebuffer" : "arraybuffer"; + }, e.listen = function() { + var t = this; + this.socket.onmessage = function(e) { + t.emit("data", e.data, e); + }, this.socket.onerror = function(e) { + t.emit("error", e); + }, this.socket.onclose = function(e) { + t.emit("close", e); + }, t.emit("ready"); + }, e.sendRaw = function(e) { + this.socket && 1 === this.socket.readyState ? this.socket.send(e) : osc.fireClosedPortSendError(this); + }, e.close = function(e, t) { + this.socket.close(e, t); + }, osc.WebSocketPort.setupSocketForBinary = function(e) { + e.binaryType = osc.isNode ? "nodebuffer" : "arraybuffer"; }; }(); @@ -880,89 +889,89 @@ osc = osc || {}; !function() { "use strict"; - osc.listenToTransport = function(e, t, r) { - t.onReceive.addListener(function(t) { - t[r] === e[r] && e.emit("data", t.data, t); - }), t.onReceiveError.addListener(function(t) { - e.emit("error", t); - }), e.emit("ready"); - }, osc.emitNetworkError = function(t, e) { - t.emit("error", "There was an error while opening the UDP socket connection. Result code: " + e); - }, osc.SerialPort = function(t) { - this.on("open", this.listen.bind(this)), osc.SLIPPort.call(this, t), this.connectionId = this.options.connectionId, + osc.listenToTransport = function(t, e, r) { + e.onReceive.addListener(function(e) { + e[r] === t[r] && t.emit("data", e.data, e); + }), e.onReceiveError.addListener(function(e) { + t.emit("error", e); + }), t.emit("ready"); + }, osc.emitNetworkError = function(e, t) { + e.emit("error", "There was an error while opening the UDP socket connection. Result code: " + t); + }, osc.SerialPort = function(e) { + this.on("open", this.listen.bind(this)), osc.SLIPPort.call(this, e), this.connectionId = this.options.connectionId, this.connectionId && this.emit("open", this.connectionId); }; - var t = osc.SerialPort.prototype = Object.create(osc.SLIPPort.prototype); - t.constructor = osc.SerialPort, t.open = function() { - var e = this, t = { - bitrate: e.options.bitrate + var e = osc.SerialPort.prototype = Object.create(osc.SLIPPort.prototype); + e.constructor = osc.SerialPort, e.open = function() { + var t = this, e = { + bitrate: t.options.bitrate }; - chrome.serial.connect(this.options.devicePath, t, function(t) { - e.connectionId = t.connectionId, e.emit("open", t); + chrome.serial.connect(this.options.devicePath, e, function(e) { + t.connectionId = e.connectionId, t.emit("open", e); }); - }, t.listen = function() { + }, e.listen = function() { osc.listenToTransport(this, chrome.serial, "connectionId"); - }, t.sendRaw = function(t) { + }, e.sendRaw = function(e) { if (this.connectionId) { var r = this; - chrome.serial.send(this.connectionId, t.buffer, function(t, e) { - e && r.emit("error", e + ". Total bytes sent: " + t); + chrome.serial.send(this.connectionId, e.buffer, function(e, t) { + t && r.emit("error", t + ". Total bytes sent: " + e); }); } else osc.fireClosedPortSendError(this); - }, t.close = function() { + }, e.close = function() { if (this.connectionId) { - var e = this; - chrome.serial.disconnect(this.connectionId, function(t) { - t && e.emit("close"); + var t = this; + chrome.serial.disconnect(this.connectionId, function(e) { + e && t.emit("close"); }); } - }, osc.UDPPort = function(t) { - osc.Port.call(this, t); - var e = this.options; - e.localAddress = e.localAddress || "127.0.0.1", e.localPort = void 0 !== e.localPort ? e.localPort : 57121, - this.on("open", this.listen.bind(this)), this.socketId = e.socketId, this.socketId && this.emit("open", 0); - }, (t = osc.UDPPort.prototype = Object.create(osc.Port.prototype)).constructor = osc.UDPPort, - t.open = function() { + }, osc.UDPPort = function(e) { + osc.Port.call(this, e); + var t = this.options; + t.localAddress = t.localAddress || "127.0.0.1", t.localPort = void 0 !== t.localPort ? t.localPort : 57121, + this.on("open", this.listen.bind(this)), this.socketId = t.socketId, this.socketId && this.emit("open", 0); + }, (e = osc.UDPPort.prototype = Object.create(osc.Port.prototype)).constructor = osc.UDPPort, + e.open = function() { if (!this.socketId) { - var t = this.options, e = { - persistent: t.persistent, - name: t.name, - bufferSize: t.bufferSize + var e = this.options, t = { + persistent: e.persistent, + name: e.name, + bufferSize: e.bufferSize }, r = this; - chrome.sockets.udp.create(e, function(t) { - r.socketId = t.socketId, r.bindSocket(); + chrome.sockets.udp.create(t, function(e) { + r.socketId = e.socketId, r.bindSocket(); }); } - }, t.bindSocket = function() { - var e = this, t = this.options; - void 0 !== t.broadcast && chrome.sockets.udp.setBroadcast(this.socketId, t.broadcast, function(t) { - t < 0 && e.emit("error", new Error("An error occurred while setting the socket's broadcast flag. Result code: " + t)); - }), void 0 !== t.multicastTTL && chrome.sockets.udp.setMulticastTimeToLive(this.socketId, t.multicastTTL, function(t) { - t < 0 && e.emit("error", new Error("An error occurred while setting the socket's multicast time to live flag. Result code: " + t)); - }), chrome.sockets.udp.bind(this.socketId, t.localAddress, t.localPort, function(t) { - 0 < t ? osc.emitNetworkError(e, t) : e.emit("open", t); + }, e.bindSocket = function() { + var t = this, e = this.options; + void 0 !== e.broadcast && chrome.sockets.udp.setBroadcast(this.socketId, e.broadcast, function(e) { + e < 0 && t.emit("error", new Error("An error occurred while setting the socket's broadcast flag. Result code: " + e)); + }), void 0 !== e.multicastTTL && chrome.sockets.udp.setMulticastTimeToLive(this.socketId, e.multicastTTL, function(e) { + e < 0 && t.emit("error", new Error("An error occurred while setting the socket's multicast time to live flag. Result code: " + e)); + }), chrome.sockets.udp.bind(this.socketId, e.localAddress, e.localPort, function(e) { + 0 < e ? osc.emitNetworkError(t, e) : t.emit("open", e); }); - }, t.listen = function() { - var t = this.options; - osc.listenToTransport(this, chrome.sockets.udp, "socketId"), t.multicastMembership && ("string" == typeof t.multicastMembership && (t.multicastMembership = [ t.multicastMembership ]), - t.multicastMembership.forEach(function(e) { - chrome.sockets.udp.joinGroup(this.socketId, e, function(t) { - t < 0 && this.emit("error", new Error("There was an error while trying to join the multicast group " + e + ". Result code: " + t)); + }, e.listen = function() { + var e = this.options; + osc.listenToTransport(this, chrome.sockets.udp, "socketId"), e.multicastMembership && ("string" == typeof e.multicastMembership && (e.multicastMembership = [ e.multicastMembership ]), + e.multicastMembership.forEach(function(t) { + chrome.sockets.udp.joinGroup(this.socketId, t, function(e) { + e < 0 && this.emit("error", new Error("There was an error while trying to join the multicast group " + t + ". Result code: " + e)); }); })); - }, t.sendRaw = function(t, e, r) { + }, e.sendRaw = function(e, t, r) { if (this.socketId) { var n = this.options, i = this; - e = e || n.remoteAddress, r = void 0 !== r ? r : n.remotePort, chrome.sockets.udp.send(this.socketId, t.buffer, e, r, function(t) { - t || i.emit("error", "There was an unknown error while trying to send a UDP message. Have you declared the appropriate udp send permissions in your application's manifest file?"), - 0 < t.resultCode && osc.emitNetworkError(i, t.resultCode); + t = t || n.remoteAddress, r = void 0 !== r ? r : n.remotePort, chrome.sockets.udp.send(this.socketId, e.buffer, t, r, function(e) { + e || i.emit("error", "There was an unknown error while trying to send a UDP message. Have you declared the appropriate udp send permissions in your application's manifest file?"), + 0 < e.resultCode && osc.emitNetworkError(i, e.resultCode); }); } else osc.fireClosedPortSendError(this); - }, t.close = function() { + }, e.close = function() { if (this.socketId) { - var t = this; + var e = this; chrome.sockets.udp.close(this.socketId, function() { - t.emit("close"); + e.emit("close"); }); } }; diff --git a/dist/osc-module.js b/dist/osc-module.js index cc69311..cf2cd71 100644 --- a/dist/osc-module.js +++ b/dist/osc-module.js @@ -25,7 +25,7 @@ * Licensed under the MIT and GPL 3 licenses. */ -/* global require, module, process, Buffer, Long */ +/* global require, module, process, Buffer, Long, util */ var osc = osc || {}; @@ -73,6 +73,11 @@ var osc = osc || {}; osc.Long = typeof Long !== "undefined" ? Long : osc.isNode ? require("long") : undefined; + // Unsupported, non-API member. Can be removed when supported versions + // of Node.js expose TextDecoder as a global, as in the browser. + osc.TextDecoder = typeof TextDecoder !== "undefined" ? TextDecoder : + typeof util !== "undefined" && typeof (util.TextDecoder !== "undefined") ? util.TextDecoder : undefined; + /** * Wraps the specified object in a DataView. * @@ -182,7 +187,34 @@ var osc = osc || {}; idx = (idx + 3) & ~0x03; offsetState.idx = idx; - return String.fromCharCode.apply(null, charCodes); + var decoder = osc.isBufferEnv ? osc.readString.withBuffer : + osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw; + + return decoder(charCodes); + }; + + osc.readString.raw = function (charCodes) { + // If no Buffer or TextDecoder, resort to fromCharCode + // This does not properly decode multi-byte Unicode characters. + var str = ""; + var sliceSize = 10000; + + // Processing the array in chunks so as not to exceed argument + // limit, see https://bugs.webkit.org/show_bug.cgi?id=80797 + for (var i = 0; i < charCodes.length; i += sliceSize) { + str += String.fromCharCode.apply(null, charCodes.slice(i, i + sliceSize)); + } + + return str; + }; + + osc.readString.withTextDecoder = function (charCodes) { + var data = new Int8Array(charCodes); + return new osc.TextDecoder("utf-8").decode(data); + }; + + osc.readString.withBuffer = function (charCodes) { + return Buffer.from(charCodes).toString("utf-8"); }; /** diff --git a/dist/osc-module.min.js b/dist/osc-module.min.js index fd2cd9f..56fb10c 100644 --- a/dist/osc-module.min.js +++ b/dist/osc-module.min.js @@ -20,7 +20,8 @@ return e.buffer && e.buffer instanceof ArrayBuffer; }, l.isBuffer = function(e) { return l.isBufferEnv && e instanceof Buffer; - }, l.Long = void 0 !== r ? r : l.isNode ? require("long") : void 0, l.dataView = function(e, t, r) { + }, l.Long = void 0 !== r ? r : l.isNode ? require("long") : void 0, l.TextDecoder = "undefined" != typeof TextDecoder ? TextDecoder : "undefined" != typeof util && (util.TextDecoder, + 1) ? util.TextDecoder : void 0, l.dataView = function(e, t, r) { return e.buffer ? new DataView(e.buffer, t, r) : e instanceof ArrayBuffer ? new DataView(e, t, r) : new DataView(new Uint8Array(e), t, r); }, l.byteArray = function(e) { if (e instanceof Uint8Array) return e; @@ -42,7 +43,15 @@ } r.push(i); } - return n = n + 3 & -4, t.idx = n, String.fromCharCode.apply(null, r); + return n = n + 3 & -4, t.idx = n, (l.isBufferEnv ? l.readString.withBuffer : l.TextDecoder ? l.readString.withTextDecoder : l.readString.raw)(r); + }, l.readString.raw = function(e) { + for (var t = "", r = 0; r < e.length; r += 1e4) t += String.fromCharCode.apply(null, e.slice(r, r + 1e4)); + return t; + }, l.readString.withTextDecoder = function(e) { + var t = new Int8Array(e); + return new l.TextDecoder("utf-8").decode(t); + }, l.readString.withBuffer = function(e) { + return Buffer.from(e).toString("utf-8"); }, l.writeString = function(e) { for (var t = e + "\0", r = t.length, n = new Uint8Array(r + 3 & -4), i = 0; i < t.length; i++) { var a = t.charCodeAt(i); @@ -158,10 +167,10 @@ for (var o = 0; o < t.length; ) { var s, u = t[o]; if ("[" === u) { - var c = t.slice(o + 1), d = c.indexOf("]"); - if (d < 0) throw new Error("Invalid argument type tag: an open array type tag ('[') was found without a matching close array tag ('[]'). Type tag was: " + r); - var f = c.slice(0, d); - s = l.readArgumentsIntoArray([], f, r, n, i, a), o += d + 2; + var d = t.slice(o + 1), c = d.indexOf("]"); + if (c < 0) throw new Error("Invalid argument type tag: an open array type tag ('[') was found without a matching close array tag ('[]'). Type tag was: " + r); + var f = d.slice(0, c); + s = l.readArgumentsIntoArray([], f, r, n, i, a), o += c + 2; } else s = l.readArgument(u, r, n, i, a), o++; e.push(s); } diff --git a/dist/osc.js b/dist/osc.js index 677d262..565a83a 100644 --- a/dist/osc.js +++ b/dist/osc.js @@ -7,7 +7,7 @@ * Licensed under the MIT and GPL 3 licenses. */ -/* global require, module, process, Buffer, Long */ +/* global require, module, process, Buffer, Long, util */ var osc = osc || {}; @@ -55,6 +55,11 @@ var osc = osc || {}; osc.Long = typeof Long !== "undefined" ? Long : osc.isNode ? require("long") : undefined; + // Unsupported, non-API member. Can be removed when supported versions + // of Node.js expose TextDecoder as a global, as in the browser. + osc.TextDecoder = typeof TextDecoder !== "undefined" ? TextDecoder : + typeof util !== "undefined" && typeof (util.TextDecoder !== "undefined") ? util.TextDecoder : undefined; + /** * Wraps the specified object in a DataView. * @@ -164,7 +169,34 @@ var osc = osc || {}; idx = (idx + 3) & ~0x03; offsetState.idx = idx; - return String.fromCharCode.apply(null, charCodes); + var decoder = osc.isBufferEnv ? osc.readString.withBuffer : + osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw; + + return decoder(charCodes); + }; + + osc.readString.raw = function (charCodes) { + // If no Buffer or TextDecoder, resort to fromCharCode + // This does not properly decode multi-byte Unicode characters. + var str = ""; + var sliceSize = 10000; + + // Processing the array in chunks so as not to exceed argument + // limit, see https://bugs.webkit.org/show_bug.cgi?id=80797 + for (var i = 0; i < charCodes.length; i += sliceSize) { + str += String.fromCharCode.apply(null, charCodes.slice(i, i + sliceSize)); + } + + return str; + }; + + osc.readString.withTextDecoder = function (charCodes) { + var data = new Int8Array(charCodes); + return new osc.TextDecoder("utf-8").decode(data); + }; + + osc.readString.withBuffer = function (charCodes) { + return Buffer.from(charCodes).toString("utf-8"); }; /** diff --git a/dist/osc.min.js b/dist/osc.min.js index 9299580..8284f0a 100644 --- a/dist/osc.min.js +++ b/dist/osc.min.js @@ -17,7 +17,8 @@ var osc = osc || {}; }, osc.isBuffer = function(r) { return osc.isBufferEnv && r instanceof Buffer; }, osc.Long = "undefined" != typeof Long ? Long : osc.isNode ? require("long") : void 0, - osc.dataView = function(r, e, t) { + osc.TextDecoder = "undefined" != typeof TextDecoder ? TextDecoder : "undefined" != typeof util && (util.TextDecoder, + 1) ? util.TextDecoder : void 0, osc.dataView = function(r, e, t) { return r.buffer ? new DataView(r.buffer, e, t) : r instanceof ArrayBuffer ? new DataView(r, e, t) : new DataView(new Uint8Array(r), e, t); }, osc.byteArray = function(r) { if (r instanceof Uint8Array) return r; @@ -27,32 +28,40 @@ var osc = osc || {}; }, osc.nativeBuffer = function(r) { return osc.isBufferEnv ? osc.isBuffer(r) ? r : Buffer.from(r.buffer ? r : new Uint8Array(r)) : osc.isTypedArrayView(r) ? r : new Uint8Array(r); }, osc.copyByteArray = function(r, e, t) { - if (osc.isTypedArrayView(r) && osc.isTypedArrayView(e)) e.set(r, t); else for (var n = void 0 === t ? 0 : t, a = Math.min(e.length - t, r.length), o = 0, s = n; o < a; o++, - s++) e[s] = r[o]; + if (osc.isTypedArrayView(r) && osc.isTypedArrayView(e)) e.set(r, t); else for (var n = void 0 === t ? 0 : t, o = Math.min(e.length - t, r.length), a = 0, i = n; a < o; a++, + i++) e[i] = r[a]; return e; }, osc.readString = function(r, e) { for (var t = [], n = e.idx; n < r.byteLength; n++) { - var a = r.getUint8(n); - if (0 === a) { + var o = r.getUint8(n); + if (0 === o) { n++; break; } - t.push(a); + t.push(o); } - return n = n + 3 & -4, e.idx = n, String.fromCharCode.apply(null, t); + return n = n + 3 & -4, e.idx = n, (osc.isBufferEnv ? osc.readString.withBuffer : osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw)(t); + }, osc.readString.raw = function(r) { + for (var e = "", t = 0; t < r.length; t += 1e4) e += String.fromCharCode.apply(null, r.slice(t, t + 1e4)); + return e; + }, osc.readString.withTextDecoder = function(r) { + var e = new Int8Array(r); + return new osc.TextDecoder("utf-8").decode(e); + }, osc.readString.withBuffer = function(r) { + return Buffer.from(r).toString("utf-8"); }, osc.writeString = function(r) { - for (var e = r + "\0", t = e.length, n = new Uint8Array(t + 3 & -4), a = 0; a < e.length; a++) { - var o = e.charCodeAt(a); - n[a] = o; + for (var e = r + "\0", t = e.length, n = new Uint8Array(t + 3 & -4), o = 0; o < e.length; o++) { + var a = e.charCodeAt(o); + n[o] = a; } return n; }, osc.readPrimitive = function(r, e, t, n) { - var a = r[e](n.idx, !1); - return n.idx += t, a; - }, osc.writePrimitive = function(r, e, t, n, a) { - var o; - return a = void 0 === a ? 0 : a, e ? o = new Uint8Array(e.buffer) : (o = new Uint8Array(n), - e = new DataView(o.buffer)), e[t](a, r, !1), o; + var o = r[e](n.idx, !1); + return n.idx += t, o; + }, osc.writePrimitive = function(r, e, t, n, o) { + var a; + return o = void 0 === o ? 0 : o, e ? a = new Uint8Array(e.buffer) : (a = new Uint8Array(n), + e = new DataView(a.buffer)), e[t](o, r, !1), a; }, osc.readInt32 = function(r, e) { return osc.readPrimitive(r, "getInt32", 4, e); }, osc.writeInt32 = function(r, e, t) { @@ -83,8 +92,8 @@ var osc = osc || {}; var n = r.charCodeAt(0); if (!(void 0 === n || n < -1)) return osc.writePrimitive(n, e, "setUint32", 4, t); }, osc.readBlob = function(r, e) { - var t = osc.readInt32(r, e), n = t + 3 & -4, a = new Uint8Array(r.buffer, e.idx, t); - return e.idx += n, a; + var t = osc.readInt32(r, e), n = t + 3 & -4, o = new Uint8Array(r.buffer, e.idx, t); + return e.idx += n, o; }, osc.writeBlob = function(r) { var e = (r = osc.byteArray(r)).byteLength, t = new Uint8Array(4 + (e + 3 & -4)), n = new DataView(t.buffer); return osc.writeInt32(e, n), t.set(r, 4), t; @@ -125,13 +134,13 @@ var osc = osc || {}; return osc.writeInt32(e[0], n, 0), osc.writeInt32(e[1], n, 4), t; }, osc.timeTag = function(r, e) { r = r || 0; - var t = (e = e || Date.now()) / 1e3, n = Math.floor(t), a = t - n, o = Math.floor(r), s = a + (r - o); - if (1 < s) { - var i = Math.floor(s); - o += i, s = s - i; + var t = (e = e || Date.now()) / 1e3, n = Math.floor(t), o = t - n, a = Math.floor(r), i = o + (r - a); + if (1 < i) { + var s = Math.floor(i); + a += s, i = i - s; } return { - raw: [ n + o + osc.SECS_70YRS, Math.round(osc.TWO_32 * s) ] + raw: [ n + a + osc.SECS_70YRS, Math.round(osc.TWO_32 * i) ] }; }, osc.ntpToJSTime = function(r, e) { return 1e3 * (r - osc.SECS_70YRS + e / osc.TWO_32); @@ -141,51 +150,51 @@ var osc = osc || {}; }, osc.readArguments = function(r, e, t) { var n = osc.readString(r, t); if (0 !== n.indexOf(",")) throw new Error("A malformed type tag string was found while reading the arguments of an OSC message. String was: " + n, " at offset: " + t.idx); - var a = n.substring(1).split(""), o = []; - return osc.readArgumentsIntoArray(o, a, n, r, e, t), o; - }, osc.readArgument = function(r, e, t, n, a) { - var o = osc.argumentTypes[r]; - if (!o) throw new Error("'" + r + "' is not a valid OSC type tag. Type tag string was: " + e); - var s = o.reader, i = osc[s](t, a); - return n.metadata && (i = { + var o = n.substring(1).split(""), a = []; + return osc.readArgumentsIntoArray(a, o, n, r, e, t), a; + }, osc.readArgument = function(r, e, t, n, o) { + var a = osc.argumentTypes[r]; + if (!a) throw new Error("'" + r + "' is not a valid OSC type tag. Type tag string was: " + e); + var i = a.reader, s = osc[i](t, o); + return n.metadata && (s = { type: r, - value: i - }), i; - }, osc.readArgumentsIntoArray = function(r, e, t, n, a, o) { - for (var s = 0; s < e.length; ) { - var i, c = e[s]; + value: s + }), s; + }, osc.readArgumentsIntoArray = function(r, e, t, n, o, a) { + for (var i = 0; i < e.length; ) { + var s, c = e[i]; if ("[" === c) { - var u = e.slice(s + 1), d = u.indexOf("]"); + var u = e.slice(i + 1), d = u.indexOf("]"); if (d < 0) throw new Error("Invalid argument type tag: an open array type tag ('[') was found without a matching close array tag ('[]'). Type tag was: " + t); var f = u.slice(0, d); - i = osc.readArgumentsIntoArray([], f, t, n, a, o), s += d + 2; - } else i = osc.readArgument(c, t, n, a, o), s++; - r.push(i); + s = osc.readArgumentsIntoArray([], f, t, n, o, a), i += d + 2; + } else s = osc.readArgument(c, t, n, o, a), i++; + r.push(s); } return r; }, osc.writeArguments = function(r, e) { var t = osc.collectArguments(r, e); return osc.joinParts(t); }, osc.joinParts = function(r) { - for (var e = new Uint8Array(r.byteLength), t = r.parts, n = 0, a = 0; a < t.length; a++) { - var o = t[a]; - osc.copyByteArray(o, e, n), n += o.length; + for (var e = new Uint8Array(r.byteLength), t = r.parts, n = 0, o = 0; o < t.length; o++) { + var a = t[o]; + osc.copyByteArray(a, e, n), n += a.length; } return e; }, osc.addDataPart = function(r, e) { e.parts.push(r), e.byteLength += r.length; }, osc.writeArrayArguments = function(r, e) { for (var t = "[", n = 0; n < r.length; n++) { - var a = r[n]; - t += osc.writeArgument(a, e); + var o = r[n]; + t += osc.writeArgument(o, e); } return t += "]"; }, osc.writeArgument = function(r, e) { if (osc.isArray(r)) return osc.writeArrayArguments(r, e); var t = r.type, n = osc.argumentTypes[t].writer; if (n) { - var a = osc[n](r.value); - osc.addDataPart(a, e); + var o = osc[n](r.value); + osc.addDataPart(o, e); } return r.type; }, osc.collectArguments = function(r, e, t) { @@ -193,26 +202,26 @@ var osc = osc || {}; byteLength: 0, parts: [] }, e.metadata || (r = osc.annotateArguments(r)); - for (var n = ",", a = t.parts.length, o = 0; o < r.length; o++) { - var s = r[o]; - n += osc.writeArgument(s, t); + for (var n = ",", o = t.parts.length, a = 0; a < r.length; a++) { + var i = r[a]; + n += osc.writeArgument(i, t); } - var i = osc.writeString(n); - return t.byteLength += i.byteLength, t.parts.splice(a, 0, i), t; + var s = osc.writeString(n); + return t.byteLength += s.byteLength, t.parts.splice(o, 0, s), t; }, osc.readMessage = function(r, e, t) { e = e || osc.defaults; var n = osc.dataView(r, r.byteOffset, r.byteLength); t = t || { idx: 0 }; - var a = osc.readString(n, t); - return osc.readMessageContents(a, n, e, t); + var o = osc.readString(n, t); + return osc.readMessageContents(o, n, e, t); }, osc.readMessageContents = function(r, e, t, n) { if (0 !== r.indexOf("/")) throw new Error("A malformed OSC address was found while reading an OSC message. String was: " + r); - var a = osc.readArguments(e, t, n); + var o = osc.readArguments(e, t, n); return { address: r, - args: 1 === a.length && t.unpackSingleArgs ? a[0] : a + args: 1 === o.length && t.unpackSingleArgs ? o[0] : o }; }, osc.collectMessageParts = function(r, e, t) { return t = t || { @@ -233,9 +242,9 @@ var osc = osc || {}; parts: [] }, osc.addDataPart(osc.writeString("#bundle"), t), osc.addDataPart(osc.writeTimeTag(r.timeTag), t); for (var n = 0; n < r.packets.length; n++) { - var a = r.packets[n], o = (a.address ? osc.collectMessageParts : osc.collectBundlePackets)(a, e); - t.byteLength += o.byteLength, osc.addDataPart(osc.writeInt32(o.byteLength), t), - t.parts = t.parts.concat(o.parts); + var o = r.packets[n], a = (o.address ? osc.collectMessageParts : osc.collectBundlePackets)(o, e); + t.byteLength += a.byteLength, osc.addDataPart(osc.writeInt32(a.byteLength), t), + t.parts = t.parts.concat(a.parts); } return t; }, osc.writeBundle = function(r, e) { @@ -246,23 +255,23 @@ var osc = osc || {}; }, osc.isValidBundle = function(r) { return void 0 !== r.timeTag && void 0 !== r.packets; }, osc.readBundleContents = function(r, e, t, n) { - for (var a = osc.readTimeTag(r, t), o = []; t.idx < n; ) { - var s = osc.readInt32(r, t), i = t.idx + s, c = osc.readPacket(r, e, t, i); - o.push(c); + for (var o = osc.readTimeTag(r, t), a = []; t.idx < n; ) { + var i = osc.readInt32(r, t), s = t.idx + i, c = osc.readPacket(r, e, t, s); + a.push(c); } return { - timeTag: a, - packets: o + timeTag: o, + packets: a }; }, osc.readPacket = function(r, e, t, n) { - var a = osc.dataView(r, r.byteOffset, r.byteLength); - n = void 0 === n ? a.byteLength : n, t = t || { + var o = osc.dataView(r, r.byteOffset, r.byteLength); + n = void 0 === n ? o.byteLength : n, t = t || { idx: 0 }; - var o = osc.readString(a, t), s = o[0]; - if ("#" === s) return osc.readBundleContents(a, e, t, n); - if ("/" === s) return osc.readMessageContents(o, a, e, t); - throw new Error("The header of an OSC packet didn't contain an OSC address or a #bundle string. Header was: " + o); + var a = osc.readString(o, t), i = a[0]; + if ("#" === i) return osc.readBundleContents(o, e, t, n); + if ("/" === i) return osc.readMessageContents(a, o, e, t); + throw new Error("The header of an OSC packet didn't contain an OSC address or a #bundle string. Header was: " + a); }, osc.writePacket = function(r, e) { if (osc.isValidMessage(r)) return osc.writeMessage(r, e); if (osc.isValidBundle(r)) return osc.writeBundle(r, e); @@ -346,11 +355,11 @@ var osc = osc || {}; throw new Error("Can't infer OSC argument type for value: " + JSON.stringify(r, null, 2)); }, osc.annotateArguments = function(r) { for (var e = [], t = 0; t < r.length; t++) { - var n, a = r[t]; - if ("object" == typeof a && a.type && void 0 !== a.value) n = a; else if (osc.isArray(a)) n = osc.annotateArguments(a); else { + var n, o = r[t]; + if ("object" == typeof o && o.type && void 0 !== o.value) n = o; else if (osc.isArray(o)) n = osc.annotateArguments(o); else { n = { - type: osc.inferTypeForArgument(a), - value: a + type: osc.inferTypeForArgument(o), + value: o }; } e.push(n); diff --git a/src/osc.js b/src/osc.js index cc2dabc..aea19f4 100644 --- a/src/osc.js +++ b/src/osc.js @@ -5,7 +5,7 @@ * Licensed under the MIT and GPL 3 licenses. */ -/* global require, module, process, Buffer, Long */ +/* global require, module, process, Buffer, Long, util */ var osc = osc || {}; @@ -53,6 +53,11 @@ var osc = osc || {}; osc.Long = typeof Long !== "undefined" ? Long : osc.isNode ? require("long") : undefined; + // Unsupported, non-API member. Can be removed when supported versions + // of Node.js expose TextDecoder as a global, as in the browser. + osc.TextDecoder = typeof TextDecoder !== "undefined" ? TextDecoder : + typeof util !== "undefined" && typeof (util.TextDecoder !== "undefined") ? util.TextDecoder : undefined; + /** * Wraps the specified object in a DataView. * @@ -162,7 +167,34 @@ var osc = osc || {}; idx = (idx + 3) & ~0x03; offsetState.idx = idx; - return String.fromCharCode.apply(null, charCodes); + var decoder = osc.isBufferEnv ? osc.readString.withBuffer : + osc.TextDecoder ? osc.readString.withTextDecoder : osc.readString.raw; + + return decoder(charCodes); + }; + + osc.readString.raw = function (charCodes) { + // If no Buffer or TextDecoder, resort to fromCharCode + // This does not properly decode multi-byte Unicode characters. + var str = ""; + var sliceSize = 10000; + + // Processing the array in chunks so as not to exceed argument + // limit, see https://bugs.webkit.org/show_bug.cgi?id=80797 + for (var i = 0; i < charCodes.length; i += sliceSize) { + str += String.fromCharCode.apply(null, charCodes.slice(i, i + sliceSize)); + } + + return str; + }; + + osc.readString.withTextDecoder = function (charCodes) { + var data = new Int8Array(charCodes); + return new osc.TextDecoder("utf-8").decode(data); + }; + + osc.readString.withBuffer = function (charCodes) { + return Buffer.from(charCodes).toString("utf-8"); }; /** diff --git a/tests/osc-tests.js b/tests/osc-tests.js index de3855d..caea563 100644 --- a/tests/osc-tests.js +++ b/tests/osc-tests.js @@ -246,6 +246,18 @@ var fluid = fluid || require("infusion"), }); }); + QUnit.test("readString very long string argument", function () { + var expectedChars = new Array(400000); + for (var i = 0; i < expectedChars.length; i++) { + expectedChars[i] = "A"; + } + var expected = expectedChars.join(""), + dv = oscjsTests.stringToDataView(expected), + actual = osc.readString(dv, {idx: 0}); + + QUnit.equal(actual, expected, "The string should have been read correctly."); + }); + /*********** * Numbers *