示例#1
0
        public static SuperSourceState Build(IBMDSwitcherInputSuperSource props)
        {
            var state = new SuperSourceState();

            props.GetInputFill(out long input);
            state.Properties.ArtFillSource = (VideoSource)input;
            props.GetInputCut(out long cutInput);
            state.Properties.ArtCutSource = (VideoSource)cutInput;
            props.GetArtOption(out _BMDSwitcherSuperSourceArtOption option);
            state.Properties.ArtOption = AtemEnumMaps.SuperSourceArtOptionMap.FindByValue(option);
            props.GetPreMultiplied(out int preMultiplied);
            state.Properties.ArtPreMultiplied = preMultiplied != 0;
            props.GetClip(out double clip);
            state.Properties.ArtClip = clip * 100;
            props.GetGain(out double gain);
            state.Properties.ArtGain = gain * 100;
            props.GetInverse(out int inverse);
            state.Properties.ArtInvertKey = inverse != 0;

            BuildBorder(state.Border, (IBMDSwitcherSuperSourceBorder)props);

            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherSuperSourceBoxIterator>(props.CreateIterator);

            state.Boxes = AtemSDKConverter.IterateList <IBMDSwitcherSuperSourceBox, SuperSourceState.BoxState>(
                iterator.Next, (box, boxId) => BuildBox(box));

            return(state);
        }
示例#2
0
        public static void ApplyEqualizer(IBMDSwitcherFairlightAudioEqualizer eq, FairlightAudioState.EqualizerState state)
        {
            eq.GetEnabled(out int eqEnabled);
            state.Enabled = eqEnabled != 0;
            eq.GetGain(out double eqGain);
            state.Gain = eqGain;

#if !ATEM_v8_1
            var bands = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioEqualizerBandIterator>(eq.CreateIterator);
            state.Bands = AtemSDKConverter.IterateList <IBMDSwitcherFairlightAudioEqualizerBand, FairlightAudioState.EqualizerBandState>(bands.Next, (band, i) =>
            {
                band.GetEnabled(out int enabled);
                band.GetFrequency(out uint freq);
                band.GetFrequencyRange(out _BMDSwitcherFairlightAudioEqualizerBandFrequencyRange freqRange);
                band.GetGain(out double gain);
                band.GetQFactor(out double qfactor);
                band.GetShape(out _BMDSwitcherFairlightAudioEqualizerBandShape shape);
                band.GetSupportedFrequencyRanges(out _BMDSwitcherFairlightAudioEqualizerBandFrequencyRange supportedRanges);
                band.GetSupportedShapes(out _BMDSwitcherFairlightAudioEqualizerBandShape supportedShapes);

                return(new FairlightAudioState.EqualizerBandState
                {
                    BandEnabled = enabled != 0,
                    Frequency = freq,
                    FrequencyRange = AtemEnumMaps.FairlightEqualizerFrequencyRangeMap.FindByValue(freqRange),
                    Gain = gain,
                    QFactor = qfactor,
                    Shape = AtemEnumMaps.FairlightEqualizerBandShapeMap.FindByValue(shape),
                    SupportedFrequencyRanges = AtemEnumMaps.FairlightEqualizerFrequencyRangeMap.FindFlagsByValue(supportedRanges),
                    SupportedShapes = AtemEnumMaps.FairlightEqualizerBandShapeMap.FindFlagsByValue(supportedShapes)
                });
            });
#endif
        }
        public static IReadOnlyList <MediaPlayerState> Build(IBMDSwitcher switcher, AtemStateBuilderSettings updateSettings, bool hasClips)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMediaPlayerIterator>(switcher.CreateIterator);

            return(AtemSDKConverter.IterateList <IBMDSwitcherMediaPlayer, MediaPlayerState>(iterator.Next,
                                                                                            (media, id) => BuildOne(media, updateSettings, hasClips)));
        }
        private static void MixMinusOutputs(AtemState state, IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMixMinusOutputIterator>(switcher.CreateIterator);

            state.Settings.MixMinusOutputs = AtemSDKConverter.IterateList <IBMDSwitcherMixMinusOutput, SettingsState.MixMinusOutputState>(iterator.Next,
                                                                                                                                          (props, id) =>
            {
                props.GetAvailableAudioModes(out _BMDSwitcherMixMinusOutputAudioMode availableModes);
                props.GetAudioMode(out _BMDSwitcherMixMinusOutputAudioMode mode);
                props.HasMinusAudioInputId(out int hasInputId);

                long inputId = 0;
                if (hasInputId != 0)
                {
                    props.GetMinusAudioInputId(out inputId);
                }

                return(new SettingsState.MixMinusOutputState
                {
                    HasAudioInputId = hasInputId != 0,
                    AudioInputId = (AudioSource)inputId,
                    SupportedModes = AtemEnumMaps.MixMinusModeMap.FindFlagsByValue(availableModes),
                    Mode = AtemEnumMaps.MixMinusModeMap.FindByValue(mode),
                });
            });
        }
        public static void Build(AtemState state, IBMDSwitcher switcher)
        {
            var auxes = new List <AuxState>();
            var cols  = new List <ColorState>();
            var ssrcs = new List <SuperSourceState>();

            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherInputIterator>(switcher.CreateIterator);

            AtemSDKConverter.Iterate <IBMDSwitcherInput>(iterator.Next, (input, i) =>
            {
                input.GetInputId(out long id);
                var src = (VideoSource)id;

                state.Settings.Inputs[src] = BuildOne(input);

                if (input is IBMDSwitcherInputAux aux)
                {
                    auxes.Add(AuxInput(aux));
                }

                if (input is IBMDSwitcherInputColor col)
                {
                    cols.Add(ColorInput(col));
                }

                if (input is IBMDSwitcherInputSuperSource ssrc)
                {
                    ssrcs.Add(SuperSourceStateBuilder.Build(ssrc));
                }
            });

            state.Auxiliaries     = auxes;
            state.ColorGenerators = cols;
            state.SuperSources    = ssrcs;
        }
示例#6
0
        private static FairlightAudioState.InputSourceState BuildSource(IBMDSwitcherFairlightAudioSource props, AudioSource inputId, Dictionary <Tuple <AudioSource, long>, bool> tally)
        {
            var state = new FairlightAudioState.InputSourceState();

            props.IsActive(out int active);
            if (active == 0)
            {
                return(null);
            }

            props.GetId(out long id);
            state.SourceId = id;
            props.GetSupportedMixOptions(out _BMDSwitcherFairlightAudioMixOption supportedMixOptions);
            state.SupportedMixOptions = (FairlightAudioMixOption)supportedMixOptions;
            props.GetSourceType(out _BMDSwitcherFairlightAudioSourceType sourceType);
            state.SourceType = AtemEnumMaps.FairlightAudioSourceTypeMap.FindByValue(sourceType);

            props.GetMaxDelayFrames(out ushort maxDelay);
            state.MaxFramesDelay = maxDelay;
            props.GetDelayFrames(out ushort delay);
            state.FramesDelay = delay;

            props.GetInputGain(out double inputGain);
            state.Gain = inputGain;
            props.GetPan(out double pan);
            state.Balance = pan;
            props.GetFaderGain(out double faderGain);
            state.FaderGain = faderGain;
            props.GetMixOption(out _BMDSwitcherFairlightAudioMixOption mixOption);
            state.MixOption = AtemEnumMaps.FairlightAudioMixOptionMap.FindByValue(mixOption);
            props.HasStereoSimulation(out int hasStereoSimulation);
            state.HasStereoSimulation = hasStereoSimulation != 0;
            props.GetStereoSimulationIntensity(out double stereoSimulation);
            state.StereoSimulation = stereoSimulation;

            props.IsMixedIn(out int mixedIn);
            tally[Tuple.Create(inputId, id)] = mixedIn != 0;

            var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(props.GetEffect);

            dynamics.GetMakeupGain(out double makeupGain);
            state.Dynamics.MakeUpGain = makeupGain;

            var compressor = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioCompressor>(dynamics.GetProcessor);

            FairlightAudioBuilderCommon.ApplyCompressor(compressor, state.Dynamics.Compressor = new FairlightAudioState.CompressorState());
            var limiter = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioLimiter>(dynamics.GetProcessor);

            FairlightAudioBuilderCommon.ApplyLimiter(limiter, state.Dynamics.Limiter = new FairlightAudioState.LimiterState());
            var expander = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioExpander>(dynamics.GetProcessor);

            FairlightAudioBuilderCommon.ApplyExpander(expander, state.Dynamics.Expander = new FairlightAudioState.ExpanderState());

            var eq = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioEqualizer>(props.GetEffect);

            FairlightAudioBuilderCommon.ApplyEqualizer(eq, state.Equalizer);

            return(state);
        }
示例#7
0
        public static IReadOnlyList <DownstreamKeyerState> Build(IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherDownstreamKeyIterator>(switcher.CreateIterator);

            return(AtemSDKConverter.IterateList <IBMDSwitcherDownstreamKey, DownstreamKeyerState>(
                       iterator.Next,
                       (key, id) => BuildOne(key)));
        }
        private static void DveInfo(AtemState state, IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMixEffectBlockIterator>(switcher.CreateIterator);
            var me       = AtemSDKConverter.ToList <IBMDSwitcherMixEffectBlock>(iterator.Next).FirstOrDefault();

            if (me == null)
            {
                return;
            }

            var keyers = AtemSDKConverter.CastSdk <IBMDSwitcherKeyIterator>(me.CreateIterator);
            var keyer  = AtemSDKConverter.ToList <IBMDSwitcherKey>(keyers.Next).FirstOrDefault();

            if (keyer == null)
            {
                return;
            }

            var flyKey   = keyer as IBMDSwitcherKeyFlyParameters;
            var dveTrans = me as IBMDSwitcherTransitionDVEParameters;

            if (flyKey == null || dveTrans == null)
            {
                return;
            }

            flyKey.GetCanRotate(out int canRotate);
            flyKey.GetCanScaleUp(out int canScaleUp);

            var dveStyles = new List <DVEEffect>();

            foreach (DVEEffect style in Enum.GetValues(typeof(DVEEffect)).OfType <DVEEffect>())
            {
                _BMDSwitcherDVETransitionStyle style2 = AtemEnumMaps.DVEStyleMap[style];
                dveTrans.DoesSupportStyle(style2, out int supported);
                if (supported != 0)
                {
                    dveStyles.Add(style);
                }
            }

            dveTrans.GetNumSupportedStyles(out uint styleCount);
            if (dveStyles.Count != styleCount)
            {
                throw new Exception("Mismatch in number of supported DVE transition styles");
            }

            state.Info.DVE = new InfoState.DveInfoState
            {
                CanScaleUp           = canScaleUp != 0,
                CanRotate            = canRotate != 0,
                SupportedTransitions = dveStyles,
            };
        }
        public static void Build(AtemState state, IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherTalkbackIterator>(switcher.CreateIterator);
            var talkback = AtemSDKConverter.IterateList <IBMDSwitcherTalkback, SettingsState.TalkbackState>(iterator.Next,
                                                                                                            (props, id0) =>
            {
                props.GetId(out _BMDSwitcherTalkbackId channelId);
                var id = AtemEnumMaps.TalkbackChannelMap.FindByValue(channelId);
                Assert.Equal((uint)id, id0);

                props.GetMuteSDI(out int muteSDI);

                var audioInputIds = state.Settings.Inputs
                                    .Where(i => i.Value.Properties.InternalPortType == InternalPortType.External &&
                                           i.Value.Properties.AvailableExternalPortTypes.Contains(VideoPortType.SDI))
                                    .Select(i => (long)i.Key).ToList();

                var res = new SettingsState.TalkbackState
                {
                    MuteSDI = muteSDI != 0,
                };

                foreach (long inputId in audioInputIds)
                {
                    props.CurrentInputSupportsMuteSDI(inputId, out int supportsMuteInputSdi);
                    int muteInputSdi    = 0;
                    int canMuteinputSdi = 0;
                    if (supportsMuteInputSdi != 0)
                    {
                        props.InputCanMuteSDI(inputId, out canMuteinputSdi);
                        if (canMuteinputSdi != 0)
                        {
                            props.GetInputMuteSDI(inputId, out muteInputSdi);
                        }
                    }

                    res.Inputs[(VideoSource)inputId] = new SettingsState.TalkbackInputState
                    {
                        MuteSDI                     = muteInputSdi != 0,
                        InputCanMuteSDI             = canMuteinputSdi != 0,
                        CurrentInputSupportsMuteSDI = supportsMuteInputSdi != 0,
                    };
                }


                return(res);
            });

            state.Settings.Talkback = talkback;
        }
        private static void SerialPorts(AtemState state, IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherSerialPortIterator>(switcher.CreateIterator);

            AtemSDKConverter.Iterate <IBMDSwitcherSerialPort>(iterator.Next, (port, id) =>
            {
                if (id != 0)
                {
                    throw new Exception("Too many serial ports");
                }

                port.GetFunction(out _BMDSwitcherSerialPortFunction function);
                state.Settings.SerialMode = AtemEnumMaps.SerialModeMap.FindByValue(function);
            });
        }
        public static FairlightAudioState Build(IBMDSwitcherFairlightAudioMixer props)
        {
            var state = new FairlightAudioState();

            props.GetMasterOutFaderGain(out double faderGain);
            state.ProgramOut.Gain = faderGain;
            props.GetMasterOutFollowFadeToBlack(out int followFTB);
            state.ProgramOut.FollowFadeToBlack = followFTB != 0;
            props.GetAudioFollowVideoCrossfadeTransition(out int followTransition);
            state.ProgramOut.AudioFollowVideoCrossfadeTransitionEnabled = followTransition != 0;

            // Effects
            var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(props.GetMasterOutEffect);

            dynamics.GetMakeupGain(out double makeupGain);
            state.ProgramOut.Dynamics.MakeUpGain = makeupGain;

            var compressor = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioCompressor>(dynamics.GetProcessor);

            FairlightAudioBuilderCommon.ApplyCompressor(compressor, state.ProgramOut.Dynamics.Compressor = new FairlightAudioState.CompressorState());
            var limiter = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioLimiter>(dynamics.GetProcessor);

            FairlightAudioBuilderCommon.ApplyLimiter(limiter, state.ProgramOut.Dynamics.Limiter = new FairlightAudioState.LimiterState());
            // MasterOut appears to never have an expander
            //var expander = AtemSDKConverter.CastSdk<IBMDSwitcherFairlightAudioExpander>(dynamics.GetProcessor);
            //FairlightAudioBuilderCommon.ApplyExpander(expander, state.ProgramOut.Dynamics.Expander = new FairlightAudioState.ExpanderState());

            // Equalizer
            var equalizer = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioEqualizer>(props.GetMasterOutEffect);

            FairlightAudioBuilderCommon.ApplyEqualizer(equalizer, state.ProgramOut.Equalizer);

            // Inputs
            state.Tally = new Dictionary <Tuple <AudioSource, long>, bool>();
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioInputIterator>(props.CreateIterator);

            for (iterator.Next(out IBMDSwitcherFairlightAudioInput input); input != null; iterator.Next(out input))
            {
                input.GetId(out long id);
                state.Inputs[id] = FairlightAudioInputStateBuilder.Build(input, (AudioSource)id, state.Tally);
            }

            var monIter = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioHeadphoneOutputIterator>(props.CreateIterator);

            state.Monitors = AtemSDKConverter.IterateList <IBMDSwitcherFairlightAudioHeadphoneOutput, FairlightAudioState.MonitorOutputState>(monIter.Next, (mon, id) => BuildMonitor(mon));

            return(state);
        }
        public static void Build(IBMDSwitcher switcher, AtemState state)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMultiViewIterator>(switcher.CreateIterator);

            state.Settings.MultiViewers = AtemSDKConverter.IterateList <IBMDSwitcherMultiView, MultiViewerState>(
                iterator.Next,
                (mv, id) =>
            {
                var res = BuildOne(mv);

                if (state.Info.MultiViewers == null)
                {
                    state.Info.MultiViewers = res.Item1;
                }

                return(res.Item2);
            });
        }
示例#13
0
        public static AudioState Build(IBMDSwitcherAudioMixer props)
        {
            var state = new AudioState();

            props.GetProgramOutGain(out double gain);
            state.ProgramOut.Gain = gain;
            props.GetProgramOutBalance(out double balance);
            state.ProgramOut.Balance = balance * 50;
            props.GetProgramOutFollowFadeToBlack(out int follow);
            state.ProgramOut.FollowFadeToBlack = follow != 0;
            props.GetAudioFollowVideoCrossfadeTransition(out int followTransition);
            state.ProgramOut.AudioFollowVideoCrossfadeTransitionEnabled = followTransition != 0;

            state.Tally = new Dictionary <AudioSource, bool>();

            var inputIt = AtemSDKConverter.CastSdk <IBMDSwitcherAudioInputIterator>(props.CreateIterator);

            AtemSDKConverter.Iterate <IBMDSwitcherAudioInput>(inputIt.Next, (port, i) =>
            {
                port.GetAudioInputId(out long inputId);
                state.Inputs[inputId] = BuildInput(port);

                port.IsMixedIn(out int isMixedIn);
                state.Tally[(AudioSource)inputId] = isMixedIn != 0;
            });

            var monIt = AtemSDKConverter.CastSdk <IBMDSwitcherAudioMonitorOutputIterator>(props.CreateIterator);

            state.MonitorOutputs =
                AtemSDKConverter.IterateList <IBMDSwitcherAudioMonitorOutput, AudioState.MonitorOutputState>(
                    monIt.Next,
                    (mon, id) => BuildMonitor(mon));

            var headphoneIt = AtemSDKConverter.CastSdk <IBMDSwitcherAudioHeadphoneOutputIterator>(props.CreateIterator);

            state.HeadphoneOutputs =
                AtemSDKConverter.IterateList <IBMDSwitcherAudioHeadphoneOutput, AudioState.HeadphoneOutputState>(
                    headphoneIt.Next,
                    (hp, id) => BuildHeadphone(hp));

            return(state);
        }
示例#14
0
        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);
        }
示例#15
0
        public static bool SupportsAdvancedChromaKeyers(IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMixEffectBlockIterator>(switcher.CreateIterator);
            var me       = AtemSDKConverter.ToList <IBMDSwitcherMixEffectBlock>(iterator.Next).FirstOrDefault();

            if (me == null)
            {
                return(false);
            }

            var iterator2 = AtemSDKConverter.CastSdk <IBMDSwitcherKeyIterator>(me.CreateIterator);
            var key       = AtemSDKConverter.ToList <IBMDSwitcherKey>(iterator2.Next).FirstOrDefault();

            if (key == null)
            {
                return(false);
            }

            key.DoesSupportAdvancedChroma(out int supported);
            return(supported != 0);
        }
        public static void Build(AtemState state, IBMDSwitcherCameraControl camera, AtemStateBuilderSettings updateSettings)
        {
            camera.GetPeriodicFlushInterval(out uint interval);
            state.CameraControl.PeriodicFlushInterval = interval;

            IBMDSwitcherCameraControlParameterIterator iterator =
                AtemSDKConverter.CastSdk <IBMDSwitcherCameraControlParameterIterator>(camera.CreateIterator);
            uint lastDevice    = uint.MaxValue;
            uint lastCategory  = 0u;
            uint lastParameter = 0u;

            for (iterator.Next(out var device, out var category, out var parameter);
                 ;
                 iterator.Next(out device, out category, out parameter))
            {
                if (device == lastDevice && category == lastCategory && parameter == lastParameter)
                {
                    break;
                }

                lastDevice    = device;
                lastCategory  = category;
                lastParameter = parameter;

                if (device == 0)
                {
                    continue;
                }

                if (!state.CameraControl.Cameras.TryGetValue(device, out CameraControlState.CameraState cState))
                {
                    cState = state.CameraControl.Cameras[device] = new CameraControlState.CameraState();
                }

                CameraControlGetCommand cmd = BuildCommand(camera, device, category, parameter);
                CameraControlUtil.ApplyToState(cState, cmd, updateSettings.IgnoreUnknownCameraControlProperties);
            }
        }
示例#17
0
        public static void Build(AtemState state, IBMDSwitcher switcher)
        {
#if !ATEM_v8_1
            var recordingSwitcher = switcher as IBMDSwitcherRecordAV;
            if (recordingSwitcher == null)
            {
                return;
            }

            state.Recording = new RecordingState();

            //recordingSwitcher.IsRecording(out int recording);
            recordingSwitcher.GetStatus(out _BMDSwitcherRecordAVState avState, out _BMDSwitcherRecordAVError error);
            recordingSwitcher.GetFilename(out string filename);
            recordingSwitcher.GetRecordInAllCameras(out int recordInAllCameras);
            recordingSwitcher.GetWorkingSetLimit(out uint workingSetLimit);
            recordingSwitcher.GetActiveDiskIndex(out uint activeDiskIndex);
            //recordingSwitcher.GetDuration(out ulong duration);
            recordingSwitcher.GetTimeCode(out byte hours, out byte minutes, out byte seconds, out byte frames, out int dropFrame);

            recordingSwitcher.GetWorkingSetDisk(0, out uint workingSet1Id);
            recordingSwitcher.GetWorkingSetDisk(1, out uint workingSet2Id);

            recordingSwitcher.GetTotalRecordingTimeAvailable(out uint totalRecordingTimeAvailable);
            state.Recording.Status.State = AtemEnumMaps.RecordingStateMap.FindByValue(avState);
            state.Recording.Status.Error = AtemEnumMaps.RecordingErrorMap.FindByValue(error);
            state.Recording.Status.TotalRecordingTimeAvailable = totalRecordingTimeAvailable;
            state.Recording.Status.Duration = new Timecode
            {
                Hour      = hours,
                Minute    = minutes,
                Second    = seconds,
                Frame     = frames,
                DropFrame = dropFrame != 0,
            };

            Assert.Equal(2u, workingSetLimit);
            state.Recording.Properties.Filename           = filename;
            state.Recording.Properties.WorkingSet1DiskId  = workingSet1Id;
            state.Recording.Properties.WorkingSet2DiskId  = workingSet2Id;
            state.Recording.Properties.RecordInAllCameras = recordInAllCameras != 0;

            recordingSwitcher.DoesSupportISORecording(out int supportsIso);
            state.Recording.CanISORecordAllInputs = supportsIso != 0;
            if (supportsIso != 0)
            {
                recordingSwitcher.GetRecordAllISOInputs(out int recordIso);
                state.Recording.ISORecordAllInputs = recordIso != 0;
            }

            var diskIterator = AtemSDKConverter.CastSdk <IBMDSwitcherRecordDiskIterator>(recordingSwitcher.CreateIterator);
            AtemSDKConverter.IterateList <IBMDSwitcherRecordDisk, RecordingState.RecordingDiskState>(diskIterator.Next,
                                                                                                     (sdk, id) =>
            {
                sdk.GetId(out uint diskId);
                sdk.GetVolumeName(out string volumeName);
                sdk.GetRecordingTimeAvailable(out uint recordingTimeAvailable);
                sdk.GetStatus(out _BMDSwitcherRecordDiskStatus diskStatus);

                var res = new RecordingState.RecordingDiskState
                {
                    DiskId                 = diskId,
                    VolumeName             = volumeName,
                    RecordingTimeAvailable = recordingTimeAvailable,
                    Status                 = AtemEnumMaps.RecordingDiskStatusMap.FindByValue(diskStatus),
                };
                state.Recording.Disks.Add(diskId, res);
                return(res);
            });

            // TODO DoesSupportISORecording
            // TODO activeDiskIndex
#endif
        }
示例#18
0
        public static FairlightAudioState.InputState Build(IBMDSwitcherFairlightAudioInput props, AudioSource inputId, Dictionary <Tuple <AudioSource, long>, bool> tally)
        {
            var state = new FairlightAudioState.InputState();

            // Input basics
            props.GetCurrentExternalPortType(out _BMDSwitcherExternalPortType portType);
            state.ExternalPortType = AtemEnumMaps.AudioPortTypeMap.FindByValue(portType);
            props.GetConfiguration(out _BMDSwitcherFairlightAudioInputConfiguration configuration);
            state.ActiveConfiguration = AtemEnumMaps.FairlightInputConfigurationMap.FindByValue(configuration);
            props.GetSupportedConfigurations(out _BMDSwitcherFairlightAudioInputConfiguration supportedConfigurations);
            state.SupportedConfigurations = (FairlightInputConfiguration)supportedConfigurations;
            props.GetType(out _BMDSwitcherFairlightAudioInputType type);
            state.InputType = AtemEnumMaps.FairlightInputTypeMap.FindByValue(type);

            // Analog
            if (props is IBMDSwitcherFairlightAnalogAudioInput analog)
            {
                state.Analog = new FairlightAudioState.AnalogState();
                analog.GetInputLevel(out _BMDSwitcherFairlightAudioAnalogInputLevel level);
                state.Analog.InputLevel = AtemEnumMaps.FairlightAnalogInputLevelMap.FindByValue(level);

                analog.GetSupportedInputLevels(out _BMDSwitcherFairlightAudioAnalogInputLevel supportedLevels);
                state.Analog.SupportedInputLevel = (FairlightAnalogInputLevel)supportedLevels;
            }

#if ATEM_v8_1
            // XLR
            if (props is IBMDSwitcherFairlightAudioInputXLR xlr)
            {
                xlr.HasRCAToXLR(out int hasRcaToXlr);
                if (hasRcaToXlr != 0)
                {
                    if (state.Analog == null)
                    {
                        state.Analog = new FairlightAudioState.AnalogState();
                    }

                    state.Analog.SupportedInputLevel =
                        FairlightAnalogInputLevel.ConsumerLine | FairlightAnalogInputLevel.ProLine;
                    xlr.GetRCAToXLREnabled(out int rcaToXlrEnabled);
                    state.Analog.InputLevel = rcaToXlrEnabled != 0
                        ? FairlightAnalogInputLevel.ConsumerLine
                        : FairlightAnalogInputLevel.ProLine;
                }
            }
#else
            // TODO
#endif

            // Sources
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioSourceIterator>(props.CreateIterator);
            AtemSDKConverter.Iterate <IBMDSwitcherFairlightAudioSource>(
                iterator.Next,
                (src, id) =>
            {
                var val = BuildSource(src, inputId, tally);
                if (val != null)
                {
                    state.Sources.Add(val);
                }
            });

            return(state);
        }
        private static void Hyperdecks(AtemState state, IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherHyperDeckIterator>(switcher.CreateIterator);

            state.Hyperdecks = AtemSDKConverter.IterateList <IBMDSwitcherHyperDeck, HyperdeckState>(iterator.Next, (props, id) =>
            {
                var st = new HyperdeckState();

                props.GetSwitcherInput(out long inputId);
                st.Settings.Input = (VideoSource)inputId;
                props.GetAutoRollOnTake(out int autoRoll);
                st.Settings.AutoRoll = autoRoll != 0;
                props.GetAutoRollOnTakeFrameDelay(out ushort frameDelay);
                st.Settings.AutoRollFrameDelay = frameDelay;
                props.GetNetworkAddress(out uint address);
                st.Settings.NetworkAddress = IPUtil.IPToString(BitConverter.GetBytes(address).Reverse().ToArray());

                props.GetLoopedPlayback(out int loop);
                st.Player.Loop = loop != 0;
                props.GetSingleClipPlayback(out int single);
                st.Player.SingleClip = single != 0;

                props.GetPlayerState(out _BMDSwitcherHyperDeckPlayerState playState);
                st.Player.State = playState == _BMDSwitcherHyperDeckPlayerState.bmdSwitcherHyperDeckStateUnknown
                    ? HyperDeckPlayerState.Idle
                    : AtemEnumMaps.HyperDeckPlayerStateMap.FindByValue(playState);
                props.GetShuttleSpeed(out int speed);
                st.Player.PlaybackSpeed = speed;

                props.GetCurrentClipTime(out ushort clipHours, out byte clipMinutes, out byte clipSeconds, out byte clipFrames);
                st.Player.ClipTime = new HyperDeckTime
                {
                    Hour = clipHours, Minute = clipMinutes, Second = clipSeconds, Frame = clipFrames
                };
                props.GetCurrentTimelineTime(out ushort tlHours, out byte tlMinutes, out byte tlSeconds, out byte tlFrames);
                st.Player.TimelineTime = new HyperDeckTime
                {
                    Hour = tlHours, Minute = tlMinutes, Second = tlSeconds, Frame = tlFrames
                };

                props.GetCurrentClip(out long clipId);
                st.Storage.CurrentClipId = (int)clipId;

                props.GetFrameRate(out uint frameRate, out uint timeScale);
                st.Storage.FrameRate = frameRate;
                st.Storage.TimeScale = timeScale;
                props.IsInterlacedVideo(out int isInterlaced);
                st.Storage.IsInterlaced = isInterlaced != 0;
                props.IsDropFrameTimeCode(out int isDropFrame);
                st.Storage.IsDropFrameTimecode = isDropFrame != 0;

                props.GetEstimatedRecordTimeRemaining(out ushort recordHours, out byte recordMinutes,
                                                      out byte recordSeconds, out byte recordFrames);
                st.Storage.RemainingRecordTime = new HyperDeckTime
                {
                    Hour = recordHours, Minute = recordMinutes, Second = recordSeconds, Frame = recordFrames
                };

                props.GetConnectionStatus(out _BMDSwitcherHyperDeckConnectionStatus status);
                st.Settings.Status = AtemEnumMaps.HyperDeckConnectionStatusMap.FindByValue(status);

                props.IsRemoteAccessEnabled(out int remoteEnabled);
                st.Settings.IsRemoteEnabled = remoteEnabled != 0;

                props.GetStorageMediaCount(out uint storageCount);
                st.Settings.StorageMediaCount = storageCount;
                props.GetActiveStorageMedia(out int activeMedia);
                st.Storage.ActiveStorageMedia = activeMedia;
                if (activeMedia >= 0)
                {
                    props.GetStorageMediaState((uint)activeMedia, out _BMDSwitcherHyperDeckStorageMediaState storageState);
                    st.Storage.ActiveStorageStatus = AtemEnumMaps.HyperDeckStorageStatusMap.FindByValue(storageState);
                }

                var clipIterator = AtemSDKConverter.CastSdk <IBMDSwitcherHyperDeckClipIterator>(props.CreateIterator);
                st.Clips         = AtemSDKConverter.IterateList <IBMDSwitcherHyperDeckClip, HyperdeckState.ClipState>(clipIterator.Next, (clip, i) =>
                {
                    clip.GetId(out long clipId);
                    clip.GetDuration(out ushort hours, out byte minutes, out byte seconds, out byte frames);
                    clip.GetName(out string name);
                    clip.GetTimelineStart(out ushort startHours, out byte startMinutes, out byte startSeconds,
                                          out byte startFrames);
                    clip.GetTimelineEnd(out ushort endHours, out byte endMinutes, out byte endSeconds,
                                        out byte endFrames);

                    clip.IsInfoAvailable(out int infoAvailable);
                    clip.IsValid(out int valid);

                    Assert.Equal(1, valid);
                    // Assert.Equal(1, infoAvailable);

                    return(new HyperdeckState.ClipState
                    {
                        Name = name,
                        Duration = infoAvailable != 0
                            ? new HyperDeckTime {
                            Hour = hours, Minute = minutes, Second = seconds, Frame = frames
                        }
                            : null,
                        TimelineStart = infoAvailable != 0
                            ? new HyperDeckTime
                        {
                            Hour = startHours, Minute = startMinutes, Second = startSeconds, Frame = startFrames
                        }
                            : null,
                        TimelineEnd = infoAvailable != 0
                            ? new HyperDeckTime
                        {
                            Hour = endHours, Minute = endMinutes, Second = endSeconds, Frame = endFrames
                        }
                            : null,
                    });
                });

                props.GetClipCount(out uint count);
                Assert.Equal((int)count, st.Clips.Count);

                return(st);
            });
        }
示例#20
0
        public static IReadOnlyList <MixEffectState> Build(IBMDSwitcher switcher)
        {
            var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMixEffectBlockIterator>(switcher.CreateIterator);

            return(AtemSDKConverter.IterateList <IBMDSwitcherMixEffectBlock, MixEffectState>(iterator.Next, (me, id) => BuildOne(me)));
        }