Skip to content

Commit

Permalink
v0.2 - fixes unicode naming issue
Browse files Browse the repository at this point in the history
  • Loading branch information
flipswitchingmonkey committed Sep 6, 2020
1 parent ba56da0 commit 28ee963
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 48 deletions.
4 changes: 3 additions & 1 deletion FlexASIOGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nett" Version="0.15.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
</ItemGroup>

<ItemGroup>
<Reference Include="portaudio-sharp">
<HintPath>lib\portaudio-sharp.dll</HintPath>
<HintPath>lib\Debug\portaudio-sharp.dll</HintPath>
</Reference>
</ItemGroup>

Expand Down
8 changes: 7 additions & 1 deletion FlexASIOGUI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlexASIOGUI", "FlexASIOGUI.csproj", "{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlexASIOGUI", "FlexASIOGUI.csproj", "{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Debug|x64.ActiveCfg = Debug|x64
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Debug|x64.Build.0 = Debug|x64
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Release|Any CPU.Build.0 = Release|Any CPU
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Release|x64.ActiveCfg = Release|x64
{3379A106-E2A5-4B28-92D0-D4E37D4ABCCF}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
59 changes: 15 additions & 44 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ public partial class Form1 : Form
private bool InitDone = false;
private string TOMLPath;
private FlexGUIConfig flexGUIConfig;
private System.Text.Encoding enc1252;

public Form1()
{
InitializeComponent();

this.Text = "FlexASIO GUI v0.2";

System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
enc1252 = Encoding.GetEncoding(1252);

System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
CultureInfo.DefaultThreadCurrentCulture = customCulture;
Expand All @@ -48,8 +53,6 @@ public Form1()
numericLatencyInput.Increment = 0.1m;
numericLatencyOutput.Increment = 0.1m;

PortAudioInterop.Pa_Initialize();

for (var i=0; i<Configuration.HostApiCount; i++)
{
comboBackend.Items.Add(Configuration.GetHostApiInfo(i).name);
Expand Down Expand Up @@ -87,13 +90,21 @@ public Form1()
GenerateOutput();
}

private string W1252fromUTF(string s)
{
byte[] bytes = Encoding.Default.GetBytes(s);
byte[] output = Encoding.Convert(Encoding.UTF8, enc1252, bytes);
return Encoding.UTF8.GetString(output);
}

private TreeNode[] GetDevicesForBackend(string Backend, bool Input)
{
List<TreeNode> treeNodes = new List<TreeNode>();
treeNodes.Add(new TreeNode("(None)"));
for (var i = 0; i < Configuration.DeviceCount; i++)
{
var deviceInfo = Configuration.GetDeviceInfo(i);

var apiInfo = Configuration.GetHostApiInfo(deviceInfo.hostApi);

if (apiInfo.name != Backend)
Expand All @@ -103,14 +114,14 @@ private TreeNode[] GetDevicesForBackend(string Backend, bool Input)
{
if (deviceInfo.maxInputChannels > 0)
{
treeNodes.Add(new TreeNode(deviceInfo.name));
treeNodes.Add(new TreeNode(W1252fromUTF(deviceInfo.name)));
}
}
else
{
if (deviceInfo.maxOutputChannels > 0)
{
treeNodes.Add(new TreeNode(deviceInfo.name));
treeNodes.Add(new TreeNode(W1252fromUTF(deviceInfo.name)));
}
}
}
Expand Down Expand Up @@ -145,46 +156,6 @@ private void GenerateOutput()
{
if (!InitDone) return;

// Old manual way of writing the config file...

//StringBuilder config = new StringBuilder();
//var backend = comboBackend.SelectedItem.ToString();
//var input = treeDevicesInput?.SelectedNode?.Text;
//var output = treeDevicesOutput?.SelectedNode?.Text;
//var inputLatency = numericLatencyInput.Value.ToString();
//var outputLatency = numericLatencyOutput.Value.ToString();

//config.AppendLine($"# Host API backend");
//config.AppendLine($"backend = \"{comboBackend.SelectedItem?.ToString()}\"");
//config.AppendLine($"bufferSizeSamples = {numericBufferSize?.Value.ToString()}");
//config.AppendLine("");
//config.AppendLine($"[input]");
//if (input == "(None)")
// config.AppendLine($"device = \"\"");
//else
// config.AppendLine($"device = \"{treeDevicesInput?.SelectedNode?.Text}\"");
//if (numericChannelsInput.Value > 0)
//{
// config.AppendLine($"channels = {numericChannelsInput?.Value.ToString()}");
//}
//config.AppendLine($"suggestedLatencySeconds = {numericLatencyInput?.Value.ToString("0.0", new CultureInfo("en-US"))}");
//config.AppendLine($"wasapiExclusiveMode = {wasapiExclusiveInput?.Checked.ToString().ToLower()}");
//config.AppendLine($"wasapiAutoConvert = {wasapiAutoConvertInput?.Checked.ToString().ToLower()}");
//config.AppendLine("");
//config.AppendLine($"[output]");
//if (output == "(None)")
// config.AppendLine($"device = \"\"");
//else
// config.AppendLine($"device = \"{treeDevicesOutput?.SelectedNode?.Text}\"");
//if (numericChannelsOutput.Value > 0)
//{
// config.AppendLine($"channels = {numericChannelsOutput?.Value.ToString()}");
//}
//config.AppendLine($"suggestedLatencySeconds = {numericLatencyOutput?.Value.ToString("0.0", new CultureInfo("en-US"))}");
//config.AppendLine($"wasapiExclusiveMode = {wasapiExclusiveOutput?.Checked.ToString().ToLower()}");
//config.AppendLine($"wasapiAutoConvert = {wasapiAutoConvertOutput?.Checked.ToString().ToLower()}");
//configOutput.Text = config.ToString();

configOutput.Clear();
configOutput.Text = Toml.WriteString(flexGUIConfig);
}
Expand Down
4 changes: 2 additions & 2 deletions installer/FlexASIOGUI.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "FlexASIO GUI"
#define MyAppVersion "0.1"
#define MyAppVersion "0.2"
#define MyAppPublisher "https://github.com/flipswitchingmonkey/FlexASIO_GUI"
#define MyAppURL ""
#define MyAppExeName "FlexASIOGUI.exe"
Expand Down Expand Up @@ -32,7 +32,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
;Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\bin\Release\netcoreapp3.1\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
Source: "..\bin\x64\Release\netcoreapp3.1\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Expand Down
Binary file modified lib/portaudio_x64.dll
Binary file not shown.
Binary file modified lib/portaudio_x64.pdb
Binary file not shown.

0 comments on commit 28ee963

Please sign in to comment.