IBMDSwitcherMixEffectBlock GetMixBox1() { 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(null); } IBMDSwitcherMixEffectBlock temp = null; if (meIterator != null) { meIterator.Next(out temp); } return(temp); }
public static IBMDSwitcherMixEffectBlock GetFirstMixEffectBlock(this IBMDSwitcher switcher) { IBMDSwitcherMixEffectBlock result = null; switcher.IterateMixEffectBlock((b) => { result = b; return(false); }); return(result); }
private void SwitcherDisconnected() { IsConnected = false; // Remove all input monitors, remove callbacks foreach (InputMonitor inputMon in m_inputMonitors) { inputMon.Input.RemoveCallback(inputMon); inputMon.LongNameChanged -= new SwitcherEventHandler(OnInputLongNameChanged); } 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; } }
public static void IterateMixEffectBlock(this IBMDSwitcher switcher, Func <IBMDSwitcherMixEffectBlock, bool> func) { // We want to get the first Mix Effect block (ME 1). We create a ME iterator, // and then get the first one: IBMDSwitcherMixEffectBlock 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); while (mixEffectBlock1 != null && func(mixEffectBlock1)) { meIterator.Next(out mixEffectBlock1); } } }
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); }
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); }
public MixEffectBlock(Switcher parentSwitcher, IBMDSwitcherMixEffectBlock apiMixEffectBlock, int index) { ParentSwitcher = parentSwitcher; ApiMixEffectBlock = apiMixEffectBlock; ApiMixEffectBlock.AddCallback(this); Index = index; initPPsources(); }
public void setPreviewSource(Source previewSource) { connect(); IBMDSwitcherMixEffectBlock mixEffectBlock = this.MixEffectBlocks.First(); inputs.ElementAt((int)previewSource).GetInputId(out long inputId); mixEffectBlock.SetPreviewInput(inputId); }
public MixEffectBlock(Switcher switcher, IBMDSwitcherMixEffectBlock bmd, IMediator mediator) { _switcher = switcher; _bmd = bmd; _mediator = mediator; _transitionParameters = _bmd.GetTransitionParameters(); _bmd.AddCallback(new MixEffectBlockCallback(this, _mediator)); _transitionParameters.AddCallback(new TransitionParametersCallback(_transitionParameters, _mediator)); }
static void Main(string[] args) { // Create switcher discovery object IBMDSwitcherDiscovery discovery = new CBMDSwitcherDiscovery(); // Connect to switcher IBMDSwitcher switcher; _BMDSwitcherConnectToFailure failureReason; discovery.ConnectTo("192.168.10.240", out switcher, out failureReason); Console.WriteLine("Connected to switcher"); var atem = new AtemSwitcher(switcher); // Get reference to various objects IBMDSwitcherMixEffectBlock me0 = atem.MixEffectBlocks.First(); IBMDSwitcherTransitionParameters me0TransitionParams = me0 as IBMDSwitcherTransitionParameters; IBMDSwitcherTransitionWipeParameters me0WipeTransitionParams = me0 as IBMDSwitcherTransitionWipeParameters; IBMDSwitcherInput input4 = atem.SwitcherInputs .Where((i, ret) => { _BMDSwitcherPortType type; i.GetPortType(out type); return(type == _BMDSwitcherPortType.bmdSwitcherPortTypeExternal); }) .ElementAt(4); // Setup the transition Console.WriteLine("Setting preview input"); me0.SetPreviewInput(GetInputId(input4)); Console.WriteLine("Setting next transition selection"); me0TransitionParams.SetNextTransitionSelection(_BMDSwitcherTransitionSelection.bmdSwitcherTransitionSelectionBackground); Console.WriteLine("Setting next transition style"); me0TransitionParams.SetNextTransitionStyle(_BMDSwitcherTransitionStyle.bmdSwitcherTransitionStyleWipe); Console.WriteLine("Setting transition style"); me0WipeTransitionParams.SetPattern(_BMDSwitcherPatternStyle.bmdSwitcherPatternStyleRectangleIris); Console.WriteLine("Setting transition rate"); me0WipeTransitionParams.SetRate(60); // Perform the transition Console.WriteLine("Performing auto transition"); me0.PerformAutoTransition(); System.Threading.Thread.Sleep(2000); System.Threading.Thread.Sleep(1000); me0.PerformAutoTransition(); Console.Write("Press ENTER to exit..."); Console.ReadLine(); }
public void Connect(string deviceAddress) { var discovery = new BMDSwitcherAPI.CBMDSwitcherDiscoveryClass(); discovery.ConnectTo(deviceAddress, out this._switcher, out var reason); this.Inputs = this.Iterate <IBMDSwitcherInputIterator, IBMDSwitcherInput>(iterator => iterator.Next).Select(GetInput).Where(input => input.Cut).ToList(); // ATEM Mini Pro only has one MixEffectBlock this._effectBlock = Iterate <IBMDSwitcherMixEffectBlockIterator, IBMDSwitcherMixEffectBlock>(iterator => iterator.Next).First(); this.updateCurrentProgramInput(); _effectBlock.AddCallback(new EffectBlockHandler(this)); }
IBMDSwitcherTransitionParameters GetKeyTransition(IBMDSwitcherMixEffectBlock block) { IBMDSwitcherTransitionParameters meIterator = null; IntPtr meIteratorPtr; Guid meIteratorIID = typeof(IBMDSwitcherTransitionParameters).GUID; IntPtr meIPtr = Marshal.GetIUnknownForObject(block); Marshal.QueryInterface(meIPtr, ref meIteratorIID, out meIteratorPtr); meIterator = (IBMDSwitcherTransitionParameters)Marshal.GetObjectForIUnknown(meIteratorPtr); return(meIterator); }
public void SwitcherDisconnected() { if (m_mixEffectBlock != null) { // Remove callback m_mixEffectBlock.RemoveCallback(m_mixEffectBlockMonitor); // Release reference m_mixEffectBlock = null; } if (m_switcherDiscovery != null) { m_switcherDiscovery = null; } }
private void SwitcherDisconnected() { 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; } }
private static MixEffectState BuildOne(IBMDSwitcherMixEffectBlock props) { var state = new MixEffectState(); props.GetProgramInput(out long program); state.Sources.Program = (VideoSource)program; props.GetPreviewInput(out long preview); state.Sources.Preview = (VideoSource)preview; props.GetFadeToBlackFramesRemaining(out uint frames); state.FadeToBlack.Status.RemainingFrames = frames; props.GetFadeToBlackRate(out uint rate); state.FadeToBlack.Properties.Rate = rate; props.GetFadeToBlackFullyBlack(out int isFullyBlack); state.FadeToBlack.Status.IsFullyBlack = isFullyBlack != 0; props.GetFadeToBlackInTransition(out int inTransition); state.FadeToBlack.Status.InTransition = inTransition != 0; if (props is IBMDSwitcherTransitionParameters trans) { BuildTransition(state.Transition, trans); props.GetPreviewTransition(out int previewTrans); state.Transition.Properties.PreviewTransition = previewTrans != 0; // props.GetPreviewLive(out int previewLive); // state.Transition.Properties.IsPreviewInProgram = previewLive != 0; props.GetTransitionPosition(out double position); state.Transition.Position.HandlePosition = position; props.GetTransitionFramesRemaining(out uint framesRemaining); state.Transition.Position.RemainingFrames = framesRemaining; props.GetInTransition(out int inTransition2); state.Transition.Position.InTransition = inTransition2 != 0; } var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherKeyIterator>(props.CreateIterator); state.Keyers = AtemSDKConverter.IterateList <IBMDSwitcherKey, MixEffectState.KeyerState>(iterator.Next, (keyer, id) => BuildKeyer(keyer)); return(state); }
private void SwitcherDisconnected() { if (SwitcherPanel.IsMainThread) { new Thread(SwitcherDisconnected).Start(); return; } // Remove all input monitors, remove callbacks foreach (InputMonitor inputMon in m_inputMonitors) { inputMon.Input.RemoveCallback(inputMon); inputMon.LongNameChanged -= new SwitcherEventHandler(OnInputLongNameChanged); } 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; } this.Invoke((Action)(() => { MixEffectBlockSetEnable(false); buttonConnect.Enabled = true; textBoxSwitcherName.Text = ""; })); }
public static IEnumerable <IBMDSwitcherKey> GetKeys(this IBMDSwitcherMixEffectBlock o) { var result = new List <IBMDSwitcherKey>(); if (o == null) { return(result); } Guid g = typeof(IBMDSwitcherKeyIterator).GUID; o.CreateIterator(ref g, out IntPtr ptr); var iterator = (IBMDSwitcherKeyIterator)Marshal.GetObjectForIUnknown(ptr); iterator.Next(out IBMDSwitcherKey input); while (input != null) { result.Add(input); iterator.Next(out input); } return(result); }
private void GetSwitcherMixEffectBlock() { // We want to get the first Mix Effect block (ME 1). We create a ME iterator, // and then get the first one: m_mixEffectBlock = 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); } Marshal.Release(meIteratorPtr); // Release必須? if (meIterator != null) { meIterator.Next(out m_mixEffectBlock); } }
public void Connect() { if (this.connected) { return; } IBMDSwitcherDiscovery switcherDiscovery = new CBMDSwitcherDiscovery(); _BMDSwitcherConnectToFailure failReason = 0; try { switcherDiscovery.ConnectTo(this.deviceAddress, out this.switcher, out failReason); this.connected = true; // Get the first Mix Effect block (ME 1). m_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) return; if (meIterator != null) { meIterator.Next(out m_mixEffectBlock1); } if (m_mixEffectBlock1 == null) { throw new SwitcherLibException("Unexpected: Could not get first mix effect block"); } // Get the second Mix Effect block (ME 2). m_mixEffectBlock2 = null; if (meIterator != null) { meIterator.Next(out m_mixEffectBlock2); } } catch (COMException ex) { switch (failReason) { case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureIncompatibleFirmware: throw new SwitcherLibException("Incompatible firmware"); case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureNoResponse: throw new SwitcherLibException(String.Format("No response from {0}", this.deviceAddress)); default: throw new SwitcherLibException(String.Format("Unknown Error: {0}", ex.Message)); } } catch (Exception ex) { throw new SwitcherLibException(String.Format("Unable to connect to switcher: {0}", ex.Message)); } }
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; } }
public BMDSwitcherManagement(string address) { //_synchContext = System.Threading.SynchronizationContext.Current; m_switcherMonitor = new SwitcherMonitor(); m_switcherMonitor.SwitcherDisconnected += OnSwitcherDisconnected; m_mixEffectBlockMonitor = new MixEffectBlockMonitor(); m_mixEffectBlockMonitor.ProgramInputChanged += OnProgramInputChanged; m_switcherDiscovery = new CBMDSwitcherDiscovery(); if (m_switcherDiscovery == null) { return; } _BMDSwitcherConnectToFailure failReason = 0; try { // Note that ConnectTo() can take several seconds to return, both for success or failure, // depending upon hostname resolution and network response times, so it may be best to // do this in a separate thread to prevent the main GUI thread blocking. m_switcherDiscovery.ConnectTo(address, out m_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; } return; } // Get the switcher name: string switcherName; m_switcher.GetProductName(out switcherName); _switcherName = switcherName; // Install SwitcherMonitor callbacks: m_switcher.AddCallback(m_switcherMonitor); m_switcher.IterateInput((i) => { InputMonitor newInputMonitor = new InputMonitor(i); i.AddCallback(newInputMonitor); newInputMonitor.LongNameChanged += new SwitcherEventHandler(OnInputLongNameChanged); m_inputMonitors.Add(newInputMonitor); }); // We want to get the first Mix Effect block (ME 1). We create a ME iterator, // and then get the first one: m_mixEffectBlock1 = m_switcher.GetFirstMixEffectBlock(); if (m_mixEffectBlock1 != null) { m_mixEffectBlock1.AddCallback(m_mixEffectBlockMonitor); UpdatePrograms(); this.Connected = true; } m_audioMixer = m_switcher.GetBMDSwitcherAudioMixer(); m_audioMixer.IterateAudioInput(i => { _audioInputs.Add(i); }); }
public void Connect() { if (this.connected) { return; } IBMDSwitcherDiscovery switcherDiscovery = new CBMDSwitcherDiscovery(); _BMDSwitcherConnectToFailure failReason = 0; try { switcherDiscovery.ConnectTo(this.deviceAddress, out this.switcher, out failReason); this.connected = true; // Get the first Mix Effect block (ME 1). m_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) { return; } if (meIterator != null) { meIterator.Next(out m_mixEffectBlock1); } if (m_mixEffectBlock1 == null) { throw new SwitcherLibException("Unexpected: Could not get first mix effect block"); } // Get the second Mix Effect block (ME 2). m_mixEffectBlock2 = null; if (meIterator != null) { meIterator.Next(out m_mixEffectBlock2); } } catch (COMException ex) { switch (failReason) { case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureIncompatibleFirmware: throw new SwitcherLibException("Incompatible firmware"); case _BMDSwitcherConnectToFailure.bmdSwitcherConnectToFailureNoResponse: throw new SwitcherLibException(String.Format("No response from {0}", this.deviceAddress)); default: throw new SwitcherLibException(String.Format("Unknown Error: {0}", ex.Message)); } } catch (Exception ex) { throw new SwitcherLibException(String.Format("Unable to connect to switcher: {0}", ex.Message)); } }
internal SwitcherMixEffectBlockCallback(IBMDSwitcherMixEffectBlock mixEffectBlock, int index) { this._indexnr = index; this.MixEffectBlock = mixEffectBlock; }
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; }
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(); }
public static IBMDSwitcherTransitionDVEParameters GetTransitionDVEParameters(this IBMDSwitcherMixEffectBlock m) { return(QueryInterface <IBMDSwitcherMixEffectBlock, IBMDSwitcherTransitionDVEParameters> .GetObject(m)); }
private void SwitcherConnected() { btn_reconnect.Enabled = false; reactivatebuttons(); // Get the switcher name: string switcherName; m_switcher.GetString(_BMDSwitcherPropertyId.bmdSwitcherPropertyIdProductName, out switcherName); this.Text = switcherName; // Install SwitcherMonitor callbacks: m_switcher.AddCallback(m_switcherMonitor); // We create input monitors for each input. To do this we iterator over all inputs: // This will allow us to update the combo boxes when input names change: IBMDSwitcherInputIterator inputIterator; if (SwitcherAPIHelper.CreateIterator(m_switcher, out inputIterator)) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { InputMonitor newInputMonitor = new InputMonitor(input); input.AddCallback(newInputMonitor); 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; SwitcherAPIHelper.CreateIterator(m_switcher, out meIterator); 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); m_transition = (BMDSwitcherAPI.IBMDSwitcherTransitionParameters)m_mixEffectBlock1; m_transition.AddCallback(m_transitionMonitor); IBMDSwitcherKeyIterator keyIterator; SwitcherAPIHelper.CreateIterator(m_mixEffectBlock1, out keyIterator); if (keyIterator != null) { keyIterator.Next(out me1_key1); keyIterator.Next(out me1_key2); keyIterator.Next(out me1_key3); keyIterator.Next(out me1_key4); } me1_key1.AddCallback(m_keyMonitor); me1_key2.AddCallback(m_keyMonitor); me1_key3.AddCallback(m_keyMonitor); me1_key4.AddCallback(m_keyMonitor); if (SwitcherAPIHelper.CreateIterator(m_switcher, out inputIterator)) { IBMDSwitcherInput input; inputIterator.Next(out input); while (input != null) { InputMonitor newInputMonitor = new InputMonitor(input); input.AddCallback(newInputMonitor); m_inputMonitors.Add(newInputMonitor); inputIterator.Next(out input); IntPtr lvPointer; IBMDSwitcherInputIterator lvInputIterator; IBMDSwitcherInput lvInput; string lvPortName; long lvPortType; int lvAUXCount; lvAUXCount = 0; m_switcher.CreateIterator(typeof(IBMDSwitcherInputIterator).GUID, out lvPointer); lvInputIterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(lvPointer); lvInputIterator.Next(out lvInput); while (lvInput != null) { lvInput.GetString(BMDSwitcherAPI._BMDSwitcherInputPropertyId.bmdSwitcherInputPropertyIdLongName, out lvPortName); // bmdSwitcherInputPropertyIdLongName lvInput.GetInt(BMDSwitcherAPI._BMDSwitcherInputPropertyId.bmdSwitcherInputPropertyIdPortType, out lvPortType); if ((_BMDSwitcherPortType)lvPortType == BMDSwitcherAPI._BMDSwitcherPortType.bmdSwitcherPortTypeColorGenerator) { } if ((_BMDSwitcherPortType)lvPortType == BMDSwitcherAPI._BMDSwitcherPortType.bmdSwitcherPortTypeAuxOutput) { lvAUXCount = lvAUXCount + 1; m_inputAux = (IBMDSwitcherInputAux)lvInput; if (lvAUXCount == 1) { m_AUX1 = m_inputAux; } if (lvAUXCount == 2) { m_AUX2 = m_inputAux; } if (lvAUXCount == 3) { m_AUX3 = m_inputAux; } } lvInputIterator.Next(out lvInput); } } } m_AUX1.AddCallback(m_auxMonitor); m_AUX2.AddCallback(m_auxMonitor); m_AUX3.AddCallback(m_auxMonitor); IBMDSwitcherDownstreamKeyIterator dkeyiterator; dkeyiterator = null; SwitcherAPIHelper.CreateIterator(m_switcher, out dkeyiterator); if (dkeyiterator != null) { dkeyiterator.Next(out me1_dkey1); dkeyiterator.Next(out me1_dkey2); } me1_dkey1.AddCallback(m_dkeyMonitor); me1_dkey2.AddCallback(m_dkeyMonitor); m_audiomixer = (BMDSwitcherAPI.IBMDSwitcherAudioMixer)m_switcher; m_audiomixer.AddCallback(m_audioMixerMonitor); IBMDSwitcherAudioInputIterator m_audioInputiterator; SwitcherAPIHelper.CreateIterator(m_audiomixer, out m_audioInputiterator); if (m_audioInputiterator != null) { m_audioInputiterator.Next(out m_audioInput); } m_audioInput.AddCallback(m_audioInputMonitor); IBMDSwitcherAudioMonitorOutputIterator m_audioOutputIterator; SwitcherAPIHelper.CreateIterator(m_audiomixer, out m_audioOutputIterator); if (m_audioOutputIterator != null) { m_audioOutputIterator.Next(out m_audioMonitorOutput); } m_audioMonitorOutput.AddCallback(m_audioOutputMonitor); btnKey1Air.Enabled = true; ProgramInputChanged(); KeyerOnAirChanged(); InputAuxChanged(); }
/// <summary> /// Initiate this class with a valid IBMDSwitcherMixEffectBlock class. /// </summary> /// <param name="meBlock">An IBMDSwitcherMixEffectBlock object generated by </param> public MEBlock(IBMDSwitcherMixEffectBlock meBlock, int meBlockIndex) { MEBlockContext = meBlock; MEBlockContext.AddCallback(this); MEBlockIndex = meBlockIndex; }
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(); } }
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); }