protected static void EachMixEffect <T>(AtemMockServerWrapper helper, Action <AtemState, MixEffectState, T, MixEffectBlockId, int> fcn, int iterations = 5) where T : class { List <Tuple <MixEffectBlockId, T> > mixEffects = GetMixEffects <T>(helper); foreach (Tuple <MixEffectBlockId, T> me in mixEffects) { AtemState stateBefore = helper.Helper.BuildLibState(); MixEffectState meBefore = stateBefore.MixEffects[(int)me.Item1]; for (int i = 0; i < iterations; i++) { fcn(stateBefore, meBefore, me.Item2, me.Item1, i); } } }
private static MixEffectState BuildOne(IBMDSwitcherMixEffectBlock props) { var state = new MixEffectState(); props.GetProgramInput(out long program); state.Sources.Program = (VideoSource)program; props.GetPreviewInput(out long preview); state.Sources.Preview = (VideoSource)preview; props.GetFadeToBlackFramesRemaining(out uint frames); state.FadeToBlack.Status.RemainingFrames = frames; props.GetFadeToBlackRate(out uint rate); state.FadeToBlack.Properties.Rate = rate; props.GetFadeToBlackFullyBlack(out int isFullyBlack); state.FadeToBlack.Status.IsFullyBlack = isFullyBlack != 0; props.GetFadeToBlackInTransition(out int inTransition); state.FadeToBlack.Status.InTransition = inTransition != 0; if (props is IBMDSwitcherTransitionParameters trans) { BuildTransition(state.Transition, trans); props.GetPreviewTransition(out int previewTrans); state.Transition.Properties.PreviewTransition = previewTrans != 0; // props.GetPreviewLive(out int previewLive); // state.Transition.Properties.IsPreviewInProgram = previewLive != 0; props.GetTransitionPosition(out double position); state.Transition.Position.HandlePosition = position; props.GetTransitionFramesRemaining(out uint framesRemaining); state.Transition.Position.RemainingFrames = framesRemaining; props.GetInTransition(out int inTransition2); state.Transition.Position.InTransition = inTransition2 != 0; } var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherKeyIterator>(props.CreateIterator); state.Keyers = AtemSDKConverter.IterateList <IBMDSwitcherKey, MixEffectState.KeyerState>(iterator.Next, (keyer, id) => BuildKeyer(keyer)); return(state); }
private static void HandleTopologyCommand(AtemState state, UpdateResultImpl result, TopologyV811Command cmd) { state.Auxiliaries = UpdaterUtil.CreateList(cmd.Auxiliaries, (i) => new AuxState()); state.ColorGenerators = UpdaterUtil.CreateList(2, (i) => new ColorState()); state.DownstreamKeyers = UpdaterUtil.CreateList(cmd.DownstreamKeyers, (i) => new DownstreamKeyerState()); state.MediaPlayers = UpdaterUtil.CreateList(cmd.MediaPlayers, (i) => new MediaPlayerState()); state.SuperSources = UpdaterUtil.CreateList(cmd.SuperSource, (i) => new SuperSourceState()); state.Hyperdecks = UpdaterUtil.CreateList(cmd.HyperDecks, i => new HyperdeckState()); state.Settings.Talkback = UpdaterUtil.CreateList(cmd.TalkbackChannels, (i) => new SettingsState.TalkbackState()); state.MixEffects = UpdaterUtil.CreateList(cmd.MixEffectBlocks, (i) => { var me = new MixEffectState(); if (cmd.Stingers > 0) { me.Transition.Stinger = new MixEffectState.TransitionStingerState(); } if (cmd.DVE > 0) { me.Transition.DVE = new MixEffectState.TransitionDVEState(); } return(me); }); state.Settings.MultiViewers = UpdaterUtil.UpdateList(state.Settings.MultiViewers, cmd.Multiviewers, i => new MultiViewerState { Windows = new List <MultiViewerState.WindowState>(), // Size gets done in a second }); state.Settings.MixMinusOutputs = UpdaterUtil.CreateList(cmd.MixMinusOutputs, i => new SettingsState.MixMinusOutputState()); state.Info.AdvancedChromaKeyers = cmd.AdvancedChromaKeyers; state.Info.OnlyConfigurableOutputs = cmd.OnlyConfigurableOutputs; state.Info.HasCameraControl = cmd.CameraControl; // Everything has changed result.SetSuccess(""); }