private void UnregisterNotifications()
        {
            if (_Sessions != null)
                _Sessions = null;

            if (_AudioSessionNotification != null)
                Marshal.ThrowExceptionForHR(_AudioSessionManager2.UnregisterSessionNotification(_AudioSessionNotification));
        }
        public void RefreshSessions()
        {
            UnregisterNotifications();

            Marshal.ThrowExceptionForHR(_AudioSessionManager2.GetSessionEnumerator(out IAudioSessionEnumerator _SessionEnum));
            _Sessions = new SessionCollection(_SessionEnum);

            _AudioSessionNotification = new AudioSessionNotification(this);
            Marshal.ThrowExceptionForHR(_AudioSessionManager2.RegisterSessionNotification(_AudioSessionNotification));
        }
        public void RefreshSessions()
        {
            UnregisterNotifications();

            IAudioSessionEnumerator _SessionEnum;
            Marshal.ThrowExceptionForHR(_AudioSessionManager2.GetSessionEnumerator(out _SessionEnum));
            _Sessions = new SessionCollection(_SessionEnum);

            _AudioSessionNotification = new AudioSessionNotification(this);
            Marshal.ThrowExceptionForHR(_AudioSessionManager2.RegisterSessionNotification(_AudioSessionNotification));
        }
        private void UnregisterNotifications()
        {
            if (_Sessions != null)
            {
                _Sessions = null;
            }

            if (_AudioSessionNotification != null)
            {
                Marshal.ThrowExceptionForHR(_AudioSessionManager2.UnregisterSessionNotification(_AudioSessionNotification));
            }
        }
Beispiel #5
0
 /// <summary>
 /// Refresh session of current device.
 /// </summary>
 public void RefreshSessions()
 {
     Marshal.ThrowExceptionForHR(_audioSessionManager2.GetSessionEnumerator(out var sessionEnum));
     _sessions = new SessionCollection(sessionEnum);
 }