private static void EachKeyer(AtemMockServerWrapper helper, Action <AtemState, DownstreamKeyerState, IBMDSwitcherDownstreamKey, DownstreamKeyId, int> fcn, int iterations = 5) { foreach (Tuple <DownstreamKeyId, IBMDSwitcherDownstreamKey> c in GetKeyers(helper)) { AtemState stateBefore = helper.Helper.BuildLibState(); DownstreamKeyerState dskBefore = stateBefore.DownstreamKeyers[(int)c.Item1]; Assert.NotNull(dskBefore); for (int i = 0; i < iterations; i++) { fcn(stateBefore, dskBefore, c.Item2, c.Item1, i); } } }
private static DownstreamKeyerState BuildOne(IBMDSwitcherDownstreamKey props) { var state = new DownstreamKeyerState(); props.GetInputCut(out long cutInput); state.Sources.CutSource = (VideoSource)cutInput; props.GetInputFill(out long input); state.Sources.FillSource = (VideoSource)input; props.GetTie(out int tie); state.Properties.Tie = tie != 0; props.GetRate(out uint frames); state.Properties.Rate = frames; props.GetPreMultiplied(out int preMultiplied); state.Properties.PreMultipliedKey = preMultiplied != 0; props.GetClip(out double clip); state.Properties.Clip = clip * 100; props.GetGain(out double gain); state.Properties.Gain = gain * 100; props.GetInverse(out int inverse); state.Properties.Invert = inverse != 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; props.GetOnAir(out int onAir); state.State.OnAir = onAir != 0; props.IsTransitioning(out int isTransitioning); state.State.InTransition = isTransitioning != 0; props.IsAutoTransitioning(out int isAuto); state.State.IsAuto = isAuto != 0; props.GetFramesRemaining(out uint framesRemaining); state.State.RemainingFrames = framesRemaining; props.IsTransitionTowardsOnAir(out int isTowardsAir); state.State.IsTowardsOnAir = isTowardsAir != 0; return(state); }