Пример #1
0
        protected static void EachKeyers <T>(AtemMockServerWrapper helper, Action <AtemState, MixEffectState.KeyerState, T, MixEffectBlockId, UpstreamKeyId, int> fcn, int iterations = 5) where T : class
        {
            var keyers = GetKeyers <T>(helper);

            foreach (Tuple <MixEffectBlockId, UpstreamKeyId, T> keyer in keyers)
            {
                AtemState stateBefore = helper.Helper.BuildLibState();
                MixEffectState.KeyerState keyerBefore = stateBefore.MixEffects[(int)keyer.Item1].Keyers[(int)keyer.Item2];

                for (int i = 0; i < iterations; i++)
                {
                    fcn(stateBefore, keyerBefore, keyer.Item3, keyer.Item1, keyer.Item2, i);
                }
            }
        }
Пример #2
0
        private static MixEffectState.KeyerState BuildKeyer(IBMDSwitcherKey props)
        {
            var state = new MixEffectState.KeyerState();


            props.GetType(out _BMDSwitcherKeyType type);
            state.Properties.KeyType = AtemEnumMaps.MixEffectKeyTypeMap.FindByValue(type);
            props.GetInputCut(out long inputCut);
            state.Properties.CutSource = (VideoSource)inputCut;
            props.GetInputFill(out long input);
            state.Properties.FillSource = (VideoSource)input;
            props.GetOnAir(out int onAir);
            state.OnAir = onAir != 0;
            props.GetMasked(out int masked);
            state.Properties.MaskEnabled = masked != 0;
            props.GetMaskTop(out double top);
            state.Properties.MaskTop = top;
            props.GetMaskBottom(out double bottom);
            state.Properties.MaskBottom = bottom;
            props.GetMaskLeft(out double left);
            state.Properties.MaskLeft = left;
            props.GetMaskRight(out double right);
            state.Properties.MaskRight = right;

            if (props is IBMDSwitcherKeyLumaParameters luma)
            {
                state.Luma = BuildKeyerLuma(luma);
            }

            if (props is IBMDSwitcherKeyChromaParameters chroma)
            {
                state.Chroma = BuildKeyerChroma(chroma);
            }

            if (props is IBMDSwitcherKeyAdvancedChromaParameters advancedChroma)
            {
                state.AdvancedChroma = BuildKeyerAdvancedChroma(advancedChroma);
            }

            if (props is IBMDSwitcherKeyPatternParameters pattern)
            {
                state.Pattern = BuildKeyerPattern(pattern);
            }

            if (props is IBMDSwitcherKeyDVEParameters dve)
            {
                state.DVE = BuildKeyerDVE(dve);
            }

            if (props is IBMDSwitcherKeyFlyParameters fly && state.DVE != null)
            {
                BuildKeyerFly(state.DVE, fly);

                fly.GetFly(out int isFlyKey);
                state.Properties.FlyEnabled = isFlyKey != 0;
                fly.GetCanFly(out int canFly);
                state.Properties.CanFlyKey = canFly != 0;

                state.FlyProperties = new MixEffectState.KeyerFlyProperties();

                fly.IsKeyFrameStored(_BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameA, out int aStored);
                state.FlyProperties.IsASet = aStored != 0;
                fly.IsKeyFrameStored(_BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameB, out int bStored);
                state.FlyProperties.IsBSet = bStored != 0;

                // This is a pretty meaningless value, as it is really the LastRunKeyFrame
                // fly.IsAtKeyFrames(out _BMDSwitcherFlyKeyFrame isAtFrame);
                // state.FlyProperties.IsAtKeyFrame = (uint) isAtFrame;

                fly.IsRunning(out int isRunning, out _BMDSwitcherFlyKeyFrame destination);
                state.FlyProperties.RunningToInfinite = 0;
                if (isRunning == 0)
                {
                    state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.None;
                }
                else
                {
                    switch (destination)
                    {
                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameFull:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.Full;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityCentreOfKey:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.CentreOfKey;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityTopLeft:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.TopLeft;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityTop:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.TopCentre;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityTopRight:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.TopRight;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityLeft:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.MiddleLeft;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityCentre:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.MiddleCentre;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityRight:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.MiddleRight;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityBottomLeft:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.BottomLeft;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityBottom:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.BottomCentre;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameInfinityBottomRight:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.RunToInfinite;
                        state.FlyProperties.RunningToInfinite = FlyKeyLocation.BottomRight;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameA:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.A;
                        break;

                    case _BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameB:
                        state.FlyProperties.RunningToKeyFrame = FlyKeyKeyFrameType.B;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                fly.GetKeyFrameParameters(_BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameA, out IBMDSwitcherKeyFlyKeyFrameParameters keyframeA);
                fly.GetKeyFrameParameters(_BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameB, out IBMDSwitcherKeyFlyKeyFrameParameters keyframeB);

                state.FlyFrames = new List <MixEffectState.KeyerFlyFrameState>
                {
                    BuildKeyerFlyFrame(keyframeA),
                    BuildKeyerFlyFrame(keyframeB)
                };
            }

            return(state);
        }