- Posts: 6
- Joined: Sun Nov 01, 2015 9:55 pm
I was originally looking at the code for selecting inputs for AUX outputs in another thread and wanted to try and make a couple of changes to see if I could get some code working to do a similar thing for super source box inputs.
I hacked together the below code to try and change the input for box 1 on a button click (This was just an example to see if I could get it working) but I get the error "Specified cast is not valid." on the line "this.m_switcher.CreateIterator(ref ssIteratorIID, out ssIteratorPtr);"
My initial thoughts is that I shouldn't be using "this.m_switcher".
Could someone point me in the right direction for the implementation of the SuperSourceBoxIterator?
I hacked together the below code to try and change the input for box 1 on a button click (This was just an example to see if I could get it working) but I get the error "Specified cast is not valid." on the line "this.m_switcher.CreateIterator(ref ssIteratorIID, out ssIteratorPtr);"
My initial thoughts is that I shouldn't be using "this.m_switcher".
Could someone point me in the right direction for the implementation of the SuperSourceBoxIterator?
- Code: Select all
int Box1 = 1;
long inputId = 1;
IBMDSwitcherSuperSourceBoxIterator ssIterator = null;
IntPtr ssIteratorPtr;
Guid ssIteratorIID = typeof(IBMDSwitcherSuperSourceBoxIterator).GUID;
this.m_switcher.CreateIterator(ref ssIteratorIID, out ssIteratorPtr);
if (ssIteratorPtr != null)
{
ssIterator = (IBMDSwitcherSuperSourceBoxIterator)Marshal.GetObjectForIUnknown(ssIteratorPtr);
}
if (ssIterator != null)
{
IBMDSwitcherSuperSourceBox input;
ssIterator.Next(out input);
int BOXCount = 0;
while (input != null)
{
BOXCount++;
if (BOXCount == Box1)
{
IBMDSwitcherSuperSourceBox liveBox = (IBMDSwitcherSuperSourceBox)input;
liveBox.SetInputSource(inputId);
break;
}
ssIterator.Next(out input);
}
}