atem-connection
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -5,2 +5,21 @@ # Change Log | ||
<a name="0.3.0"></a> | ||
# [0.3.0](https://github.com/nrkno/tv-automation-atem-connection/compare/0.2.3...0.3.0) (2018-08-07) | ||
### Bug Fixes | ||
* emit error upon failing value sanity check ([e11b3fa](https://github.com/nrkno/tv-automation-atem-connection/commit/e11b3fa)) | ||
* export util ([004ef9a](https://github.com/nrkno/tv-automation-atem-connection/commit/004ef9a)) | ||
* flyKeyFrameId is 1 or 2 ([b0ced83](https://github.com/nrkno/tv-automation-atem-connection/commit/b0ced83)) | ||
* use an object when appriopriate ([7d13bd3](https://github.com/nrkno/tv-automation-atem-connection/commit/7d13bd3)) | ||
* **atemSocket:** fix _maxPacketID being off-by-one ([28c1400](https://github.com/nrkno/tv-automation-atem-connection/commit/28c1400)) | ||
### Features | ||
* value sanity checks ([9d2b021](https://github.com/nrkno/tv-automation-atem-connection/commit/9d2b021)) | ||
<a name="0.2.3"></a> | ||
@@ -7,0 +26,0 @@ ## [0.2.3](https://github.com/nrkno/tv-automation-atem-connection/compare/0.2.2...0.2.3) (2018-08-07) |
@@ -31,2 +31,3 @@ "use strict"; | ||
this.socket.on('commandAcknowleged', (packetId) => this._resolveCommand(packetId)); | ||
this.socket.on('error', (e) => this.emit('error', e)); | ||
this.socket.on('connect', () => this.emit('connected')); | ||
@@ -33,0 +34,0 @@ this.socket.on('disconnect', () => this.emit('disconnected')); |
@@ -5,2 +5,3 @@ "use strict"; | ||
const atemUtil_1 = require("../../lib/atemUtil"); | ||
const __1 = require("../.."); | ||
class ProductIdentifierCommand extends AbstractCommand_1.default { | ||
@@ -14,3 +15,3 @@ constructor() { | ||
deviceName: atemUtil_1.Util.bufToNullTerminatedString(rawCommand, 0, 32), | ||
model: rawCommand[40] | ||
model: atemUtil_1.Util.parseEnum(rawCommand[40], __1.Enums.Model) | ||
}; | ||
@@ -17,0 +18,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class SuperSourceConfigCommand extends AbstractCommand_1.default { | ||
@@ -11,3 +12,3 @@ constructor() { | ||
this.properties = { | ||
superSourceBoxes: rawCommand[0] | ||
superSourceBoxes: __1.Util.parseNumberBetween(rawCommand[0], 0, 3) | ||
}; | ||
@@ -14,0 +15,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class DownstreamKeyPropertiesCommand extends AbstractCommand_1.default { | ||
@@ -13,13 +14,13 @@ constructor() { | ||
tie: rawCommand[1] === 1, | ||
rate: rawCommand[2], | ||
rate: __1.Util.parseNumberBetween(rawCommand[2], 0, 300), | ||
preMultiply: rawCommand[3] === 1, | ||
clip: rawCommand.readUInt16BE(4), | ||
gain: rawCommand.readUInt16BE(6), | ||
clip: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 1000), | ||
gain: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(6), 0, 1000), | ||
invert: rawCommand[8] === 1, | ||
mask: { | ||
enabled: rawCommand[9] === 1, | ||
top: rawCommand.readInt16BE(10), | ||
bottom: rawCommand.readInt16BE(12), | ||
left: rawCommand.readInt16BE(14), | ||
right: rawCommand.readInt16BE(16) | ||
top: __1.Util.parseNumberBetween(rawCommand.readInt16BE(10), -9000, 9000), | ||
bottom: __1.Util.parseNumberBetween(rawCommand.readInt16BE(12), -9000, 9000), | ||
left: __1.Util.parseNumberBetween(rawCommand.readInt16BE(14), -16000, 16000), | ||
right: __1.Util.parseNumberBetween(rawCommand.readInt16BE(16), -16000, 16000) | ||
} | ||
@@ -26,0 +27,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class DownstreamKeySourcesCommand extends AbstractCommand_1.default { | ||
@@ -10,7 +11,7 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.downstreamKeyerId = rawCommand[0]; | ||
this.properties = { | ||
fillSource: rawCommand.readInt16BE(2), | ||
cutSource: rawCommand.readInt16BE(4) | ||
}; | ||
this.downstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[0], 0, 3), | ||
this.properties = { | ||
fillSource: rawCommand.readInt16BE(2), | ||
cutSource: rawCommand.readInt16BE(4) | ||
}; | ||
} | ||
@@ -17,0 +18,0 @@ applyToState(state) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class DownstreamKeyStateCommand extends AbstractCommand_1.default { | ||
@@ -10,3 +11,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.downstreamKeyId = rawCommand[0]; | ||
this.downstreamKeyId = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
@@ -13,0 +14,0 @@ onAir: rawCommand[1] === 1, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const atemUtil_1 = require("../../lib/atemUtil"); | ||
class MediaPlayerStatusCommand extends AbstractCommand_1.default { | ||
@@ -13,3 +14,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mediaPlayerId = rawCommand[0]; | ||
this.mediaPlayerId = atemUtil_1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
@@ -16,0 +17,0 @@ playing: rawCommand[1] === 1, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class AutoTransitionCommand extends AbstractCommand_1.default { | ||
@@ -10,3 +11,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
} | ||
@@ -13,0 +14,0 @@ serialize() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class CutCommand extends AbstractCommand_1.default { | ||
@@ -10,3 +11,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
} | ||
@@ -13,0 +14,0 @@ serialize() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyChromaCommand extends AbstractCommand_1.default { | ||
@@ -10,9 +11,9 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
hue: rawCommand.readUInt16BE(2), | ||
gain: rawCommand.readUInt16BE(4), | ||
ySuppress: rawCommand.readUInt16BE(6), | ||
lift: rawCommand.readUInt16BE(8), | ||
hue: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(2), 0, 3599), | ||
gain: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 1000), | ||
ySuppress: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(6), 0, 1000), | ||
lift: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(8), 0, 1000), | ||
narrow: rawCommand[10] === 1 | ||
@@ -19,0 +20,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyDVECommand extends AbstractCommand_1.default { | ||
@@ -10,31 +11,31 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
sizeX: rawCommand.readUInt32BE(4), | ||
sizeY: rawCommand.readUInt32BE(8), | ||
positionX: rawCommand.readInt32BE(12), | ||
positionY: rawCommand.readInt32BE(16), | ||
rotation: rawCommand.readInt32BE(20), | ||
sizeX: __1.Util.parseNumberBetween(rawCommand.readUInt32BE(4), 0, 99990), | ||
sizeY: __1.Util.parseNumberBetween(rawCommand.readUInt32BE(8), 0, 99990), | ||
positionX: __1.Util.parseNumberBetween(rawCommand.readInt32BE(12), -1000 * 1000, 1000 * 1000), | ||
positionY: __1.Util.parseNumberBetween(rawCommand.readInt32BE(16), -1000 * 1000, 1000 * 1000), | ||
rotation: __1.Util.parseNumberBetween(rawCommand.readInt32BE(20), -332230, 332230), | ||
borderEnabled: rawCommand[24] === 1, | ||
shadowEnabled: rawCommand[25] === 1, | ||
borderBevel: rawCommand.readUInt8(26), | ||
borderOuterWidth: rawCommand.readUInt16BE(28), | ||
borderInnerWidth: rawCommand.readUInt16BE(30), | ||
borderOuterSoftness: rawCommand.readInt8(32), | ||
borderInnerSoftness: rawCommand.readInt8(33), | ||
borderBevelSoftness: rawCommand.readInt8(34), | ||
borderBevelPosition: rawCommand.readInt8(35), | ||
borderOpacity: rawCommand.readInt8(36), | ||
borderHue: rawCommand.readUInt16BE(38), | ||
borderSaturation: rawCommand.readUInt16BE(40), | ||
borderLuma: rawCommand.readUInt16BE(42), | ||
lightSourceDirection: rawCommand.readUInt16BE(44), | ||
lightSourceAltitude: rawCommand.readUInt8(46), | ||
borderBevel: __1.Util.parseEnum(rawCommand.readUInt8(26), __1.Enums.BorderBevel), | ||
borderOuterWidth: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(28), 0, 1600), | ||
borderInnerWidth: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(30), 0, 1600), | ||
borderOuterSoftness: __1.Util.parseNumberBetween(rawCommand.readInt8(32), 0, 100), | ||
borderInnerSoftness: __1.Util.parseNumberBetween(rawCommand.readInt8(33), 0, 100), | ||
borderBevelSoftness: __1.Util.parseNumberBetween(rawCommand.readInt8(34), 0, 100), | ||
borderBevelPosition: __1.Util.parseNumberBetween(rawCommand.readInt8(35), 0, 100), | ||
borderOpacity: __1.Util.parseNumberBetween(rawCommand.readInt8(36), 0, 100), | ||
borderHue: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(38), 0, 1000), | ||
borderSaturation: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(40), 0, 1000), | ||
borderLuma: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(42), 0, 1000), | ||
lightSourceDirection: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(44), 0, 3599), | ||
lightSourceAltitude: __1.Util.parseNumberBetween(rawCommand.readUInt8(46), 0, 100), | ||
maskEnabled: rawCommand[47] === 1, | ||
maskTop: rawCommand.readUInt16BE(48), | ||
maskBottom: rawCommand.readUInt16BE(50), | ||
maskLeft: rawCommand.readUInt16BE(52), | ||
maskRight: rawCommand.readUInt16BE(54), | ||
rate: rawCommand.readInt8(56) | ||
maskTop: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(48), 0, 38000), | ||
maskBottom: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(50), 0, 38000), | ||
maskLeft: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(52), 0, 52000), | ||
maskRight: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(54), 0, 52000), | ||
rate: __1.Util.parseNumberBetween(rawCommand.readInt8(56), 0, 250) | ||
}; | ||
@@ -41,0 +42,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyFlyKeyframeGetCommand extends AbstractCommand_1.default { | ||
@@ -10,28 +11,28 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
keyFrameId: rawCommand[2], | ||
sizeX: rawCommand.readUInt32BE(4), | ||
sizeY: rawCommand.readUInt32BE(8), | ||
positionX: rawCommand.readInt32BE(12), | ||
positionY: rawCommand.readInt32BE(16), | ||
rotation: rawCommand.readInt32BE(20), | ||
borderOuterWidth: rawCommand.readUInt16BE(24), | ||
borderInnerWidth: rawCommand.readUInt16BE(26), | ||
borderOuterSoftness: rawCommand.readInt8(28), | ||
borderInnerSoftness: rawCommand.readInt8(29), | ||
borderBevelSoftness: rawCommand.readInt8(30), | ||
borderBevelPosition: rawCommand.readInt8(31), | ||
borderOpacity: rawCommand.readInt8(32), | ||
borderHue: rawCommand.readUInt16BE(34), | ||
borderSaturation: rawCommand.readUInt16BE(36), | ||
borderLuma: rawCommand.readUInt16BE(38), | ||
lightSourceDirection: rawCommand.readUInt16BE(40), | ||
lightSourceAltitude: rawCommand.readUInt8(42), | ||
keyFrameId: __1.Util.parseNumberBetween(rawCommand[2], 1, 2), | ||
sizeX: __1.Util.parseNumberBetween(rawCommand.readUInt32BE(4), 0, 99990), | ||
sizeY: __1.Util.parseNumberBetween(rawCommand.readUInt32BE(8), 0, 99990), | ||
positionX: __1.Util.parseNumberBetween(rawCommand.readInt32BE(12), -1000 * 1000, 1000 * 1000), | ||
positionY: __1.Util.parseNumberBetween(rawCommand.readInt32BE(16), -1000 * 1000, 1000 * 1000), | ||
rotation: __1.Util.parseNumberBetween(rawCommand.readInt32BE(20), -332230, 332230), | ||
borderOuterWidth: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(24), 0, 1600), | ||
borderInnerWidth: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(26), 0, 1600), | ||
borderOuterSoftness: __1.Util.parseNumberBetween(rawCommand.readInt8(28), 0, 100), | ||
borderInnerSoftness: __1.Util.parseNumberBetween(rawCommand.readInt8(29), 0, 100), | ||
borderBevelSoftness: __1.Util.parseNumberBetween(rawCommand.readInt8(30), 0, 100), | ||
borderBevelPosition: __1.Util.parseNumberBetween(rawCommand.readInt8(31), 0, 100), | ||
borderOpacity: __1.Util.parseNumberBetween(rawCommand.readInt8(32), 0, 100), | ||
borderHue: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(34), 0, 1000), | ||
borderSaturation: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(36), 0, 1000), | ||
borderLuma: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(38), 0, 1000), | ||
lightSourceDirection: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(40), 0, 3599), | ||
lightSourceAltitude: __1.Util.parseNumberBetween(rawCommand.readUInt8(42), 0, 100), | ||
maskEnabled: rawCommand[43] === 1, | ||
maskTop: rawCommand.readUInt16BE(44), | ||
maskBottom: rawCommand.readUInt16BE(46), | ||
maskLeft: rawCommand.readUInt16BE(48), | ||
maskRight: rawCommand.readUInt16BE(50) | ||
maskTop: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(44), 0, 38000), | ||
maskBottom: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(46), 0, 38000), | ||
maskLeft: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(48), 0, 52000), | ||
maskRight: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(50), 0, 52000) | ||
}; | ||
@@ -38,0 +39,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyFlyPropertiesGetCommand extends AbstractCommand_1.default { | ||
@@ -10,4 +11,4 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
@@ -14,0 +15,0 @@ isASet: rawCommand[2] === 1, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyLumaCommand extends AbstractCommand_1.default { | ||
@@ -10,8 +11,8 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
preMultiplied: rawCommand[2] === 1, | ||
clip: rawCommand.readUInt16BE(4), | ||
gain: rawCommand.readUInt16BE(6), | ||
clip: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 1000), | ||
gain: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(6), 0, 1000), | ||
invert: rawCommand[8] === 1 | ||
@@ -18,0 +19,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyOnAirCommand extends AbstractCommand_1.default { | ||
@@ -10,4 +11,4 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
@@ -14,0 +15,0 @@ onAir: rawCommand[2] === 1 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyPatternCommand extends AbstractCommand_1.default { | ||
@@ -10,11 +11,11 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.upstreamKeyerId = rawCommand[1]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.upstreamKeyerId = __1.Util.parseNumberBetween(rawCommand[1], 0, 3); | ||
this.properties = { | ||
style: rawCommand[2], | ||
size: rawCommand.readUInt16BE(4), | ||
symmetry: rawCommand.readUInt16BE(6), | ||
softness: rawCommand.readUInt16BE(8), | ||
positionX: rawCommand.readUInt16BE(10), | ||
positionY: rawCommand.readUInt16BE(12), | ||
style: __1.Util.parseEnum(rawCommand[2], __1.Enums.Pattern), | ||
size: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 10000), | ||
symmetry: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(6), 0, 10000), | ||
softness: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(8), 0, 10000), | ||
positionX: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(10), 0, 10000), | ||
positionY: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(12), 0, 10000), | ||
invert: rawCommand[14] === 1 | ||
@@ -21,0 +22,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class MixEffectKeyPropertiesGetCommand extends AbstractCommand_1.default { | ||
@@ -10,6 +11,6 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
upstreamKeyerId: rawCommand[1], | ||
mixEffectKeyType: rawCommand[2], | ||
upstreamKeyerId: __1.Util.parseNumberBetween(rawCommand[1], 0, 3), | ||
mixEffectKeyType: __1.Util.parseEnum(rawCommand[2], __1.Enums.MixEffectKeyType), | ||
flyEnabled: rawCommand[5] === 1, | ||
@@ -19,6 +20,6 @@ fillSource: rawCommand.readUInt16BE(6), | ||
maskEnabled: rawCommand[10] === 1, | ||
maskTop: rawCommand.readInt16BE(12), | ||
maskBottom: rawCommand.readInt16BE(14), | ||
maskLeft: rawCommand.readInt16BE(16), | ||
maskRight: rawCommand.readInt16BE(18) | ||
maskTop: __1.Util.parseNumberBetween(rawCommand.readInt16BE(12), -9000, 9000), | ||
maskBottom: __1.Util.parseNumberBetween(rawCommand.readInt16BE(14), -9000, 9000), | ||
maskLeft: __1.Util.parseNumberBetween(rawCommand.readInt16BE(16), -16000, 16000), | ||
maskRight: __1.Util.parseNumberBetween(rawCommand.readInt16BE(18), -16000, 16000) | ||
}; | ||
@@ -25,0 +26,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class PreviewInputCommand extends AbstractCommand_1.default { | ||
@@ -10,3 +11,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
@@ -13,0 +14,0 @@ source: rawCommand.readUInt16BE(2) |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class ProgramInputCommand extends AbstractCommand_1.default { | ||
@@ -10,3 +11,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
@@ -13,0 +14,0 @@ source: rawCommand.readUInt16BE(2) |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionDipCommand extends AbstractCommand_1.default { | ||
@@ -13,5 +14,5 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
rate: rawCommand[1], | ||
rate: __1.Util.parseNumberBetween(rawCommand[1], 0, 250), | ||
input: rawCommand[2] << 8 | (rawCommand[3] & 0xFF) | ||
@@ -18,0 +19,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionDVECommand extends AbstractCommand_1.default { | ||
@@ -13,7 +14,7 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
rate: rawCommand[1], | ||
logoRate: rawCommand[2], | ||
style: rawCommand[3], | ||
rate: __1.Util.parseNumberBetween(rawCommand[1], 1, 250), | ||
logoRate: __1.Util.parseNumberBetween(rawCommand[2], 1, 250), | ||
style: __1.Util.parseEnum(rawCommand[3], __1.Enums.DVEEffect), | ||
fillSource: rawCommand[4] << 8 | (rawCommand[5] & 0xff), | ||
@@ -23,4 +24,4 @@ keySource: rawCommand[6] << 8 | (rawCommand[7] & 0xff), | ||
preMultiplied: rawCommand[9] === 1, | ||
clip: rawCommand[10] << 8 | (rawCommand[11] & 0xff), | ||
gain: rawCommand[12] << 8 | (rawCommand[13] & 0xff), | ||
clip: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(10), 0, 1000), | ||
gain: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(12), 0, 1000), | ||
invertKey: rawCommand[14] === 1, | ||
@@ -27,0 +28,0 @@ reverse: rawCommand[15] === 1, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionMixCommand extends AbstractCommand_1.default { | ||
@@ -13,5 +14,5 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
rate: rawCommand[1] | ||
rate: __1.Util.parseNumberBetween(rawCommand[1], 1, 250) | ||
}; | ||
@@ -18,0 +19,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionPositionCommand extends AbstractCommand_1.default { | ||
@@ -10,7 +11,7 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
inTransition: rawCommand[1] === 1, | ||
remainingFrames: rawCommand[2], | ||
handlePosition: rawCommand[4] << 8 | rawCommand[4] | ||
remainingFrames: __1.Util.parseNumberBetween(rawCommand[2], 0, 250), | ||
handlePosition: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 9999) | ||
}; | ||
@@ -17,0 +18,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class PreviewTransitionCommand extends AbstractCommand_1.default { | ||
@@ -10,3 +11,3 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
@@ -13,0 +14,0 @@ preview: rawCommand[1] === 1 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionPropertiesCommand extends AbstractCommand_1.default { | ||
@@ -13,7 +14,7 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
style: rawCommand[1], | ||
style: __1.Util.parseEnum(rawCommand[1], __1.Enums.TransitionStyle), | ||
selection: rawCommand[2], | ||
nextStyle: rawCommand[3], | ||
nextStyle: __1.Util.parseEnum(rawCommand[3], __1.Enums.TransitionStyle), | ||
nextSelection: rawCommand[4] | ||
@@ -20,0 +21,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionStingerCommand extends AbstractCommand_1.default { | ||
@@ -13,8 +14,8 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
source: rawCommand[1], | ||
preMultipliedKey: rawCommand[2] === 1, | ||
clip: rawCommand[4] << 8 | rawCommand[5], | ||
gain: rawCommand[6] << 8 | rawCommand[7], | ||
clip: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 1000), | ||
gain: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(6), 0, 1000), | ||
invert: rawCommand[8] === 1, | ||
@@ -21,0 +22,0 @@ preroll: rawCommand[10] << 8 | rawCommand[11], |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../../AbstractCommand"); | ||
const __1 = require("../../.."); | ||
class TransitionWipeCommand extends AbstractCommand_1.default { | ||
@@ -13,12 +14,12 @@ constructor() { | ||
deserialize(rawCommand) { | ||
this.mixEffect = rawCommand[0]; | ||
this.mixEffect = __1.Util.parseNumberBetween(rawCommand[0], 0, 3); | ||
this.properties = { | ||
rate: rawCommand[1], | ||
pattern: rawCommand[2], | ||
borderWidth: rawCommand[4] << 8 | rawCommand[5], | ||
borderInput: rawCommand[6] << 8 | rawCommand[7], | ||
symmetry: rawCommand[8] << 8 | rawCommand[9], | ||
borderSoftness: rawCommand[10] << 8 | rawCommand[11], | ||
xPosition: rawCommand[12] << 8 | rawCommand[13], | ||
yPosition: rawCommand[14] << 8 | rawCommand[15], | ||
rate: __1.Util.parseNumberBetween(rawCommand[1], 1, 250), | ||
pattern: __1.Util.parseEnum(rawCommand[2], __1.Enums.Pattern), | ||
borderWidth: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(4), 0, 10000), | ||
borderInput: rawCommand.readUInt16BE(6), | ||
symmetry: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(8), 0, 10000), | ||
borderSoftness: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(10), 0, 10000), | ||
xPosition: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(12), 0, 10000), | ||
yPosition: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(14), 0, 10000), | ||
reverseDirection: rawCommand[16] === 1, | ||
@@ -25,0 +26,0 @@ flipFlop: rawCommand[17] === 1 |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const AbstractCommand_1 = require("../AbstractCommand"); | ||
const __1 = require("../.."); | ||
class SuperSourceBoxParametersCommand extends AbstractCommand_1.default { | ||
@@ -17,10 +18,10 @@ constructor() { | ||
source: rawCommand.readUInt16BE(2), | ||
x: rawCommand.readInt16BE(4), | ||
y: rawCommand.readInt16BE(6), | ||
size: rawCommand.readUInt16BE(8), | ||
x: __1.Util.parseNumberBetween(rawCommand.readInt16BE(4), -4800, 4800), | ||
y: __1.Util.parseNumberBetween(rawCommand.readInt16BE(6), -3400, 3400), | ||
size: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(8), 70, 1000), | ||
cropped: rawCommand[10] === 1, | ||
cropTop: rawCommand.readUInt16BE(12), | ||
cropBottom: rawCommand.readUInt16BE(14), | ||
cropLeft: rawCommand.readUInt16BE(16), | ||
cropRight: rawCommand.readUInt16BE(18) | ||
cropTop: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(12), 0, 18000), | ||
cropBottom: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(14), 0, 18000), | ||
cropLeft: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(16), 0, 32000), | ||
cropRight: __1.Util.parseNumberBetween(rawCommand.readUInt16BE(18), 0, 3200) | ||
}; | ||
@@ -27,0 +28,0 @@ } |
@@ -5,3 +5,4 @@ export * from './atem'; | ||
import * as Commands from './commands'; | ||
export { Enums, Commands }; | ||
import { Util } from './lib/atemUtil'; | ||
export { Enums, Commands, Util }; | ||
import * as VideoState from './state/video'; | ||
@@ -8,0 +9,0 @@ import * as AudioState from './state/audio'; |
@@ -10,2 +10,4 @@ "use strict"; | ||
exports.Commands = Commands; | ||
const atemUtil_1 = require("./lib/atemUtil"); | ||
exports.Util = atemUtil_1.Util; | ||
const VideoState = require("./state/video"); | ||
@@ -12,0 +14,0 @@ exports.VideoState = VideoState; |
@@ -160,5 +160,10 @@ "use strict"; | ||
if (cmd && typeof cmd.deserialize === 'function') { | ||
cmd.deserialize(buffer.slice(0, length).slice(8)); | ||
cmd.packetId = packetId || -1; | ||
this.emit('receivedStateChange', cmd); | ||
try { | ||
cmd.deserialize(buffer.slice(0, length).slice(8)); | ||
cmd.packetId = packetId || -1; | ||
this.emit('receivedStateChange', cmd); | ||
} | ||
catch (e) { | ||
this.emit('error', e); | ||
} | ||
} | ||
@@ -165,0 +170,0 @@ if (buffer.length > length) { |
@@ -5,4 +5,6 @@ /// <reference types="node" /> | ||
function bufToNullTerminatedString(buffer: Buffer, start: number, length: number): string; | ||
function parseNumberBetween(num: number, min: number, max: number): number; | ||
function parseEnum<G>(value: G, type: any): G; | ||
const COMMAND_CONNECT_HELLO: Buffer; | ||
const COMMAND_CONNECT_HELLO_ANSWER: Buffer; | ||
} |
@@ -19,2 +19,16 @@ "use strict"; | ||
Util.bufToNullTerminatedString = bufToNullTerminatedString; | ||
function parseNumberBetween(num, min, max) { | ||
if (num > max) | ||
throw Error(`Number too big: ${num} > ${max}`); | ||
else if (num < min) | ||
throw Error(`Number too small: ${num} < ${min}`); | ||
return num; | ||
} | ||
Util.parseNumberBetween = parseNumberBetween; | ||
function parseEnum(value, type) { | ||
if (!type[value]) | ||
throw Error('Value is not a valid option in enum'); | ||
return value; | ||
} | ||
Util.parseEnum = parseEnum; | ||
Util.COMMAND_CONNECT_HELLO = Buffer.from([ | ||
@@ -21,0 +35,0 @@ 0x10, 0x14, 0x53, 0xAB, |
@@ -72,3 +72,5 @@ import * as Enum from '../../enums'; | ||
transitionSettings: TransitionSettings; | ||
upstreamKeyers: Array<USK.UpstreamKeyer>; | ||
upstreamKeyers: { | ||
[index: number]: USK.UpstreamKeyer; | ||
}; | ||
} | ||
@@ -87,3 +89,5 @@ export declare class MixEffect implements IMixEffect { | ||
transitionSettings: TransitionSettings; | ||
upstreamKeyers: Array<USK.UpstreamKeyer>; | ||
upstreamKeyers: { | ||
[index: number]: USK.UpstreamKeyer; | ||
}; | ||
constructor(index: number); | ||
@@ -105,8 +109,16 @@ getUpstreamKeyer(index: number): USK.UpstreamKeyer; | ||
export declare class AtemVideoState { | ||
ME: Array<MixEffect>; | ||
downstreamKeyers: Array<DownstreamKeyer>; | ||
auxilliaries: Array<number>; | ||
superSourceBoxes: Array<SuperSourceBox>; | ||
ME: { | ||
[index: string]: MixEffect; | ||
}; | ||
downstreamKeyers: { | ||
[index: string]: DownstreamKeyer; | ||
}; | ||
auxilliaries: { | ||
[index: string]: number; | ||
}; | ||
superSourceBoxes: { | ||
[index: string]: SuperSourceBox; | ||
}; | ||
getMe(index: number): MixEffect; | ||
getDownstreamKeyer(index: number): DownstreamKeyer; | ||
} |
@@ -27,6 +27,6 @@ "use strict"; | ||
constructor() { | ||
this.ME = []; | ||
this.downstreamKeyers = []; | ||
this.auxilliaries = []; | ||
this.superSourceBoxes = []; | ||
this.ME = {}; | ||
this.downstreamKeyers = {}; | ||
this.auxilliaries = {}; | ||
this.superSourceBoxes = {}; | ||
} | ||
@@ -33,0 +33,0 @@ getMe(index) { |
{ | ||
"name": "atem-connection", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "Typescript Node.js library for connecting with an ATEM switcher.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
262312
3915