From 41e9969978c057c0b6675559fc2465ec53d49a4a Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Sun, 1 Jan 2017 21:12:41 -0500 Subject: [PATCH] Version 2.2.0 --- bower.json | 2 +- dist/osc-browser.js | 2 +- dist/osc-browser.min.js | 2 +- dist/osc-chromeapp.js | 2 +- dist/osc-chromeapp.min.js | 2 +- dist/osc-module.js | 2 +- dist/osc-module.min.js | 2 +- dist/osc.js | 2 +- dist/osc.min.js | 2 +- package.json | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bower.json b/bower.json index 6aa8db3..aa7896d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "osc.js", - "version": "2.1.0", + "version": "2.2.0", "main": "dist/osc-browser.js", "ignore": [ ".jshintrc", diff --git a/dist/osc-browser.js b/dist/osc-browser.js index eb756f8..ed90fcc 100644 --- a/dist/osc-browser.js +++ b/dist/osc-browser.js @@ -1,4 +1,4 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ /* * osc.js: An Open Sound Control library for JavaScript that works in both the browser and Node.js diff --git a/dist/osc-browser.min.js b/dist/osc-browser.min.js index b827ad2..75ee1b0 100644 --- a/dist/osc-browser.min.js +++ b/dist/osc-browser.min.js @@ -1,3 +1,3 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ var osc=osc||{};!function(){"use strict";osc.SECS_70YRS=2208988800,osc.TWO_32=4294967296,osc.defaults={metadata:!1,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(a){return a&&"[object Array]"===Object.prototype.toString.call(a)},osc.isTypedArrayView=function(a){return a.buffer&&a.buffer instanceof ArrayBuffer},osc.isBuffer=function(a){return osc.isBufferEnv&&a instanceof Buffer};var a="undefined"!=typeof dcodeIO?dcodeIO.Long:"undefined"!=typeof a?a:osc.isNode?require("long"):void 0;osc.dataView=function(a,b,c){return a.buffer?new DataView(a.buffer,b,c):a instanceof ArrayBuffer?new DataView(a,b,c):new DataView(new Uint8Array(a),b,c)},osc.byteArray=function(a){if(a instanceof Uint8Array)return a;var b=a.buffer?a.buffer:a;if(!(b instanceof ArrayBuffer||"undefined"!=typeof b.length&&"string"!=typeof b))throw new Error("Can't wrap a non-array-like object as Uint8Array. Object was: "+JSON.stringify(a,null,2));return new Uint8Array(b)},osc.nativeBuffer=function(a){return osc.isBufferEnv?osc.isBuffer(a)?a:new Buffer(a.buffer?a:new Uint8Array(a)):osc.isTypedArrayView(a)?a:new Uint8Array(a)},osc.copyByteArray=function(a,b,c){if(osc.isTypedArrayView(a)&&osc.isTypedArrayView(b))b.set(a,c);else for(var d=void 0===c?0:c,e=Math.min(b.length-c,a.length),f=0,g=d;f1){var i=Math.floor(h),j=h-i;f+=i,h=j}var k=d+f+osc.SECS_70YRS,l=Math.round(osc.TWO_32*h);return{raw:[k,l]}},osc.ntpToJSTime=function(a,b){var c=a-osc.SECS_70YRS,d=b/osc.TWO_32,e=1e3*(c+d);return e},osc.jsToNTPTime=function(a){var b=a/1e3,c=Math.floor(b),d=b-c,e=c+osc.SECS_70YRS,f=Math.round(osc.TWO_32*d);return[e,f]},osc.readArguments=function(a,b,c){var d=osc.readString(a,c);if(0!==d.indexOf(","))throw new Error("A malformed type tag string was found while reading the arguments of an OSC message. String was: "+d," at offset: "+c.idx);var e=d.substring(1).split(""),f=[];return osc.readArgumentsIntoArray(f,e,d,a,b,c),f},osc.readArgument=function(a,b,c,d,e){var f=osc.argumentTypes[a];if(!f)throw new Error("'"+a+"' is not a valid OSC type tag. Type tag string was: "+b);var g=f.reader,h=osc[g](c,e);return d.metadata&&(h={type:a,value:h}),h},osc.readArgumentsIntoArray=function(a,b,c,d,e,f){for(var g=0;g>>=0,(f=0<=a&&a<256)&&(d=i[a])?d:(c=e(a,(0|a)<0?-1:0,!0),f&&(i[a]=c),c)):(a|=0,(f=-128<=a&&a<128)&&(d=h[a])?d:(c=e(a,a<0?-1:0,!1),f&&(h[a]=c),c))}function d(a,b){if(isNaN(a)||!isFinite(a))return b?q:p;if(b){if(a<0)return q;if(a>=m)return v}else{if(a<=-n)return w;if(a+1>=n)return u}return a<0?d(-a,b).neg():e(a%l|0,a/l|0,b)}function e(b,c,d){return new a(b,c,d)}function f(a,b,c){if(0===a.length)throw Error("empty string");if("NaN"===a||"Infinity"===a||"+Infinity"===a||"-Infinity"===a)return p;if("number"==typeof b?(c=b,b=!1):b=!!b,c=c||10,c<2||360)throw Error("interior hyphen");if(0===e)return f(a.substring(1),b,c).neg();for(var g=d(j(c,8)),h=p,i=0;i>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},x.toString=function(a){if(a=a||10,a<2||36>>0,l=k.toString(a);if(g=i,g.isZero())return l+h;for(;l.length<6;)l="0"+l;h=""+l+h}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;b>0&&0==(a&1<=0},x.isOdd=function(){return 1===(1&this.low)},x.isEven=function(){return 0===(1&this.low)},x.equals=function(a){return b(a)||(a=g(a)),(this.unsigned===a.unsigned||this.high>>>31!==1||a.high>>>31!==1)&&(this.high===a.high&&this.low===a.low)},x.eq=x.equals,x.notEquals=function(a){return!this.eq(a)},x.neq=x.notEquals,x.lessThan=function(a){return this.comp(a)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(a){return this.comp(a)<=0},x.lte=x.lessThanOrEqual,x.greaterThan=function(a){return this.comp(a)>0},x.gt=x.greaterThan,x.greaterThanOrEqual=function(a){return this.comp(a)>=0},x.gte=x.greaterThanOrEqual,x.compare=function(a){if(b(a)||(a=g(a)),this.eq(a))return 0;var c=this.isNegative(),d=a.isNegative();return c&&!d?-1:!c&&d?1:this.unsigned?a.high>>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(r)},x.neg=x.negate,x.add=function(a){b(a)||(a=g(a));var c=this.high>>>16,d=65535&this.high,f=this.low>>>16,h=65535&this.low,i=a.high>>>16,j=65535&a.high,k=a.low>>>16,l=65535&a.low,m=0,n=0,o=0,p=0;return p+=h+l,o+=p>>>16,p&=65535,o+=f+k,n+=o>>>16,o&=65535,n+=d+j,m+=n>>>16,n&=65535,m+=c+i,m&=65535,e(o<<16|p,m<<16|n,this.unsigned)},x.subtract=function(a){return b(a)||(a=g(a)),this.add(a.neg())},x.sub=x.subtract,x.multiply=function(a){if(this.isZero())return p;if(b(a)||(a=g(a)),a.isZero())return p;if(this.eq(w))return a.isOdd()?w:p;if(a.eq(w))return this.isOdd()?w:p;if(this.isNegative())return a.isNegative()?this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(o)&&a.lt(o))return d(this.toNumber()*a.toNumber(),this.unsigned);var c=this.high>>>16,f=65535&this.high,h=this.low>>>16,i=65535&this.low,j=a.high>>>16,k=65535&a.high,l=a.low>>>16,m=65535&a.low,n=0,q=0,r=0,s=0;return s+=i*m,r+=s>>>16,s&=65535,r+=h*m,q+=r>>>16,r&=65535,r+=i*l,q+=r>>>16,r&=65535,q+=f*m,n+=q>>>16,q&=65535,q+=h*l,n+=q>>>16,q&=65535,q+=i*k,n+=q>>>16,q&=65535,n+=c*m+f*l+h*k+i*j,n&=65535,e(r<<16|s,n<<16|q,this.unsigned)},x.mul=x.multiply,x.divide=function(a){if(b(a)||(a=g(a)),a.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?q:p;var c,e,f;if(this.unsigned){if(a.unsigned||(a=a.toUnsigned()),a.gt(this))return q;if(a.gt(this.shru(1)))return s;f=q}else{if(this.eq(w)){if(a.eq(r)||a.eq(t))return w;if(a.eq(w))return r;var h=this.shr(1);return c=h.div(a).shl(1),c.eq(p)?a.isNegative()?r:t:(e=this.sub(a.mul(c)),f=c.add(e.div(a)))}if(a.eq(w))return this.unsigned?q:p;if(this.isNegative())return a.isNegative()?this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();f=p}for(e=this;e.gte(a);){c=Math.max(1,Math.floor(e.toNumber()/a.toNumber()));for(var i=Math.ceil(Math.log(c)/Math.LN2),k=i<=48?1:j(2,i-48),l=d(c),m=l.mul(a);m.isNegative()||m.gt(e);)c-=k,l=d(c,this.unsigned),m=l.mul(a);l.isZero()&&(l=r),f=f.add(l),e=e.sub(m)}return f},x.div=x.divide,x.modulo=function(a){return b(a)||(a=g(a)),this.sub(this.div(a).mul(a))},x.mod=x.modulo,x.not=function(){return e(~this.low,~this.high,this.unsigned)},x.and=function(a){return b(a)||(a=g(a)),e(this.low&a.low,this.high&a.high,this.unsigned)},x.or=function(a){return b(a)||(a=g(a)),e(this.low|a.low,this.high|a.high,this.unsigned)},x.xor=function(a){return b(a)||(a=g(a)),e(this.low^a.low,this.high^a.high,this.unsigned)},x.shiftLeft=function(a){return b(a)&&(a=a.toInt()),0===(a&=63)?this:a<32?e(this.low<>>32-a,this.unsigned):e(0,this.low<>>a|this.high<<32-a,this.high>>a,this.unsigned):e(this.high>>a-32,this.high>=0?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(a){if(b(a)&&(a=a.toInt()),a&=63,0===a)return this;var c=this.high;if(a<32){var d=this.low;return e(d>>>a|c<<32-a,c>>>a,this.unsigned)}return 32===a?e(c,0,this.unsigned):e(c>>>a-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.toSigned=function(){return this.unsigned?e(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:e(this.low,this.high,!0)},x.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var a=this.high,b=this.low;return[255&b,b>>>8&255,b>>>16&255,b>>>24&255,255&a,a>>>8&255,a>>>16&255,a>>>24&255]},x.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,255&a,b>>>24&255,b>>>16&255,b>>>8&255,255&b]},a}),function(a,b){"use strict";"object"==typeof exports?(a.slip=exports,b(exports)):"function"==typeof define&&define.amd?define(["exports"],function(c){return a.slip=c,a.slip,b(c)}):(a.slip={},b(a.slip))}(this,function(a){"use strict";var b=a;b.END=192,b.ESC=219,b.ESC_END=220,b.ESC_ESC=221,b.byteArray=function(a,b,c){return a instanceof ArrayBuffer?new Uint8Array(a,b,c):a},b.expandByteArray=function(a){var b=new Uint8Array(2*a.length);return b.set(a),b},b.sliceByteArray=function(a,b,c){var d=a.buffer.slice?a.buffer.slice(b,c):a.subarray(b,c);return new Uint8Array(d)},b.encode=function(a,c){c=c||{},c.bufferPadding=c.bufferPadding||4,a=b.byteArray(a,c.offset,c.byteLength);var d=a.length+c.bufferPadding+3&-4,e=new Uint8Array(d),f=1;e[0]=b.END;for(var g=0;ge.length-3&&(e=b.expandByteArray(e));var h=a[g];h===b.END?(e[f++]=b.ESC,h=b.ESC_END):h===b.ESC&&(e[f++]=b.ESC,h=b.ESC_ESC),e[f++]=h}return e[f]=b.END,b.sliceByteArray(e,0,f+1)},b.Decoder=function(a){a="function"!=typeof a?a||{}:{onMessage:a},this.maxMessageSize=a.maxMessageSize||10485760,this.bufferSize=a.bufferSize||1024,this.msgBuffer=new Uint8Array(this.bufferSize),this.msgBufferIdx=0,this.onMessage=a.onMessage,this.onError=a.onError,this.escape=!1};var c=b.Decoder.prototype;return c.decode=function(a){a=b.byteArray(a);for(var c,d=0;dthis.msgBuffer.length-1&&(this.msgBuffer=b.expandByteArray(this.msgBuffer)),this.msgBuffer[this.msgBufferIdx++]=a,this.escape=!1,this.msgBuffer.length1)&&(this.socket=new osc.WebSocket(this.options.url)),osc.WebSocketPort.setupSocketForBinary(this.socket);var a=this;this.socket.onopen=function(){a.emit("open",a.socket)}},a.listen=function(){var a=this;this.socket.onmessage=function(b){a.emit("data",b.data,b)},this.socket.onerror=function(b){a.emit("error",b)},this.socket.onclose=function(b){a.emit("close",b)},a.emit("ready")},a.sendRaw=function(a){return this.socket&&1===this.socket.readyState?void this.socket.send(a):void osc.fireClosedPortSendError(this)},a.close=function(a,b){this.socket.close(a,b)},osc.WebSocketPort.setupSocketForBinary=function(a){a.binaryType=osc.isNode?"nodebuffer":"arraybuffer"}}(); \ No newline at end of file diff --git a/dist/osc-chromeapp.js b/dist/osc-chromeapp.js index e3c6211..e898949 100644 --- a/dist/osc-chromeapp.js +++ b/dist/osc-chromeapp.js @@ -1,4 +1,4 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ /* * osc.js: An Open Sound Control library for JavaScript that works in both the browser and Node.js diff --git a/dist/osc-chromeapp.min.js b/dist/osc-chromeapp.min.js index e5b7122..bab030c 100644 --- a/dist/osc-chromeapp.min.js +++ b/dist/osc-chromeapp.min.js @@ -1,3 +1,3 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ var osc=osc||{};!function(){"use strict";osc.SECS_70YRS=2208988800,osc.TWO_32=4294967296,osc.defaults={metadata:!1,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(a){return a&&"[object Array]"===Object.prototype.toString.call(a)},osc.isTypedArrayView=function(a){return a.buffer&&a.buffer instanceof ArrayBuffer},osc.isBuffer=function(a){return osc.isBufferEnv&&a instanceof Buffer};var a="undefined"!=typeof dcodeIO?dcodeIO.Long:"undefined"!=typeof a?a:osc.isNode?require("long"):void 0;osc.dataView=function(a,b,c){return a.buffer?new DataView(a.buffer,b,c):a instanceof ArrayBuffer?new DataView(a,b,c):new DataView(new Uint8Array(a),b,c)},osc.byteArray=function(a){if(a instanceof Uint8Array)return a;var b=a.buffer?a.buffer:a;if(!(b instanceof ArrayBuffer||"undefined"!=typeof b.length&&"string"!=typeof b))throw new Error("Can't wrap a non-array-like object as Uint8Array. Object was: "+JSON.stringify(a,null,2));return new Uint8Array(b)},osc.nativeBuffer=function(a){return osc.isBufferEnv?osc.isBuffer(a)?a:new Buffer(a.buffer?a:new Uint8Array(a)):osc.isTypedArrayView(a)?a:new Uint8Array(a)},osc.copyByteArray=function(a,b,c){if(osc.isTypedArrayView(a)&&osc.isTypedArrayView(b))b.set(a,c);else for(var d=void 0===c?0:c,e=Math.min(b.length-c,a.length),f=0,g=d;f1){var i=Math.floor(h),j=h-i;f+=i,h=j}var k=d+f+osc.SECS_70YRS,l=Math.round(osc.TWO_32*h);return{raw:[k,l]}},osc.ntpToJSTime=function(a,b){var c=a-osc.SECS_70YRS,d=b/osc.TWO_32,e=1e3*(c+d);return e},osc.jsToNTPTime=function(a){var b=a/1e3,c=Math.floor(b),d=b-c,e=c+osc.SECS_70YRS,f=Math.round(osc.TWO_32*d);return[e,f]},osc.readArguments=function(a,b,c){var d=osc.readString(a,c);if(0!==d.indexOf(","))throw new Error("A malformed type tag string was found while reading the arguments of an OSC message. String was: "+d," at offset: "+c.idx);var e=d.substring(1).split(""),f=[];return osc.readArgumentsIntoArray(f,e,d,a,b,c),f},osc.readArgument=function(a,b,c,d,e){var f=osc.argumentTypes[a];if(!f)throw new Error("'"+a+"' is not a valid OSC type tag. Type tag string was: "+b);var g=f.reader,h=osc[g](c,e);return d.metadata&&(h={type:a,value:h}),h},osc.readArgumentsIntoArray=function(a,b,c,d,e,f){for(var g=0;g>>=0,(f=0<=a&&a<256)&&(d=i[a])?d:(c=e(a,(0|a)<0?-1:0,!0),f&&(i[a]=c),c)):(a|=0,(f=-128<=a&&a<128)&&(d=h[a])?d:(c=e(a,a<0?-1:0,!1),f&&(h[a]=c),c))}function d(a,b){if(isNaN(a)||!isFinite(a))return b?q:p;if(b){if(a<0)return q;if(a>=m)return v}else{if(a<=-n)return w;if(a+1>=n)return u}return a<0?d(-a,b).neg():e(a%l|0,a/l|0,b)}function e(b,c,d){return new a(b,c,d)}function f(a,b,c){if(0===a.length)throw Error("empty string");if("NaN"===a||"Infinity"===a||"+Infinity"===a||"-Infinity"===a)return p;if("number"==typeof b?(c=b,b=!1):b=!!b,c=c||10,c<2||360)throw Error("interior hyphen");if(0===e)return f(a.substring(1),b,c).neg();for(var g=d(j(c,8)),h=p,i=0;i>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},x.toString=function(a){if(a=a||10,a<2||36>>0,l=k.toString(a);if(g=i,g.isZero())return l+h;for(;l.length<6;)l="0"+l;h=""+l+h}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var a=0!=this.high?this.high:this.low,b=31;b>0&&0==(a&1<=0},x.isOdd=function(){return 1===(1&this.low)},x.isEven=function(){return 0===(1&this.low)},x.equals=function(a){return b(a)||(a=g(a)),(this.unsigned===a.unsigned||this.high>>>31!==1||a.high>>>31!==1)&&(this.high===a.high&&this.low===a.low)},x.eq=x.equals,x.notEquals=function(a){return!this.eq(a)},x.neq=x.notEquals,x.lessThan=function(a){return this.comp(a)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(a){return this.comp(a)<=0},x.lte=x.lessThanOrEqual,x.greaterThan=function(a){return this.comp(a)>0},x.gt=x.greaterThan,x.greaterThanOrEqual=function(a){return this.comp(a)>=0},x.gte=x.greaterThanOrEqual,x.compare=function(a){if(b(a)||(a=g(a)),this.eq(a))return 0;var c=this.isNegative(),d=a.isNegative();return c&&!d?-1:!c&&d?1:this.unsigned?a.high>>>0>this.high>>>0||a.high===this.high&&a.low>>>0>this.low>>>0?-1:1:this.sub(a).isNegative()?-1:1},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(r)},x.neg=x.negate,x.add=function(a){b(a)||(a=g(a));var c=this.high>>>16,d=65535&this.high,f=this.low>>>16,h=65535&this.low,i=a.high>>>16,j=65535&a.high,k=a.low>>>16,l=65535&a.low,m=0,n=0,o=0,p=0;return p+=h+l,o+=p>>>16,p&=65535,o+=f+k,n+=o>>>16,o&=65535,n+=d+j,m+=n>>>16,n&=65535,m+=c+i,m&=65535,e(o<<16|p,m<<16|n,this.unsigned)},x.subtract=function(a){return b(a)||(a=g(a)),this.add(a.neg())},x.sub=x.subtract,x.multiply=function(a){if(this.isZero())return p;if(b(a)||(a=g(a)),a.isZero())return p;if(this.eq(w))return a.isOdd()?w:p;if(a.eq(w))return this.isOdd()?w:p;if(this.isNegative())return a.isNegative()?this.neg().mul(a.neg()):this.neg().mul(a).neg();if(a.isNegative())return this.mul(a.neg()).neg();if(this.lt(o)&&a.lt(o))return d(this.toNumber()*a.toNumber(),this.unsigned);var c=this.high>>>16,f=65535&this.high,h=this.low>>>16,i=65535&this.low,j=a.high>>>16,k=65535&a.high,l=a.low>>>16,m=65535&a.low,n=0,q=0,r=0,s=0;return s+=i*m,r+=s>>>16,s&=65535,r+=h*m,q+=r>>>16,r&=65535,r+=i*l,q+=r>>>16,r&=65535,q+=f*m,n+=q>>>16,q&=65535,q+=h*l,n+=q>>>16,q&=65535,q+=i*k,n+=q>>>16,q&=65535,n+=c*m+f*l+h*k+i*j,n&=65535,e(r<<16|s,n<<16|q,this.unsigned)},x.mul=x.multiply,x.divide=function(a){if(b(a)||(a=g(a)),a.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?q:p;var c,e,f;if(this.unsigned){if(a.unsigned||(a=a.toUnsigned()),a.gt(this))return q;if(a.gt(this.shru(1)))return s;f=q}else{if(this.eq(w)){if(a.eq(r)||a.eq(t))return w;if(a.eq(w))return r;var h=this.shr(1);return c=h.div(a).shl(1),c.eq(p)?a.isNegative()?r:t:(e=this.sub(a.mul(c)),f=c.add(e.div(a)))}if(a.eq(w))return this.unsigned?q:p;if(this.isNegative())return a.isNegative()?this.neg().div(a.neg()):this.neg().div(a).neg();if(a.isNegative())return this.div(a.neg()).neg();f=p}for(e=this;e.gte(a);){c=Math.max(1,Math.floor(e.toNumber()/a.toNumber()));for(var i=Math.ceil(Math.log(c)/Math.LN2),k=i<=48?1:j(2,i-48),l=d(c),m=l.mul(a);m.isNegative()||m.gt(e);)c-=k,l=d(c,this.unsigned),m=l.mul(a);l.isZero()&&(l=r),f=f.add(l),e=e.sub(m)}return f},x.div=x.divide,x.modulo=function(a){return b(a)||(a=g(a)),this.sub(this.div(a).mul(a))},x.mod=x.modulo,x.not=function(){return e(~this.low,~this.high,this.unsigned)},x.and=function(a){return b(a)||(a=g(a)),e(this.low&a.low,this.high&a.high,this.unsigned)},x.or=function(a){return b(a)||(a=g(a)),e(this.low|a.low,this.high|a.high,this.unsigned)},x.xor=function(a){return b(a)||(a=g(a)),e(this.low^a.low,this.high^a.high,this.unsigned)},x.shiftLeft=function(a){return b(a)&&(a=a.toInt()),0===(a&=63)?this:a<32?e(this.low<>>32-a,this.unsigned):e(0,this.low<>>a|this.high<<32-a,this.high>>a,this.unsigned):e(this.high>>a-32,this.high>=0?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(a){if(b(a)&&(a=a.toInt()),a&=63,0===a)return this;var c=this.high;if(a<32){var d=this.low;return e(d>>>a|c<<32-a,c>>>a,this.unsigned)}return 32===a?e(c,0,this.unsigned):e(c>>>a-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.toSigned=function(){return this.unsigned?e(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:e(this.low,this.high,!0)},x.toBytes=function(a){return a?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var a=this.high,b=this.low;return[255&b,b>>>8&255,b>>>16&255,b>>>24&255,255&a,a>>>8&255,a>>>16&255,a>>>24&255]},x.toBytesBE=function(){var a=this.high,b=this.low;return[a>>>24&255,a>>>16&255,a>>>8&255,255&a,b>>>24&255,b>>>16&255,b>>>8&255,255&b]},a}),function(a,b){"use strict";"object"==typeof exports?(a.slip=exports,b(exports)):"function"==typeof define&&define.amd?define(["exports"],function(c){return a.slip=c,a.slip,b(c)}):(a.slip={},b(a.slip))}(this,function(a){"use strict";var b=a;b.END=192,b.ESC=219,b.ESC_END=220,b.ESC_ESC=221,b.byteArray=function(a,b,c){return a instanceof ArrayBuffer?new Uint8Array(a,b,c):a},b.expandByteArray=function(a){var b=new Uint8Array(2*a.length);return b.set(a),b},b.sliceByteArray=function(a,b,c){var d=a.buffer.slice?a.buffer.slice(b,c):a.subarray(b,c);return new Uint8Array(d)},b.encode=function(a,c){c=c||{},c.bufferPadding=c.bufferPadding||4,a=b.byteArray(a,c.offset,c.byteLength);var d=a.length+c.bufferPadding+3&-4,e=new Uint8Array(d),f=1;e[0]=b.END;for(var g=0;ge.length-3&&(e=b.expandByteArray(e));var h=a[g];h===b.END?(e[f++]=b.ESC,h=b.ESC_END):h===b.ESC&&(e[f++]=b.ESC,h=b.ESC_ESC),e[f++]=h}return e[f]=b.END,b.sliceByteArray(e,0,f+1)},b.Decoder=function(a){a="function"!=typeof a?a||{}:{onMessage:a},this.maxMessageSize=a.maxMessageSize||10485760,this.bufferSize=a.bufferSize||1024,this.msgBuffer=new Uint8Array(this.bufferSize),this.msgBufferIdx=0,this.onMessage=a.onMessage,this.onError=a.onError,this.escape=!1};var c=b.Decoder.prototype;return c.decode=function(a){a=b.byteArray(a);for(var c,d=0;dthis.msgBuffer.length-1&&(this.msgBuffer=b.expandByteArray(this.msgBuffer)),this.msgBuffer[this.msgBufferIdx++]=a,this.escape=!1,this.msgBuffer.length1)&&(this.socket=new osc.WebSocket(this.options.url)),osc.WebSocketPort.setupSocketForBinary(this.socket);var a=this;this.socket.onopen=function(){a.emit("open",a.socket)}},a.listen=function(){var a=this;this.socket.onmessage=function(b){a.emit("data",b.data,b)},this.socket.onerror=function(b){a.emit("error",b)},this.socket.onclose=function(b){a.emit("close",b)},a.emit("ready")},a.sendRaw=function(a){return this.socket&&1===this.socket.readyState?void this.socket.send(a):void osc.fireClosedPortSendError(this)},a.close=function(a,b){this.socket.close(a,b)},osc.WebSocketPort.setupSocketForBinary=function(a){a.binaryType=osc.isNode?"nodebuffer":"arraybuffer"}}();var osc=osc||{};!function(){"use strict";osc.listenToTransport=function(a,b,c){b.onReceive.addListener(function(b){b[c]===a[c]&&a.emit("data",b.data,b)}),b.onReceiveError.addListener(function(b){a.emit("error",b)}),a.emit("ready")},osc.emitNetworkError=function(a,b){a.emit("error","There was an error while opening the UDP socket connection. Result code: "+b)},osc.SerialPort=function(a){this.on("open",this.listen.bind(this)),osc.SLIPPort.call(this,a),this.connectionId=this.options.connectionId,this.connectionId&&this.emit("open",this.connectionId)};var a=osc.SerialPort.prototype=Object.create(osc.SLIPPort.prototype);a.constructor=osc.SerialPort,a.open=function(){var a=this,b={bitrate:a.options.bitrate};chrome.serial.connect(this.options.devicePath,b,function(b){a.connectionId=b.connectionId,a.emit("open",b)})},a.listen=function(){osc.listenToTransport(this,chrome.serial,"connectionId")},a.sendRaw=function(a){if(!this.connectionId)return void osc.fireClosedPortSendError(this);var b=this;chrome.serial.send(this.connectionId,a.buffer,function(a,c){c&&b.emit("error",c+". Total bytes sent: "+a)})},a.close=function(){if(this.connectionId){var a=this;chrome.serial.disconnect(this.connectionId,function(b){b&&a.emit("close")})}},osc.UDPPort=function(a){osc.Port.call(this,a);var b=this.options;b.localAddress=b.localAddress||"127.0.0.1",b.localPort=void 0!==b.localPort?b.localPort:57121,this.on("open",this.listen.bind(this)),this.socketId=b.socketId,this.socketId&&this.emit("open",0)},a=osc.UDPPort.prototype=Object.create(osc.Port.prototype),a.constructor=osc.UDPPort,a.open=function(){if(!this.socketId){var a=this.options,b={persistent:a.persistent,name:a.name,bufferSize:a.bufferSize},c=this;chrome.sockets.udp.create(b,function(a){c.socketId=a.socketId,c.bindSocket()})}},a.bindSocket=function(){var a=this,b=this.options;void 0!==b.broadcast&&chrome.sockets.udp.setBroadcast(this.socketId,b.broadcast,function(b){b<0&&a.emit("error",new Error("An error occurred while setting the socket's broadcast flag. Result code: "+b))}),void 0!==b.multicastTTL&&chrome.sockets.udp.setMulticastTimeToLive(this.socketId,b.multicastTTL,function(b){b<0&&a.emit("error",new Error("An error occurred while setting the socket's multicast time to live flag. Result code: "+b))}),chrome.sockets.udp.bind(this.socketId,b.localAddress,b.localPort,function(b){return b>0?void osc.emitNetworkError(a,b):void a.emit("open",b)})},a.listen=function(){var a=this.options;osc.listenToTransport(this,chrome.sockets.udp,"socketId"),a.multicastMembership&&("string"==typeof a.multicastMembership&&(a.multicastMembership=[a.multicastMembership]),a.multicastMembership.forEach(function(a){chrome.sockets.udp.joinGroup(this.socketId,a,function(b){b<0&&this.emit("error",new Error("There was an error while trying to join the multicast group "+a+". Result code: "+b))})}))},a.sendRaw=function(a,b,c){if(!this.socketId)return void osc.fireClosedPortSendError(this);var d=this.options,e=this;b=b||d.remoteAddress,c=void 0!==c?c:d.remotePort,chrome.sockets.udp.send(this.socketId,a.buffer,b,c,function(a){a||e.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?"),a.resultCode>0&&osc.emitNetworkError(e,a.resultCode)})},a.close=function(){if(this.socketId){var a=this;chrome.sockets.udp.close(this.socketId,function(){a.emit("close")})}}}(); \ No newline at end of file diff --git a/dist/osc-module.js b/dist/osc-module.js index cb9388b..33d68ad 100644 --- a/dist/osc-module.js +++ b/dist/osc-module.js @@ -1,4 +1,4 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ (function (root, factory) { if (typeof exports === "object") { diff --git a/dist/osc-module.min.js b/dist/osc-module.min.js index d19032e..3cf9992 100644 --- a/dist/osc-module.min.js +++ b/dist/osc-module.min.js @@ -1,3 +1,3 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ !function(a,b){"object"==typeof exports?(a.osc=exports,b(exports,require("slip"),require("EventEmitter"),require("long"))):"function"==typeof define&&define.amd?define(["exports","slip","EventEmitter","long"],function(c,d,e,f){return a.osc=c,a.osc,b(c,d,e,f)}):(a.osc={},b(a.osc,slip,EventEmitter))}(this,function(a,b,c,d){var e=e||{};!function(){"use strict";e.SECS_70YRS=2208988800,e.TWO_32=4294967296,e.defaults={metadata:!1,unpackSingleArgs:!0},e.isCommonJS=!("undefined"==typeof module||!module.exports),e.isNode=e.isCommonJS&&"undefined"==typeof window,e.isElectron=!("undefined"==typeof process||!process.versions||!process.versions.electron),e.isBufferEnv=e.isNode||e.isElectron,e.isArray=function(a){return a&&"[object Array]"===Object.prototype.toString.call(a)},e.isTypedArrayView=function(a){return a.buffer&&a.buffer instanceof ArrayBuffer},e.isBuffer=function(a){return e.isBufferEnv&&a instanceof Buffer};var a="undefined"!=typeof dcodeIO?dcodeIO.Long:"undefined"!=typeof a?a:e.isNode?require("long"):void 0;e.dataView=function(a,b,c){return a.buffer?new DataView(a.buffer,b,c):a instanceof ArrayBuffer?new DataView(a,b,c):new DataView(new Uint8Array(a),b,c)},e.byteArray=function(a){if(a instanceof Uint8Array)return a;var b=a.buffer?a.buffer:a;if(!(b instanceof ArrayBuffer||"undefined"!=typeof b.length&&"string"!=typeof b))throw new Error("Can't wrap a non-array-like object as Uint8Array. Object was: "+JSON.stringify(a,null,2));return new Uint8Array(b)},e.nativeBuffer=function(a){return e.isBufferEnv?e.isBuffer(a)?a:new Buffer(a.buffer?a:new Uint8Array(a)):e.isTypedArrayView(a)?a:new Uint8Array(a)},e.copyByteArray=function(a,b,c){if(e.isTypedArrayView(a)&&e.isTypedArrayView(b))b.set(a,c);else for(var d=void 0===c?0:c,f=Math.min(b.length-c,a.length),g=0,h=d;g1){var j=Math.floor(i),k=i-j;g+=j,i=k}var l=d+g+e.SECS_70YRS,m=Math.round(e.TWO_32*i);return{raw:[l,m]}},e.ntpToJSTime=function(a,b){var c=a-e.SECS_70YRS,d=b/e.TWO_32,f=1e3*(c+d);return f},e.jsToNTPTime=function(a){var b=a/1e3,c=Math.floor(b),d=b-c,f=c+e.SECS_70YRS,g=Math.round(e.TWO_32*d);return[f,g]},e.readArguments=function(a,b,c){var d=e.readString(a,c);if(0!==d.indexOf(","))throw new Error("A malformed type tag string was found while reading the arguments of an OSC message. String was: "+d," at offset: "+c.idx);var f=d.substring(1).split(""),g=[];return e.readArgumentsIntoArray(g,f,d,a,b,c),g},e.readArgument=function(a,b,c,d,f){var g=e.argumentTypes[a];if(!g)throw new Error("'"+a+"' is not a valid OSC type tag. Type tag string was: "+b);var h=g.reader,i=e[h](c,f);return d.metadata&&(i={type:a,value:i}),i},e.readArgumentsIntoArray=function(a,b,c,d,f,g){for(var h=0;h1)&&(this.socket=new e.WebSocket(this.options.url)),e.WebSocketPort.setupSocketForBinary(this.socket);var a=this;this.socket.onopen=function(){a.emit("open",a.socket)}},a.listen=function(){var a=this;this.socket.onmessage=function(b){a.emit("data",b.data,b)},this.socket.onerror=function(b){a.emit("error",b)},this.socket.onclose=function(b){a.emit("close",b)},a.emit("ready")},a.sendRaw=function(a){return this.socket&&1===this.socket.readyState?void this.socket.send(a):void e.fireClosedPortSendError(this)},a.close=function(a,b){this.socket.close(a,b)},e.WebSocketPort.setupSocketForBinary=function(a){a.binaryType=e.isNode?"nodebuffer":"arraybuffer"}}(),e}); \ No newline at end of file diff --git a/dist/osc.js b/dist/osc.js index 525eaf5..f402381 100644 --- a/dist/osc.js +++ b/dist/osc.js @@ -1,4 +1,4 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ /* * osc.js: An Open Sound Control library for JavaScript that works in both the browser and Node.js diff --git a/dist/osc.min.js b/dist/osc.min.js index a86111e..5c42582 100644 --- a/dist/osc.min.js +++ b/dist/osc.min.js @@ -1,3 +1,3 @@ -/*! osc.js 2.1.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ +/*! osc.js 2.2.0, Copyright 2017 Colin Clark | github.com/colinbdclark/osc.js */ var osc=osc||{};!function(){"use strict";osc.SECS_70YRS=2208988800,osc.TWO_32=4294967296,osc.defaults={metadata:!1,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(a){return a&&"[object Array]"===Object.prototype.toString.call(a)},osc.isTypedArrayView=function(a){return a.buffer&&a.buffer instanceof ArrayBuffer},osc.isBuffer=function(a){return osc.isBufferEnv&&a instanceof Buffer};var a="undefined"!=typeof dcodeIO?dcodeIO.Long:"undefined"!=typeof a?a:osc.isNode?require("long"):void 0;osc.dataView=function(a,b,c){return a.buffer?new DataView(a.buffer,b,c):a instanceof ArrayBuffer?new DataView(a,b,c):new DataView(new Uint8Array(a),b,c)},osc.byteArray=function(a){if(a instanceof Uint8Array)return a;var b=a.buffer?a.buffer:a;if(!(b instanceof ArrayBuffer||"undefined"!=typeof b.length&&"string"!=typeof b))throw new Error("Can't wrap a non-array-like object as Uint8Array. Object was: "+JSON.stringify(a,null,2));return new Uint8Array(b)},osc.nativeBuffer=function(a){return osc.isBufferEnv?osc.isBuffer(a)?a:new Buffer(a.buffer?a:new Uint8Array(a)):osc.isTypedArrayView(a)?a:new Uint8Array(a)},osc.copyByteArray=function(a,b,c){if(osc.isTypedArrayView(a)&&osc.isTypedArrayView(b))b.set(a,c);else for(var d=void 0===c?0:c,e=Math.min(b.length-c,a.length),f=0,g=d;f1){var i=Math.floor(h),j=h-i;f+=i,h=j}var k=d+f+osc.SECS_70YRS,l=Math.round(osc.TWO_32*h);return{raw:[k,l]}},osc.ntpToJSTime=function(a,b){var c=a-osc.SECS_70YRS,d=b/osc.TWO_32,e=1e3*(c+d);return e},osc.jsToNTPTime=function(a){var b=a/1e3,c=Math.floor(b),d=b-c,e=c+osc.SECS_70YRS,f=Math.round(osc.TWO_32*d);return[e,f]},osc.readArguments=function(a,b,c){var d=osc.readString(a,c);if(0!==d.indexOf(","))throw new Error("A malformed type tag string was found while reading the arguments of an OSC message. String was: "+d," at offset: "+c.idx);var e=d.substring(1).split(""),f=[];return osc.readArgumentsIntoArray(f,e,d,a,b,c),f},osc.readArgument=function(a,b,c,d,e){var f=osc.argumentTypes[a];if(!f)throw new Error("'"+a+"' is not a valid OSC type tag. Type tag string was: "+b);var g=f.reader,h=osc[g](c,e);return d.metadata&&(h={type:a,value:h}),h},osc.readArgumentsIntoArray=function(a,b,c,d,e,f){for(var g=0;g