Esempio n. 1
0
        /// <summary>
        /// Deletes a previous registration by the client to receive notifications.
        /// </summary>
        /// <param name="notifications">The instance of the <see cref="IAudioSessionEvents"/> object which got registered previously by the <see cref="RegisterAudioSessionNotification"/> method.</param>
        /// <returns>HRESULT</returns>
        public unsafe int UnregisterAudioSessionNotificationNative(IAudioSessionEvents notifications)
        {
            int result = 0;

            if (_sessionEventHandler.Contains(notifications))
            {
                IntPtr ptr = notifications != null
                    ? Marshal.GetComInterfaceForObject(notifications, typeof(IAudioSessionEvents))
                    : IntPtr.Zero;

                try
                {
                    result = InteropCalls.CallI(UnsafeBasePtr, ptr.ToPointer(), ((void **)(*(void **)UnsafeBasePtr))[11]);
                }
                finally
                {
                    if (ptr != IntPtr.Zero)
                    {
                        Marshal.Release(ptr);
                    }
                }
                _sessionEventHandler.Remove(notifications);
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// The RegisterAudioSessionNotification method registers the client to receive notifications of session events, including changes in the stream state.
        /// </summary>
        /// <returns>HRESULT</returns>
        public unsafe int RegisterAudioSessionNotificationNative(IAudioSessionEvents notifications)
        {
            int result = 0;

            if (!_sessionEventHandler.Contains(notifications))
            {
                IntPtr ptr = notifications != null?Marshal.GetComInterfaceForObject(notifications, typeof(IAudioSessionEvents)) : IntPtr.Zero;

                result = InteropCalls.CallI(_basePtr, ptr.ToPointer(), ((void **)(*(void **)_basePtr))[10]);
                _sessionEventHandler.Add(notifications);
            }
            return(result);
        }
Esempio n. 3
0
 /// <summary>
 /// Deletes a previous registration by the client to receive notifications.
 /// </summary>
 /// <param name="notifications">The instance of the <see cref="IAudioSessionEvents"/> object which got registered previously by the <see cref="RegisterAudioSessionNotification"/> method.</param>
 public void UnregisterAudioSessionNotification(IAudioSessionEvents notifications)
 {
     CoreAudioAPIException.Try(UnregisterAudioSessionNotificationNative(notifications), InterfaceName,
                               "UnregisterAudioSessionNotification");
 }
 public void UnregisterAudioSessionNotification(IAudioSessionEvents eventConsumer)
 {
     Marshal.ThrowExceptionForHR(_AudioSessionControl.UnregisterAudioSessionNotification(eventConsumer));
 }
Esempio n. 5
0
 public void UnregisterAudioSessionNotification(IAudioSessionEvents eventConsumer)
 {
     Marshal.ThrowExceptionForHR(_AudioSessionControl.UnregisterAudioSessionNotification(eventConsumer));
 }
Esempio n. 6
0
 /// <summary>
 /// The RegisterAudioSessionNotification method registers the client to receive notifications of session events, including changes in the stream state.
 /// </summary>
 public void RegisterAudioSessionNotification(IAudioSessionEvents notifications)
 {
     CoreAudioAPIException.Try(RegisterAudioSessionNotificationNative(notifications), c, "RegisterAudioSessionNotification");
 }
Esempio n. 7
0
 /// <summary>
 /// The UnregisterAudioSessionNotification method deletes a previous registration by the client to receive notifications.
 /// </summary>
 /// <returns>HRESULT</returns>
 public unsafe int UnregisterAudioSessionNotificationNative(IAudioSessionEvents notifications)
 {
     int result = 0;
     if (_sessionEventHandler.Contains(notifications))
     {
         IntPtr ptr = notifications != null ? Marshal.GetComInterfaceForObject(notifications, typeof(IAudioSessionEvents)) : IntPtr.Zero;
         result = InteropCalls.CallI(_basePtr, ptr.ToPointer(), ((void**)(*(void**)_basePtr))[11]);
         _sessionEventHandler.Remove(notifications);
     }
     return result;
 }
Esempio n. 8
0
 /// <summary>
 /// The UnregisterAudioSessionNotification method deletes a previous registration by the client to receive notifications.
 /// </summary>
 public void UnregisterAudioSessionNotification(IAudioSessionEvents notifications)
 {
     CoreAudioAPIException.Try(UnregisterAudioSessionNotificationNative(notifications), c, "UnregisterAudioSessionNotification");
 }
Esempio n. 9
0
 /// <summary>
 /// Registers the client to receive notifications of session events, including changes in the stream state.
 /// </summary>
 /// <param name="notifications">An instance of the <see cref="IAudioSessionEvents"/> object which receives the notifications.</param>
 public void RegisterAudioSessionNotification(IAudioSessionEvents notifications)
 {
     CoreAudioAPIException.Try(RegisterAudioSessionNotificationNative(notifications), InterfaceName,
         "RegisterAudioSessionNotification");
 }
 public void UnregisterAudioSessionNotification(IAudioSessionEvents notifications)
 {
     _updateThread.RunSynchronizedAction(
         () => _sessionControl.UnregisterAudioSessionNotification(notifications));
 }
Esempio n. 11
0
 /// <summary>
 /// Registers the client to receive notifications of session events, including changes in the stream state.
 /// <seealso cref="RegisterAudioSessionNotification"/>
 /// </summary>
 /// <param name="notifications">An instance of the <see cref="IAudioSessionEvents"/> object which receives the notifications.</param>
 /// <returns>HRESULT</returns>
 public unsafe int RegisterAudioSessionNotificationNative(IAudioSessionEvents notifications)
 {
     int result = 0;
     if (!_sessionEventHandler.Contains(notifications))
     {
         IntPtr ptr = notifications != null
             ? Marshal.GetComInterfaceForObject(notifications, typeof (IAudioSessionEvents))
             : IntPtr.Zero;
         try
         {
             result = InteropCalls.CallI(UnsafeBasePtr, ptr.ToPointer(), ((void**) (*(void**) UnsafeBasePtr))[10]);
         }
         finally
         {
             if (ptr != IntPtr.Zero)
             {
                 Marshal.Release(ptr);
             }
         }
         _sessionEventHandler.Add(notifications);
     }
     return result;
 }
Esempio n. 12
0
 /// <summary>
 /// Deletes a previous registration by the client to receive notifications.
 /// </summary>
 /// <param name="notifications">The instance of the <see cref="IAudioSessionEvents"/> object which got registered previously by the <see cref="RegisterAudioSessionNotification"/> method.</param>
 public void UnregisterAudioSessionNotification(IAudioSessionEvents notifications)
 {
     UnregisterAudioSessionNotificationNative(notifications);
 }