Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion packages/timeline-state-resolver-types/src/generated/kairos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ export interface MappingKairosSceneLayer {
mappingType: MappingKairosType.SceneLayer
}

export interface MappingKairosSceneLayerEffect {
effectType:
| 'crop'
| 'transform2D'
| 'luminanceKey'
| 'chromaKey'
| 'yUVCorrection'
| 'rGBCorrection'
| 'lUTCorrection'
| 'virtualPTZ'
| 'toneCurveCorrection'
| 'matrixCorrection'
| 'temperatureCorrection'
| 'linearKey'
| 'position'
| 'pCrop'
| 'filmLook'
| 'glowEffect'
sceneName: string[]
layerName: string[]
effectName?: string[]
temporalPriority?: number
mappingType: MappingKairosType.SceneLayerEffect
}

export interface MappingKairosAux {
auxName: string
temporalPriority?: number
Expand Down Expand Up @@ -75,6 +100,7 @@ export interface MappingKairosSoundPlayer {
export enum MappingKairosType {
Scene = 'scene',
SceneLayer = 'scene-layer',
SceneLayerEffect = 'scene-layer-effect',
Aux = 'aux',
Macro = 'macro',
ClipPlayer = 'clip-player',
Expand All @@ -83,7 +109,7 @@ export enum MappingKairosType {
SoundPlayer = 'sound-player',
}

export type SomeMappingKairos = MappingKairosScene | MappingKairosSceneLayer | MappingKairosAux | MappingKairosMacro | MappingKairosClipPlayer | MappingKairosRamRecPlayer | MappingKairosImageStore | MappingKairosSoundPlayer
export type SomeMappingKairos = MappingKairosScene | MappingKairosSceneLayer | MappingKairosSceneLayerEffect | MappingKairosAux | MappingKairosMacro | MappingKairosClipPlayer | MappingKairosRamRecPlayer | MappingKairosImageStore | MappingKairosSoundPlayer

export interface ListScenesPayload {
scenePath: string[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,28 @@ import type {
MediaImageRef,
DissolveMode,
UpdateImageStoreObject,
UpdateEffectChromaKeyObject,
UpdateEffectCropObject,
UpdateEffectFilmLookObject,
UpdateEffectGlowEffectObject,
UpdateEffectLinearKeyObject,
UpdateEffectLuminanceKeyObject,
UpdateEffectLUTCorrectionObject,
UpdateEffectMatrixCorrectionObject,
UpdateEffectPCropObject,
UpdateEffectPositionObject,
UpdateEffectRGBCorrectionObject,
UpdateEffectTemperatureCorrectionObject,
UpdateEffectToneCurveCorrectionObject,
UpdateEffectTransform2DObject,
UpdateEffectVirtualPTZObject,
UpdateEffectYUVCorrectionObject,
} from 'kairos-lib'

export enum TimelineContentTypeKairos {
SCENE = 'scene',
SCENE_LAYER = 'scene-layer',
SCENE_LAYER_EFFECT = 'scene-layer-effect',

// MVs? - no
// gfx / painter - yes, to be implemented
Expand All @@ -41,6 +58,7 @@ type PartialOrNull<T> = {
export type TimelineContentKairosAny =
| TimelineContentKairosScene
| TimelineContentKairosSceneLayer
| TimelineContentKairosSceneLayerEffect
| TimelineContentKairosAux
| TimelineContentKairosMacros
| TimelineContentKairosClipPlayer
Expand Down Expand Up @@ -81,6 +99,30 @@ export interface TimelineContentKairosSceneLayer {
}
>
}
export interface TimelineContentKairosSceneLayerEffect {
deviceType: DeviceType.KAIROS
type: TimelineContentTypeKairos.SCENE_LAYER_EFFECT

effect: TimelineContentKairosSceneAnySceneLayerEffect
}

export type TimelineContentKairosSceneAnySceneLayerEffect =
| { type: 'crop'; values: Partial<UpdateEffectCropObject> }
| { type: 'transform2D'; values: Partial<UpdateEffectTransform2DObject> }
| { type: 'luminanceKey'; values: Partial<UpdateEffectLuminanceKeyObject> }
| { type: 'chromaKey'; values: Partial<UpdateEffectChromaKeyObject> }
| { type: 'yUVCorrection'; values: Partial<UpdateEffectYUVCorrectionObject> }
| { type: 'rGBCorrection'; values: Partial<UpdateEffectRGBCorrectionObject> }
| { type: 'lUTCorrection'; values: Partial<UpdateEffectLUTCorrectionObject> }
| { type: 'virtualPTZ'; values: Partial<UpdateEffectVirtualPTZObject> }
| { type: 'toneCurveCorrection'; values: Partial<UpdateEffectToneCurveCorrectionObject> }
| { type: 'matrixCorrection'; values: Partial<UpdateEffectMatrixCorrectionObject> }
| { type: 'temperatureCorrection'; values: Partial<UpdateEffectTemperatureCorrectionObject> }
| { type: 'linearKey'; values: Partial<UpdateEffectLinearKeyObject> }
| { type: 'position'; values: Partial<UpdateEffectPositionObject> }
| { type: 'pCrop'; values: Partial<UpdateEffectPCropObject> }
| { type: 'filmLook'; values: Partial<UpdateEffectFilmLookObject> }
| { type: 'glowEffect'; values: Partial<UpdateEffectGlowEffectObject> }

export interface TimelineContentKairosAux {
deviceType: DeviceType.KAIROS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,87 @@
],
"additionalProperties": false
},
"scene-layer-effect": {
"type": "object",
"properties": {
"effectType": {
"type": "string",
"enum": [
"crop",
"transform2D",
"luminanceKey",
"chromaKey",
"yUVCorrection",
"rGBCorrection",
"lUTCorrection",
"virtualPTZ",
"toneCurveCorrection",
"matrixCorrection",
"temperatureCorrection",
"linearKey",
"position",
"pCrop",
"filmLook",
"glowEffect"
],
"ui:title": "Effect Type",
"ui:description": "Type of Layer Effect",
"ui:summaryTitle": "Effect Type",
"ui:displayType": "breadcrumbs",
"default": []
},
"sceneName": {
"type": "array",
"items": {
"type": "string"
},
"ui:title": "Scene",
"ui:description": "The Scene to use",
"ui:summaryTitle": "Scene",
"ui:displayType": "breadcrumbs",
"default": [
"Main"
]
},
"layerName": {
"type": "array",
"items": {
"type": "string"
},
"ui:title": "Layer",
"ui:description": "The layer in a scene to use",
"ui:summaryTitle": "Layer",
"ui:displayType": "breadcrumbs",
"default": [
"Background"
]
},
"effectName": {
"type": "array",
"items": {
"type": "string"
},
"ui:title": "Effect",
"ui:description": "Name of the effect (optional)",
"ui:summaryTitle": "Effect Name",
"ui:displayType": "breadcrumbs",
"default": []
},
"temporalPriority": {
"type": "integer",
"ui:title": "Temporal Priority",
"ui:description": "Set this to a higher value to make commands that affects this Scene be sent first. Set this to a negative value to ensure that other untracked things are done first. Defaults to 0.",
"ui:summaryTitle": "Temporal Priority",
"default": 0
}
},
"required": [
"effectType",
"sceneName",
"layerName"
],
"additionalProperties": false
},
"aux": {
"type": "object",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
layerName: ['Background'],
},
},
mainSceneBackgroundLayerLuminance: {
device: DeviceType.KAIROS,
deviceId: 'kairos0',
options: {
mappingType: MappingKairosType.SceneLayerEffect,
effectType: 'luminanceKey',
sceneName: ['Main'],
layerName: ['Background'],
},
},
clipPlayer1: {
device: DeviceType.KAIROS,
deviceId: 'kairos0',
Expand All @@ -43,7 +53,7 @@
beforeEach(() => {
now = 10000
})
test('empty state to empty state', () => {

Check warning on line 56 in packages/timeline-state-resolver/src/integrations/kairos/__tests__/diffState.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Test has no assertions
compareStates(DEFAULT_MAPPINGS, undefined, { ...EMPTY_STATE, stateTime: 0 }, [])
})
test('Assign Camera1 to SceneLayer', () => {
Expand Down Expand Up @@ -491,7 +501,64 @@
compareStates(DEFAULT_MAPPINGS, oldState, newState, [])
})
})
test('Set LuminanceKey of SceneLayer', () => {
compareStates(
DEFAULT_MAPPINGS,
{ ...EMPTY_STATE, stateTime: now },
KairosStateBuilder.fromTimeline(
{
objects: [
makeDeviceTimelineStateObject({
enable: { start: now },
id: 'obj0',
layer: 'mainSceneBackgroundLayerLuminance',
content: {
deviceType: DeviceType.KAIROS,
type: TimelineContentTypeKairos.SCENE_LAYER_EFFECT,
effect: {
type: 'luminanceKey',
values: {
sourceKey: {
realm: 'ip-input',
ipInput: 23,
},
},
},
},
}),
],
time: now,
},
DEFAULT_MAPPINGS
),
[
{
context: expect.any(String),
timelineObjId: expect.any(String),
command: {
type: 'scene-layer-effect',
// sceneLayerId: 'SCENES.Main.Layers.Background',
ref: {
realm: 'scene-layer-effect',
scenePath: ['Main'],
layerPath: ['Background'],
effectPath: ['LuminanceKey'],
},
effect: {
type: 'luminanceKey',
values: {
sourceKey: {
realm: 'ip-input',
ipInput: 23,
},
},
},
},
},
]
)
})
// test('temporal order when cutting to/from a clip player before it has started/stopped playing', () => {

Check warning on line 561 in packages/timeline-state-resolver/src/integrations/kairos/__tests__/diffState.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Do not comment out tests

// })
})
Expand All @@ -513,6 +580,7 @@
macros: {},
ramRecPlayers: {},
sceneLayers: {},
sceneLayerEffects: {},
sceneSnapshots: {},
scenes: {},
soundPlayers: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const EMPTY_STATE: Omit<KairosDeviceState, 'stateTime'> = {
macros: {},
ramRecPlayers: {},
sceneLayers: {},
sceneLayerEffects: {},
sceneSnapshots: {},
scenes: {},
soundPlayers: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import type { CommandWithContext } from 'timeline-state-resolver-api'
import { isEqual } from 'underscore'
import { assertNever } from '../../lib.js'
import type { KairosRamLoader } from './lib/kairosRamLoader.js'
import { SceneLayerEffectRef, TimelineContentKairosSceneAnySceneLayerEffect } from 'timeline-state-resolver-types'

export type KairosCommandWithContext = CommandWithContext<KairosCommandAny, string>

export type KairosCommandAny =
| KairosSceneCommand
| KairosSceneRecallSnapshotCommand
| KairosSceneLayerCommand
| KairosSceneLayerEffectCommand
| KairosAuxCommand
| KairosMacroCommand
| KairosClipPlayerCommand
Expand Down Expand Up @@ -58,6 +60,13 @@ export interface KairosSceneLayerCommand {

values: Partial<UpdateSceneLayerObject>
}
export interface KairosSceneLayerEffectCommand {
type: 'scene-layer-effect'

ref: SceneLayerEffectRef

effect: TimelineContentKairosSceneAnySceneLayerEffect
}

export interface KairosAuxCommand {
type: 'aux'
Expand Down Expand Up @@ -223,6 +232,47 @@ export async function sendCommand(
await kairos.updateSceneLayer(command.ref, values)
break
}
case 'scene-layer-effect': {
const effect = command.effect
const ref = command.ref

if (effect.type === 'crop') {
await kairos.updateSceneLayerEffectCrop(ref, effect.values)
} else if (effect.type === 'transform2D') {
await kairos.updateSceneLayerEffectTransform2D(ref, effect.values)
} else if (effect.type === 'luminanceKey') {
await kairos.updateSceneLayerEffectLuminanceKey(ref, effect.values)
} else if (effect.type === 'chromaKey') {
await kairos.updateSceneLayerEffectChromaKey(ref, effect.values)
} else if (effect.type === 'yUVCorrection') {
await kairos.updateSceneLayerEffectYUVCorrection(ref, effect.values)
} else if (effect.type === 'rGBCorrection') {
await kairos.updateSceneLayerEffectRGBCorrection(ref, effect.values)
} else if (effect.type === 'lUTCorrection') {
await kairos.updateSceneLayerEffectLUTCorrection(ref, effect.values)
} else if (effect.type === 'virtualPTZ') {
await kairos.updateSceneLayerEffectVirtualPTZ(ref, effect.values)
} else if (effect.type === 'toneCurveCorrection') {
await kairos.updateSceneLayerEffectToneCurveCorrection(ref, effect.values)
} else if (effect.type === 'matrixCorrection') {
await kairos.updateSceneLayerEffectMatrixCorrection(ref, effect.values)
} else if (effect.type === 'temperatureCorrection') {
await kairos.updateSceneLayerEffectTemperatureCorrection(ref, effect.values)
} else if (effect.type === 'linearKey') {
await kairos.updateSceneLayerEffectLinearKey(ref, effect.values)
} else if (effect.type === 'position') {
await kairos.updateSceneLayerEffectPosition(ref, effect.values)
} else if (effect.type === 'pCrop') {
await kairos.updateSceneLayerEffectPCrop(ref, effect.values)
} else if (effect.type === 'filmLook') {
await kairos.updateSceneLayerEffectFilmLook(ref, effect.values)
} else if (effect.type === 'glowEffect') {
await kairos.updateSceneLayerEffectGlowEffect(ref, effect.values)
} else {
assertNever(effect)
}
break
}
case 'aux':
await kairos.updateAux(command.ref, command.values)
break
Expand Down
Loading
Loading