void CommonConstructor(AudioDevicePool audioDevices) { AudioDevices = audioDevices ?? throw new Exception("Audio device is required."); AudioDevices.WaveOutDeviceChanged += (s, e) => { InitializeWave(); }; Worker.DoWork += DoWork; }
public ProfileEditor() { InitializeComponent(); comboBoxAPI.DataSource = Enum.GetValues(typeof(VRAPI)); comboBoxDeviceSource.DataSource = Enum.GetValues(typeof(AudioDeviceSource)); comboBoxManual.DataSource = AudioDevicePool.GetWaveOutDevices(); TTip.SetToolTip(comboBoxAPI, $"API for reading the headset data. (Application Programming Interface){Environment.NewLine + Environment.NewLine}" + $"\u2022 {VRAPI.OculusVR} = Native Oculus connection. Recommended for Oculus headsets. Works with both platforms (Oculus Home + SteamVR).{Environment.NewLine}" + $"\u2022 {VRAPI.OpenVR} = SteamVR connection. For all SteamVR compatible headsets."); TTip.SetToolTip(checkBoxStartup, $"Load this profile when program starts.{Environment.NewLine}" + "If a startup profile has not been defined, the previously used profile will be loaded."); TTip.SetToolTip(checkBoxFreeze, "Freeze profile to prevent accidental changes."); TTip.SetToolTip(pictureBoxPlus, "Add a new alert"); TTip.SetToolTip(pictureBoxClone, "Clone the selected alert"); TTip.SetToolTip(pictureBoxMinus, "Delete the selected alert"); TTip.SetToolTip(comboBoxDeviceSource, "Source for the audio device for playing the waves in this profile."); TTip.SetToolTip(labelOcuChanges, $"Change in Oculus Home audio device is only updated to {Config.ProgramTitle} at startup OR when you change the device here."); TTip.SetToolTip(checkBoxHome, $"When checked, the headset orientation is polled only when Oculus Home is running. This minimizes CPU usage for those non-VR moments. {Environment.NewLine}" + $"The presence of Home is polled once in two seconds."); TTip.SetToolTip(checkBoxResetOnMount, ResetOnMountWarning); TTip.SetToolTip(pictureBoxMounting, $"Adjust the sound that plays when you put on the headset."); TTip.SetToolTip(checkBoxMountingSound, $"Play a sound when putting on the VR headset. Check this if you want to be sure that {Config.ProgramTitle} is up and running when starting a VR session." + Environment.NewLine + "NOTE: Depending on the detection hardware and API implementation, this feature may not work as you'd expect."); if (!FormMain.RunFromDesigner) { InitializeAppearance(); } AddEventHandlers(); }
public ProfileEditor() { InitializeComponent(); comboBoxAPI.DataSource = Enum.GetValues(typeof(VRAPI)); comboBoxDeviceSource.DataSource = Enum.GetValues(typeof(AudioDeviceSource)); comboBoxManual.DataSource = AudioDevicePool.GetWaveOutDevices(); TTip.SetToolTip(comboBoxAPI, $"Choose {VRAPI.OculusVR} for Oculus headsets, {VRAPI.OpenVR} for others.{Environment.NewLine}" + $"If you switch between different headsets (with different API / Audio device), it is recommended to make a separate profile for each.{Environment.NewLine}" + "You can use the \"Clone profile\" -button to quickly copy the rotation settings to another profile."); TTip.SetToolTip(checkBoxStartup, $"Load this profile when program starts.{Environment.NewLine}" + "If a startup profile has not been defined, the previously used profile will be loaded."); TTip.SetToolTip(checkBoxFreeze, "Freeze profile to prevent accidental changes."); TTip.SetToolTip(pictureBoxPlus, "Add a new action"); TTip.SetToolTip(pictureBoxClone, "Clone the selected action"); TTip.SetToolTip(pictureBoxMinus, "Remove the selected action"); TTip.SetToolTip(comboBoxDeviceSource, "Source for the audio device for playing the waves in this profile."); TTip.SetToolTip(labelOcuChanges, $"Change in Oculus Home audio device is only updated to {Config.ProgramTitle} at startup OR when you change the device here."); TTip.SetToolTip(checkBoxHome, $"When checked, the headset orientation is polled only when Oculus Home is running. This minimizes CPU usage for those non-VR moments. {Environment.NewLine}" + $"The presence of Home is polled once in two seconds."); if (!FormMain.RunFromDesigner) { InitializeAppearance(); } AddEventHandlers(); }
public CGActionWave(AudioDevicePool audioDevices, string wave, int volume = 100, int pan = 0) { CommonConstructor(audioDevices); Wave = wave; Volume = volume; Pan = pan; }
void RefreshManualDeviceCombo() { WaveOutDevice previouslySelected = (comboBoxManual.SelectedItem as WaveOutDevice); SkipFlaggedEventHandlers = true; Enabled = false; comboBoxManual.DataSource = null; comboBoxManual.DataSource = AudioDevicePool.GetWaveOutDevices(); Enabled = true; object matchToPreviouslySelected = null; foreach (var item in comboBoxManual.Items) { if ((item as WaveOutDevice).ValueEquals(previouslySelected)) { matchToPreviouslySelected = item; } } object matchToCurrentProfile = null; foreach (var item in comboBoxManual.Items) { if ((item as WaveOutDevice).ValueEquals(TheProfile?.TheWaveOutDevice)) { matchToCurrentProfile = item; } } if (matchToPreviouslySelected != null) { comboBoxManual.SelectedItem = matchToPreviouslySelected; } else if (matchToCurrentProfile != null) { comboBoxManual.SelectedItem = matchToCurrentProfile; } else if (previouslySelected != null) { TheProfile.TheWaveOutDevice = previouslySelected; } SkipFlaggedEventHandlers = false; }
public void LoadFromXml(XElement xUserProfile) { if (xUserProfile != null) { Name = xUserProfile.GetElementValueTrimmed("Name"); Frozen = xUserProfile.GetElementValueBool("Frozen"); RequireHome = xUserProfile.GetElementValueBool("RequireHome"); if (xUserProfile.GetElementValueOrNull("API") == null) { API = Config.LegacyAPI; // backwards compatibility, API was in config-xml before } else { if (Enum.TryParse(xUserProfile.GetElementValueTrimmed("API"), out VRAPI a)) { API = a; } else { API = VRAPI.OculusVR; } } string wout = xUserProfile.GetElementValueTrimmed("WaveOutDeviceSource"); if (Enum.TryParse(wout, out AudioDeviceSource ads)) { WaveOutDeviceSource = ads; } else { if (String.Compare(wout, "Oculus", true) == 0) // backwards compatibility { WaveOutDeviceSource = AudioDeviceSource.OculusHome; } else { WaveOutDeviceSource = AudioDeviceSource.Windows; } } string waveOutName = xUserProfile.GetElementValueTrimmed("WaveOutDeviceName"); TheWaveOutDevice = AudioDevicePool.GetWaveOutDevice(waveOutName); OriginalWaveOutDeviceNotFound = false; if (TheWaveOutDevice == null && WaveOutDeviceSource == AudioDeviceSource.Manual) { OriginalWaveOutDeviceNotFound = true; NotFoundDeviceName = waveOutName; if (API == VRAPI.OculusVR) { WaveOutDeviceSource = AudioDeviceSource.OculusHome; } else { WaveOutDeviceSource = AudioDeviceSource.Windows; } } foreach (var trig in xUserProfile.Descendants().Where(element => element.Name == "TriggeredAction")) { TriggeredAction newAct = new TriggeredAction(FormMain.Tracker, this); newAct.LoadFromXml(trig, false); } } }
public CGActionWave(AudioDevicePool audioDevices) { CommonConstructor(audioDevices); }