private void AudioEngBoxTrigger(bool S) { int AE = AudioEngBox.SelectedIndex; bool NOAtWASIOE = (AE != AudioEngine.AUDTOWAV && AE != AudioEngine.ASIO_ENGINE); bool NoAtW = (AE != AudioEngine.AUDTOWAV); bool NoASIOE = (AE != AudioEngine.ASIO_ENGINE); switch (AudioEngBox.SelectedIndex) { case AudioEngine.WASAPI_ENGINE: case AudioEngine.DSOUND_ENGINE: default: BufferText.Text = "Output buffer (in ms, from 1 to 1000. If the buffer is too small, it'll be set automatically to the lowest value possible)"; break; case AudioEngine.AUDTOWAV: BufferText.Text = "The output buffer isn't needed when outputting to a .WAV file"; break; case AudioEngine.ASIO_ENGINE: if (DefaultASIOAudioOutput.GetASIODevicesCount() < 1) { Program.ShowError(4, "Error", "No ASIO devices installed!\n\nClick OK to switch to WASAPI.", null); AudioEngBox.SelectedIndex = 3; AudioEngBoxTrigger(true); return; } BufferText.Text = "The output buffer is controlled by the ASIO device itself"; break; } ChangeDefaultOutput.Enabled = NoAtW ? true : false; BufferText.Enabled = NOAtWASIOE ? true : false; DrvHzLabel.Enabled = true; Frequency.Enabled = true; MaxCPU.Enabled = NoAtW ? true : false; RenderingTimeLabel.Enabled = NoAtW ? true : false; VolLabel.Enabled = NoAtW ? true : false; VolSimView.Enabled = NoAtW ? true : false; VolTrackBar.Enabled = NoAtW ? true : false; bufsize.Enabled = NoASIOE ? true : false; OldBuff.Enabled = NoAtW ? true : false; if (S) { Program.SynthSettings.SetValue("xaudiodisabled", AudioEngBox.SelectedIndex, RegistryValueKind.DWord); } }
private void ChangeDefaultOutput_Click(object sender, EventArgs e) { if (OmniMIDIConfiguratorMain.Delegate.AudioEngBox.SelectedIndex == AudioEngine.DSOUND_ENGINE) { DefaultOutput frm = new DefaultOutput(false); frm.ShowDialog(this); frm.Dispose(); } else if (OmniMIDIConfiguratorMain.Delegate.AudioEngBox.SelectedIndex == AudioEngine.WASAPI_ENGINE) { DefaultOutput frm = new DefaultOutput(true); frm.ShowDialog(this); frm.Dispose(); } else if (OmniMIDIConfiguratorMain.Delegate.AudioEngBox.SelectedIndex == AudioEngine.ASIO_ENGINE) { DefaultASIOAudioOutput frm = new DefaultASIOAudioOutput(); frm.ShowDialog(this); frm.Dispose(); } }
private void AudioEngBoxTrigger(bool S) { int AE = AudioEngBox.SelectedIndex; bool NOAtWASIOE = (AE != AudioEngine.AUDTOWAV && AE != AudioEngine.ASIO_ENGINE); bool NoAtW = (AE != AudioEngine.AUDTOWAV); bool NoASIOE = (AE != AudioEngine.ASIO_ENGINE); switch (AudioEngBox.SelectedIndex) { case AudioEngine.WASAPI_ENGINE: case AudioEngine.DSOUND_ENGINE: default: BufferText.Text = "Output buffer (in ms, from 1 to 1000. If the buffer is too small, it'll be set automatically to the lowest value possible)"; break; case AudioEngine.AUDTOWAV: BufferText.Text = "The output buffer isn't needed when outputting to a .WAV file"; break; case AudioEngine.ASIO_ENGINE: if (DefaultASIOAudioOutput.GetASIODevicesCount() < 1 && !S) { DialogResult RES = Program.ShowError( 3, "Error", "You selected ASIO, but no ASIO devices are installed on your computer.\n" + "Running any MIDI app with this configuration might lead to an error on startup.\n\n" + "Are you sure you want to continue?\nPress Yes to keep this configuration, or No to switch back to the previous engine.", null); if (RES == DialogResult.No) { AudioEngBox.SelectedIndex = PreviousValue; AudioEngBoxTrigger(true); } return; } BufferText.Text = "The output buffer is controlled by the ASIO device itself"; break; } ChangeDefaultOutput.Enabled = NoAtW ? true : false; BufferText.Enabled = NOAtWASIOE ? true : false; DrvHzLabel.Enabled = true; Frequency.Enabled = true; MaxCPU.Enabled = NoAtW ? true : false; RenderingTimeLabel.Enabled = NoAtW ? true : false; VolLabel.Enabled = NoAtW ? true : false; VolSimView.Enabled = NoAtW ? true : false; VolTrackBar.Enabled = NoAtW ? true : false; bufsize.Enabled = NoASIOE ? true : false; OldBuff.Enabled = NoAtW ? true : false; PreviousValue = AudioEngBox.SelectedIndex; if (S) { Program.SynthSettings.SetValue("xaudiodisabled", AudioEngBox.SelectedIndex, RegistryValueKind.DWord); } }