Skip to content

Commit

Permalink
Merge branch 'release52' into bbc-release52
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterC89 committed Oct 4, 2024
2 parents 46e9e30 + 59f6d37 commit a240f33
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DeviceStatus, StatusCode } from './../../devices/device'
import { CommandWithContext, DeviceStatus, StatusCode } from './../../devices/device'
import {
AbstractOptions,
Timeline,
Expand All @@ -10,10 +10,8 @@ import {
} from 'timeline-state-resolver-types'
import { Device } from '../../service/device'

export interface AbstractCommandWithContext {
export interface AbstractCommandWithContext extends CommandWithContext {
command: string
timelineObjId: string
context: string
}

export type DeviceOptionsAbstractInternal = DeviceOptionsAbstract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import { CommandWithContext, Device } from '../../service/device'
import { AtemStateBuilder } from './stateBuilder'
import { createDiffOptions } from './diffState'

export interface AtemCommandWithContext {
export interface AtemCommandWithContext extends CommandWithContext {
command: AtemCommands.ISerializableCommand[]
context: string
timelineObjId: string
}

type AtemDeviceState = DeviceState
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Commands as HyperdeckCommands, TransportStatus } from 'hyperdeck-connection'
import { CommandWithContext } from '../..'
import type { HyperdeckDeviceState } from './stateBuilder'

export interface HyperdeckCommandWithContext {
export interface HyperdeckCommandWithContext extends CommandWithContext {
command: HyperdeckCommands.AbstractCommand<any>
context: any
timelineObjId: string
}

function diffHyperdeckNotifyStates(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { EmberValue } from 'timeline-state-resolver-types'
import { LawoState } from './state'
import { Model as EmberModel } from 'emberplus-connection'
import { literal } from '../../lib'
import { CommandWithContext } from '../..'

export interface LawoCommandWithContext {
export interface LawoCommandWithContext extends CommandWithContext {
command: LawoCommand
context: string
timelineObjId: string
preliminary?: number
}

export enum LawoCommandType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Device } from '../../service/device'
import { OSCConnection } from './deviceConnection'
import { ResolvedTimelineObjectInstance } from 'superfly-timeline'
import * as osc from 'osc'
import { CommandWithContext } from '../..'

export interface MultiOscInitTestOptions {
oscSenders?: Record<string, (msg: osc.OscMessage, address?: string | undefined, port?: number | undefined) => void>
Expand All @@ -33,10 +34,8 @@ interface OSCDeviceStateContent extends OSCMessageCommandContent {
fromTlObject: string
}

export interface MultiOscCommandWithContext {
export interface MultiOscCommandWithContext extends CommandWithContext {
command: OSCDeviceStateContent
context: string
timelineObjId: string
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ interface OSCDeviceStateContent extends OSCMessageCommandContent {
fromTlObject: string
}

export interface OscCommandWithContext {
export interface OscCommandWithContext extends CommandWithContext {
command: OSCDeviceStateContent
context: string
timelineObjId: string
}

export class OscDevice extends Device<OSCOptions, OscDeviceState, OscCommandWithContext> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TimelineContentTypePanasonicPtz } from 'timeline-state-resolver-types'
import _ = require('underscore')
import { CommandWithContext } from '../..'
import { PanasonicPtzState } from './state'

const COMMAND_PRIORITY: Record<PanasonicPtzCommand['type'], number> = {
Expand All @@ -16,12 +17,9 @@ export interface PanasonicPtzCommand {
zoomSpeed?: number // -1 is full speed WIDE, +1 is full speed TELE, 0 is stationary
zoom?: number // 0 is WIDE, 1 is TELE
}
export interface PanasonicPtzCommandWithContext {
export interface PanasonicPtzCommandWithContext extends CommandWithContext {
command: PanasonicPtzCommand
context: CommandContext
timelineObjId: string
}
type CommandContext = any

export function diffStates(
oldPtzState: PanasonicPtzState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ import { Pharos } from './connection'
import { Device, CommandWithContext, DeviceContextAPI } from '../../service/device'
import { diffStates } from './diffStates'

export interface PharosCommandWithContext {
export interface PharosCommandWithContext extends CommandWithContext {
command: CommandContent
context: string
timelineObjId: string
}
export type PharosState = Timeline.StateInTime<TSRTimelineContent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ interface OSCDeviceStateContent extends OSCMessageCommandContent {
fromTlObject: string
}

export interface QuantelCommandWithContext {
export interface QuantelCommandWithContext extends CommandWithContext {
command: QuantelCommand
context: string
timelineObjId: string
preliminary?: number
}

export class QuantelDevice extends Device<QuantelOptions, QuantelState, QuantelCommandWithContext> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ShotokuTransitionType,
ShotokuOptions,
} from 'timeline-state-resolver-types'
import { Device } from '../../service/device'
import { CommandWithContext, Device } from '../../service/device'

import _ = require('underscore')
import { ShotokuAPI, ShotokuCommand, ShotokuCommandType } from './connection'
Expand All @@ -25,10 +25,8 @@ interface ShotokuSequence {
shots: TimelineContentShotokuSequence['shots']
}

export interface ShotokuCommandWithContext {
export interface ShotokuCommandWithContext extends CommandWithContext {
command: ShotokuCommand // todo
context: string
timelineObjId: string
}

export class ShotokuDevice extends Device<ShotokuOptions, ShotokuDeviceState, ShotokuCommandWithContext> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ export interface SingularLiveCommandContent {
subCompositionName: string
}

export interface SingularLiveCommandContext {
export interface SingularLiveCommandContext extends CommandWithContext {
command: Command
context: string
timelineObjId: string
}

interface Command {
Expand Down
39 changes: 16 additions & 23 deletions packages/timeline-state-resolver/src/integrations/sisyfos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,11 @@ const debug = Debug('timeline-state-resolver:sisyfos')
export interface DeviceOptionsSisyfosInternal extends DeviceOptionsSisyfos {
commandReceiver?: CommandReceiver
}
export type CommandReceiver = (
time: number,
cmd: SisyfosCommand,
context: CommandContext,
timelineObjId: string
) => Promise<any>
interface Command {
content: SisyfosCommand
context: CommandContext
timelineObjId: string
export type CommandReceiver = (time: number, cmd: SisyfosCommand, context: any, timelineObjId: string) => Promise<any>
interface Command extends CommandWithContext {
command: SisyfosCommand
}
type CommandContext = string

/**
* This is a generic wrapper for any osc-enabled device.
*/
Expand Down Expand Up @@ -492,7 +485,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
time,
undefined,
async (cmd: Command) => {
return this._commandReceiver(time, cmd.content, cmd.context, cmd.timelineObjId)
return this._commandReceiver(time, cmd.command, cmd.context, cmd.timelineObjId)
},
cmd
)
Expand All @@ -507,7 +500,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
if (newOscSendState.resync && !oldOscSendState.resync) {
commands.push({
context: `Resyncing with Sisyfos`,
content: {
command: {
type: SisyfosCommandType.RESYNC,
},
timelineObjId: '',
Expand All @@ -523,7 +516,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug('reset channel ' + index)
commands.push({
context: `Channel ${index} reset`,
content: {
command: {
type: SisyfosCommandType.SET_CHANNEL,
channel: Number(index),
values: newChannel,
Expand Down Expand Up @@ -556,7 +549,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
}
commands.push({
context: `Channel ${index} pgm goes from "${oldChannel.pgmOn}" to "${newChannel.pgmOn}"`,
content: {
command: {
type: SisyfosCommandType.TOGGLE_PGM,
channel: Number(index),
values,
Expand All @@ -569,7 +562,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug(`Channel ${index} pst goes from "${oldChannel.pstOn}" to "${newChannel.pstOn}"`)
commands.push({
context: `Channel ${index} pst goes from "${oldChannel.pstOn}" to "${newChannel.pstOn}"`,
content: {
command: {
type: SisyfosCommandType.TOGGLE_PST,
channel: Number(index),
value: newChannel.pstOn,
Expand All @@ -586,7 +579,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
}
commands.push({
context: 'faderLevel change',
content: {
command: {
type: SisyfosCommandType.SET_FADER,
channel: Number(index),
values,
Expand All @@ -600,7 +593,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug(`set label on fader ${index}: "${newChannel.label}"`)
commands.push({
context: 'set label on fader',
content: {
command: {
type: SisyfosCommandType.LABEL,
channel: Number(index),
value: newChannel.label,
Expand All @@ -613,7 +606,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug(`Channel ${index} Visibility goes from "${oldChannel.visible}" to "${newChannel.visible}"`)
commands.push({
context: `Channel ${index} Visibility goes from "${oldChannel.visible}" to "${newChannel.visible}"`,
content: {
command: {
type: SisyfosCommandType.VISIBLE,
channel: Number(index),
value: newChannel.visible,
Expand All @@ -626,7 +619,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug(`Channel ${index} mute goes from "${oldChannel.muteOn}" to "${newChannel.muteOn}"`)
commands.push({
context: `Channel ${index} mute goes from "${oldChannel.muteOn}" to "${newChannel.muteOn}"`,
content: {
command: {
type: SisyfosCommandType.SET_MUTE,
channel: Number(index),
value: newChannel.muteOn,
Expand All @@ -639,7 +632,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug(`Channel ${index} inputGain goes from "${oldChannel.inputGain}" to "${newChannel.inputGain}"`)
commands.push({
context: `Channel ${index} inputGain goes from "${oldChannel.inputGain}" to "${newChannel.inputGain}"`,
content: {
command: {
type: SisyfosCommandType.SET_INPUT_GAIN,
channel: Number(index),
value: newChannel.inputGain,
Expand All @@ -652,7 +645,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
debug(`Channel ${index} inputSelector goes from "${oldChannel.inputSelector}" to "${newChannel.inputSelector}"`)
commands.push({
context: `Channel ${index} inputSelector goes from "${oldChannel.inputSelector}" to "${newChannel.inputSelector}"`,
content: {
command: {
type: SisyfosCommandType.SET_INPUT_SELECTOR,
channel: Number(index),
value: newChannel.inputSelector,
Expand All @@ -667,7 +660,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
private async _defaultCommandReceiver(
_time: number,
cmd: SisyfosCommand,
context: CommandContext,
context: string,
timelineObjId: string
): Promise<any> {
const cwc: CommandWithContext = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ import { CommandWithContext, Device } from '../../service/device'
import { diffStates } from './diffStates'
import { buildSofieChefState } from './stateBuilder'

export interface SofieChefCommandWithContext {
export interface SofieChefCommandWithContext extends CommandWithContext {
command: ReceiveWSMessageAny
context: string
timelineObjId: string
}
export interface SofieChefState {
windows: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ interface TelemetricsState {
presetShotIdentifiers: number[]
}

interface TelemetricsCommandWithContext {
interface TelemetricsCommandWithContext extends CommandWithContext {
command: { presetShotIdentifier: number }
context: string
timelineObjId: string
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CommandWithContext } from '../../service/device'

/**
* Values in this enum correspond to actual shortcut names or their suffixes
*/
Expand Down Expand Up @@ -169,11 +171,8 @@ export type TriCasterGenericCommandName<T> = T extends boolean
? TriCasterGenericNumberCommand['name']
: never

export type TriCasterCommandContext = any
export interface TriCasterCommandWithContext {
export interface TriCasterCommandWithContext extends CommandWithContext {
command: TriCasterCommand
context: TriCasterCommandContext
timelineObjId: string
temporalPriority: number
}

Expand Down

0 comments on commit a240f33

Please sign in to comment.