Audio Outputs Enumetate

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline
User avatar

Anton Kotov

  • Posts: 3
  • Joined: Thu Apr 16, 2015 4:47 am
  • Location: Krasnoyarsk City, Russia

Audio Outputs Enumetate

PostSun Jan 21, 2018 9:34 am

Hello.
I can enumerate audio inputs, but not outputs.
I try such
Code: Select all
IBMDSwitcherAudioMonitorOutputIterator audioOutIterator = null;
            IntPtr audioOutIteratorPtr;
            Guid audioOutIteratorIID = typeof(IBMDSwitcherAudioMonitorOutputIterator).GUID;

            m_audiomixer.CreateIterator(ref audioIteratorIID, out audioOutIteratorPtr);
            if (audioOutIteratorPtr != null)
            {
                audioOutIterator = (IBMDSwitcherAudioMonitorOutputIterator)Marshal.GetObjectForIUnknown(audioOutIteratorPtr);
            }
            if (audioOutIterator != null)
            {
                IBMDSwitcherAudioMonitorOutput output;
                audioOutIterator.Next(out output);
                while (output != null)
                {
                    //...
                    audioOutIterator.Next(out output);
                }
            }


but when
Code: Select all
audioOutIterator = (IBMDSwitcherAudioMonitorOutputIterator)Marshal.GetObjectForIUnknown(audioOutIteratorPtr);

I get
System.InvalidCastException:
It is impossible to bring a COM object of type "System .__ ComObject" to the interface type "BMDSwitcherAPI.IBMDSwitcherAudioMonitorOutputIterator". The operation failed because the QueryInterface COM component call for interface with IID "{C76BAC6A-DFEE-4F2F-B161-226B481D556A}" returned the following error: The interface is not supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Why "The interface is not supported"?
How can I enumerate audio outputs else?
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 442
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Audio Outputs Enumetate

PostMon Jan 29, 2018 2:41 am

Hi Anton,

The ATEM Switcher API requires a multithreaded COM apartment. Please check that you are calling Marshal.GetObjectForIUnknown via thread contexts sharing the multi-threaded apartment. This is most common cause for HRESULT = E_NOINTERFACE for calls to IUnknown::QueryInterface()

More details on MTAThread attribute and the Thread.SetApartmentState() method can be found at: https://msdn.microsoft.com/en-us/library/system.mtathreadattribute(v=vs.110).aspx

Kind Regards
Cameron
Offline
User avatar

Anton Kotov

  • Posts: 3
  • Joined: Thu Apr 16, 2015 4:47 am
  • Location: Krasnoyarsk City, Russia

Re: Audio Outputs Enumetate

PostSun Feb 11, 2018 3:07 pm

Thank you, Cameron.
Tell please how I can get one group with 2 channels at output, instead of 4 groups with 4 channels each as now?
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 442
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Audio Outputs Enumetate

PostWed Feb 14, 2018 3:11 am

Hi Anton,

Which ATEM Switcher are you using? There should be one IBMDSwitcherAudioMonitorOutput instance for each SDI output

Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: roger.magnusson and 20 guests