public void ActivateCompleted(IActivateAudioInterfaceAsyncOperation activateOperation)
        {
            // First get the activation results, and see if anything bad happened then
            int    hr  = 0;
            object unk = null;

            activateOperation.GetActivateResult(out hr, out unk);
            if (hr != 0)
            {
                tcs.TrySetException(Marshal.GetExceptionForHR(hr, new IntPtr(-1)));
                return;
            }

            var pAudioClient = (IAudioClient2)unk;

            // Next try to call the client's (synchronous, blocking) initialization method.
            try
            {
                initializeAction(pAudioClient);
                tcs.SetResult(pAudioClient);
            }
            catch (Exception ex)
            {
                tcs.TrySetException(ex);
            }
        }
            public void ActivateCompleted(IActivateAudioInterfaceAsyncOperation operation)
            {
                operation.GetActivateResult(out var hr, out var activatedInterface);

                Debug.Assert(hr == (uint)HResult.S_OK);

                _result = (T)activatedInterface;

                var setResult = _completionEvent.Set();

                Debug.Assert(setResult != false);
            }
Example #3
0
        public void ActivateCompleted(IActivateAudioInterfaceAsyncOperation operation)
        {
            HResult operationHR;
            object  activatedInterface;

            operation.GetActivateResult(out operationHR, out activatedInterface);
            Debug.Assert(operationHR == HResult.S_OK);

            m_Result = (T)activatedInterface;

            var setResult = m_CompletionEvent.Set();

            Debug.Assert(setResult != false);
        }
Example #4
0
            public void ActivateCompleted(IActivateAudioInterfaceAsyncOperation activateOperation)
            {
                activateOperation.GetActivateResult(out int activateResult, out object activatedInterface);

                if (activateResult != 0)
                {
                    promise.SetException(new Win32Exception(activateResult));
                }

#if NET5_0_OR_GREATER
                promise.SetResult(activatedInterface.As <T>());
#else
                promise.SetResult((T)activatedInterface);
#endif
            }
Example #5
0
        public void ActivateCompleted(IActivateAudioInterfaceAsyncOperation activateOperation)
        {
            // First get the activation results, and see if anything bad happened then
            int hr = 0;
            object unk = null;
            activateOperation.GetActivateResult(out hr, out unk);
            if (hr != 0)
            {
                tcs.TrySetException(Marshal.GetExceptionForHR(hr, new IntPtr(-1)));
                return;
            }

            var pAudioClient = (IAudioClient2) unk;

            // Next try to call the client's (synchronous, blocking) initialization method.
            try
            {
                initializeAction(pAudioClient);
                tcs.SetResult(pAudioClient);
            }
            catch (Exception ex)
            {
                tcs.TrySetException(ex);
            }


        }
Example #6
0
 public static extern void ActivateAudioInterfaceAsync(
     [In, MarshalAs(UnmanagedType.LPWStr)] string deviceInterfacePath,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
     [In] IntPtr activationParams, // n.b. is actually a pointer to a PropVariant, but we never need to pass anything but null
     [In] IActivateAudioInterfaceCompletionHandler completionHandler,
     out IActivateAudioInterfaceAsyncOperation activationOperation);
Example #7
0
 static extern HResult ActivateAudioInterfaceAsync(
     [MarshalAs(UnmanagedType.LPWStr)] string deviceInterfacePath,
     [MarshalAs(UnmanagedType.LPStruct)] Guid riid,
     IntPtr activationParams,
     IActivateAudioInterfaceCompletionHandler completionHandler,
     out IActivateAudioInterfaceAsyncOperation activationOperation);
 public static extern void ActivateAudioInterfaceAsync(
     [In, MarshalAs(UnmanagedType.LPWStr)] string deviceInterfacePath,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
     [In] IntPtr activationParams, // n.b. is actually a pointer to a PropVariant, but we never need to pass anything but null
     [In] IActivateAudioInterfaceCompletionHandler completionHandler,
     out IActivateAudioInterfaceAsyncOperation activationOperation);
Example #9
0
 private static extern uint ActivateAudioInterfaceAsyncInternal([In][MarshalAs(UnmanagedType.LPWStr)] string deviceInterfacePath, [In][MarshalAs(UnmanagedType.LPStruct)] Guid riid, [In] IntPtr activationParams, [In] IActivateAudioInterfaceCompletionHandler completionHandler, out IActivateAudioInterfaceAsyncOperation activationOperation);