Skip to content

Commit

Permalink
fix: better support for constellation (#58)
Browse files Browse the repository at this point in the history
fix: better support for constellation
  • Loading branch information
Julusian authored Sep 21, 2019
2 parents 772c815 + b540f11 commit 5bb512d
Show file tree
Hide file tree
Showing 3 changed files with 341 additions and 338 deletions.
2 changes: 2 additions & 0 deletions src/commands/DeviceProfile/productIdentifierCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class ProductIdentifierCommand extends AbstractCommand {
case Enums.Model.TwoME:
case Enums.Model.TwoME4K:
case Enums.Model.TwoMEBS4K:
case Enums.Model.Constellation:
case Enums.Model.Constellation8K:
state.info.power = [false, false]
break
default:
Expand Down
114 changes: 57 additions & 57 deletions src/commands/MixEffects/Key/MixEffectKeyFlyKeyframeGetCommand.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
import AbstractCommand from '../../AbstractCommand'
import { AtemState } from '../../../state'
import { UpstreamKeyerFlyKeyframe } from '../../../state/video/upstreamKeyers'
import { Util } from '../../..'

export class MixEffectKeyFlyKeyframeGetCommand extends AbstractCommand {
rawName = 'KKFP'
mixEffect: number
upstreamKeyerId: number
properties: UpstreamKeyerFlyKeyframe

deserialize (rawCommand: Buffer) {
this.mixEffect = Util.parseNumberBetween(rawCommand[0], 0, 3)
this.upstreamKeyerId = Util.parseNumberBetween(rawCommand[1], 0, 3)
this.properties = {
keyFrameId: Util.parseNumberBetween(rawCommand[2], 1, 2),

// Note: these are higher than the ui shows, but are within the range the atem can be set to
sizeX: Util.parseNumberBetween(rawCommand.readUInt32BE(4), 0, Math.pow(2, 32) - 1),
sizeY: Util.parseNumberBetween(rawCommand.readUInt32BE(8), 0, Math.pow(2, 32) - 1),

positionX: Util.parseNumberBetween(rawCommand.readInt32BE(12), -32768 * 1000, 32768 * 1000),
positionY: Util.parseNumberBetween(rawCommand.readInt32BE(16), -32768 * 1000, 32768 * 1000),
rotation: Util.parseNumberBetween(rawCommand.readInt32BE(20), -332230, 332230),

borderOuterWidth: Util.parseNumberBetween(rawCommand.readUInt16BE(24), 0, 65535),
borderInnerWidth: Util.parseNumberBetween(rawCommand.readUInt16BE(26), 0, 65535),
borderOuterSoftness: Util.parseNumberBetween(rawCommand.readUInt8(28), 0, 254),
borderInnerSoftness: Util.parseNumberBetween(rawCommand.readUInt8(29), 0, 254),
borderBevelSoftness: Util.parseNumberBetween(rawCommand.readUInt8(30), 0, 254),
borderBevelPosition: Util.parseNumberBetween(rawCommand.readUInt8(31), 0, 254),

borderOpacity: Util.parseNumberBetween(rawCommand.readUInt8(32), 0, 254),
borderHue: Util.parseNumberBetween(rawCommand.readUInt16BE(34), 0, 65535),
borderSaturation: Util.parseNumberBetween(rawCommand.readUInt16BE(36), 0, 65535),
borderLuma: Util.parseNumberBetween(rawCommand.readUInt16BE(38), 0, 65535),

lightSourceDirection: Util.parseNumberBetween(rawCommand.readUInt16BE(40), 0, 65535),
lightSourceAltitude: Util.parseNumberBetween(rawCommand.readUInt8(42), 0, 254),

maskEnabled: rawCommand[43] === 1,
maskTop: Util.parseNumberBetween(rawCommand.readInt16BE(44), -9000, 9000),
maskBottom: Util.parseNumberBetween(rawCommand.readInt16BE(46), -9000, 9000),
maskLeft: Util.parseNumberBetween(rawCommand.readInt16BE(48), -16000, 16000),
maskRight: Util.parseNumberBetween(rawCommand.readInt16BE(50), -16000, 16000)
}
}

applyToState (state: AtemState) {
const mixEffect = state.video.getMe(this.mixEffect)
const upstreamKeyer = mixEffect.getUpstreamKeyer(this.upstreamKeyerId)
upstreamKeyer.flyKeyframes[this.properties.keyFrameId] = {
...this.properties
}
return `video.ME.${this.mixEffect}.upstreamKeyers.${this.upstreamKeyerId}.flyKeyframes.${this.properties.keyFrameId}`
}
}
import AbstractCommand from '../../AbstractCommand'
import { AtemState } from '../../../state'
import { UpstreamKeyerFlyKeyframe } from '../../../state/video/upstreamKeyers'
import { Util } from '../../..'

export class MixEffectKeyFlyKeyframeGetCommand extends AbstractCommand {
rawName = 'KKFP'
mixEffect: number
upstreamKeyerId: number
properties: UpstreamKeyerFlyKeyframe

deserialize (rawCommand: Buffer) {
this.mixEffect = Util.parseNumberBetween(rawCommand[0], 0, 3)
this.upstreamKeyerId = Util.parseNumberBetween(rawCommand[1], 0, 3)
this.properties = {
keyFrameId: Util.parseNumberBetween(rawCommand[2], 1, 2),

// Note: these are higher than the ui shows, but are within the range the atem can be set to
sizeX: Util.parseNumberBetween(rawCommand.readUInt32BE(4), 0, Math.pow(2, 32) - 1),
sizeY: Util.parseNumberBetween(rawCommand.readUInt32BE(8), 0, Math.pow(2, 32) - 1),

positionX: Util.parseNumberBetween(rawCommand.readInt32BE(12), -32768 * 1000, 32768 * 1000),
positionY: Util.parseNumberBetween(rawCommand.readInt32BE(16), -32768 * 1000, 32768 * 1000),
rotation: Util.parseNumberBetween(rawCommand.readInt32BE(20), -332230, 332230),

borderOuterWidth: Util.parseNumberBetween(rawCommand.readUInt16BE(24), 0, 65535),
borderInnerWidth: Util.parseNumberBetween(rawCommand.readUInt16BE(26), 0, 65535),
borderOuterSoftness: Util.parseNumberBetween(rawCommand.readUInt8(28), 0, 255),
borderInnerSoftness: Util.parseNumberBetween(rawCommand.readUInt8(29), 0, 255),
borderBevelSoftness: Util.parseNumberBetween(rawCommand.readUInt8(30), 0, 255),
borderBevelPosition: Util.parseNumberBetween(rawCommand.readUInt8(31), 0, 255),

borderOpacity: Util.parseNumberBetween(rawCommand.readUInt8(32), 0, 255),
borderHue: Util.parseNumberBetween(rawCommand.readUInt16BE(34), 0, 65535),
borderSaturation: Util.parseNumberBetween(rawCommand.readUInt16BE(36), 0, 65535),
borderLuma: Util.parseNumberBetween(rawCommand.readUInt16BE(38), 0, 65535),

lightSourceDirection: Util.parseNumberBetween(rawCommand.readUInt16BE(40), 0, 65535),
lightSourceAltitude: Util.parseNumberBetween(rawCommand.readUInt8(42), 0, 254),

maskEnabled: rawCommand[43] === 1,
maskTop: Util.parseNumberBetween(rawCommand.readInt16BE(44), -9000, 9000),
maskBottom: Util.parseNumberBetween(rawCommand.readInt16BE(46), -9000, 9000),
maskLeft: Util.parseNumberBetween(rawCommand.readInt16BE(48), -16000, 16000),
maskRight: Util.parseNumberBetween(rawCommand.readInt16BE(50), -16000, 16000)
}
}

applyToState (state: AtemState) {
const mixEffect = state.video.getMe(this.mixEffect)
const upstreamKeyer = mixEffect.getUpstreamKeyer(this.upstreamKeyerId)
upstreamKeyer.flyKeyframes[this.properties.keyFrameId] = {
...this.properties
}
return `video.ME.${this.mixEffect}.upstreamKeyers.${this.upstreamKeyerId}.flyKeyframes.${this.properties.keyFrameId}`
}
}
Loading

0 comments on commit 5bb512d

Please sign in to comment.