public static void IterateInput(this IBMDSwitcher switcher, Action <IBMDSwitcherInput> action) { // We create input monitors for each input. To do this we iterate over all inputs: // This will allow us to update the combo boxes when input names change: IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); IBMDSwitcherInputIterator inputIterator = null; if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { action(input); inputIterator.Next(out input); } } }
public static IBMDSwitcherInput GetSource(this IBMDSwitcher switcher, long inputId) { IBMDSwitcherInputIterator inputIterator = switcher.GetInputIterator(); if (inputIterator == null) { return(null); } IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { long inputIdFound; input.GetInputId(out inputIdFound); if (inputIdFound == inputId) { return(input); } inputIterator.Next(out input); } return(null); }
void GetInputs() { IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { InputMonitor newInputMonitor = new InputMonitor(input); input.AddCallback(newInputMonitor); newInputMonitor.LongNameChanged += new SwitcherEventHandler(OnInputLongNameChanged); m_inputMonitors.Add(newInputMonitor); inputIterator.Next(out input); } } }
private void addAUXCallback() { IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); int AUXCount = 0; while (input != null) { BMDSwitcherAPI._BMDSwitcherPortType inputPortType; input.GetPortType(out inputPortType); if (inputPortType == BMDSwitcherAPI._BMDSwitcherPortType.bmdSwitcherPortTypeAuxOutput) { AuxMonitor WkMonitor = new AuxMonitor(AUXCount++); WkMonitor.AuxSourceChanged += new SwitcherEventHandler(OnAuxSourceChanged); ((IBMDSwitcherInputAux)input).AddCallback(WkMonitor); m_auxMonitors.Add(WkMonitor); } inputIterator.Next(out input); } } }
private void UpdatePopupItems() { if (SwitcherPanel.IsMainThread) { new Thread(UpdatePopupItems).Start(); return; } this.Invoke((Action)(() => { // Clear the combo boxes: comboBoxProgramSel.Items.Clear(); comboBoxPreviewSel.Items.Clear(); })); // Get an input iterator. IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator == null) { return; } IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { string inputName; long inputId; input.GetInputId(out inputId); input.GetLongName(out inputName); this.Invoke((Action)(() => { // Add items to list: comboBoxProgramSel.Items.Add(new StringObjectPair <long>(inputName, inputId)); comboBoxPreviewSel.Items.Add(new StringObjectPair <long>(inputName, inputId)); })); inputIterator.Next(out input); } UpdateProgramButtonSelection(); UpdatePreviewButtonSelection(); }
public static IBMDSwitcherInputIterator GetInputIterator(this IBMDSwitcher switcher) { IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != IntPtr.Zero) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } return(inputIterator); }
public VisionService(String IP) { if (!MainForm.IGNORE_VISION) { _BMDSwitcherConnectToFailure failReason = 0; CBMDSwitcherDiscovery switcher_discovery = new CBMDSwitcherDiscovery(); if (switcher_discovery == null) { throw new Exception("ATEM Switcher Software not installed"); } try { switcher_discovery.ConnectTo(IP, out this.Switcher, out failReason); } catch (COMException) { switch (failReason) { case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureNoResponse: throw new Exception("No response from Switcher at " + IP); case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureIncompatibleFirmware: throw new Exception("Switcher at " + IP + " has incompatible firmware"); default: throw new Exception("Connection to " + IP + " failed for unknown reason"); } } if (this.Switcher != null) { IntPtr input_iterator_ptr; this.Switcher.CreateIterator(typeof(IBMDSwitcherInputIterator).GUID, out input_iterator_ptr); if (input_iterator_ptr != null) { this.InputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(input_iterator_ptr); } else { this.Switcher = null; } } } }
public VisionService(String IP) { if (!MainForm.IGNORE_VISION) { _BMDSwitcherConnectToFailure failReason = 0; CBMDSwitcherDiscovery switcher_discovery = new CBMDSwitcherDiscovery(); if (switcher_discovery == null) { throw new Exception("ATEM Switcher Software not installed"); } try { switcher_discovery.ConnectTo(IP, out this.Switcher, out failReason); } catch (COMException) { switch (failReason) { case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureNoResponse: throw new Exception("No response from Switcher at " + IP); case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureIncompatibleFirmware: throw new Exception("Switcher at " + IP + " has incompatible firmware"); default: throw new Exception("Connection to " + IP + " failed for unknown reason"); } } if (this.Switcher != null) { IntPtr input_iterator_ptr; this.Switcher.CreateIterator(typeof(IBMDSwitcherInputIterator).GUID, out input_iterator_ptr); if (input_iterator_ptr != null) { this.InputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(input_iterator_ptr); } else { this.Switcher = null; } } } }
private void GetInputs() { IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPointer; Guid inputIteratorInterfaceID = typeof(IBMDSwitcherInputIterator).GUID; bSwitcher.CreateIterator(ref inputIteratorInterfaceID, out inputIteratorPointer); if (inputIteratorPointer == null) { return; } inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPointer); if (inputIterator == null) { return; } IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { long inputId; string inputName; input.GetInputId(out inputId); input.GetShortName(out inputName); bInputNamesById.Add(inputId, inputName); bInputIdsByName.Add(inputName, inputId); InputCallback inputCallback = new InputCallback(input); input.AddCallback(inputCallback); inputCallback.LongNameChanged += () => Dispatcher.Invoke((Action)(() => OnLongNameChanged())); bInputCallbacks.Add(inputCallback); inputIterator.Next(out input); } }
private void GetSwitcherInputIterator() { IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } Marshal.Release(inputIteratorPtr); // Releaseå¿…é ˆï¼Ÿ if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { string name = ""; long inputId; input.GetInputId(out inputId); if (input != null) { input.GetLongName(out name); ProgramDropdown.options.Add(new Dropdown.OptionData { text = name }); PreviewDropdown.options.Add(new Dropdown.OptionData { text = name }); } _inputList.Add(input); inputIterator.Next(out input); } } }
public static List <IBMDSwitcherInput> GetPorts(this IBMDSwitcher apiSwitcher) { IBMDSwitcherInputIterator inputIterator = apiSwitcher.GetInputIterator(); if (inputIterator == null) { return(null); } List <IBMDSwitcherInput> inputs = new List <IBMDSwitcherInput>(); IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { inputs.Add(input); inputIterator.Next(out input); } return(inputs); }
private void UpdatePopupItems() { // Clear the combo boxes: ComboBoxItems.Clear(); // Get an input iterator. IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator == null) { return; } IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { string inputName; long inputId; input.GetInputId(out inputId); input.GetLongName(out inputName); // Add items to list: ComboBoxItems.Add(new StringObjectPair <long>(inputName, inputId)); inputIterator.Next(out input); } }
private void ChangeAUX(int AuxNumber, long inputId) { //Console.WriteLine("AuxNumber=" + AuxNumber + " inputId=" + inputId); IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; this.m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); int AUXCount = 0; while (input != null) { BMDSwitcherAPI._BMDSwitcherPortType inputPortType; input.GetPortType(out inputPortType); if (inputPortType == BMDSwitcherAPI._BMDSwitcherPortType.bmdSwitcherPortTypeAuxOutput) { AUXCount++; if (AUXCount == AuxNumber) { IBMDSwitcherInputAux WkAux = (IBMDSwitcherInputAux)input; WkAux.SetInputSource(inputId); break; } } inputIterator.Next(out input); } } }
public void Connect() { this.BMDSwitcherInfo = new SwitcherInfo(this); #region Switcher this.BMDSwitcher = new SwitcherCallback(this.m_switcher); this.m_switcher.AddCallback(this.BMDSwitcher); #endregion #region SwitcherMediaPool this.m_switcherMediaPool = (IBMDSwitcherMediaPool)this.m_switcher; this.BMDSwitcherMediaPool = new SwitcherMediaPoolCallback(this.m_switcherMediaPool); this.m_switcherMediaPool.AddCallback(this.BMDSwitcherMediaPool); #endregion #region SwitcherStills this.m_switcherMediaPool.GetStills(out this.m_switcherStills); this.BMDSwitcherStills = new SwitcherStillsCallback(this.m_switcherStills); this.m_switcherStills.GetCount(out uint totalStills); for (this.BMDSwitcherInfo.TotalSwitcherStills = 0; this.BMDSwitcherInfo.TotalSwitcherStills < totalStills; this.BMDSwitcherInfo.TotalSwitcherStills++) { this.BMDSwitcherStill.Add(new SwitcherStill(this.m_switcherStills, (int)this.BMDSwitcherInfo.TotalSwitcherStills)); } #endregion #region SwitcherClips this.m_switcherMediaPool.GetClipCount(out uint totalClips); for (this.BMDSwitcherInfo.TotalSwitcherClip = 0; this.BMDSwitcherInfo.TotalSwitcherClip < totalClips; this.BMDSwitcherInfo.TotalSwitcherClip++) { this.m_switcherMediaPool.GetClip(this.BMDSwitcherInfo.TotalSwitcherClip, out this.m_switcherClip); this.BMDSwitcherClip.Add(new SwitcherClipCallback(this.m_switcherClip, (int)this.BMDSwitcherInfo.TotalSwitcherClip)); } #endregion #region SwitcherMacroPool this.m_switcherMacroPool = (IBMDSwitcherMacroPool)this.m_switcher; this.BMDSwitcherMacroPool = new SwitcherMacroPoolCallback(this.m_switcherMacroPool); this.m_switcherMacroPool.AddCallback(this.BMDSwitcherMacroPool); this.m_switcherMacroPool.GetMaxCount(out uint totalMacros); for (this.BMDSwitcherInfo.TotalSwitcherMacros = 0; this.BMDSwitcherInfo.TotalSwitcherMacros < totalMacros; this.BMDSwitcherInfo.TotalSwitcherMacros++) { this.BMDSwitcherMacro.Add(new SwitcherMacro(this.m_switcherMacroPool, (int)this.BMDSwitcherInfo.TotalSwitcherMacros)); } #endregion #region SwitcherAudioMixer this.m_switcherAudioMixer = (IBMDSwitcherAudioMixer)this.m_switcher; this.BMDSwitcherAudioMixer = new SwitcherAudioMixerCallback(this.m_switcherAudioMixer); this.m_switcherAudioMixer.AddCallback(this.BMDSwitcherAudioMixer); #endregion #region SwitcherMixMinusOutput try { this.m_switcherMixMinusOutput = (IBMDSwitcherMixMinusOutput)this.m_switcher; this.BMDSwitcherMixMinusOutput = new SwitcherMixMinusOutputCallback(this.m_switcherMixMinusOutput); this.m_switcherMixMinusOutput.AddCallback(this.BMDSwitcherMixMinusOutput); } catch { // Not Supported bij switcher } #endregion #region SwitcherInput IBMDSwitcherInputIterator SwitcherInputIterator = null; Guid SwitcherInputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; this.m_switcher.CreateIterator(ref SwitcherInputIteratorIID, out IntPtr SwitcherInputIteratorintPtr); SwitcherInputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(SwitcherInputIteratorintPtr); if (SwitcherInputIterator != null) { SwitcherInputIterator.Next(out this.m_switcherInput); while (this.m_switcherInput != null) { SwitcherInputCallback switcherInputCallback = new SwitcherInputCallback(this.m_switcherInput, this.BMDSwitcherInfo.TotalSwitcherInput); this.m_switcherInput.AddCallback(switcherInputCallback); this.BMDSwitcherInput.Add(switcherInputCallback); switch (switcherInputCallback.PortType) { #region bmdSwitcherPortTypeBlack case _BMDSwitcherPortType.bmdSwitcherPortTypeBlack: this.BMDSwitcherInfo.TotalSwitcherPortTypeBlack++; break; #endregion #region SwitcherPortTypeColorBars case _BMDSwitcherPortType.bmdSwitcherPortTypeColorBars: this.BMDSwitcherInfo.TotalSwitcherPortTypeColorBars++; break; #endregion #region SwitcherPortTypeExternal case _BMDSwitcherPortType.bmdSwitcherPortTypeExternal: this.BMDSwitcherInfo.TotalSwitcherPortTypeExternal++; break; #endregion #region SwitcherPortTypeKeyCutOutput case _BMDSwitcherPortType.bmdSwitcherPortTypeKeyCutOutput: this.BMDSwitcherInfo.TotalSwitcherPortTypeKeyCutOutput++; break; #endregion #region SwitcherPortTypeMediaPlayerCut case _BMDSwitcherPortType.bmdSwitcherPortTypeMediaPlayerCut: this.BMDSwitcherInfo.TotalSwitcherPortTypeMediaPlayerCut++; break; #endregion #region SwitcherPortTypeMediaPlayerFill case _BMDSwitcherPortType.bmdSwitcherPortTypeMediaPlayerFill: this.BMDSwitcherInfo.TotalSwitcherPortTypeMediaPlayerFill++; break; #endregion #region SwitcherPortTypeMixEffectBlockOutput case _BMDSwitcherPortType.bmdSwitcherPortTypeMixEffectBlockOutput: this.BMDSwitcherInfo.TotalSwitcherPortTypeMixEffectBlockOutput++; break; #endregion #region SwitcherPortTypeAuxOutput case _BMDSwitcherPortType.bmdSwitcherPortTypeAuxOutput: this.m_switcherInputAux = (IBMDSwitcherInputAux)this.m_switcherInput; SwitcherInputAuxCallback switcherInputAuxCallback = new SwitcherInputAuxCallback(this.m_switcherInputAux, this.BMDSwitcherInfo.TotalSwitcherPortTypeAuxOutput); this.BMDSwitcherInputAux.Add(switcherInputAuxCallback); this.BMDSwitcherInfo.TotalSwitcherPortTypeAuxOutput++; break; #endregion #region SwitcherPortTypeColorGenerator case _BMDSwitcherPortType.bmdSwitcherPortTypeColorGenerator: this.m_switcherInputColor = (IBMDSwitcherInputColor)this.m_switcherInput; SwitcherInputColorCallback switcherInputColorCallback = new SwitcherInputColorCallback(this.m_switcherInputColor, this.BMDSwitcherInfo.TotalSwitcherPortTypeColorGenerator); this.BMDSwitcherInputColor.Add(switcherInputColorCallback); this.BMDSwitcherInfo.TotalSwitcherPortTypeColorGenerator++; break; #endregion #region SwitcherPortTypeSuperSource case _BMDSwitcherPortType.bmdSwitcherPortTypeSuperSource: this.m_switcherInputSuperSource_v7_5_2 = (IBMDSwitcherInputSuperSource_v7_5_2)this.m_switcherInput; SwitcherInputSuperSourceCallback_v7_5_2 switcherInputSuperSourceCallback_v7_5_2 = new SwitcherInputSuperSourceCallback_v7_5_2(this.m_switcherInputSuperSource_v7_5_2, this.BMDSwitcherInfo.TotalSwitcherPortTypeSuperSource_v7_5_2); this.BMDSwitcherInputSuperSource_v7_5_2.Add(switcherInputSuperSourceCallback_v7_5_2); this.BMDSwitcherInfo.TotalSwitcherPortTypeSuperSource_v7_5_2++; break; #endregion } SwitcherInputIterator.Next(out this.m_switcherInput); this.BMDSwitcherInfo.TotalSwitcherInput++; } } #endregion #region SwitcherMixEffectBlock IBMDSwitcherMixEffectBlockIterator_v7_5 SwitcherMixEffectBlockIterator_v7_5 = null; Guid SwitcherMixEffectBlockIteratorIID_v7_5 = typeof(IBMDSwitcherMixEffectBlockIterator_v7_5).GUID; IBMDSwitcherKeyIterator SwitcherKeyIterator = null; Guid SwitcherKeyIteratorIID = typeof(IBMDSwitcherKeyIterator).GUID; this.m_switcher.CreateIterator(ref SwitcherMixEffectBlockIteratorIID_v7_5, out IntPtr SwitcherMixEffectBlockIteratorintPtr); SwitcherMixEffectBlockIterator_v7_5 = (IBMDSwitcherMixEffectBlockIterator_v7_5)Marshal.GetObjectForIUnknown(SwitcherMixEffectBlockIteratorintPtr); if (SwitcherMixEffectBlockIterator_v7_5 != null) { SwitcherMixEffectBlockIterator_v7_5.Next(out this.m_switcherMixEffectBlock_v7_5); while (this.m_switcherMixEffectBlock_v7_5 != null) { #region SwitcherTransitionParameters this.m_switcherTransitionParameters = (IBMDSwitcherTransitionParameters)this.m_switcherMixEffectBlock_v7_5; this.BMDSwitcherTransitionParameters = new SwitcherTransitionParametersCallback(this.m_switcherTransitionParameters); this.m_switcherTransitionParameters.AddCallback(this.BMDSwitcherTransitionParameters); #endregion #region SwitcherTransitionDipParameters this.m_switcherTransitionDipParameters = (IBMDSwitcherTransitionDipParameters)this.m_switcherMixEffectBlock_v7_5; this.BMDSwitcherTransitionDipParameters = new SwitcherTransitionDipParametersCallback(this.m_switcherTransitionDipParameters); this.m_switcherTransitionDipParameters.AddCallback(this.BMDSwitcherTransitionDipParameters); #endregion #region SwitcherTransitionDVEParameters try { this.m_switcherTransitionDVEParameters = (IBMDSwitcherTransitionDVEParameters)this.m_switcherMixEffectBlock_v7_5; this.BMDSwitcherTransitionDVEParameters = new SwitcherTransitionDVEParametersCallback(this.m_switcherTransitionDVEParameters); this.m_switcherTransitionDVEParameters.AddCallback(this.BMDSwitcherTransitionDVEParameters); } catch { } #endregion #region SwitcherTransitionMixParameters this.m_switcherTransitionMixParameters = (IBMDSwitcherTransitionMixParameters)this.m_switcherMixEffectBlock_v7_5; this.BMDSwitcherTransitionMixParameters = new SwitcherTransitionMixParametersCallback(this.m_switcherTransitionMixParameters); this.m_switcherTransitionMixParameters.AddCallback(this.BMDSwitcherTransitionMixParameters); #endregion #region SwitcherTransitionStingerParameters try { this.m_switcherTransitionStingerParameters = (IBMDSwitcherTransitionStingerParameters)this.m_switcherMixEffectBlock_v7_5; this.BMDSwitcherTransitionStingerParameters = new SwitcherTransitionStingerParametersCallback(this.m_switcherTransitionStingerParameters); this.m_switcherTransitionStingerParameters.AddCallback(this.BMDSwitcherTransitionStingerParameters); } catch { } #endregion #region SwitcherTransitionWipeParameters this.m_switcherTransitionWipeParameters = (IBMDSwitcherTransitionWipeParameters)this.m_switcherMixEffectBlock_v7_5; this.BMDSwitcherTransitionWipeParameters = new SwitcherTransitionWipeParametersCallback(this.m_switcherTransitionWipeParameters); this.m_switcherTransitionWipeParameters.AddCallback(this.BMDSwitcherTransitionWipeParameters); #endregion SwitcherMixEffectBlockCallback_v7_5 switcherMixEffectBlockCallback_v7_5 = new SwitcherMixEffectBlockCallback_v7_5(this.m_switcherMixEffectBlock_v7_5, this.BMDSwitcherInfo.TotalSwitcherMixEffectBlock_v7_5); this.m_switcherMixEffectBlock_v7_5.AddCallback(switcherMixEffectBlockCallback_v7_5); this.BMDSwitcherMixEffectBlock_7_5.Add(switcherMixEffectBlockCallback_v7_5); this.m_switcherMixEffectBlock_v7_5.CreateIterator(ref SwitcherKeyIteratorIID, out IntPtr SwitcherKeyIteratorintPtr); SwitcherKeyIterator = (IBMDSwitcherKeyIterator)Marshal.GetObjectForIUnknown(SwitcherKeyIteratorintPtr); if (SwitcherKeyIterator != null) { SwitcherKeyIterator.Next(out this.m_switcherKey); while (this.m_switcherKey != null) { #region SwitcherKey SwitcherKeyCallback switcherKeyCallback = new SwitcherKeyCallback(this.m_switcherKey, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKey.AddCallback(switcherKeyCallback); this.BMDSwitcherKey.Add(switcherKeyCallback); #endregion #region SwitcherKeyChromaParameters this.m_switcherKeyChromaParameters = (IBMDSwitcherKeyChromaParameters)this.m_switcherKey; SwitcherKeyChromaParametersCallback switcherKeyChromaParametersCallback = new SwitcherKeyChromaParametersCallback(this.m_switcherKeyChromaParameters, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKeyChromaParameters.AddCallback(switcherKeyChromaParametersCallback); this.BMDSwitcherKeyChromaParameters.Add(switcherKeyChromaParametersCallback); #endregion #region SwitcherKeyLumaParameters this.m_switcherKeyLumaParameters = (IBMDSwitcherKeyLumaParameters)this.m_switcherKey; SwitcherKeyLumaParametersCallback switcherKeyLumaParametersCallback = new SwitcherKeyLumaParametersCallback(this.m_switcherKeyLumaParameters, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKeyLumaParameters.AddCallback(switcherKeyLumaParametersCallback); this.BMDSwitcherKeyLumaParameters.Add(switcherKeyLumaParametersCallback); #endregion #region SwitcherKeyPatternParameters this.m_switcherKeyPatternParameters = (IBMDSwitcherKeyPatternParameters)this.m_switcherKey; SwitcherKeyPatternParametersCallback switcherKeyPatternParametersCallback = new SwitcherKeyPatternParametersCallback(this.m_switcherKeyPatternParameters, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKeyPatternParameters.AddCallback(switcherKeyPatternParametersCallback); this.BMDSwitcherKeyPatternParameters.Add(switcherKeyPatternParametersCallback); #endregion #region SwitcherKeyDVEParameters try { this.m_switcherKeyDVEParameters = (IBMDSwitcherKeyDVEParameters)this.m_switcherKey; SwitcherKeyDVEParametersCallback switcherKeyDVEParametersCallback = new SwitcherKeyDVEParametersCallback(this.m_switcherKeyDVEParameters, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKeyDVEParameters.AddCallback(switcherKeyDVEParametersCallback); this.BMDSwitcherKeyDVEParameters.Add(switcherKeyDVEParametersCallback); } catch { } #endregion #region SwitcherKeyFlyParameters this.m_switcherKeyFlyParameters = (IBMDSwitcherKeyFlyParameters)this.m_switcherKey; SwitcherKeyFlyParametersCallback switcherKeyFlyParametersCallback = new SwitcherKeyFlyParametersCallback(this.m_switcherKeyFlyParameters, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKeyFlyParameters.AddCallback(switcherKeyFlyParametersCallback); this.BMDSwitcherKeyFlyParameters.Add(switcherKeyFlyParametersCallback); #endregion #region SwitcherKeyFlyKeyFrameParameters (Not sure if i handle it the right way. this.m_switcherKeyFlyKeyFrameParameters = (IBMDSwitcherKeyFlyKeyFrameParameters)switcherKeyFlyParametersCallback.KeyFrameParameters(_BMDSwitcherFlyKeyFrame.bmdSwitcherFlyKeyFrameA); SwitcherKeyFlyKeyFrameParametersCallback switcherKeyFlyKeyFrameParametersCallback = new SwitcherKeyFlyKeyFrameParametersCallback(this.m_switcherKeyFlyKeyFrameParameters, this.BMDSwitcherInfo.TotalSwitcherKey); this.m_switcherKeyFlyKeyFrameParameters.AddCallback(switcherKeyFlyKeyFrameParametersCallback); this.BMDSwitcherKeyFlyKeyFrameParameters.Add(switcherKeyFlyKeyFrameParametersCallback); #endregion SwitcherKeyIterator.Next(out this.m_switcherKey); this.BMDSwitcherInfo.TotalSwitcherKey++; } } SwitcherMixEffectBlockIterator_v7_5.Next(out this.m_switcherMixEffectBlock_v7_5); this.BMDSwitcherInfo.TotalSwitcherMixEffectBlock_v7_5++; } } #endregion #region SwitcherDownstreamKey IBMDSwitcherDownstreamKeyIterator SwitcherDownstreamKeyIterator = null; Guid SwitcherDownstreamKeyIteratorIID = typeof(IBMDSwitcherDownstreamKeyIterator).GUID; this.m_switcher.CreateIterator(ref SwitcherDownstreamKeyIteratorIID, out IntPtr SwitcherDownstreamKeyIteratorintPtr); SwitcherDownstreamKeyIterator = (IBMDSwitcherDownstreamKeyIterator)Marshal.GetObjectForIUnknown(SwitcherDownstreamKeyIteratorintPtr); if (SwitcherDownstreamKeyIterator != null) { SwitcherDownstreamKeyIterator.Next(out this.m_switcherDownstreamKey); while (this.m_switcherDownstreamKey != null) { SwitcherDownstreamKeyCallback switcherDownstreamKeyCallback = new SwitcherDownstreamKeyCallback(this.m_switcherDownstreamKey, this.BMDSwitcherInfo.TotalSwitcherDownstreamKey); this.m_switcherDownstreamKey.AddCallback(switcherDownstreamKeyCallback); this.BMDSwitcherDownstreamKey.Add(switcherDownstreamKeyCallback); SwitcherDownstreamKeyIterator.Next(out this.m_switcherDownstreamKey); this.BMDSwitcherInfo.TotalSwitcherDownstreamKey++; } } #endregion #region SwitcherAudioInput IBMDSwitcherAudioInputIterator SwitcherAudioInputIterator = null; Guid SwitcherAudioInputIteratorIID = typeof(IBMDSwitcherAudioInputIterator).GUID; this.m_switcherAudioMixer.CreateIterator(ref SwitcherAudioInputIteratorIID, out IntPtr SwitcherAudioInputIteratorintPtr); SwitcherAudioInputIterator = (IBMDSwitcherAudioInputIterator)Marshal.GetObjectForIUnknown(SwitcherAudioInputIteratorintPtr); if (SwitcherAudioInputIterator != null) { SwitcherAudioInputIterator.Next(out this.m_switcherAudioInput); while (this.m_switcherAudioInput != null) { SwitcherAudioInputCallback switcherAudioInputCallback = new SwitcherAudioInputCallback(this.m_switcherAudioInput, this.BMDSwitcherInfo.TotalSwitcherAudioInput); this.m_switcherAudioInput.AddCallback(switcherAudioInputCallback); this.BMDSwitcherAudioInput.Add(switcherAudioInputCallback); SwitcherAudioInputIterator.Next(out this.m_switcherAudioInput); this.BMDSwitcherInfo.TotalSwitcherAudioInput++; } } #endregion #region SwitcherAudioMonitorOutput IBMDSwitcherAudioMonitorOutputIterator SwitcherAudioMonitorOutputIterator = null; Guid SwitcherAudioMonitorOutputIteratorIID = typeof(IBMDSwitcherAudioMonitorOutputIterator).GUID; this.m_switcherAudioMixer.CreateIterator(ref SwitcherAudioMonitorOutputIteratorIID, out IntPtr SwitcherAudioMonitorOutputIteratorintPtr); SwitcherAudioMonitorOutputIterator = (IBMDSwitcherAudioMonitorOutputIterator)Marshal.GetObjectForIUnknown(SwitcherAudioMonitorOutputIteratorintPtr); if (SwitcherAudioMonitorOutputIterator != null) { SwitcherAudioMonitorOutputIterator.Next(out this.m_switcherAudioMonitorOutput); while (this.m_switcherAudioMonitorOutput != null) { SwitcherAudioMonitorOutputCallback switcherAudioMonitorOutputCallback = new SwitcherAudioMonitorOutputCallback(this.m_switcherAudioMonitorOutput, this.BMDSwitcherInfo.TotalSwitcherAudioMonitorOutput); this.m_switcherAudioMonitorOutput.AddCallback(switcherAudioMonitorOutputCallback); this.BMDSwitcherAudioMonitorOutput.Add(switcherAudioMonitorOutputCallback); SwitcherAudioMonitorOutputIterator.Next(out this.m_switcherAudioMonitorOutput); this.BMDSwitcherInfo.TotalSwitcherAudioMonitorOutput++; } } #endregion #region SwitcherMediaPlayer IBMDSwitcherMediaPlayerIterator SwitcherMediaPlayerIterator = null; Guid SwitcherMediaPlayerIteratorIID = typeof(IBMDSwitcherMediaPlayerIterator).GUID; this.m_switcher.CreateIterator(ref SwitcherMediaPlayerIteratorIID, out IntPtr SwitcherMediaPlayerIteratorintPtr); SwitcherMediaPlayerIterator = (IBMDSwitcherMediaPlayerIterator)Marshal.GetObjectForIUnknown(SwitcherMediaPlayerIteratorintPtr); if (SwitcherMediaPlayerIterator != null) { SwitcherMediaPlayerIterator.Next(out m_switcherMediaPlayer); while (this.m_switcherMediaPlayer != null) { SwitcherMediaPlayerCallback switcherMediaPlayerCallback = new SwitcherMediaPlayerCallback(this.m_switcherMediaPlayer, this.BMDSwitcherInfo.TotalSwitcherMediaPlayer); this.m_switcherMediaPlayer.AddCallback(switcherMediaPlayerCallback); this.BMDSwitcherMediaPlayer.Add(switcherMediaPlayerCallback); SwitcherMediaPlayerIterator.Next(out m_switcherMediaPlayer); this.BMDSwitcherInfo.TotalSwitcherMediaPlayer++; } } #endregion #region SwitcherMultiView IBMDSwitcherMultiViewIterator_v7_5_2 SwitcherMultiViewIterator_v7_5_2 = null; Guid SwitcherMultiViewIteratorIID_v7_5_2 = typeof(IBMDSwitcherMultiViewIterator_v7_5_2).GUID; this.m_switcher.CreateIterator(ref SwitcherMultiViewIteratorIID_v7_5_2, out IntPtr SwitcherMultiViewIteratorintPtr_v7_5_2); SwitcherMultiViewIterator_v7_5_2 = (IBMDSwitcherMultiViewIterator_v7_5_2)Marshal.GetObjectForIUnknown(SwitcherMultiViewIteratorintPtr_v7_5_2); if (SwitcherMultiViewIterator_v7_5_2 != null) { SwitcherMultiViewIterator_v7_5_2.Next(out m_switcherMultiView_v7_5_2); while (this.m_switcherMultiView_v7_5_2 != null) { SwitcherMultiViewCallback switcherMultiViewCallback = new SwitcherMultiViewCallback(this.m_switcherMultiView_v7_5_2, this.BMDSwitcherInfo.TotalSwitcherMultiView); this.m_switcherMultiView_v7_5_2.AddCallback(switcherMultiViewCallback); this.BMDSwitcherMultiView.Add(switcherMultiViewCallback); SwitcherMultiViewIterator_v7_5_2.Next(out m_switcherMultiView_v7_5_2); this.BMDSwitcherInfo.TotalSwitcherMultiView++; } } #endregion }
private void SwitcherConnected() { //buttonConnect.Enabled = false; // Get the switcher name: string switcherName; m_switcher.GetProductName(out switcherName); //textBoxSwitcherName.Text = switcherName; // Install SwitcherMonitor callbacks: m_switcher.AddCallback(m_switcherMonitor); // We create input monitors for each input. To do this we iterate over all inputs: // This will allow us to update the combo boxes when input names change: IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { InputMonitor newInputMonitor = new InputMonitor(input); input.AddCallback(newInputMonitor); newInputMonitor.LongNameChanged += new SwitcherEventHandler(OnInputLongNameChanged); m_inputMonitors.Add(newInputMonitor); inputIterator.Next(out input); } } // We want to get the first Mix Effect block (ME 1). We create a ME iterator, // and then get the first one: m_mixEffectBlock1 = null; IBMDSwitcherMixEffectBlockIterator meIterator = null; IntPtr meIteratorPtr; Guid meIteratorIID = typeof(IBMDSwitcherMixEffectBlockIterator).GUID; m_switcher.CreateIterator(ref meIteratorIID, out meIteratorPtr); if (meIteratorPtr != null) { meIterator = (IBMDSwitcherMixEffectBlockIterator)Marshal.GetObjectForIUnknown(meIteratorPtr); } if (meIterator == null) { return; } if (meIterator != null) { meIterator.Next(out m_mixEffectBlock1); } if (m_mixEffectBlock1 == null) { MessageBox.Show("Unexpected: Could not get first mix effect block", "Error"); return; } // Install MixEffectBlockMonitor callbacks: m_mixEffectBlock1.AddCallback(m_mixEffectBlockMonitor); //MixEffectBlockSetEnable(true); getInputNames(); addAUXCallback(); //setCurrent preview ID m_mixEffectBlock1.GetInt(_BMDSwitcherMixEffectBlockPropertyId.bmdSwitcherMixEffectBlockPropertyIdPreviewInput, out currentPreview); currentKey = -1; //setCurrent Program ID m_mixEffectBlock1.GetInt(_BMDSwitcherMixEffectBlockPropertyId.bmdSwitcherMixEffectBlockPropertyIdProgramInput, out currentProgram); updateProgPrevUI(currentPreview, false); updateProgPrevUI(currentProgram, true); UpdateAuxSourceCombos(); MidiListener midi = new MidiListener(); midi.StartListening(this); }
private void getInputNames() { // Get an input iterator. IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator == null) { return; } IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { string inputName; long inputId; input.GetInputId(out inputId); input.GetLongName(out inputName); Console.WriteLine(inputId + " " + inputName); switch (inputId) { case 1: //progBut6.Content = inputName; //prevBut6.Content = inputName; break; case 2: progBut1.Content = inputName; prevBut1.Content = inputName; break; case 3: progBut2.Content = inputName; prevBut2.Content = inputName; break; case 4: progBut3.Content = inputName; prevBut3.Content = inputName; break; case 5: progBut4.Content = inputName; prevBut4.Content = inputName; break; case 6: progBut5.Content = inputName; prevBut5.Content = inputName; break; /* * case 3010: * progBut6.Content = inputName; * prevBut6.Content = inputName; * break; */ } inputIterator.Next(out input); } }
private void UpdateAuxSourceCombos() { long lvSource = 0; IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; this.m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); int AUXCount = 0; while (input != null) { BMDSwitcherAPI._BMDSwitcherPortType inputPortType; input.GetPortType(out inputPortType); if (inputPortType == BMDSwitcherAPI._BMDSwitcherPortType.bmdSwitcherPortTypeAuxOutput) { IBMDSwitcherInputAux WkAux = (IBMDSwitcherInputAux)input; WkAux.GetInputSource(out lvSource); AUXCount++; if (AUXCount == 1) { switch (lvSource) { case 6: aux1But1.IsChecked = true; break; case 10010: aux1But2.IsChecked = true; break; case 3010: aux1But3.IsChecked = true; break; case 2: aux1But4.IsChecked = true; break; case 3: aux1But5.IsChecked = true; break; case 4: aux1But7.IsChecked = true; break; case 5: aux1But8.IsChecked = true; break; } //ComboBox WkCombo = (ComboBox)this.Controls.Find("comboBoxAUX" + AUXCount, true)[0]; //foreach (StringObjectPair<long> item in WkCombo.Items) //{ // if (item.value == lvSource) // { //WkCombo.SelectedIndex = WkCombo.Items.IndexOf(item); // break; // } //} } if (AUXCount == 3) { //UpdateAudio options -- 6=input 6 (Slid/mixer out), 1=input 1 (Ann/broadcast computer). 1201=input RCA (slides computer) switch (lvSource) { case 1: Console.WriteLine("2"); //aux2But2.IsChecked = true; //UpdateAudio(1, 6); aux2But8.IsChecked = true; break; case 10010: aux2But1.IsChecked = true; //UpdateAudio(6, 1); //aux2But9.IsChecked = true; break; case 3010: //aux2But2.IsChecked = true; break; case 2: aux2But3.IsChecked = true; break; case 3: aux2But4.IsChecked = true; break; case 4: aux2But6.IsChecked = true; break; case 5: aux2But7.IsChecked = true; break; case 6: aux2But5.IsChecked = true; break; } } } inputIterator.Next(out input); } } }
public MainWindow() { InitializeComponent(); _BMDSwitcherConnectToFailure failReason = 0; switcherDiscovery = new CBMDSwitcherDiscovery(); try { switcherDiscovery.ConnectTo("10.11.12.21", out switcher, out failReason); } catch (COMException) { // An exception will be thrown if ConnectTo fails. For more information, see failReason. switch (failReason) { case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureNoResponse: MessageBox.Show("No response from Switcher", "Error"); break; case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureIncompatibleFirmware: MessageBox.Show("Switcher has incompatible firmware", "Error"); break; default: MessageBox.Show("Connection failed for unknown reason", "Error"); break; } } mixEffectBlock1 = null; IBMDSwitcherMixEffectBlockIterator meIterator = null; IntPtr meIteratorPtr; Guid meIteratorIID = typeof(IBMDSwitcherMixEffectBlockIterator).GUID; switcher.CreateIterator(ref meIteratorIID, out meIteratorPtr); if (meIteratorPtr != null) { meIterator = (IBMDSwitcherMixEffectBlockIterator)Marshal.GetObjectForIUnknown(meIteratorPtr); } if (meIterator != null) { meIterator.Next(out mixEffectBlock1); } if (mixEffectBlock1 == null) { MessageBox.Show("Unexpected: Could not get first mix effect block", "Error"); } IBMDSwitcherInput currentInput = null; IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { inputIterator.Next(out currentInput); while (currentInput != null) { MixerInput input = new MixerInput(currentInput); inputList.Add(input); inputIterator.Next(out currentInput); } } mixEffectBlock1.AddCallback(monitor); monitor.InTransitionChanged += new MixerMonitorEventHandler((s, a) => this.Dispatcher.Invoke((Action)(() => InTransitionChanged(s, a)))); indev = new Sanford.Multimedia.Midi.InputDevice(3); indev.ChannelMessageReceived += Indev_ChannelMessageReceived; indev.StartRecording(); mappingList.ItemsSource = inputList; }
public Switcher(string ipAddress) { var options = new PusherOptions { Cluster = "us2", Encrypted = true }; pusher = new Pusher( "1137245", "f9cabd4c01730143d579", "3b87a4daf5b3f26ee1be", options); IBMDSwitcherDiscovery discovery = new CBMDSwitcherDiscovery(); _BMDSwitcherConnectToFailure failureReason; discovery.ConnectTo(ipAddress, out m_switcher, out failureReason); m_switcherMonitor = new SwitcherMonitor(); m_switcherMonitor.SwitcherDisconnected += OnSwitcherDisconnected; m_mixEffectBlockMonitor = new MixEffectBlockMonitor(); m_mixEffectBlockMonitor.ProgramInputChanged += OnSwitcherProgramChange; m_mixEffectBlockMonitor.PreviewInputChanged += OnSwitcherPreviewChange; m_switcher.AddCallback(m_switcherMonitor); IBMDSwitcherInput input = null; // We create input monitors for each input. To do this we iterate over all inputs: // This will allow us to update the combo boxes when input names change: IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { input = null; inputIterator.Next(out input); while (input != null) { InputMonitor newInputMonitor = new InputMonitor(input); input.AddCallback(newInputMonitor); m_inputMonitors.Add(newInputMonitor); inputIterator.Next(out input); } } //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; //} // We want to get the first Mix Effect block (ME 1). We create a ME iterator, // and then get the first one: //m_mixEffectBlock1 = null; IBMDSwitcherMixEffectBlockIterator meIterator = null; IntPtr meIteratorPtr; Guid meIteratorIID = typeof(IBMDSwitcherMixEffectBlockIterator).GUID; m_switcher.CreateIterator(ref meIteratorIID, out meIteratorPtr); if (meIteratorPtr != null) { meIterator = (IBMDSwitcherMixEffectBlockIterator)Marshal.GetObjectForIUnknown(meIteratorPtr); } if (meIterator == null) { return; } if (meIterator != null) { meIterator.Next(out m_mixEffectBlock1); } // Install MixEffectBlockMonitor callbacks: m_mixEffectBlock1.AddCallback(m_mixEffectBlockMonitor); // Get an input iterator. inputIterator = null; inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator == null) { return; } input = null; inputIterator.Next(out input); while (input != null) { string inputName; long inputId; input.GetInputId(out inputId); input.GetLongName(out inputName); // Add items to list: m_output_list.Add(new StringObjectPair <long>(inputName, inputId)); //m_output_list.Add(new StringObjectPair<long>(inputName, inputId)); inputIterator.Next(out input); } //while (true) //{ //} }
private void SwitcherConnected() { if (SwitcherPanel.IsMainThread) { new Thread(SwitcherConnected).Start(); return; } this.Invoke((Action)(() => { buttonConnect.Enabled = false; })); // Get the switcher name: string switcherName; m_switcher.GetProductName(out switcherName); this.Invoke((Action)(() => { textBoxSwitcherName.Text = switcherName; })); // Install SwitcherMonitor callbacks: m_switcher.AddCallback(m_switcherMonitor); // We create input monitors for each input. To do this we iterate over all inputs: // This will allow us to update the combo boxes when input names change: IBMDSwitcherInputIterator inputIterator = null; IntPtr inputIteratorPtr; Guid inputIteratorIID = typeof(IBMDSwitcherInputIterator).GUID; m_switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { InputMonitor newInputMonitor = new InputMonitor(input); input.AddCallback(newInputMonitor); newInputMonitor.LongNameChanged += new SwitcherEventHandler(OnInputLongNameChanged); m_inputMonitors.Add(newInputMonitor); inputIterator.Next(out input); } } // We want to get the first Mix Effect block (ME 1). We create a ME iterator, // and then get the first one: m_mixEffectBlock1 = null; IBMDSwitcherMixEffectBlockIterator meIterator = null; IntPtr meIteratorPtr; Guid meIteratorIID = typeof(IBMDSwitcherMixEffectBlockIterator).GUID; m_switcher.CreateIterator(ref meIteratorIID, out meIteratorPtr); if (meIteratorPtr != null) { meIterator = (IBMDSwitcherMixEffectBlockIterator)Marshal.GetObjectForIUnknown(meIteratorPtr); } if (meIterator == null) { return; } if (meIterator != null) { meIterator.Next(out m_mixEffectBlock1); } if (m_mixEffectBlock1 == null) { this.Invoke((Action)(() => { MessageBox.Show("Unexpected: Could not get first mix effect block", "Error"); })); return; } // Install MixEffectBlockMonitor callbacks: m_mixEffectBlock1.AddCallback(m_mixEffectBlockMonitor); this.Invoke((Action)(() => { MixEffectBlockSetEnable(true); })); UpdatePopupItems(); UpdateTransitionFramesRemaining(); UpdateSliderPosition(); }