marcoauto Posted July 24, 2018 Share Posted July 24, 2018 Ciao I would like to control an ATEM Video Mixer from autoit. I downloaded his SDK which is written in c ++ and I found the sequences to interface, but I was not able to convert the script to self. The instructions say to follow this sequence: Quote Switcher Configuration and Transitions An application for controlling a switcher may perform the following steps: ‚ Use IBMDSwitcherDiscovery::ConnectTo to connect to a switcher device and obtain an IBMDSwitcher object interface ‚ Use IBMDSwitcher::CreateIterator to get an IBMDSwitcherInputIterator object interface ‚ For each IBMDSwitcherInput returned by IBMDSwitcherInputIterator::Next retrieve the input’s unique Id using IBMDSwitcherInput::GetInputId and retrieve other properties of the input, such as the input’s name, using IBMDSwitcherInput::GetString or IBMDSwitcherInput::GetInt ‚ Use IBMDSwitcher::CreateIterator to get an IBMDSwitcherMixEffectBlockIterator object interface ‚ Obtain an IBMDSwitcherMixEffectBlock object interface using IBMDSwitcherMixEffectBlockIterator::Next ‚ Use IBMDSwitcherMixEffectBlock::SetInt to configure the Program and Preview inputs to the mix effect block by assigning the input Ids returned by IBMDSwitcherInput::GetInputId ‚ Perform a transition between Program and Preview inputs by calling IBMDSwitcherMixEffectBlock::PerformTransition ‚ Install a callback using IBMDSwitcherMixEffectBlock::AddCallback and receive IBMDSwitcherMixEffectBlockCallback::PropertyChanged callbacks to determine progress through the transition and when the transition is complete and to connectTo with C++ is: string address = "192.168.1.240"; _BMDSwitcherConnectToFailure failureReason = 0; IBMDSwitcher switcher = null; var discovery = new CBMDSwitcherDiscovery(); discovery.ConnectTo(address, out switcher, out failureReason); From Blackmagic SDK: IBMDSwitcherDiscovery::ConnectTo method The ConnectTo method connects to the specified switcher and returns an IBMDSwitcher object interface for the switcher. Syntax HRESULT ConnectTo (string deviceAddress, IBMDSwitcher** switcherDevice, BMDSwitcherConnectToFailure* failReason); Parameters: deviceAddress in Network hostname or IP address of switcher to connect to. switcherDevice out IBMDSwitcher object interface for the connected switcher. failReason out Reason for connection failure as a BMDSwitcherConnectToFailure value. So, I have I tried these solutions but with non success: $DllName =@ScriptDir&"\BMDSwitcherAPI.dll" $result = DllCall($DllName, "none", "IBMDSwitcherDiscovery::ConnectTo" & @CRLF) ConsoleWrite("DLLCall Result: " & $result & @CRLF) and I have tried also create an Object (That I think is the best way solution): #include <MsgBoxConstants.au3> $oSwitcher=ObjCreate("IBMDSwitcher") If IsObj($oSwitcher) Then MsgBox(64, "", "Object $oSwitcher created successfully") EndIf $oAtem=ObjCreate("IBMDSwitcherDiscovery") If IsObj($oAtem) Then MsgBox(64, "", "Object $oAtem created successfully") EndIf $failureReason =ObjCreate("_BMDSwitcherConnectToFailure") If IsObj($failureReason) Then MsgBox(64, "", "Object $failureReason created successfully") EndIf $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler Global $errore,$oSwitcher1 $oAtem.ConnectTo("192.168.1.36",$oSwitcher,$failureReason); ; This is the custom error handler Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Helpfile is: " & $oMyError.helpfile & @CRLF & _ "Helpcontext is: " & $oMyError.helpcontext & @CRLF & _ "Lastdllerror is: " & $oMyError.lastdllerror & @CRLF & _ "Scriptline is: " & $oMyError.scriptline) EndFunc ;==>MyErrFunc But the result is: We intercepted a COM Error ! Number is: 000000A9 Windescription is: Variable must be of type 'Object'. Source is: Description is: Helpfile is: Helpcontext is: Lastdllerror is: 0 Scriptline is: 17 The BMDSwitcherAPI.dll is registered in system. Can someone help me? Grazie Marco Link to comment Share on other sites More sharing options...
Danyfirex Posted July 24, 2018 Share Posted July 24, 2018 Hello. Could you provide doc file? Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
marcoauto Posted July 24, 2018 Author Share Posted July 24, 2018 Hi, I Have pdf Backmagic SDK. You can find it in attachment here Thankyou Marco Blackmagic Switchers SDK.pdf Link to comment Share on other sites More sharing options...
Danyfirex Posted July 25, 2018 Share Posted July 25, 2018 Hello. You need to get the basic about AutoIt DllCall Function. You're walking blind. You also need to get the basic about C++ Implement this. I really have not to much free time to look deeply in the doc file. You need to make sure this SDK registers a COM Visible Object otherwise You can't use ObjCreate. If You can't you probably need to use ObjCreateInterface to handle this. let's try this script. I don't know the ProgID (if It shows one) So I'm using the CLSID to create the object. (not sure if it will work). If It does not. Good look with ObjCreateInterface or probably direct dll calls of which I'm not sure if it exposes the functions. Script: (sorry I'm unable to load sintaxis highlighting) Global Const $sCLSID_CBMDSwitcherDiscovery='{F2DC5149-9599-47E4-84B9-054C78A1A46D}' Local $oObject=ObjCreate($sCLSID_CBMDSwitcherDiscovery) ConsoleWrite('IsObj($oObject): ' & IsObj($oObject) & @CRLF) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
marcoauto Posted July 25, 2018 Author Share Posted July 25, 2018 4 hours ago, Danyfirex said: Hello. You need to get the basic about AutoIt DllCall Function. You're walking blind. You also need to get the basic about C++ Implement this. I really have not to much free time to look deeply in the doc file. You need to make sure this SDK registers a COM Visible Object otherwise You can't use ObjCreate. Yes, the problem is I don't know how to understand if is a COM Visible method. the result of Global Const $sCLSID_CBMDSwitcherDiscovery='{F2DC5149-9599-47E4-84B9-054C78A1A46D}' Local $oObject=ObjCreate($sCLSID_CBMDSwitcherDiscovery) ConsoleWrite('IsObj($oObject): ' & IsObj($oObject) & @CRLF) in console is: IsObj($oObject): 0 I'll try with ObjCreateInterface. I'll study the sintax. My problem is that I do not have the knowledge of c ++ to understand how it works. I'll try Thankyou for your time! Marco Link to comment Share on other sites More sharing options...
Danyfirex Posted July 25, 2018 Share Posted July 25, 2018 Could you provide me the BMDSwitcherAPI.dll to do some tests. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
marcoauto Posted July 25, 2018 Author Share Posted July 25, 2018 yes, of course!! I zipped dll file because the maximum forum upload file size Grazie marco BMDSwitcherAPI.zip Link to comment Share on other sites More sharing options...
Danyfirex Posted July 25, 2018 Share Posted July 25, 2018 Here a simple example for create a CBMDSwitcherDiscovery Interface. Global Const $sCLSID_CBMDSwitcherDiscovery = "{F2DC5149-9599-47E4-84B9-054C78A1A46D}" Global Const $sIID_IBMDSwitcherDiscovery = "{A676047A-D3A4-44B1-B8B5-31D7289D266A}" Global Const $sTag_IBMDSwitcherDiscovery = "ConnectTo hresult(bstr;ptr*;int*);" Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oCBMDSwitcherDiscovery = ObjCreateInterface($sCLSID_CBMDSwitcherDiscovery, $sIID_IBMDSwitcherDiscovery, $sTag_IBMDSwitcherDiscovery) ConsoleWrite("IsObj($oCBMDSwitcherDiscovery): " & IsObj($oCBMDSwitcherDiscovery) & @CRLF) Local $sDeviceAddress = "192.168.1.240" Local $pIBMDSwitcher = 0 Local $iConnectToFailure = 0 $oCBMDSwitcherDiscovery.ConnectTo($sDeviceAddress, $pIBMDSwitcher, $iConnectToFailure) ConsoleWrite("$pIBMDSwitcher: " & $pIBMDSwitcher & @CRLF) ConsoleWrite("$iConnectToFailure: " & $iConnectToFailure & @CRLF) ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc on success you'll need to casting $pIBMDSwitcher pointer to an Interface IBMDSwitcher using ObjectCreateInterface Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
marcoauto Posted July 31, 2018 Author Share Posted July 31, 2018 ciao, Hi, I tried to do what you told me, but I can not understand the syntax I have to use. I'm trying to study how c ++ works but it's very different from autoit and so I have a lot of difficulties For the moment I did only this with success: $oIBMDSwitcher.GetProductName($nome) expandcollapse popupGlobal Const $sCLSID_CBMDSwitcherDiscovery = "{F2DC5149-9599-47E4-84B9-054C78A1A46D}" Global Const $sIID_IBMDSwitcherDiscovery = "{A676047A-D3A4-44B1-B8B5-31D7289D266A}" Global Const $sTag_IBMDSwitcherDiscovery = "ConnectTo hresult(bstr;ptr*;int*);" Global Const $sIID_IBMDSwitcher = "{3D480E2F-3CF4-474B-92E7-B7907EE83B41}" Global Const $sTag_IBMDSwitcher = "ConnectTo hresult(bstr;ptr*;int*);" Global Const $sTag_IBMDSwitcher_CreateIterator = "CreateIterator hresult(ptr*;int*);" Global Const $sIID_IBMDSwitcherMixEffectBlockIterator = "{930BDE3B-4A78-43D0-8FD3-6E82ABA0E117}" Global Const $sTag_IBMDSwitcherMixEffectBlockIterator = "Next hresult(int*);" Global Const $sIID_IBMDSwitcherMixEffectBlock = "{11974D55-45E0-49D8-AE06-EEF4D5F81DF6}" Global Const $sTag_IBMDSwitcherMixEffectBlock = "CreateIterator hresult(REFIID, LPVOID*);" Global Const $sIID_IBMDSwitcherInputIterator = "{275E9888-2F65-4B2E-9434-1937A72B9EC4}" Global Const $sTag_IBMDSwitcherInputIterator = " GetById hresult (int,int*);" Global Const $sTag_IBMDSwitcher_GetProductName = "GetProductName hresult(bstr*);" Global Const $sTag_IBMDSwitcher_Creator = "CreateIterator hresult(lpvoid*);" Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oCBMDSwitcherDiscovery = ObjCreateInterface($sCLSID_CBMDSwitcherDiscovery, $sIID_IBMDSwitcherDiscovery, $sTag_IBMDSwitcherDiscovery) ConsoleWrite("IsObj($oCBMDSwitcherDiscovery): " & IsObj($oCBMDSwitcherDiscovery) & @CRLF) $sFileWithDefinition = ObjName($oCBMDSwitcherDiscovery) ConsoleWrite($sFileWithDefinition & @CRLF) Local $sDeviceAddress = "192.168.1.37" Local $pIBMDSwitcher = 0 Local $iConnectToFailure = 0 $oCBMDSwitcherDiscovery.ConnectTo($sDeviceAddress, $pIBMDSwitcher, $iConnectToFailure) ConsoleWrite("$pIBMDSwitcher: " & $pIBMDSwitcher & @CRLF) ConsoleWrite("$iConnectToFailure: " & $iConnectToFailure & @CRLF) ConsoleWrite("-------" & @CRLF) ;~ Output console: ;~ IsObj($oCBMDSwitcherDiscovery): 1 ;~ InterfaceDispatch ;~ $pIBMDSwitcher: 72569844 ;~ $iConnectToFailure: 0 ;~ ------- local $iterator,$nome Local $oIBMDSwitcher = ObjCreateInterface($pIBMDSwitcher,$sIID_IBMDSwitcher,$sTag_IBMDSwitcher_GetProductName);$sTag_IBMDSwitcher_Creator) ConsoleWrite("IsObj($oIBMDSwitcher): " & IsObj($oIBMDSwitcher) & @CRLF) $sFileWithDefinition = ObjName($oIBMDSwitcher) ConsoleWrite($sFileWithDefinition & @CRLF) ConsoleWrite("-------" & @CRLF) ;~ Output console: ;~ IsObj($oIBMDSwitcher): 1 ;~ InterfaceDispatch ;~ ------- $oIBMDSwitcher.GetProductName($nome) ConsoleWrite("$oIBMDSwitcher.GetProductName: " & $nome & @CRLF) ConsoleWrite("-------" & @CRLF) ;~ Output console: ;~ $oIBMDSwitcher.GetProductName: ATEM 1 M/E Production Switcher ;~ ------- Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc I'd like to set a preview input and after do a cut transition From a c++ script: result = mSwitcher->CreateIterator((IID_IBMDSwitcherInputIterator, (void**)&inputIterator); but I can't understand how to obtain (void**)&iterator and how to declare it from SDK is IBMDSwitcher::CreateIterator method HRESULT CreateIterator (REFIID iid, LPVOID* ppv); iid [in] = Iterator Interface ID to create an iterator for ppv [in] = Pointer to return interface object. result = mSwitcher->CreateIterator(IID_IBMDSwitcherInputIterator, (void**)&inputIterator); I tried with $return = $oIBMDSwitcher.CreateIterator($sIID_IBMDSwitcherInputIterator,$pIBMDSwitcher) ConsoleWrite("$oIBMDSwitcher.CreateIterator: " & $return & @CRLF) ConsoleWrite("-------" & @CRLF) ;~ Output console: ;~ atem.au3 (109) : ==> COM Error intercepted ! ;~ err.number is: 0x80020006 ;~ err.windescription: Nome sconosciuto. ;~ err.description is: ;~ err.source is: ;~ err.helpfile is: ;~ err.helpcontext is: ;~ err.lastdllerror is: 0 ;~ err.scriptline is: 109 ;~ err.retcode is: 0x00000000 but is wrong, of course! from SDK I need to: IBMDSwitcher::CreateIterator to get an IBMDSwitcherInputIterator object interface For each IBMDSwitcherInput returned by IBMDSwitcherInputIterator::Next retrieve the input’s unique Id using IBMDSwitcherInput::GetInputId and retrieve other properties of the input, such as the input’s name, using IBMDSwitcherInput::GetString or IBMDSwitcherInput::GetInt Use IBMDSwitcher::CreateIterator to get an IBMDSwitcherMixEffectBlockIterator object interface Obtain an IBMDSwitcherMixEffectBlock object interface using IBMDSwitcherMixEffectBlockIterator::Next Use IBMDSwitcherMixEffectBlock::SetInt to configure the Program and Preview inputs to the mix effect block by assigning the input Ids returned by IBMDSwitcherInput::GetInputId Perform a transition between Program and Preview inputs by calling IBMDSwitcherMixEffectBlock::PerformTransition Install a callback using IBMDSwitcherMixEffectBlock::AddCallback and receive IBMDSwitcherMixEffectBlockCallback::PropertyChanged callbacks to determine progress through the transition and when the transition is complete Thanks marco Link to comment Share on other sites More sharing options...
Danyfirex Posted July 31, 2018 Share Posted July 31, 2018 Hello. I think the best and easy alternative for you is use .NET I think SDK has some C# examples, because convert this to AutoIt is a little hard if you dont have at least basic knowledge of C++ / AutoIt. Saludos Earthshine 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now