Main menu

Help with syntax to run Atem 2M/E Macro in C#

I am programming a client in to run CasparCG. The client is in C# and I have most of it working. The only thing that I cannot get to work is the ATEM Library to run a macro stored in the ATEM2 M/E. Does anybody know the right syntax to execute a macro Here's the code for the client:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using CasparCGNETConnector;
using CasparCGClientForm;
using System.Runtime.InteropServices;
using BMDSwitcherAPI;

namespace CasparCGClientForm
{

//Code

. . . . .

//Code

private void button2_Click(object sender, EventArgs e)
{

//Trying to run a macro on the ATEM 2 M/E. It does not work...
IBMDSwitcherMacroControl playMacro;
playMacro = new IBMDSwitcherMacroControl;
playMacro(3);

Answer: nothing it is totally meaningless. O.O.P-101 - You don't create instances of interfaces do you?

COM Programming is slightly different to base object orientated techniques, as it does domething called "reference counting", so with "a real programming language", you must call IUnknown's QueryInterface on a COM object in order to pickup a reference to it's other interfaces.

Just because C# and interop is doing it for you, doesn't mean you can forget what it is doing, and why. So I am very reluctant to say this, as it is simplifying it too much, but the IBMDSwitcherMacroControl interface is exposed by the Switcher Object, so all you actually need to do in c# is cast your switcher interface reference as a IBMDSwitcherMacroControl interface.

Because you excluded the code that establishes your Switcher Interface reference, I can't give you code to copy-paste, but it would look something like.