コード例 #1
0
        public void CSGOWasRunning()
        {
            lock (LockObject)
            {
                isActive = false;
                //disable DispatcherTimer
                refreshDispatcherTimer.Stop();

                #region AquireData

                //Extract Data from the UI Thread
                bool isAudioEnabled       = false;
                bool isVibranceEnabled    = false;
                int  inGameVibranceLevel  = 0;
                int  windowsVibranceLevel = 0;

                Dispatcher.Invoke(new Action(() =>
                {
                    isAudioEnabled       = UseAudioSettingsCheckBox.IsChecked == true;
                    isVibranceEnabled    = UseVibranceSettingsCheckBox.IsChecked == true;
                    inGameVibranceLevel  = (int)InGameVibranceLevelSlider.Value;
                    windowsVibranceLevel = (int)WindowsVibranceLevelSlider.Value;
                }));
                #endregion

                #region Audio

                if (isAudioEnabled)
                {
                    Dispatcher.Invoke(new Action(() =>
                    {
                        if (WindowsAudioDeviceComboBox.SelectedItem != null)
                        {
                            int audioDevice = ((AudioDevice)WindowsAudioDeviceComboBox.SelectedItem).DeviceID;
                            AudioDeviceController.SetAudioDevice(audioDevice);
                        }
                    }));
                }

                #endregion

                #region Vibrance

                //If Vibrance is enabled we want to set the Vibrance when go is running
                if (isVibranceEnabled && windowsVibranceLevel != inGameVibranceLevel)
                {
                    if (vibranceProxy != null && vibranceProxy.VibranceInfo.isInitialized)
                    {
                        //vibranceProxy.VibranceInfo.displayHandles.ForEach(handle => VibranceProxy.setDVCLevel(handle, 0));
                        VibranceProxy.setDVCLevel(csgoHandle, getNVIDIAValue(windowsVibranceLevel));

                        vibranceProxy.UnloadLibraryEx();
                        csgoHandle   = -1;
                        stillRunning = false;
                    }
                }

                #endregion
            }
        }
コード例 #2
0
        public void CSGOWasRunning()
        {
            #region AquireData
            //Extract Data from the UI Thread
            bool isAudioEnabled  = false;
            bool extractedValues = false;

            Dispatcher.BeginInvoke(new Action(() =>
            {
                isAudioEnabled  = UseAudioSettingsCheckBox.IsChecked == true;
                extractedValues = true;
            }));

            while (!extractedValues)
            {
                Thread.Sleep(100);
            }

            #endregion

            if (isAudioEnabled)
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    if (WindowsAudioDeviceComboBox.SelectedItem != null)
                    {
                        int audioDevice = ((AudioDevice)WindowsAudioDeviceComboBox.SelectedItem).DeviceID;
                        AudioDeviceController.SetAudioDevice(audioDevice);
                    }
                }));
            }
        }
コード例 #3
0
 private void loadAudioDevices()
 {
     comboBoxAudioDevices.Items.Clear();
     audioDevices = AudioDeviceController.GetAllAudioDevices();
     foreach (AudioDevice audioDevice in audioDevices)
     {
         comboBoxAudioDevices.Items.Add(audioDevice.Name);
     }
 }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: wjendli/windows-uwp
        //</SnippetProcessAudioFrame>

        private void MuteAudioDeviceController(MediaFrameSource frameSource)
        {
            //<SnippetAudioDeviceController>
            audioDeviceController = frameSource.Controller.AudioDeviceController;
            //</SnippetAudioDeviceController>

            //<SnippetAudioDeviceControllerMute>
            audioDeviceController.Muted = true;
            //</SnippetAudioDeviceControllerMute>
        }
コード例 #5
0
        //Fills the audiodevices Combobox
        private void PopulateAudioDeviceCombobox()
        {
            audioDeviceList = AudioDeviceController.GetAudioDevices();

            Dispatcher.BeginInvoke(new Action(() =>
            {
                WindowsAudioDeviceComboBox.ItemsSource = audioDeviceList;
                InGameAudioDeviceComboBox.ItemsSource  = audioDeviceList;
            }));
        }
コード例 #6
0
        private async void SetupMicrophone()
        {
            // Set default microphone here, so we can get the usb mic not the webcam mic
            // Enables camera operations with PO

            captureDev = new Windows.Media.Capture.MediaCapture();
            await captureDev.InitializeAsync();

            microphone = captureDev.AudioDeviceController;
        }
コード例 #7
0
        public void CSGOIsRunning()
        {
            if (!stillRunning)
            {
                stillRunning = true;
                isActive     = true;

                #region AquireData

                //Extract Data from the UI Thread
                bool isAudioEnabled       = false;
                bool isVibranceEnabled    = false;
                int  refreshRate          = 0;
                int  inGameVibranceLevel  = 0;
                int  windowsVibranceLevel = 0;

                Dispatcher.Invoke(new Action(() =>
                {
                    isAudioEnabled       = UseAudioSettingsCheckBox.IsChecked == true;
                    isVibranceEnabled    = UseVibranceSettingsCheckBox.IsChecked == true;
                    inGameVibranceLevel  = (int)InGameVibranceLevelSlider.Value;
                    windowsVibranceLevel = (int)WindowsVibranceLevelSlider.Value;

                    //Making sure the User doesn't DDOS himself
                    if (int.TryParse(RefreshRateTextBox.Text, out refreshRate))
                    {
                        refreshRate = refreshRate < 100 ? refreshRate : 100;
                    }
                }));

                #endregion

                #region Audio

                //If Audio is enabled we want to switch the Audio Device when CSGO is running
                if (isAudioEnabled)
                {
                    Dispatcher.Invoke(new Action(() =>
                    {
                        if (InGameAudioDeviceComboBox.SelectedItem != null)
                        {
                            int audioDevice = ((AudioDevice)InGameAudioDeviceComboBox.SelectedItem).DeviceID;
                            AudioDeviceController.SetAudioDevice(audioDevice);
                        }
                    }));
                }

                #endregion

                #region Vibrance

                //If Vibrance is enabled we want to set the Vibrance when go is running
                if (isVibranceEnabled && windowsVibranceLevel != inGameVibranceLevel)
                {
                    vibranceProxy = new VibranceProxy();

                    if (vibranceProxy.VibranceInfo.isInitialized)
                    {
                        csgoHandle = vibranceProxy.GetCsgoDisplayHandle();

                        while (csgoHandle == -1)
                        {
                            csgoHandle = vibranceProxy.GetCsgoDisplayHandle();
                        }

                        //vibranceProxy.VibranceInfo.defaultHandle = csgoHandle;
                        VibranceProxy.setDVCLevel(csgoHandle, getNVIDIAValue(inGameVibranceLevel));

                        refreshDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, refreshRate);
                        refreshDispatcherTimer.Start();
                    }
                }
                #endregion
            }
        }
コード例 #8
0
        public void CSGOIsRunning()
        {
            if (!stillRunning)
            {
                stillRunning = true;

                #region AquireData

                //Extract Data from the UI Thread
                bool isVibranceEnabled = false;
                bool isAudioEnabled    = false;

                int refreshRate          = 0;
                int inGameVibranceLevel  = 0;
                int windowsVibranceLevel = 0;

                bool extractedValues = false;

                Dispatcher.BeginInvoke(new Action(() =>
                {
                    isVibranceEnabled = UseVibranceSettingsCheckBox.IsChecked == true;
                    isAudioEnabled    = UseAudioSettingsCheckBox.IsChecked == true;
                    //Making sure the user won't accidentally DOS his own PC
                    refreshRate = Convert.ToInt32(RefreshRateTextBox.Text);
                    if (refreshRate < 100)
                    {
                        RefreshRateTextBox.Text = "100";
                        refreshRate             = 100;
                    }

                    inGameVibranceLevel  = (int)InGameVibranceLevelSlider.Value;
                    windowsVibranceLevel = (int)WindowsVibranceLevelSlider.Value;

                    extractedValues = true;
                }));

                while (!extractedValues)
                {
                    Thread.Sleep(100);
                }

                #endregion

                #region Audio

                //If Audio is enabled we want to switch the Audio Device when CSGO is running
                if (isAudioEnabled)
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        if (InGameAudioDeviceComboBox.SelectedItem != null)
                        {
                            int audioDevice = ((AudioDevice)InGameAudioDeviceComboBox.SelectedItem).DeviceID;
                            AudioDeviceController.SetAudioDevice(audioDevice);
                        }
                    }));
                }

                #endregion

                #region Vibrance

                //If Vibrance is enabled we want to set the Vibrance when go is running
                if (isVibranceEnabled && windowsVibranceLevel != inGameVibranceLevel)
                {
                    ThreadStart vibranceThreadStart = () =>
                    {
                        //This blocks the Thread until CSGO is closed/minimised
                        //therefore we stick in in another Thread
                        vibranceProxy = new VibranceProxy();
                        if (vibranceProxy.VibranceInfo.isInitialized)
                        {
                            vibranceProxy.SetShouldRun(true);
                            vibranceProxy.SetKeepActive(false);
                            vibranceProxy.SetVibranceInGameLevel(inGameVibranceLevel);
                            vibranceProxy.SetVibranceWindowsLevel(windowsVibranceLevel);
                            vibranceProxy.SetSleepInterval(refreshRate);
                            vibranceProxy.HandleDvc();
                            vibranceProxy.UnloadLibraryEx();
                            stillRunning = false;
                        }
                    };

                    Thread vibranceThread = new Thread(vibranceThreadStart);
                    vibranceThread.Start();
                }

                #endregion
            }
        }