From 586bf81109bc01623fbf98506afed89c692b4c6c Mon Sep 17 00:00:00 2001 From: Michael Auerswald Date: Wed, 19 May 2021 22:51:20 +0200 Subject: [PATCH 1/3] fix for https://github.com/flipswitchingmonkey/FlexASIO_GUI/issues/14 --- Form1.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Form1.cs b/Form1.cs index 9516a38..53c8559 100644 --- a/Form1.cs +++ b/Form1.cs @@ -22,12 +22,15 @@ public partial class Form1 : Form private string TOMLPath; private FlexGUIConfig flexGUIConfig; private System.Text.Encoding enc1252; + private string flexasioGuiVersion = "0.3"; + private string flexasioVersion = "1.7a"; + private string tomlName = "FlexASIO.toml"; public Form1() { InitializeComponent(); - this.Text = "FlexASIO GUI v0.2"; + this.Text = $"FlexASIO GUI v{flexasioGuiVersion}"; System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; @@ -38,7 +41,7 @@ public Form1() CultureInfo.DefaultThreadCurrentCulture = customCulture; CultureInfo.DefaultThreadCurrentUICulture = customCulture; - TOMLPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\FlexASIO.toml"; + TOMLPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\{tomlName}"; flexGUIConfig = new FlexGUIConfig(); if (File.Exists(TOMLPath)) @@ -86,7 +89,7 @@ public Form1() wasapiAutoConvertOutput.Checked = flexGUIConfig.output.wasapiAutoConvert; InitDone = true; - SetStatusMessage($"FlexASIO GUI for FlexASIO 0.15 started ({Configuration.VersionString})"); + SetStatusMessage($"FlexASIO GUI for FlexASIO {flexasioVersion} started ({Configuration.VersionString})"); GenerateOutput(); } @@ -147,6 +150,7 @@ private void comboBackend_SelectedIndexChanged(object sender, EventArgs e) treeDevicesOutput.Nodes.Clear(); treeDevicesOutput.Nodes.AddRange(GetDevicesForBackend(selectedBackend, false)); } + if (selectedBackend == "(None)") selectedBackend = ""; flexGUIConfig.backend = selectedBackend; GenerateOutput(); } @@ -183,7 +187,7 @@ private void btSaveAs_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); - saveFileDialog.FileName = "FlexASIO.toml"; + saveFileDialog.FileName = tomlName; var ret = saveFileDialog.ShowDialog(); if (ret == DialogResult.OK) { @@ -233,7 +237,7 @@ private void treeDevicesInput_AfterSelect(object sender, TreeViewEventArgs e) if (o.SelectedNode != null) { o.SelectedNode.Checked = true; - flexGUIConfig.input.device = o.SelectedNode.Text; + flexGUIConfig.input.device = o.SelectedNode.Text == "(None)" ? "" : o.SelectedNode.Text; GenerateOutput(); } } @@ -245,7 +249,7 @@ private void treeDevicesOutput_AfterSelect(object sender, TreeViewEventArgs e) if (o.SelectedNode != null) { o.SelectedNode.Checked = true; - flexGUIConfig.output.device = o.SelectedNode.Text; + flexGUIConfig.output.device = o.SelectedNode.Text == "(None)" ? "" : o.SelectedNode.Text; GenerateOutput(); } } From 46c2f20e28f257d30ca105b939d65657b5fb362e Mon Sep 17 00:00:00 2001 From: Michael Auerswald Date: Thu, 20 May 2021 00:10:55 +0200 Subject: [PATCH 2/3] fix for https://github.com/flipswitchingmonkey/FlexASIO_GUI/issues/11 --- FlexGUIConfig.cs | 8 +-- Form1.Designer.cs | 128 +++++++++++++++++++++++++++++++++++----- Form1.cs | 147 +++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 250 insertions(+), 33 deletions(-) diff --git a/FlexGUIConfig.cs b/FlexGUIConfig.cs index 237a82d..739175c 100644 --- a/FlexGUIConfig.cs +++ b/FlexGUIConfig.cs @@ -7,7 +7,7 @@ namespace FlexASIOGUI public class FlexGUIConfig { public string backend { get; set; } = "Windows WASAPI"; - public int bufferSizeSamples { get; set; } = 256; + public int? bufferSizeSamples { get; set; } = null; public FlexGUIConfigDeviceSection input { get; set; } public FlexGUIConfigDeviceSection output { get; set; } @@ -21,9 +21,9 @@ public FlexGUIConfig() public class FlexGUIConfigDeviceSection { public string device { get; set; } - public double suggestedLatencySeconds { get; set; } - public bool wasapiExclusiveMode { get; set; } = false; - public bool wasapiAutoConvert { get; set; } = true; + public double? suggestedLatencySeconds { get; set; } = null; + public bool? wasapiExclusiveMode { get; set; } = null; + public bool? wasapiAutoConvert { get; set; } = null; public int? channels { get; set; } } } diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 3022c5a..16b0a79 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -36,17 +36,23 @@ private void InitializeComponent() this.label3 = new System.Windows.Forms.Label(); this.btSaveToProfile = new System.Windows.Forms.Button(); this.comboBackend = new System.Windows.Forms.ComboBox(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); + this.checkBoxSetOutputLatency = new System.Windows.Forms.CheckBox(); this.numericLatencyOutput = new System.Windows.Forms.NumericUpDown(); this.label7 = new System.Windows.Forms.Label(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.checkBoxWasapiInputSet = new System.Windows.Forms.CheckBox(); this.wasapiExclusiveInput = new System.Windows.Forms.CheckBox(); this.wasapiAutoConvertInput = new System.Windows.Forms.CheckBox(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); + this.checkBoxWasapiOutputSet = new System.Windows.Forms.CheckBox(); this.wasapiExclusiveOutput = new System.Windows.Forms.CheckBox(); this.wasapiAutoConvertOutput = new System.Windows.Forms.CheckBox(); this.configOutput = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); + this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); + this.checkBoxSetInputLatency = new System.Windows.Forms.CheckBox(); this.numericLatencyInput = new System.Windows.Forms.NumericUpDown(); this.label4 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); @@ -57,11 +63,14 @@ private void InitializeComponent() this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.label6 = new System.Windows.Forms.Label(); + this.checkBoxSetBufferSize = new System.Windows.Forms.CheckBox(); this.numericBufferSize = new System.Windows.Forms.NumericUpDown(); this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericLatencyOutput)).BeginInit(); this.flowLayoutPanel2.SuspendLayout(); this.flowLayoutPanel3.SuspendLayout(); + this.flowLayoutPanel5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericLatencyInput)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericChannelsInput)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericChannelsOutput)).BeginInit(); @@ -113,14 +122,14 @@ private void InitializeComponent() this.tableLayoutPanel1.Controls.Add(this.btSaveToProfile, 3, 4); this.tableLayoutPanel1.Controls.Add(this.treeDevicesInput, 1, 2); this.tableLayoutPanel1.Controls.Add(this.comboBackend, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.numericLatencyOutput, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel4, 2, 3); this.tableLayoutPanel1.Controls.Add(this.label7, 0, 4); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 1, 4); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 2, 4); this.tableLayoutPanel1.Controls.Add(this.configOutput, 3, 2); this.tableLayoutPanel1.Controls.Add(this.label1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.label2, 2, 1); - this.tableLayoutPanel1.Controls.Add(this.numericLatencyInput, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel5, 1, 3); this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3); this.tableLayoutPanel1.Controls.Add(this.label9, 3, 1); this.tableLayoutPanel1.Controls.Add(this.label5, 0, 5); @@ -139,6 +148,7 @@ private void InitializeComponent() this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(875, 534); this.tableLayoutPanel1.TabIndex = 4; // @@ -196,13 +206,34 @@ private void InitializeComponent() this.comboBackend.TabIndex = 1; this.comboBackend.SelectedIndexChanged += new System.EventHandler(this.comboBackend_SelectedIndexChanged); // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.Controls.Add(this.checkBoxSetOutputLatency); + this.flowLayoutPanel4.Controls.Add(this.numericLatencyOutput); + this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel4.Location = new System.Drawing.Point(335, 417); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(236, 24); + this.flowLayoutPanel4.TabIndex = 11; + // + // checkBoxSetOutputLatency + // + this.checkBoxSetOutputLatency.AutoSize = true; + this.checkBoxSetOutputLatency.Location = new System.Drawing.Point(3, 3); + this.checkBoxSetOutputLatency.Name = "checkBoxSetOutputLatency"; + this.checkBoxSetOutputLatency.Size = new System.Drawing.Size(127, 19); + this.checkBoxSetOutputLatency.TabIndex = 19; + this.checkBoxSetOutputLatency.Text = "Set Output Latency"; + this.checkBoxSetOutputLatency.UseVisualStyleBackColor = true; + this.checkBoxSetOutputLatency.CheckedChanged += new System.EventHandler(this.checkBoxSetOutputLatency_CheckedChanged); + // // numericLatencyOutput // this.numericLatencyOutput.DecimalPlaces = 1; this.numericLatencyOutput.Dock = System.Windows.Forms.DockStyle.Fill; - this.numericLatencyOutput.Location = new System.Drawing.Point(335, 417); + this.numericLatencyOutput.Location = new System.Drawing.Point(136, 3); this.numericLatencyOutput.Name = "numericLatencyOutput"; - this.numericLatencyOutput.Size = new System.Drawing.Size(236, 23); + this.numericLatencyOutput.Size = new System.Drawing.Size(90, 23); this.numericLatencyOutput.TabIndex = 3; this.numericLatencyOutput.ValueChanged += new System.EventHandler(this.numericLatencyOutput_ValueChanged); // @@ -218,6 +249,7 @@ private void InitializeComponent() // // flowLayoutPanel2 // + this.flowLayoutPanel2.Controls.Add(this.checkBoxWasapiInputSet); this.flowLayoutPanel2.Controls.Add(this.wasapiExclusiveInput); this.flowLayoutPanel2.Controls.Add(this.wasapiAutoConvertInput); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -226,10 +258,21 @@ private void InitializeComponent() this.flowLayoutPanel2.Size = new System.Drawing.Size(236, 24); this.flowLayoutPanel2.TabIndex = 11; // + // checkBoxWasapiInputSet + // + this.checkBoxWasapiInputSet.AutoSize = true; + this.checkBoxWasapiInputSet.Location = new System.Drawing.Point(3, 3); + this.checkBoxWasapiInputSet.Name = "checkBoxWasapiInputSet"; + this.checkBoxWasapiInputSet.Size = new System.Drawing.Size(45, 19); + this.checkBoxWasapiInputSet.TabIndex = 9; + this.checkBoxWasapiInputSet.Text = "Set:"; + this.checkBoxWasapiInputSet.UseVisualStyleBackColor = true; + this.checkBoxWasapiInputSet.CheckedChanged += new System.EventHandler(this.checkBoxWasapiInputSet_CheckedChanged); + // // wasapiExclusiveInput // this.wasapiExclusiveInput.AutoSize = true; - this.wasapiExclusiveInput.Location = new System.Drawing.Point(3, 3); + this.wasapiExclusiveInput.Location = new System.Drawing.Point(54, 3); this.wasapiExclusiveInput.Name = "wasapiExclusiveInput"; this.wasapiExclusiveInput.Size = new System.Drawing.Size(74, 19); this.wasapiExclusiveInput.TabIndex = 7; @@ -242,7 +285,7 @@ private void InitializeComponent() this.wasapiAutoConvertInput.AutoSize = true; this.wasapiAutoConvertInput.Checked = true; this.wasapiAutoConvertInput.CheckState = System.Windows.Forms.CheckState.Checked; - this.wasapiAutoConvertInput.Location = new System.Drawing.Point(83, 3); + this.wasapiAutoConvertInput.Location = new System.Drawing.Point(134, 3); this.wasapiAutoConvertInput.Name = "wasapiAutoConvertInput"; this.wasapiAutoConvertInput.Size = new System.Drawing.Size(94, 19); this.wasapiAutoConvertInput.TabIndex = 8; @@ -252,6 +295,7 @@ private void InitializeComponent() // // flowLayoutPanel3 // + this.flowLayoutPanel3.Controls.Add(this.checkBoxWasapiOutputSet); this.flowLayoutPanel3.Controls.Add(this.wasapiExclusiveOutput); this.flowLayoutPanel3.Controls.Add(this.wasapiAutoConvertOutput); this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; @@ -260,10 +304,21 @@ private void InitializeComponent() this.flowLayoutPanel3.Size = new System.Drawing.Size(236, 24); this.flowLayoutPanel3.TabIndex = 12; // + // checkBoxWasapiOutputSet + // + this.checkBoxWasapiOutputSet.AutoSize = true; + this.checkBoxWasapiOutputSet.Location = new System.Drawing.Point(3, 3); + this.checkBoxWasapiOutputSet.Name = "checkBoxWasapiOutputSet"; + this.checkBoxWasapiOutputSet.Size = new System.Drawing.Size(45, 19); + this.checkBoxWasapiOutputSet.TabIndex = 10; + this.checkBoxWasapiOutputSet.Text = "Set:"; + this.checkBoxWasapiOutputSet.UseVisualStyleBackColor = true; + this.checkBoxWasapiOutputSet.CheckedChanged += new System.EventHandler(this.checkBoxWasapOutputSet_CheckedChanged); + // // wasapiExclusiveOutput // this.wasapiExclusiveOutput.AutoSize = true; - this.wasapiExclusiveOutput.Location = new System.Drawing.Point(3, 3); + this.wasapiExclusiveOutput.Location = new System.Drawing.Point(54, 3); this.wasapiExclusiveOutput.Name = "wasapiExclusiveOutput"; this.wasapiExclusiveOutput.Size = new System.Drawing.Size(74, 19); this.wasapiExclusiveOutput.TabIndex = 8; @@ -276,7 +331,7 @@ private void InitializeComponent() this.wasapiAutoConvertOutput.AutoSize = true; this.wasapiAutoConvertOutput.Checked = true; this.wasapiAutoConvertOutput.CheckState = System.Windows.Forms.CheckState.Checked; - this.wasapiAutoConvertOutput.Location = new System.Drawing.Point(83, 3); + this.wasapiAutoConvertOutput.Location = new System.Drawing.Point(134, 3); this.wasapiAutoConvertOutput.Name = "wasapiAutoConvertOutput"; this.wasapiAutoConvertOutput.Size = new System.Drawing.Size(94, 19); this.wasapiAutoConvertOutput.TabIndex = 9; @@ -314,13 +369,34 @@ private void InitializeComponent() this.label2.TabIndex = 0; this.label2.Text = "Output Device"; // + // flowLayoutPanel5 + // + this.flowLayoutPanel5.Controls.Add(this.checkBoxSetInputLatency); + this.flowLayoutPanel5.Controls.Add(this.numericLatencyInput); + this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel5.Location = new System.Drawing.Point(93, 417); + this.flowLayoutPanel5.Name = "flowLayoutPanel5"; + this.flowLayoutPanel5.Size = new System.Drawing.Size(236, 24); + this.flowLayoutPanel5.TabIndex = 11; + // + // checkBoxSetInputLatency + // + this.checkBoxSetInputLatency.AutoSize = true; + this.checkBoxSetInputLatency.Location = new System.Drawing.Point(3, 3); + this.checkBoxSetInputLatency.Name = "checkBoxSetInputLatency"; + this.checkBoxSetInputLatency.Size = new System.Drawing.Size(117, 19); + this.checkBoxSetInputLatency.TabIndex = 20; + this.checkBoxSetInputLatency.Text = "Set Input Latency"; + this.checkBoxSetInputLatency.UseVisualStyleBackColor = true; + this.checkBoxSetInputLatency.CheckedChanged += new System.EventHandler(this.checkBoxSetInputLatency_CheckedChanged); + // // numericLatencyInput // this.numericLatencyInput.DecimalPlaces = 1; this.numericLatencyInput.Dock = System.Windows.Forms.DockStyle.Fill; - this.numericLatencyInput.Location = new System.Drawing.Point(93, 417); + this.numericLatencyInput.Location = new System.Drawing.Point(126, 3); this.numericLatencyInput.Name = "numericLatencyInput"; - this.numericLatencyInput.Size = new System.Drawing.Size(236, 23); + this.numericLatencyInput.Size = new System.Drawing.Size(90, 23); this.numericLatencyInput.TabIndex = 3; this.numericLatencyInput.ValueChanged += new System.EventHandler(this.numericLatencyInput_ValueChanged); // @@ -393,6 +469,7 @@ private void InitializeComponent() // flowLayoutPanel1 // this.flowLayoutPanel1.Controls.Add(this.label6); + this.flowLayoutPanel1.Controls.Add(this.checkBoxSetBufferSize); this.flowLayoutPanel1.Controls.Add(this.numericBufferSize); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Location = new System.Drawing.Point(335, 3); @@ -404,20 +481,30 @@ private void InitializeComponent() // this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 3); + this.label6.Location = new System.Drawing.Point(3, 6); this.label6.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(62, 15); + this.label6.Size = new System.Drawing.Size(0, 15); this.label6.TabIndex = 6; - this.label6.Text = "Buffer Size"; + // + // checkBoxSetBufferSize + // + this.checkBoxSetBufferSize.AutoSize = true; + this.checkBoxSetBufferSize.Location = new System.Drawing.Point(9, 3); + this.checkBoxSetBufferSize.Name = "checkBoxSetBufferSize"; + this.checkBoxSetBufferSize.Size = new System.Drawing.Size(100, 19); + this.checkBoxSetBufferSize.TabIndex = 7; + this.checkBoxSetBufferSize.Text = "Set Buffer Size"; + this.checkBoxSetBufferSize.UseVisualStyleBackColor = true; + this.checkBoxSetBufferSize.CheckedChanged += new System.EventHandler(this.checkBoxSetBufferSize_CheckedChanged); // // numericBufferSize // this.numericBufferSize.Dock = System.Windows.Forms.DockStyle.Fill; - this.numericBufferSize.Location = new System.Drawing.Point(71, 0); + this.numericBufferSize.Location = new System.Drawing.Point(115, 0); this.numericBufferSize.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); this.numericBufferSize.Name = "numericBufferSize"; - this.numericBufferSize.Size = new System.Drawing.Size(120, 23); + this.numericBufferSize.Size = new System.Drawing.Size(90, 23); this.numericBufferSize.TabIndex = 5; this.numericBufferSize.ValueChanged += new System.EventHandler(this.numericBufferSize_ValueChanged); // @@ -432,11 +519,15 @@ private void InitializeComponent() this.Load += new System.EventHandler(this.Form1_Load); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel4.ResumeLayout(false); + this.flowLayoutPanel4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericLatencyOutput)).EndInit(); this.flowLayoutPanel2.ResumeLayout(false); this.flowLayoutPanel2.PerformLayout(); this.flowLayoutPanel3.ResumeLayout(false); this.flowLayoutPanel3.PerformLayout(); + this.flowLayoutPanel5.ResumeLayout(false); + this.flowLayoutPanel5.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericLatencyInput)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericChannelsInput)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericChannelsOutput)).EndInit(); @@ -471,6 +562,8 @@ private void InitializeComponent() private System.Windows.Forms.Button btSaveToProfile; private System.Windows.Forms.Button btSaveAs; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel5; private System.Windows.Forms.CheckBox wasapiAutoConvertInput; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; private System.Windows.Forms.CheckBox wasapiAutoConvertOutput; @@ -481,6 +574,11 @@ private void InitializeComponent() private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.CheckBox checkBoxSetOutputLatency; + private System.Windows.Forms.CheckBox checkBoxSetInputLatency; + private System.Windows.Forms.CheckBox checkBoxSetBufferSize; + private System.Windows.Forms.CheckBox checkBoxWasapiInputSet; + private System.Windows.Forms.CheckBox checkBoxWasapiOutputSet; } } diff --git a/Form1.cs b/Form1.cs index 53c8559..6ce76f0 100644 --- a/Form1.cs +++ b/Form1.cs @@ -50,7 +50,6 @@ public Form1() } numericBufferSize.Maximum = 8192; - numericBufferSize.Value = 256; numericBufferSize.Increment = 16; numericLatencyInput.Increment = 0.1m; @@ -70,23 +69,36 @@ public Form1() comboBackend.SelectedIndex = 0; } - - numericBufferSize.Value = (Int64)flexGUIConfig.bufferSizeSamples; + checkBoxSetBufferSize.Checked = numericBufferSize.Enabled = flexGUIConfig.bufferSizeSamples != null; + if (flexGUIConfig.bufferSizeSamples != null) + numericBufferSize.Value = (Int64)flexGUIConfig.bufferSizeSamples; treeDevicesInput.SelectedNode = treeDevicesInput.Nodes.Cast().FirstOrDefault(x => x.Text == (flexGUIConfig.input.device == "" ? "(None)" : flexGUIConfig.input.device)); treeDevicesOutput.SelectedNode = treeDevicesOutput.Nodes.Cast().FirstOrDefault(x => x.Text == (flexGUIConfig.output.device == "" ? "(None)" : flexGUIConfig.output.device)); - - numericLatencyInput.Value = (decimal)(double)flexGUIConfig.input.suggestedLatencySeconds; - numericLatencyOutput.Value = (decimal)(double)flexGUIConfig.output.suggestedLatencySeconds; + + checkBoxSetInputLatency.Checked = numericLatencyInput.Enabled = flexGUIConfig.input.suggestedLatencySeconds != null; + checkBoxSetOutputLatency.Checked = numericLatencyOutput.Enabled = flexGUIConfig.output.suggestedLatencySeconds != null; + + if (flexGUIConfig.input.suggestedLatencySeconds != null) + numericLatencyInput.Value = (decimal)(double)flexGUIConfig.input.suggestedLatencySeconds; + if (flexGUIConfig.output.suggestedLatencySeconds != null) + numericLatencyOutput.Value = (decimal)(double)flexGUIConfig.output.suggestedLatencySeconds; numericChannelsInput.Value = (decimal)(flexGUIConfig.input.channels ?? 0); numericChannelsOutput.Value = (decimal)(flexGUIConfig.output.channels ?? 0); - wasapiExclusiveInput.Checked = flexGUIConfig.input.wasapiExclusiveMode; - wasapiExclusiveOutput.Checked = flexGUIConfig.output.wasapiExclusiveMode; + checkBoxWasapiInputSet.Checked = flexGUIConfig.input.wasapiExclusiveMode != null || flexGUIConfig.input.wasapiAutoConvert != null; + checkBoxWasapiOutputSet.Checked = flexGUIConfig.output.wasapiExclusiveMode != null || flexGUIConfig.output.wasapiAutoConvert != null; + + wasapiExclusiveInput.Enabled = flexGUIConfig.input.wasapiExclusiveMode != null; + wasapiExclusiveInput.Checked = flexGUIConfig.input.wasapiExclusiveMode ?? false; + wasapiExclusiveOutput.Enabled = flexGUIConfig.output.wasapiExclusiveMode != null; + wasapiExclusiveOutput.Checked = flexGUIConfig.output.wasapiExclusiveMode ?? false; - wasapiAutoConvertInput.Checked = flexGUIConfig.input.wasapiAutoConvert; - wasapiAutoConvertOutput.Checked = flexGUIConfig.output.wasapiAutoConvert; + wasapiAutoConvertInput.Enabled = flexGUIConfig.input.wasapiAutoConvert != null; + wasapiAutoConvertInput.Checked = flexGUIConfig.input.wasapiAutoConvert ?? false; + wasapiAutoConvertOutput.Enabled = flexGUIConfig.output.wasapiAutoConvert != null; + wasapiAutoConvertOutput.Checked = flexGUIConfig.output.wasapiAutoConvert ?? false; InitDone = true; SetStatusMessage($"FlexASIO GUI for FlexASIO {flexasioVersion} started ({Configuration.VersionString})"); @@ -160,6 +172,20 @@ private void GenerateOutput() { if (!InitDone) return; + if (!checkBoxSetBufferSize.Checked) flexGUIConfig.bufferSizeSamples = null; + if (!checkBoxSetInputLatency.Checked) flexGUIConfig.input.suggestedLatencySeconds = null; + if (!checkBoxSetOutputLatency.Checked) flexGUIConfig.output.suggestedLatencySeconds = null; + if (!checkBoxWasapiInputSet.Checked) + { + flexGUIConfig.input.wasapiAutoConvert = null; + flexGUIConfig.input.wasapiExclusiveMode = null; + } + if (!checkBoxWasapiOutputSet.Checked) + { + flexGUIConfig.output.wasapiAutoConvert = null; + flexGUIConfig.output.wasapiExclusiveMode = null; + } + configOutput.Clear(); configOutput.Text = Toml.WriteString(flexGUIConfig); } @@ -275,16 +301,22 @@ private void numericLatencyOutput_ValueChanged(object sender, EventArgs e) { var o = sender as NumericUpDown; if (o == null) return; - flexGUIConfig.output.suggestedLatencySeconds = (o.Value > 0 ? (double)o.Value : 0); - GenerateOutput(); + if (checkBoxSetOutputLatency.Enabled) + { + flexGUIConfig.output.suggestedLatencySeconds = (o.Value > 0 ? (double)o.Value : 0); + GenerateOutput(); + } } private void numericLatencyInput_ValueChanged(object sender, EventArgs e) { var o = sender as NumericUpDown; if (o == null) return; - flexGUIConfig.input.suggestedLatencySeconds = (o.Value > 0 ? (double)o.Value : 0); - GenerateOutput(); + if (checkBoxSetInputLatency.Enabled) + { + flexGUIConfig.input.suggestedLatencySeconds = (o.Value > 0 ? (double)o.Value : 0); + GenerateOutput(); + } } private void wasapiAutoConvertOutput_CheckedChanged(object sender, EventArgs e) @@ -335,5 +367,92 @@ private void treeDevicesInput_AfterCheck(object sender, TreeViewEventArgs e) { } + + private void checkBoxSetInputLatency_CheckedChanged(object sender, EventArgs e) + { + var o = sender as CheckBox; + if (o == null) return; + numericLatencyInput.Enabled = o.Checked; + if (o.Checked == false) + { + flexGUIConfig.input.suggestedLatencySeconds = null; + } + else + { + numericLatencyInput_ValueChanged(numericLatencyInput, null); + } + GenerateOutput(); + } + + private void checkBoxSetOutputLatency_CheckedChanged(object sender, EventArgs e) + { + var o = sender as CheckBox; + if (o == null) return; + numericLatencyOutput.Enabled = o.Checked; + if (o.Checked == false) { + flexGUIConfig.output.suggestedLatencySeconds = null; + } + else + { + numericLatencyOutput_ValueChanged(numericLatencyOutput, null); + } + GenerateOutput(); + } + + + private void checkBoxSetBufferSize_CheckedChanged(object sender, EventArgs e) + { + var o = sender as CheckBox; + if (o == null) return; + numericBufferSize.Enabled = o.Checked; + if (o.Checked == false) { + flexGUIConfig.bufferSizeSamples = null; + } + else + { + numericBufferSize_ValueChanged(numericBufferSize, null); + } + GenerateOutput(); + } + + private void checkBoxWasapiInputSet_CheckedChanged(object sender, EventArgs e) + { + var o = sender as CheckBox; + if (o == null) return; + wasapiAutoConvertInput.Enabled = o.Checked; + wasapiExclusiveInput.Enabled = o.Checked; + + if (o.Checked == false) + { + flexGUIConfig.input.wasapiAutoConvert = null; + flexGUIConfig.input.wasapiExclusiveMode = null; + } + else + { + flexGUIConfig.input.wasapiAutoConvert = wasapiAutoConvertInput.Checked; + flexGUIConfig.input.wasapiExclusiveMode = wasapiExclusiveInput.Checked; + } + GenerateOutput(); + } + + private void checkBoxWasapOutputSet_CheckedChanged(object sender, EventArgs e) + { + var o = sender as CheckBox; + if (o == null) return; + wasapiAutoConvertOutput.Enabled = o.Checked; + wasapiExclusiveOutput.Enabled = o.Checked; + + if (o.Checked == false) + { + flexGUIConfig.output.wasapiAutoConvert = null; + flexGUIConfig.output.wasapiExclusiveMode = null; + } + else + { + flexGUIConfig.output.wasapiAutoConvert = wasapiAutoConvertOutput.Checked; + flexGUIConfig.output.wasapiExclusiveMode = wasapiExclusiveOutput.Checked; + } + GenerateOutput(); + } } } From a38acdbb6b03c6bc3efff7466d72df031f4474c5 Mon Sep 17 00:00:00 2001 From: Michael Auerswald Date: Thu, 20 May 2021 00:33:01 +0200 Subject: [PATCH 3/3] v0.3, registry key added to installer --- FlexASIOGUI.csproj | 1 + installer/FlexASIOGUI.iss | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/FlexASIOGUI.csproj b/FlexASIOGUI.csproj index a3ff05b..c7ec55b 100644 --- a/FlexASIOGUI.csproj +++ b/FlexASIOGUI.csproj @@ -5,6 +5,7 @@ netcoreapp3.1 true AnyCPU;x64 + installer\flexasiogui.ico diff --git a/installer/FlexASIOGUI.iss b/installer/FlexASIOGUI.iss index 7271a18..36a8c85 100644 --- a/installer/FlexASIOGUI.iss +++ b/installer/FlexASIOGUI.iss @@ -1,5 +1,5 @@ #define MyAppName "FlexASIO GUI" -#define MyAppVersion "0.2" +#define MyAppVersion "0.3" #define MyAppPublisher "https://github.com/flipswitchingmonkey/FlexASIO_GUI" #define MyAppURL "" #define MyAppExeName "FlexASIOGUI.exe" @@ -38,3 +38,8 @@ Source: "..\bin\x64\Release\netcoreapp3.1\*"; DestDir: "{app}"; Flags: ignorever [Icons] Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ;Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Registry] +Root: HKLM64; Subkey: "Software\Fabrikat"; Flags: uninsdeletekeyifempty +Root: HKLM64; Subkey: "Software\Fabrikat\FlexASIOGUI"; Flags: uninsdeletekey +Root: HKLM64; Subkey: "Software\Fabrikat\FlexASIOGUI\Install"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}" \ No newline at end of file