locked
ActivateAudioInterfaceAsync from main thread

    Question

  • Hi,

    I'm working on a DirectX game for Windows Store compatible devices. To get an IAudioClient interface I'm using ActivateAudioInterfaceAsync, but it failes everytime with error 0x8000000E (A method was called at an unexpected time).

    I read from MSDN documentation that it should be called from UI thread, but my game has not XAML UI. The function is called from Windows::ApplicationModel::Core::IFrameworkView::Run. ActivateAudioInterface is supported only from Windows Phone 8 and IMMDevice::Activate works only on Desktop.

    There is a sync function that gets the IAudioClient or a way to use ActivateAudioInterfaceAsync from an app without the XAML UI?

    Thursday, February 19, 2015 4:08 PM

All replies

  • Hello,

    Are you initializing Media Foundation before your call to ActivateAudioInterfaceAsync?

    // Initialize MF
    HRESULT hr = MFStartup(MF_VERSION, MFSTARTUP_LITE);
    if (SUCCEEDED(hr))
    {
    	m_IsMFLoaded = true;
    }
    else
    {
    	ThrowIfFailed(hr);
    }

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Friday, February 20, 2015 12:21 AM
    Moderator
  • Hi and thank you for your reply.

    Unfortunately the error persists.

    Friday, February 20, 2015 11:25 AM
  • Hello,

    I just spend a few minutes looking through the Windows Source. I do see a few references to E_ILLEGAL_METHOD_CALL in the ActivateAudioInterfaceAsync code but nothing that really makes sense.

    The only thing I can think of is to make sure that you are calling ActivateAudioInterfaceAsync on an MTA or STA thread. I don't think you can call it from a free thread.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/


    Saturday, February 21, 2015 12:16 AM
    Moderator