1
- import { Commands as AtemCommands , VideoState } from 'atem-connection'
1
+ import { Commands as AtemCommands , Enums , VideoState } from 'atem-connection'
2
2
import { diffObject , fillDefaults , getAllKeysNumber } from '../../util'
3
3
import * as Defaults from '../../defaults'
4
4
import { PartialDeep } from 'type-fest'
5
5
6
- type FlyFrmaesState = [
6
+ type FlyFramesState = [
7
7
VideoState . USK . UpstreamKeyerFlyKeyframe | undefined ,
8
8
VideoState . USK . UpstreamKeyerFlyKeyframe | undefined
9
9
]
10
10
11
11
export function resolveFlyKeyerFramesState (
12
12
mixEffectId : number ,
13
13
upstreamKeyerId : number ,
14
- oldState : PartialDeep < FlyFrmaesState > ,
15
- newState : PartialDeep < FlyFrmaesState > ,
14
+ oldState : PartialDeep < FlyFramesState > ,
15
+ newState : PartialDeep < FlyFramesState > ,
16
16
diffOptions : number [ ] | 'all'
17
17
) : Array < AtemCommands . ISerializableCommand > {
18
18
const commands : Array < AtemCommands . ISerializableCommand > = [ ]
@@ -32,3 +32,27 @@ export function resolveFlyKeyerFramesState(
32
32
33
33
return commands
34
34
}
35
+
36
+ export function resolveFlyPropertiesState (
37
+ mixEffectId : number ,
38
+ upstreamKeyerId : number ,
39
+ oldState : Partial < VideoState . USK . UpstreamKeyerFlySettings > | undefined ,
40
+ newState : PartialDeep < VideoState . USK . UpstreamKeyerFlySettings > | undefined
41
+ ) : Array < AtemCommands . ISerializableCommand > {
42
+ const commands : Array < AtemCommands . ISerializableCommand > = [ ]
43
+
44
+ if ( ! oldState && ! newState ) return commands
45
+
46
+ const oldKeyProps = fillDefaults ( Defaults . Video . FlyKeyProperties , oldState )
47
+ const newKeyProps = fillDefaults ( Defaults . Video . FlyKeyProperties , newState )
48
+
49
+ if ( oldKeyProps . isAtKeyFrame !== newKeyProps . isAtKeyFrame ) {
50
+ const keyframe : Enums . FlyKeyKeyFrame = newKeyProps . isAtKeyFrame as number
51
+
52
+ commands . push (
53
+ new AtemCommands . MixEffectKeyRunToCommand ( mixEffectId , upstreamKeyerId , keyframe , newKeyProps . runToInfiniteIndex )
54
+ )
55
+ }
56
+
57
+ return commands
58
+ }
0 commit comments