Пример #1
0
        private void UnregisterNotifications()
        {
            sessions = null;

            if (audioSessionNotification != null && audioSessionInterface2 != null)
            {
                Marshal.ThrowExceptionForHR(
                    audioSessionInterface2.UnregisterSessionNotification(audioSessionNotification));
                audioSessionNotification = null;
            }
        }
Пример #2
0
        /// <summary>
        /// Refresh session of current device.
        /// </summary>
        public void RefreshSessions()
        {
            UnregisterNotifications();

            if (audioSessionInterface2 != null)
            {
                Marshal.ThrowExceptionForHR(audioSessionInterface2.GetSessionEnumerator(out var sessionEnum));
                sessions = new SessionCollection(sessionEnum);

                audioSessionNotification = new AudioSessionNotification(this);
                Marshal.ThrowExceptionForHR(audioSessionInterface2.RegisterSessionNotification(audioSessionNotification));
            }
        }