diff --git a/src/atem.ts b/src/atem.ts index 4ae7edc17..e519fbc7b 100644 --- a/src/atem.ts +++ b/src/atem.ts @@ -1078,6 +1078,11 @@ export class Atem extends BasicAtem { return this.sendCommand(command) } + public async setEnableISORecording(enabled: boolean): Promise { + const command = new Commands.RecordingISOCommand(enabled) + return this.sendCommand(command) + } + public async saveStartupState(): Promise { const command = new Commands.StartupStateSaveCommand() return this.sendCommand(command) diff --git a/src/commands/Recording/RecordingISOCommand.ts b/src/commands/Recording/RecordingISOCommand.ts new file mode 100644 index 000000000..f7c19861a --- /dev/null +++ b/src/commands/Recording/RecordingISOCommand.ts @@ -0,0 +1,34 @@ +import { SymmetricalCommand } from '../CommandBase' +import { AtemState, InvalidIdError } from '../../state' +import { ProtocolVersion } from '../../enums' + +export class RecordingISOCommand extends SymmetricalCommand<{ recordAllInputs: boolean }> { + public static readonly rawName = 'ISOi' + public static readonly minimumVersion = ProtocolVersion.V8_1_1 + + constructor(recordAllInputs: boolean) { + super({ recordAllInputs }) + } + + public serialize(): Buffer { + const buffer = Buffer.alloc(4) + buffer.writeUInt8(this.properties.recordAllInputs ? 1 : 0, 0) + return buffer + } + + public static deserialize(rawCommand: Buffer): RecordingISOCommand { + const recordAllInputs = rawCommand.readUInt8(0) > 0 + + return new RecordingISOCommand(recordAllInputs) + } + + public applyToState(state: AtemState): string { + if (!state.recording) { + throw new InvalidIdError('Recording') + } + + state.recording.recordAllInputs = this.properties.recordAllInputs + + return `recording.recordAllInputs` + } +} diff --git a/src/commands/Recording/index.ts b/src/commands/Recording/index.ts index 918976eb6..98addadd2 100644 --- a/src/commands/Recording/index.ts +++ b/src/commands/Recording/index.ts @@ -1,4 +1,5 @@ export * from './RecordingDiskCommand' export * from './RecordingDurationCommand' +export * from './RecordingISOCommand' export * from './RecordingSettingsCommand' export * from './RecordingStatusCommand' diff --git a/src/state/recording.ts b/src/state/recording.ts index 13cf0fa61..0101ce4dd 100644 --- a/src/state/recording.ts +++ b/src/state/recording.ts @@ -5,6 +5,8 @@ export interface RecordingState { status?: RecordingStateStatus properties: RecordingStateProperties + recordAllInputs?: boolean + duration?: Timecode disks: { [id: number]: RecordingDiskProperties | undefined }