Exemple #1
0
        public void UpdateSession(int sessionIndex, float newVolume)
        {
            if (sessionIndex >= sessions.Count)
            {
                return;
            }
            SessionUI sessionUI = sessions[sessionIndex];

            if (sessionUI == null)
            {
                return;
            }
            UpdateSession(sessionIndex, newVolume, sessionUI.session.SimpleAudioVolume.Mute);
        }
Exemple #2
0
        public void UpdateSession(int sessionIndex, bool newMute)
        {
            if (sessionIndex >= sessions.Count)
            {
                return;
            }
            SessionUI sessionUI = sessions[sessionIndex];

            if (sessionUI == null)
            {
                return;
            }
            UpdateSession(sessionIndex, sessionUI.session.SimpleAudioVolume.MasterVolume, newMute);
        }
Exemple #3
0
 private void OnSessionCreated(object sender, CoreAudio.Interfaces.IAudioSessionControl2 newSession)
 {
     Dispatcher.Invoke(() => {
         SessionUI sessionUI          = new SessionUI();
         ConstructorInfo contructor   = typeof(AudioSessionControl2).GetConstructors(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)[0];
         AudioSessionControl2 session = contructor.Invoke(new object[] { newSession }) as AudioSessionControl2;
         sessionUI.SetSession(session);
         sessionStackPanel.Children.Add(sessionUI);
         this.sessions.Add(sessionUI);
         MainWindow.instance.SendAudioSession(sessions.IndexOf(sessionUI), session.SimpleAudioVolume.MasterVolume, session.SimpleAudioVolume.Mute, true);
         //Session_OnSimpleVolumeChanged(session, session.SimpleAudioVolume.MasterVolume, session.SimpleAudioVolume.Mute);
         SessionVolumeChanged(session, session.SimpleAudioVolume.MasterVolume, session.SimpleAudioVolume.Mute);
         //sessionUI.session.OnSimpleVolumeChanged += Session_OnSimpleVolumeChanged;
     });
 }
Exemple #4
0
        public void UpdateSession(int sessionIndex, float newVolume, bool newMute)
        {
            if (sessionIndex >= sessions.Count)
            {
                return;
            }
            SessionUI sessionUI = sessions[sessionIndex];

            if (sessionUI == null)
            {
                return;
            }
            //sessionUI.session.OnSimpleVolumeChanged -= Session_OnSimpleVolumeChanged;
            sessionUI.UpdateSession(this, newVolume, newMute);
            //sessionUI.session.OnSimpleVolumeChanged += Session_OnSimpleVolumeChanged;
        }
Exemple #5
0
        private void EnumerateSessions()
        {
            selectedDevice = ((RenderDevice)deviceComboBox.SelectedItem).Device;
            audioSessionManager2.OnSessionCreated -= OnSessionCreated;
            audioSessionManager2 = selectedDevice.AudioSessionManager2;
            audioSessionManager2.OnSessionCreated += OnSessionCreated;
            audioSessionManager2.RefreshSessions();
            SessionCollection sessions = audioSessionManager2.Sessions;

            sessionStackPanel.Children.Clear();

            foreach (AudioSessionControl2 session in sessions)
            {
                if (session.State != AudioSessionState.AudioSessionStateExpired)
                {
                    SessionUI sessionUI = new SessionUI();
                    sessionUI.SetSession(session);
                    //sessionUI.session.OnSimpleVolumeChanged += Session_OnSimpleVolumeChanged;
                    sessionStackPanel.Children.Add(sessionUI);
                    this.sessions.Add(sessionUI);
                }
            }
        }