@@ -21,13 +21,18 @@ public partial class Form1 : Form
21
21
private bool InitDone = false ;
22
22
private string TOMLPath ;
23
23
private FlexGUIConfig flexGUIConfig ;
24
+ private System . Text . Encoding enc1252 ;
24
25
25
26
public Form1 ( )
26
27
{
27
28
InitializeComponent ( ) ;
28
29
30
+ this . Text = "FlexASIO GUI v0.2" ;
31
+
29
32
System . Globalization . CultureInfo customCulture = ( System . Globalization . CultureInfo ) System . Threading . Thread . CurrentThread . CurrentCulture . Clone ( ) ;
30
33
customCulture . NumberFormat . NumberDecimalSeparator = "." ;
34
+ Encoding . RegisterProvider ( CodePagesEncodingProvider . Instance ) ;
35
+ enc1252 = Encoding . GetEncoding ( 1252 ) ;
31
36
32
37
System . Threading . Thread . CurrentThread . CurrentCulture = customCulture ;
33
38
CultureInfo . DefaultThreadCurrentCulture = customCulture ;
@@ -48,8 +53,6 @@ public Form1()
48
53
numericLatencyInput . Increment = 0.1m ;
49
54
numericLatencyOutput . Increment = 0.1m ;
50
55
51
- PortAudioInterop . Pa_Initialize ( ) ;
52
-
53
56
for ( var i = 0 ; i < Configuration . HostApiCount ; i ++ )
54
57
{
55
58
comboBackend . Items . Add ( Configuration . GetHostApiInfo ( i ) . name ) ;
@@ -87,13 +90,21 @@ public Form1()
87
90
GenerateOutput ( ) ;
88
91
}
89
92
93
+ private string W1252fromUTF ( string s )
94
+ {
95
+ byte [ ] bytes = Encoding . Default . GetBytes ( s ) ;
96
+ byte [ ] output = Encoding . Convert ( Encoding . UTF8 , enc1252 , bytes ) ;
97
+ return Encoding . UTF8 . GetString ( output ) ;
98
+ }
99
+
90
100
private TreeNode [ ] GetDevicesForBackend ( string Backend , bool Input )
91
101
{
92
102
List < TreeNode > treeNodes = new List < TreeNode > ( ) ;
93
103
treeNodes . Add ( new TreeNode ( "(None)" ) ) ;
94
104
for ( var i = 0 ; i < Configuration . DeviceCount ; i ++ )
95
105
{
96
106
var deviceInfo = Configuration . GetDeviceInfo ( i ) ;
107
+
97
108
var apiInfo = Configuration . GetHostApiInfo ( deviceInfo . hostApi ) ;
98
109
99
110
if ( apiInfo . name != Backend )
@@ -103,14 +114,14 @@ private TreeNode[] GetDevicesForBackend(string Backend, bool Input)
103
114
{
104
115
if ( deviceInfo . maxInputChannels > 0 )
105
116
{
106
- treeNodes . Add ( new TreeNode ( deviceInfo . name ) ) ;
117
+ treeNodes . Add ( new TreeNode ( W1252fromUTF ( deviceInfo . name ) ) ) ;
107
118
}
108
119
}
109
120
else
110
121
{
111
122
if ( deviceInfo . maxOutputChannels > 0 )
112
123
{
113
- treeNodes . Add ( new TreeNode ( deviceInfo . name ) ) ;
124
+ treeNodes . Add ( new TreeNode ( W1252fromUTF ( deviceInfo . name ) ) ) ;
114
125
}
115
126
}
116
127
}
@@ -145,46 +156,6 @@ private void GenerateOutput()
145
156
{
146
157
if ( ! InitDone ) return ;
147
158
148
- // Old manual way of writing the config file...
149
-
150
- //StringBuilder config = new StringBuilder();
151
- //var backend = comboBackend.SelectedItem.ToString();
152
- //var input = treeDevicesInput?.SelectedNode?.Text;
153
- //var output = treeDevicesOutput?.SelectedNode?.Text;
154
- //var inputLatency = numericLatencyInput.Value.ToString();
155
- //var outputLatency = numericLatencyOutput.Value.ToString();
156
-
157
- //config.AppendLine($"# Host API backend");
158
- //config.AppendLine($"backend = \"{comboBackend.SelectedItem?.ToString()}\"");
159
- //config.AppendLine($"bufferSizeSamples = {numericBufferSize?.Value.ToString()}");
160
- //config.AppendLine("");
161
- //config.AppendLine($"[input]");
162
- //if (input == "(None)")
163
- // config.AppendLine($"device = \"\"");
164
- //else
165
- // config.AppendLine($"device = \"{treeDevicesInput?.SelectedNode?.Text}\"");
166
- //if (numericChannelsInput.Value > 0)
167
- //{
168
- // config.AppendLine($"channels = {numericChannelsInput?.Value.ToString()}");
169
- //}
170
- //config.AppendLine($"suggestedLatencySeconds = {numericLatencyInput?.Value.ToString("0.0", new CultureInfo("en-US"))}");
171
- //config.AppendLine($"wasapiExclusiveMode = {wasapiExclusiveInput?.Checked.ToString().ToLower()}");
172
- //config.AppendLine($"wasapiAutoConvert = {wasapiAutoConvertInput?.Checked.ToString().ToLower()}");
173
- //config.AppendLine("");
174
- //config.AppendLine($"[output]");
175
- //if (output == "(None)")
176
- // config.AppendLine($"device = \"\"");
177
- //else
178
- // config.AppendLine($"device = \"{treeDevicesOutput?.SelectedNode?.Text}\"");
179
- //if (numericChannelsOutput.Value > 0)
180
- //{
181
- // config.AppendLine($"channels = {numericChannelsOutput?.Value.ToString()}");
182
- //}
183
- //config.AppendLine($"suggestedLatencySeconds = {numericLatencyOutput?.Value.ToString("0.0", new CultureInfo("en-US"))}");
184
- //config.AppendLine($"wasapiExclusiveMode = {wasapiExclusiveOutput?.Checked.ToString().ToLower()}");
185
- //config.AppendLine($"wasapiAutoConvert = {wasapiAutoConvertOutput?.Checked.ToString().ToLower()}");
186
- //configOutput.Text = config.ToString();
187
-
188
159
configOutput . Clear ( ) ;
189
160
configOutput . Text = Toml . WriteString ( flexGUIConfig ) ;
190
161
}
0 commit comments