diff --git a/FlexASIOGUI.csproj b/FlexASIOGUI.csproj
index 45ddec8..90cfd59 100644
--- a/FlexASIOGUI.csproj
+++ b/FlexASIOGUI.csproj
@@ -10,6 +10,7 @@
+
diff --git a/Form1.Designer.cs b/Form1.Designer.cs
index 75871e3..9468780 100644
--- a/Form1.Designer.cs
+++ b/Form1.Designer.cs
@@ -391,6 +391,7 @@ private void InitializeComponent()
this.configOutput.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.configOutput.Size = new System.Drawing.Size(295, 333);
this.configOutput.TabIndex = 9;
+ this.configOutput.ReadOnly = true;
//
// label1
//
diff --git a/Form1.cs b/Form1.cs
index 21fb000..471f055 100644
--- a/Form1.cs
+++ b/Form1.cs
@@ -19,7 +19,6 @@ public partial class Form1 : Form
private bool InitDone = false;
private string TOMLPath;
private FlexGUIConfig flexGUIConfig;
- private Encoding legacyEncoding;
private readonly string flexasioGuiVersion = "0.35";
private readonly string flexasioVersion = "1.9";
private readonly string tomlName = "FlexASIO.toml";
@@ -34,23 +33,19 @@ public partial class Form1 : Form
public Form1()
{
InitializeComponent();
-
+
this.Text = $"FlexASIO GUI v{flexasioGuiVersion}";
System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
- // get the value of the "Language for non-Unicode programs" setting (1252 for English)
- // note: in Win11 this could be UTF-8 already, since it's natively supported
- legacyEncoding = Encoding.GetEncoding((int)GetACP());
-
System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
CultureInfo.DefaultThreadCurrentCulture = customCulture;
CultureInfo.DefaultThreadCurrentUICulture = customCulture;
TOMLPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\{tomlName}";
-
+
tomlModelOptions.ConvertPropertyName = (string name) => name;
this.LoadFlexASIOConfig(TOMLPath);
@@ -65,7 +60,15 @@ private FlexGUIConfig LoadFlexASIOConfig(string tomlPath)
if (File.Exists(tomlPath))
{
var tomlPathAsText = File.ReadAllText(tomlPath);
- flexGUIConfig = Toml.ToModel(tomlPathAsText, options: tomlModelOptions);
+ try
+ {
+ flexGUIConfig = Toml.ToModel(tomlPathAsText, options: tomlModelOptions);
+ }
+ catch (Exception)
+ {
+ MessageBox.Show($"Error loading config, the config file is reset.");
+ File.Delete(tomlPath);
+ }
}
numericBufferSize.Maximum = 8192;
@@ -121,14 +124,6 @@ private FlexGUIConfig LoadFlexASIOConfig(string tomlPath)
return flexGUIConfig;
}
- private string DescrambleUTF8(string s)
- {
- // portaudio incorrectly returns UTF-8 strings as if they were ANSI (CP1252 for most Latin systems, CP1251 for Cyrillic, etc...)
- // this line fixes the issue by reading the input as CP* and parsing it as UTF-8
- var bytes = legacyEncoding.GetBytes(s);
- return Encoding.UTF8.GetString(bytes);
- }
-
private TreeNode[] GetDevicesForBackend(string Backend, bool Input)
{
List treeNodes = new List();
@@ -138,22 +133,22 @@ private TreeNode[] GetDevicesForBackend(string Backend, bool Input)
var deviceInfo = Configuration.GetDeviceInfo(i);
var apiInfo = Configuration.GetHostApiInfo(deviceInfo.hostApi);
-
- if (apiInfo.name != Backend)
+
+ if (apiInfo.name != Backend)
continue;
if (Input == true)
{
if (deviceInfo.maxInputChannels > 0)
{
- treeNodes.Add(new TreeNode(DescrambleUTF8(deviceInfo.name)));
+ treeNodes.Add(new TreeNode(deviceInfo.name));
}
}
else
{
if (deviceInfo.maxOutputChannels > 0)
{
- treeNodes.Add(new TreeNode(DescrambleUTF8(deviceInfo.name)));
+ treeNodes.Add(new TreeNode(deviceInfo.name));
}
}
}
@@ -162,7 +157,7 @@ private TreeNode[] GetDevicesForBackend(string Backend, bool Input)
private void Form1_Load(object sender, EventArgs e)
{
-
+
}
private void comboBackend_SelectedIndexChanged(object sender, EventArgs e)
@@ -170,7 +165,7 @@ private void comboBackend_SelectedIndexChanged(object sender, EventArgs e)
var o = sender as ComboBox;
if (o != null)
{
- var selectedBackend = o.SelectedItem as string;
+ var selectedBackend = o.SelectedItem as String;
RefreshDevices(selectedBackend);
if (selectedBackend == "(None)") selectedBackend = "";
flexGUIConfig.backend = selectedBackend;
@@ -262,7 +257,7 @@ private void btSaveAs_Click(object sender, EventArgs e)
SetStatusMessage($"Configuration written to {saveFileDialog.FileName}");
}
- private void treeDevicesInput_AfterSelect(object sender, TreeViewEventArgs e)
+ private void treeDevicesInput_AfterSelect(object sender, TreeViewEventArgs e)
{
if (sender == null) return;
else
@@ -402,7 +397,7 @@ private void numericBufferSize_ValueChanged(object sender, EventArgs e)
GenerateOutput();
}
-
+
private void checkBoxSetInputLatency_CheckedChanged(object sender, EventArgs e)
{
var o = sender as CheckBox;
@@ -424,7 +419,8 @@ 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) {
+ if (o.Checked == false)
+ {
flexGUIConfig.output.suggestedLatencySeconds = null;
}
else
@@ -433,15 +429,16 @@ private void checkBoxSetOutputLatency_CheckedChanged(object sender, EventArgs e)
}
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;
+ if (o.Checked == false)
+ {
+ flexGUIConfig.bufferSizeSamples = null;
}
else
{
@@ -504,7 +501,7 @@ private void linkLabelDocs_LinkClicked(object sender, LinkLabelLinkClickedEventA
private void btLoadFrom_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
-
+
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
openFileDialog.FileName = tomlName;
openFileDialog.Filter = "FlexASIO Config (*.toml)|*.toml";
@@ -522,7 +519,7 @@ private void btLoadFrom_Click(object sender, EventArgs e)
this.LoadFlexASIOConfig(TOMLPath);
return;
}
-
+
}
SetStatusMessage($"Configuration loaded from {openFileDialog.FileName}");
}
diff --git a/lib/Debug/portaudio-sharp.dll b/lib/Debug/portaudio-sharp.dll
index 996fb73..3a12f03 100644
Binary files a/lib/Debug/portaudio-sharp.dll and b/lib/Debug/portaudio-sharp.dll differ
diff --git a/lib/Debug/portaudio-sharp.pdb b/lib/Debug/portaudio-sharp.pdb
index 0a8df14..115a57e 100644
Binary files a/lib/Debug/portaudio-sharp.pdb and b/lib/Debug/portaudio-sharp.pdb differ
diff --git a/lib/Release/portaudio-sharp.dll b/lib/Release/portaudio-sharp.dll
index 996fb73..3a12f03 100644
Binary files a/lib/Release/portaudio-sharp.dll and b/lib/Release/portaudio-sharp.dll differ
diff --git a/lib/Release/portaudio-sharp.pdb b/lib/Release/portaudio-sharp.pdb
index 0a8df14..115a57e 100644
Binary files a/lib/Release/portaudio-sharp.pdb and b/lib/Release/portaudio-sharp.pdb differ
diff --git a/lib/portaudio.dll b/lib/portaudio.dll
new file mode 100644
index 0000000..614764a
Binary files /dev/null and b/lib/portaudio.dll differ
diff --git a/lib/portaudio.pdb b/lib/portaudio.pdb
new file mode 100644
index 0000000..7887c12
Binary files /dev/null and b/lib/portaudio.pdb differ
diff --git a/lib/portaudio_x64.dll b/lib/portaudio_x64.dll
deleted file mode 100644
index f7461d3..0000000
Binary files a/lib/portaudio_x64.dll and /dev/null differ
diff --git a/lib/portaudio_x64.pdb b/lib/portaudio_x64.pdb
deleted file mode 100644
index c741405..0000000
Binary files a/lib/portaudio_x64.pdb and /dev/null differ