private void UpdateAudio(int audioOn, int AudioOff) { IBMDSwitcherAudioMixer m_audiomixer; m_audiomixer = (BMDSwitcherAPI.IBMDSwitcherAudioMixer)m_switcher; IBMDSwitcherAudioInputIterator audioIterator = null; IntPtr audioIteratorPtr; Guid audioIteratorIID = typeof(IBMDSwitcherAudioInputIterator).GUID; m_audiomixer.CreateIterator(ref audioIteratorIID, out audioIteratorPtr); if (audioIteratorPtr != null) { audioIterator = (IBMDSwitcherAudioInputIterator)Marshal.GetObjectForIUnknown(audioIteratorPtr); } IBMDSwitcherAudioInput audioInput; audioIterator.Next(out audioInput); while (audioInput != null) { audioInput.GetAudioInputId(out long audioInputID); Console.WriteLine(audioInputID); if (audioInputID == audioOn) { audioInput.SetMixOption(_BMDSwitcherAudioMixOption.bmdSwitcherAudioMixOptionOn); } if (audioInputID == AudioOff) { audioInput.SetMixOption(_BMDSwitcherAudioMixOption.bmdSwitcherAudioMixOptionOff); } audioIterator.Next(out audioInput); } }
public static void IterateAudioInput(this IBMDSwitcherAudioMixer switcher, Action <IBMDSwitcherAudioInput> 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(IBMDSwitcherAudioInputIterator).GUID; switcher.CreateIterator(ref inputIteratorIID, out inputIteratorPtr); IBMDSwitcherAudioInputIterator inputIterator = null; if (inputIteratorPtr != null) { inputIterator = (IBMDSwitcherAudioInputIterator)Marshal.GetObjectForIUnknown(inputIteratorPtr); } if (inputIterator != null) { IBMDSwitcherAudioInput input; inputIterator.Next(out input); while (input != null) { action(input); inputIterator.Next(out input); } } }
public static IBMDSwitcherAudioInput GetInput(AtemMockServerWrapper helper, long targetId) { IBMDSwitcherAudioMixer mixer = TestAudioProgramOut.GetAudioMixer(helper); var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherAudioInputIterator>(mixer.CreateIterator); iterator.GetById(targetId, out IBMDSwitcherAudioInput input); Assert.NotNull(input); return(input); }
public void TestLevelsAndPeaks() { AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.ClassicAudioMain, helper => { IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper); var cb = new ProgramOutLevelCallback(); using (new UseCallback <ProgramOutLevelCallback>(cb, mixer.AddCallback, mixer.RemoveCallback)) { for (int i = 0; i < 5; i++) { cb.Reset(); AtemState expectedState = helper.Helper.BuildLibState(); var testCmd = new AudioMixerLevelsCommand() { MasterLeftLevel = Randomiser.Range(-100, 0), MasterRightLevel = Randomiser.Range(-100, 0), MasterLeftPeak = Randomiser.Range(-100, 0), MasterRightPeak = Randomiser.Range(-100, 0), }; expectedState.Audio.ProgramOut.Levels = new AudioState.LevelsState { Levels = new[] { testCmd.MasterLeftLevel, testCmd.MasterRightLevel }, Peaks = new[] { testCmd.MasterLeftPeak, testCmd.MasterRightPeak }, }; helper.SendAndWaitForChange(expectedState, () => { helper.Server.SendCommands(testCmd); }, -1, (sdkState, libState) => { sdkState.Audio.ProgramOut.Levels = new AudioState.LevelsState { Levels = cb.Levels, Peaks = cb.Peaks, }; }); } } }); }
public void TestFollowFadeToBlack() { var handler = CommandGenerator.CreateAutoCommandHandler <AudioMixerMasterSetCommand, AudioMixerMasterGetCommand>( "FollowFadeToBlack"); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMain, helper => { IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper); AtemState stateBefore = helper.Helper.BuildLibState(); for (int i = 0; i < 5; i++) { int target = i % 2; stateBefore.Audio.ProgramOut.FollowFadeToBlack = target != 0; helper.SendAndWaitForChange(stateBefore, () => { mixer.SetProgramOutFollowFadeToBlack(target); }); } }); }
public void TestBalance() { var handler = CommandGenerator.CreateAutoCommandHandler <AudioMixerMasterSetCommand, AudioMixerMasterGetCommand>( "Balance"); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMain, helper => { IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper); AtemState stateBefore = helper.Helper.BuildLibState(); for (int i = 0; i < 5; i++) { double target = Randomiser.Range(-50, 50); stateBefore.Audio.ProgramOut.Balance = target; helper.SendAndWaitForChange(stateBefore, () => { mixer.SetProgramOutBalance(target / 50); }); } }); }
public static AudioState Build(IBMDSwitcherAudioMixer props) { var state = new AudioState(); props.GetProgramOutGain(out double gain); state.ProgramOut.Gain = gain; props.GetProgramOutBalance(out double balance); state.ProgramOut.Balance = balance * 50; props.GetProgramOutFollowFadeToBlack(out int follow); state.ProgramOut.FollowFadeToBlack = follow != 0; props.GetAudioFollowVideoCrossfadeTransition(out int followTransition); state.ProgramOut.AudioFollowVideoCrossfadeTransitionEnabled = followTransition != 0; state.Tally = new Dictionary <AudioSource, bool>(); var inputIt = AtemSDKConverter.CastSdk <IBMDSwitcherAudioInputIterator>(props.CreateIterator); AtemSDKConverter.Iterate <IBMDSwitcherAudioInput>(inputIt.Next, (port, i) => { port.GetAudioInputId(out long inputId); state.Inputs[inputId] = BuildInput(port); port.IsMixedIn(out int isMixedIn); state.Tally[(AudioSource)inputId] = isMixedIn != 0; }); var monIt = AtemSDKConverter.CastSdk <IBMDSwitcherAudioMonitorOutputIterator>(props.CreateIterator); state.MonitorOutputs = AtemSDKConverter.IterateList <IBMDSwitcherAudioMonitorOutput, AudioState.MonitorOutputState>( monIt.Next, (mon, id) => BuildMonitor(mon)); var headphoneIt = AtemSDKConverter.CastSdk <IBMDSwitcherAudioHeadphoneOutputIterator>(props.CreateIterator); state.HeadphoneOutputs = AtemSDKConverter.IterateList <IBMDSwitcherAudioHeadphoneOutput, AudioState.HeadphoneOutputState>( headphoneIt.Next, (hp, id) => BuildHeadphone(hp)); return(state); }
public void TestResetAllPeaks() { var expected = new AudioMixerResetPeaksCommand { Mask = AudioMixerResetPeaksCommand.MaskFlags.All }; var handler = CommandGenerator.MatchCommand(expected, true); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMain, helper => { IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper); AtemState stateBefore = helper.Helper.BuildLibState(); uint timeBefore = helper.Server.CurrentTime; helper.SendAndWaitForChange(stateBefore, () => { mixer.ResetAllLevelNotificationPeaks(); }); // It should have sent a response, but we dont expect any comparable data Assert.NotEqual(timeBefore, helper.Server.CurrentTime); }); }
public void TestAudioFollowVideoCrossfadeTransition() { var handler = CommandGenerator.CreateAutoCommandHandler <AudioMixerPropertiesSetCommand, AudioMixerPropertiesGetCommand>( "AudioFollowVideo"); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMain, helper => { IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper); AtemState stateBefore = helper.Helper.BuildLibState(); for (int i = 0; i < 5; i++) { int target = i % 2; stateBefore.Audio.ProgramOut.AudioFollowVideoCrossfadeTransitionEnabled = target != 0; helper.SendAndWaitForChange(stateBefore, () => { mixer.SetAudioFollowVideoCrossfadeTransition(target); }); } }); }
public void TestSendLevelsCommand() { var expected = new AudioMixerSendLevelsCommand(); var handler = CommandGenerator.MatchCommand(expected); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMain, helper => { IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper); AtemState stateBefore = helper.Helper.BuildLibState(); for (int i = 0; i < 5; i++) { uint timeBefore = helper.Server.CurrentTime; expected.SendLevels = i % 2 == 1; helper.SendAndWaitForChange(stateBefore, () => { mixer.SetAllLevelNotificationsEnable(i % 2); }); // It should have sent a response, but we dont expect any comparable data Assert.NotEqual(timeBefore, helper.Server.CurrentTime); } }); }
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() { 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(); }
internal SwitcherAudioMixerCallback(IBMDSwitcherAudioMixer mixer) { this.AudioMixer = mixer; }
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); }); }
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 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 }