Example #1
0
        IBMDSwitcherKey GetSwitcherKey1(IBMDSwitcherMixEffectBlock block)
        {
            IBMDSwitcherKeyIterator meIterator = null;
            IntPtr meIteratorPtr;
            Guid   meIteratorIID = typeof(IBMDSwitcherKeyIterator).GUID;

            block.CreateIterator(ref meIteratorIID, out meIteratorPtr);
            if (meIteratorPtr != null)
            {
                meIterator = (IBMDSwitcherKeyIterator)Marshal.GetObjectForIUnknown(meIteratorPtr);
            }

            if (meIterator == null)
            {
                return(null);
            }

            IBMDSwitcherKey temp = null;

            if (meIterator != null)
            {
                meIterator.Next(out temp);
            }

            return(temp);
        }
Example #2
0
        private void SwitcherConnected()
        {
            string switcherName;

            m_switcher.GetProductName(out switcherName);
            SwitcherName = switcherName;

            // Install SwitcherMonitor callbacks:
            m_switcher.AddCallback(m_switcherMonitor);

            GetInputs();

            m_mixEffectBlock1 = GetMixBox1();
            if (m_mixEffectBlock1 != null)
            {
                m_mixEffectBlock1.AddCallback(m_mixEffectBlockMonitor);
            }
            else
            {
                MessageBox.Show("Unexpected: Could not get first mix effect block", "Error");
            }

            m_switcherKey       = GetSwitcherKey1(m_mixEffectBlock1);
            m_switcherKeyPreset = GetKeyParam(m_mixEffectBlock1);
            m_transitionParam   = GetKeyTransition(m_mixEffectBlock1);

            UpdatePopupItems();
            UpdateSliderPosition();
            IsConnected = true;

            m_switcherKey.SetOnAir(0);
        }
Example #3
0
        public Key(IBMDSwitcherKey key, IMediator mediator)
        {
            _key = key;
            _key.AddCallback(new KeyCallback(mediator));

            _keyFlyParameters = _key.GetKeyFlyParameters();
            _flyParameters    = new KeyFlyParameters(_keyFlyParameters, mediator);
        }
Example #4
0
 public void SetSongOffAir()
 {
     try
     {
         GetTransition1Parameters().SetNextTransitionSelection(_BMDSwitcherTransitionSelection.bmdSwitcherTransitionSelectionBackground);
         IBMDSwitcherKey key = GetKey1();
         key.SetOnAir(0);
     }
     catch (Exception ex)
     {
         throw new SwitcherLibException(ex.Message, ex);
     }
 }
Example #5
0
 public void SetSongOnAir()
 {
     try
     {
         IBMDSwitcherKey key = GetKey1();
         key.SetInputFill(3010);                 //http://skaarhoj.com/fileadmin/BMDPROTOCOL.html
         GetTransition1Parameters().SetNextTransitionSelection(_BMDSwitcherTransitionSelection.bmdSwitcherTransitionSelectionBackground);
         key.SetOnAir(1);
     }
     catch (Exception ex)
     {
         throw new SwitcherLibException(ex.Message, ex);
     }
 }
Example #6
0
        private void SwitcherDisconnected()
        {
            try
            {
                this.Text = "";
                deactivatebuttons();
                btn_reconnect.Enabled = true;
                btnKey1Air.Enabled = false;
                if (m_audioInput != null)
                {
                    m_audioInput.RemoveCallback(m_audioInputMonitor);
                    m_audioInput = null;
                }

                if (m_audioMonitorOutput != null)
                {
                    m_audioMonitorOutput.RemoveCallback(m_audioOutputMonitor);
                    m_audioMonitorOutput = null;
                }

                if (m_audiomixer != null)
                {
                    m_audiomixer.RemoveCallback(m_audioMixerMonitor);
                    m_audiomixer = null;
                }

                if (me1_dkey1 != null)
                {
                    // Remove callback
                    me1_dkey1.RemoveCallback(m_dkeyMonitor);

                    // Release reference
                    me1_dkey1 = null;
                }

                if (me1_dkey2 != null)
                {
                    // Remove callback
                    me1_dkey2.RemoveCallback(m_dkeyMonitor);

                    // Release reference
                    me1_dkey2 = null;
                }

                if (m_AUX1 != null)
                {
                    // Remove callback
                    m_AUX1.RemoveCallback(m_auxMonitor);

                    // Release reference
                    m_AUX1 = null;
                }

                if (m_AUX2 != null)
                {
                    // Remove callback
                    m_AUX2.RemoveCallback(m_auxMonitor);

                    // Release reference
                    m_AUX2 = null;
                }

                if (m_AUX3 != null)
                {
                    // Remove callback
                    m_AUX3.RemoveCallback(m_auxMonitor);

                    // Release reference
                    m_AUX3 = null;
                }

                if (me1_key1 != null)
                {
                    // Remove callback
                    me1_key1.RemoveCallback(m_keyMonitor);

                    // Release reference
                    me1_key1 = null;
                }
                if (me1_key2 != null)
                {
                    // Remove callback
                    me1_key2.RemoveCallback(m_keyMonitor);

                    // Release reference
                    me1_key2 = null;
                }
                if (me1_key3 != null)
                {
                    // Remove callback
                    me1_key3.RemoveCallback(m_keyMonitor);

                    // Release reference
                    me1_key3 = null;
                }
                if (me1_key4 != null)
                {
                    // Remove callback
                    me1_key4.RemoveCallback(m_keyMonitor);

                    // Release reference
                    me1_key4 = null;
                }

                if (m_transition != null)
                {
                    // Remove callback
                    m_transition.RemoveCallback(m_transitionMonitor);

                    // Release reference
                    m_transition = null;
                }

                // Remove all input monitors, remove callbacks
                foreach (InputMonitor inputMon in m_inputMonitors)
                {
                    inputMon.Input.RemoveCallback(inputMon);
                }
                m_inputMonitors.Clear();

                if (m_mixEffectBlock1 != null)
                {
                    // Remove callback
                    m_mixEffectBlock1.RemoveCallback(m_mixEffectBlockMonitor);

                    // Release reference
                    m_mixEffectBlock1 = null;
                }

                if (m_switcher != null)
                {
                    // Remove callback:
                    m_switcher.RemoveCallback(m_switcherMonitor);

                    // release reference:
                    m_switcher = null;
                }
            }
            catch (ArgumentException)
            {
                SwitcherDisconnected();
            }
        }
Example #7
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);
        }
 public static IBMDSwitcherKeyFlyParameters GetKeyFlyParameters(this IBMDSwitcherKey o)
 {
     return(QueryInterface <IBMDSwitcherKey, IBMDSwitcherKeyFlyParameters> .GetObject(o));
 }
Example #9
0
        private void SwitcherDisconnected()
        {
            buttonConnect.Enabled = true;
            textBoxSwitcherName.Text = "";

            if (m_audioInput != null)
            {
                m_audioInput.RemoveCallback(m_audioInputMonitor);
                m_audioInput = null;
            }

            if (m_audioMonitorOutput != null)
            {
                m_audioMonitorOutput.RemoveCallback(m_audioOutputMonitor);
                m_audioMonitorOutput = null;
            }

            if (m_audiomixer != null)
            {
                 m_audiomixer.RemoveCallback(m_audioMixerMonitor);
                 m_audiomixer = null;
            }

            if (me1_dkey1 != null)
            {
                // Remove callback
                me1_dkey1.RemoveCallback(m_dkeyMonitor);

                // Release reference
                me1_dkey1 = null;
            }

            if (me1_dkey2 != null)
            {
                // Remove callback
                me1_dkey2.RemoveCallback(m_dkeyMonitor);

                // Release reference
                me1_dkey2 = null;
            }

            if (m_AUX1 != null)
            {
                // Remove callback
                m_AUX1.RemoveCallback(m_auxMonitor);

                // Release reference
                m_AUX1 = null;
            }

            if (m_AUX2 != null)
            {
                // Remove callback
                m_AUX2.RemoveCallback(m_auxMonitor);

                // Release reference
                m_AUX2 = null;
            }

            if (m_AUX3 != null)
            {
                // Remove callback
                m_AUX3.RemoveCallback(m_auxMonitor);

                // Release reference
                m_AUX3 = null;
            }

            if (m_inputAux != null)
            {
                // Remove callback
                m_inputAux.RemoveCallback(m_auxMonitor);

                // Release reference
                m_inputAux = null;
            }

            if (me1_key1 != null)
            {
                // Remove callback
                me1_key1.RemoveCallback(m_keyMonitor);

                // Release reference
                me1_key1 = null;
            }
            if (me1_key2 != null)
            {
                // Remove callback
                me1_key2.RemoveCallback(m_keyMonitor);

                // Release reference
                me1_key2 = null;
            }
            if (me1_key3 != null)
            {
                // Remove callback
                me1_key3.RemoveCallback(m_keyMonitor);

                // Release reference
                me1_key3 = null;
            }
            if (me1_key4 != null)
            {
                // Remove callback
                me1_key4.RemoveCallback(m_keyMonitor);

                // Release reference
                me1_key4 = null;
            }

            if (m_transition != null)
            {
                // Remove callback
                m_transition.RemoveCallback(m_transitionMonitor);

                // Release reference
                m_transition = null;
            }
            
            // Remove all input monitors, remove callbacks
            foreach (InputMonitor inputMon in m_inputMonitors)
            {
                inputMon.Input.RemoveCallback(inputMon);
            }
            m_inputMonitors.Clear();

            if (m_mixEffectBlock1 != null)
            {
                // Remove callback
                m_mixEffectBlock1.RemoveCallback(m_mixEffectBlockMonitor);

                // Release reference
                m_mixEffectBlock1 = null;
            }

            if (m_switcher != null)
            {
                // Remove callback:
                m_switcher.RemoveCallback(m_switcherMonitor);

                // release reference:
                m_switcher = null;
            }
        }
 internal SwitcherKeyCallback(IBMDSwitcherKey key, int index)
 {
     this._indexnr = index;
     this.Key      = key;
 }