atem-connection
Advanced tools
Comparing version 2.1.0-nightly-20200824-202933-7fd86b9.0 to 2.1.0-nightly-20200828-192415-a1cc735.0
@@ -125,2 +125,4 @@ /// <reference types="node" /> | ||
setAudioMixerMasterProps(props: Partial<AudioMasterChannel>): Promise<void>; | ||
setFairlightAudioMixerInputProps(index: number, props: Commands.FairlightMixerInputCommand['properties']): Promise<void>; | ||
setFairlightAudioMixerSourceProps(index: number, source: string, props: Commands.FairlightMixerSourceCommand['properties']): Promise<void>; | ||
startStreaming(): Promise<void>; | ||
@@ -127,0 +129,0 @@ stopStreaming(): Promise<void>; |
@@ -13,2 +13,4 @@ "use strict"; | ||
const tally_1 = require("./lib/tally"); | ||
const atemUtil_1 = require("./lib/atemUtil"); | ||
const bigInt = require("big-integer"); | ||
var AtemConnectionStatus; | ||
@@ -112,6 +114,6 @@ (function (AtemConnectionStatus) { | ||
if (e instanceof state_1.InvalidIdError) { | ||
this.emit('debug', `Invalid command id: ${e}. Command: ${command.constructor.name} ${JSON.stringify(command)}`); | ||
this.emit('debug', `Invalid command id: ${e}. Command: ${command.constructor.name} ${atemUtil_1.commandStringify(command)}`); | ||
} | ||
else { | ||
this.emit('error', `MutateState failed: ${e}. Command: ${command.constructor.name} ${JSON.stringify(command)}`); | ||
this.emit('error', `MutateState failed: ${e}. Command: ${command.constructor.name} ${atemUtil_1.commandStringify(command)}`); | ||
} | ||
@@ -461,2 +463,19 @@ } | ||
} | ||
setFairlightAudioMixerInputProps(index, props) { | ||
if (this.state && this.state.info.apiVersion >= Enums.ProtocolVersion.V8_0) { | ||
const command = new Commands.FairlightMixerInputV8Command(index); | ||
command.updateProps(props); | ||
return this.sendCommand(command); | ||
} | ||
else { | ||
const command = new Commands.FairlightMixerInputCommand(index); | ||
command.updateProps(props); | ||
return this.sendCommand(command); | ||
} | ||
} | ||
setFairlightAudioMixerSourceProps(index, source, props) { | ||
const command = new Commands.FairlightMixerSourceCommand(index, bigInt(source)); | ||
command.updateProps(props); | ||
return this.sendCommand(command); | ||
} | ||
startStreaming() { | ||
@@ -463,0 +482,0 @@ const command = new Commands.StreamingStatusCommand(true); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const state_1 = require("../../state"); | ||
const __1 = require("../.."); | ||
@@ -47,2 +48,5 @@ const CommandBase_1 = require("../CommandBase"); | ||
applyToState(state) { | ||
if (!state.audio) { | ||
throw new state_1.InvalidIdError('Classic Audio'); | ||
} | ||
state.audio.channels[this.index] = Object.assign(Object.assign({}, this.properties), { rcaToXlrEnabled: false, supportsRcaToXlrEnabled: false }); | ||
@@ -73,2 +77,5 @@ return `audio.channels.${this.index}`; | ||
applyToState(state) { | ||
if (!state.audio) { | ||
throw new state_1.InvalidIdError('Classic Audio'); | ||
} | ||
state.audio.channels[this.index] = this.properties; | ||
@@ -75,0 +82,0 @@ return `audio.channels.${this.index}`; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const CommandBase_1 = require("../CommandBase"); | ||
const state_1 = require("../../state"); | ||
const __1 = require("../.."); | ||
@@ -32,2 +33,5 @@ class AudioMixerMasterCommand extends CommandBase_1.WritableCommand { | ||
applyToState(state) { | ||
if (!state.audio) { | ||
throw new state_1.InvalidIdError('Classic Audio'); | ||
} | ||
state.audio.master = Object.assign(Object.assign({}, state.audio.master), this.properties); | ||
@@ -34,0 +38,0 @@ return `audio.master`; |
@@ -17,2 +17,7 @@ "use strict"; | ||
state.info.audioMixer = this.properties; | ||
state.audio = { | ||
numberOfChannels: this.properties.inputs, | ||
hasMonitor: this.properties.monitors != 0, | ||
channels: [] | ||
}; | ||
return `info.audioMixer`; | ||
@@ -19,0 +24,0 @@ } |
@@ -10,1 +10,2 @@ export * from './versionCommand'; | ||
export * from './multiviewerConfigCommand'; | ||
export * from './fairlightAudioMixerConfigCommand'; |
@@ -13,2 +13,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./multiviewerConfigCommand"), exports); | ||
tslib_1.__exportStar(require("./fairlightAudioMixerConfigCommand"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,2 +5,3 @@ export * from './Audio'; | ||
export * from './DownstreamKey'; | ||
export * from './Fairlight'; | ||
export * from './Inputs'; | ||
@@ -7,0 +8,0 @@ export * from './Macro'; |
@@ -8,2 +8,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./DownstreamKey"), exports); | ||
tslib_1.__exportStar(require("./Fairlight"), exports); | ||
tslib_1.__exportStar(require("./Inputs"), exports); | ||
@@ -10,0 +11,0 @@ tslib_1.__exportStar(require("./Macro"), exports); |
@@ -253,1 +253,26 @@ export declare enum Model { | ||
} | ||
export declare enum FairlightAudioMixOption { | ||
Off = 1, | ||
On = 2, | ||
AudioFollowVideo = 4 | ||
} | ||
export declare enum FairlightInputConfiguration { | ||
Mono = 1, | ||
Stereo = 2, | ||
DualMono = 4 | ||
} | ||
export declare enum FairlightAnalogInputLevel { | ||
Microphone = 1, | ||
ConsumerLine = 2, | ||
ProLine = 4 | ||
} | ||
export declare enum FairlightAudioSourceType { | ||
Mono = 0, | ||
Stereo = 1 | ||
} | ||
export declare enum FairlightInputType { | ||
EmbeddedWithVideo = 0, | ||
MediaPlayer = 1, | ||
AudioIn = 2, | ||
MADI = 4 | ||
} |
@@ -282,2 +282,33 @@ "use strict"; | ||
})(RecordingDiskStatus = exports.RecordingDiskStatus || (exports.RecordingDiskStatus = {})); | ||
var FairlightAudioMixOption; | ||
(function (FairlightAudioMixOption) { | ||
FairlightAudioMixOption[FairlightAudioMixOption["Off"] = 1] = "Off"; | ||
FairlightAudioMixOption[FairlightAudioMixOption["On"] = 2] = "On"; | ||
FairlightAudioMixOption[FairlightAudioMixOption["AudioFollowVideo"] = 4] = "AudioFollowVideo"; | ||
})(FairlightAudioMixOption = exports.FairlightAudioMixOption || (exports.FairlightAudioMixOption = {})); | ||
var FairlightInputConfiguration; | ||
(function (FairlightInputConfiguration) { | ||
FairlightInputConfiguration[FairlightInputConfiguration["Mono"] = 1] = "Mono"; | ||
FairlightInputConfiguration[FairlightInputConfiguration["Stereo"] = 2] = "Stereo"; | ||
FairlightInputConfiguration[FairlightInputConfiguration["DualMono"] = 4] = "DualMono"; | ||
})(FairlightInputConfiguration = exports.FairlightInputConfiguration || (exports.FairlightInputConfiguration = {})); | ||
var FairlightAnalogInputLevel; | ||
(function (FairlightAnalogInputLevel) { | ||
FairlightAnalogInputLevel[FairlightAnalogInputLevel["Microphone"] = 1] = "Microphone"; | ||
FairlightAnalogInputLevel[FairlightAnalogInputLevel["ConsumerLine"] = 2] = "ConsumerLine"; | ||
// [Since(ProtocolVersion.V8_1_1)] | ||
FairlightAnalogInputLevel[FairlightAnalogInputLevel["ProLine"] = 4] = "ProLine"; | ||
})(FairlightAnalogInputLevel = exports.FairlightAnalogInputLevel || (exports.FairlightAnalogInputLevel = {})); | ||
var FairlightAudioSourceType; | ||
(function (FairlightAudioSourceType) { | ||
FairlightAudioSourceType[FairlightAudioSourceType["Mono"] = 0] = "Mono"; | ||
FairlightAudioSourceType[FairlightAudioSourceType["Stereo"] = 1] = "Stereo"; | ||
})(FairlightAudioSourceType = exports.FairlightAudioSourceType || (exports.FairlightAudioSourceType = {})); | ||
var FairlightInputType; | ||
(function (FairlightInputType) { | ||
FairlightInputType[FairlightInputType["EmbeddedWithVideo"] = 0] = "EmbeddedWithVideo"; | ||
FairlightInputType[FairlightInputType["MediaPlayer"] = 1] = "MediaPlayer"; | ||
FairlightInputType[FairlightInputType["AudioIn"] = 2] = "AudioIn"; | ||
FairlightInputType[FairlightInputType["MADI"] = 4] = "MADI"; | ||
})(FairlightInputType = exports.FairlightInputType || (exports.FairlightInputType = {})); | ||
//# sourceMappingURL=index.js.map |
/// <reference types="node" /> | ||
import * as Enums from '../enums'; | ||
import * as bigInt from 'big-integer'; | ||
export declare function bufToBase64String(buffer: Buffer, start: number, length: number): string; | ||
export declare function bufToNullTerminatedString(buffer: Buffer, start: number, length: number): string; | ||
export declare function bufToBigInt(buffer: Buffer, start: number): bigInt.BigInteger; | ||
export declare function bigIntToBuf(buffer: Buffer, val: bigInt.BigInteger, start: number): void; | ||
export declare const COMMAND_CONNECT_HELLO: Buffer; | ||
@@ -23,1 +26,2 @@ /** | ||
export declare function getComponents(val: number): number[]; | ||
export declare function commandStringify(command: any): string; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const WaveFile = require("wavefile"); | ||
const bigInt = require("big-integer"); | ||
function bufToBase64String(buffer, start, length) { | ||
@@ -16,2 +17,22 @@ return buffer.toString('base64', start, start + length); | ||
exports.bufToNullTerminatedString = bufToNullTerminatedString; | ||
const UINT63_MAX = bigInt.one.shiftLeft(63); | ||
const UINT64_MAX = bigInt.one.shiftLeft(64); | ||
function bufToBigInt(buffer, start) { | ||
const hex = buffer.toString('hex', start, start + 8); | ||
const rawVal = bigInt(hex, 16); | ||
if (rawVal.greater(UINT63_MAX)) { | ||
return UINT64_MAX.subtract(rawVal).negate(); | ||
} | ||
else { | ||
return rawVal; | ||
} | ||
} | ||
exports.bufToBigInt = bufToBigInt; | ||
function bigIntToBuf(buffer, val, start) { | ||
if (val.isNegative()) | ||
val = UINT64_MAX.subtract(val.negate()); | ||
const str = val.toString(16).padStart(16, '0'); | ||
buffer.write(str, start, 'hex'); | ||
} | ||
exports.bigIntToBuf = bigIntToBuf; | ||
exports.COMMAND_CONNECT_HELLO = Buffer.from([ | ||
@@ -180,2 +201,6 @@ 0x10, | ||
exports.getComponents = getComponents; | ||
function commandStringify(command) { | ||
return JSON.stringify(command, (_key, value) => typeof value === 'bigint' || bigInt.isInstance(value) ? value.toString() : value); | ||
} | ||
exports.commandStringify = commandStringify; | ||
//# sourceMappingURL=atemUtil.js.map |
import { AudioSourceType, ExternalPortType, AudioMixOption } from '../enums'; | ||
export interface AudioChannel { | ||
export declare type AudioChannel = ClassicAudioChannel; | ||
export declare type AudioMasterChannel = ClassicAudioMasterChannel; | ||
export declare type AtemAudioState = AtemClassicAudioState; | ||
export interface ClassicAudioChannel { | ||
readonly sourceType: AudioSourceType; | ||
@@ -13,3 +16,3 @@ portType: ExternalPortType; | ||
} | ||
export interface AudioMasterChannel { | ||
export interface ClassicAudioMasterChannel { | ||
/** Gain in decibel, -Infinity to +6dB */ | ||
@@ -21,9 +24,9 @@ gain: number; | ||
} | ||
export interface AtemAudioState { | ||
export interface AtemClassicAudioState { | ||
readonly numberOfChannels?: number; | ||
readonly hasMonitor?: boolean; | ||
channels: { | ||
[channelId: number]: AudioChannel | undefined; | ||
[channelId: number]: ClassicAudioChannel | undefined; | ||
}; | ||
master?: AudioMasterChannel; | ||
master?: ClassicAudioMasterChannel; | ||
} |
import { DeviceInfo } from './info'; | ||
import { AtemVideoState } from './video'; | ||
import { AtemAudioState } from './audio'; | ||
import { AtemClassicAudioState } from './audio'; | ||
import { MediaState } from './media'; | ||
@@ -10,2 +10,3 @@ import { InputChannel } from './input'; | ||
import { StreamingState } from './streaming'; | ||
import { AtemFairlightAudioState } from './fairlight'; | ||
import * as AtemStateUtil from './util'; | ||
@@ -16,3 +17,4 @@ export { AtemStateUtil }; | ||
video: AtemVideoState; | ||
audio: AtemAudioState; | ||
audio?: AtemClassicAudioState; | ||
fairlight?: AtemFairlightAudioState; | ||
media: MediaState; | ||
@@ -19,0 +21,0 @@ inputs: { |
@@ -30,2 +30,6 @@ import { Model, ProtocolVersion } from '../enums'; | ||
} | ||
export interface FairlightAudioMixerInfo { | ||
readonly inputs: number; | ||
readonly monitors: number; | ||
} | ||
export interface MacroPoolInfo { | ||
@@ -58,2 +62,3 @@ readonly macroCount: number; | ||
audioMixer?: AudioMixerInfo; | ||
fairlightMixer?: FairlightAudioMixerInfo; | ||
macroPool?: MacroPoolInfo; | ||
@@ -60,0 +65,0 @@ mediaPool?: MediaPoolInfo; |
@@ -19,5 +19,2 @@ "use strict"; | ||
}, | ||
audio: { | ||
channels: {} | ||
}, | ||
media: { | ||
@@ -24,0 +21,0 @@ stillPool: [], |
{ | ||
"name": "atem-connection", | ||
"version": "2.1.0-nightly-20200824-202933-7fd86b9.0", | ||
"version": "2.1.0-nightly-20200828-192415-a1cc735.0", | ||
"description": "Typescript Node.js library for connecting with an ATEM switcher.", | ||
@@ -97,2 +97,3 @@ "main": "dist/index.js", | ||
"jest-resolve": "^25.5.0", | ||
"jest-verify-node-version": "^1.0.3", | ||
"lint-staged": "^9.2.5", | ||
@@ -118,2 +119,3 @@ "node-license-validator": "^1.3.0", | ||
"dependencies": { | ||
"big-integer": "^1.6.48", | ||
"eventemitter3": "^4.0.4", | ||
@@ -120,0 +122,0 @@ "exit-hook": "^2.0.0", |
# Sofie: The Modern TV News Studio Automation System (ATEM connection library) | ||
[](https://circleci.com/gh/nrkno/tv-automation-atem-connection) | ||
@@ -10,6 +11,6 @@ [](https://codecov.io/gh/nrkno/tv-automation-atem-connection) | ||
| Version | Level of Support | | ||
| ----- | ----- | | ||
| v8.0 - v8.1 | Primary focus. Target for new features | | ||
| v7.2 | Previous focus, should still work well | | ||
| Version | Level of Support | | ||
| ------------- | ----------------------------------------------------------------- | | ||
| v8.0 - v8.4 | Primary focus. Target for new features | | ||
| v7.2 | Previous focus, should still work well | | ||
| v7.3 - v7.5.2 | Community tested, we may accept PRs but will not be testing these | | ||
@@ -25,2 +26,3 @@ | ||
## Technology highlights | ||
- Typescript | ||
@@ -35,2 +37,3 @@ - Yarn | ||
For usage by library consumers installation is as easy as: | ||
```sh | ||
@@ -41,2 +44,3 @@ yarn add atem-connection | ||
For library developers installation steps are as following: | ||
```sh | ||
@@ -70,4 +74,4 @@ git clone https://github.com/nrkno/tv-automation-atem-connection | ||
myAtem.on('stateChanged', (state, pathToChange) => { | ||
console.log(state); // catch the ATEM state. | ||
}); | ||
console.log(state) // catch the ATEM state. | ||
}) | ||
``` | ||
@@ -82,23 +86,23 @@ | ||
- `error` | ||
This event will be fired when an error occurs in the connection. Node requires you to handle these errors, or your application will quit. | ||
This event will be fired when an error occurs in the connection. Node requires you to handle these errors, or your application will quit. | ||
- `info` | ||
This event will be fired when the connection provides some logging information. | ||
This event will be fired when the connection provides some logging information. | ||
- `debug` | ||
This event is not useful for most users. It will emit some messages useful to figure out why some data useful mostly to library developers. | ||
This event is not useful for most users. It will emit some messages useful to figure out why some data useful mostly to library developers. | ||
- `connected` | ||
This event will be fired once we have connected with the ATEM. | ||
This event will be fired once we have connected with the ATEM. | ||
- `disconnected` | ||
Whenever the connection to the ATEM fails and does not recover within 5 seconds this is called. | ||
Whenever the connection to the ATEM fails and does not recover within 5 seconds this is called. | ||
- `stateChanged(state, path)` | ||
Whenever a packet from the ATEM is received that changes the state, this event will be fired. | ||
The path parameter is a path into the state that represents the change, to allow for filtering of events. eg video.ME.0.programInput | ||
Whenever a packet from the ATEM is received that changes the state, this event will be fired. | ||
The path parameter is a path into the state that represents the change, to allow for filtering of events. eg video.ME.0.programInput | ||
- `receivedCommand(command)` | ||
Whenever a packet from the ATEM is received that contains a command, this event will be fired. | ||
This should not be relied on in most usage, as the commands can and will have breaking changes in patch releases. This event is needed for some use cases, so if this is used you should likely pin the version down to a specific patch release to ensure nothing breaks. | ||
Whenever a packet from the ATEM is received that contains a command, this event will be fired. | ||
This should not be relied on in most usage, as the commands can and will have breaking changes in patch releases. This event is needed for some use cases, so if this is used you should likely pin the version down to a specific patch release to ensure nothing breaks. | ||
@@ -108,2 +112,3 @@ ## Debug | ||
Set `debugBuffers=true` config option in order to see raw packets. This is especially useful for library developers. | ||
```javascript | ||
@@ -115,2 +120,3 @@ const myAtem = new Atem({ debugBuffers: true }) | ||
``` | ||
```sh | ||
@@ -127,5 +133,7 @@ SEND <Buffer 10 14 53 ab 00 00 00 00 00 3a 00 00 01 00 00 00 00 00 00 00> | ||
This module run tests with jest. | ||
```sh | ||
$ yarn unit | ||
``` | ||
There is a suite of generated serialization tests, using [atem-connection-test-generator](https://github.com/LibAtem/atem-connection-test-generator) as the [LibAtem](https://github.com/LibAtem) project has tests to verify its serialization against the Blackmagic Atem SDK |
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
674585
433
9318
131
7
29
+ Addedbig-integer@^1.6.48
+ Addedbig-integer@1.6.52(transitive)