Kaynağa Gözat

添加麦克风设置

tags/对接微服务前^0
张剑 2 yıl önce
ebeveyn
işleme
9dda06378c

+ 3
- 3
XHWK.WKTool/App.config Dosyayı Görüntüle

@@ -5,12 +5,12 @@
5 5
   </startup>
6 6
   <appSettings>
7 7
     <!--0正式 1测试-->
8
-    <add key="IsDebug" value="1" />
8
+    <add key="IsDebug" value="0" />
9 9
     <!--参数是否加密 0不加密 1加密-->
10 10
     <add key="IsParameterEncryption" value="0" />
11 11
     <!--版本号-->
12
-    <add key="VersionCode" value="107" />
13
-    <add key="VersionName" value="3.1.13" />
12
+    <add key="VersionCode" value="108" />
13
+    <add key="VersionName" value="3.1.14" />
14 14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15 15
     <add key="SkinStyle" value="0" />
16 16
     <!--是否输出视频记录日志:0否-->

+ 9
- 0
XHWK.WKTool/DeviceWindow.xaml Dosyayı Görüntüle

@@ -513,6 +513,15 @@
513 513
                         SelectionChanged="CmbMicrophoneList_SelectionChanged"
514 514
                         Style="{StaticResource stlComboBox}"
515 515
                         Text="请选择" />
516
+
517
+                    <Button
518
+                        x:Name="MicrophoneSetting"
519
+                        Width="60"
520
+                        Margin="20,0,0,0"
521
+                        Background="#3f6fff"
522
+                        Content="设置"
523
+                        FontSize="14"
524
+                        Foreground="White" />
516 525
                 </StackPanel>
517 526
 
518 527
                 <Grid Grid.Row="1">

+ 86
- 58
XHWK.WKTool/DeviceWindow.xaml.cs Dosyayı Görüntüle

@@ -8,9 +8,11 @@ using NAudio.Wave;
8 8
 using System;
9 9
 using System.Collections.Generic;
10 10
 using System.Data;
11
+using System.Diagnostics;
11 12
 using System.Drawing.Imaging;
12 13
 using System.IO;
13 14
 using System.Threading;
15
+using System.Threading.Tasks;
14 16
 using System.Windows;
15 17
 using System.Windows.Input;
16 18
 using System.Windows.Media.Imaging;
@@ -32,9 +34,16 @@ namespace XHWK.WKTool
32 34
         {
33 35
             InitializeComponent();
34 36
 
37
+            MicrophoneSetting.Click += MicrophoneSetting_Click;
38
+
35 39
             cameraCheck();
36 40
         }
37 41
 
42
+        private void MicrophoneSetting_Click(object sender, RoutedEventArgs e)
43
+        {
44
+            Process.Start("mmsys.cpl");
45
+        }
46
+
38 47
         /// <summary>
39 48
         /// 初始化
40 49
         /// </summary>
@@ -48,8 +57,10 @@ namespace XHWK.WKTool
48 57
         /// <summary>
49 58
         /// 窗体移动
50 59
         /// </summary>
51
-        /// <param name="sender"></param>
52
-        /// <param name="e"></param>
60
+        /// <param name="sender">
61
+        /// </param>
62
+        /// <param name="e">
63
+        /// </param>
53 64
         private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
54 65
         {
55 66
             DragMove();
@@ -58,8 +69,10 @@ namespace XHWK.WKTool
58 69
         /// <summary>
59 70
         /// 关闭当前页
60 71
         /// </summary>
61
-        /// <param name="sender"></param>
62
-        /// <param name="e"></param>
72
+        /// <param name="sender">
73
+        /// </param>
74
+        /// <param name="e">
75
+        /// </param>
63 76
         private void BtnDown_Click(object sender, RoutedEventArgs e)
64 77
         {
65 78
             imgPlayer.Visibility = Visibility.Hidden;
@@ -98,8 +111,10 @@ namespace XHWK.WKTool
98 111
         /// <summary>
99 112
         /// 检测
100 113
         /// </summary>
101
-        /// <param name="sender"></param>
102
-        /// <param name="e"></param>
114
+        /// <param name="sender">
115
+        /// </param>
116
+        /// <param name="e">
117
+        /// </param>
103 118
         private void checkCamera()
104 119
         {
105 120
             try
@@ -159,8 +174,10 @@ namespace XHWK.WKTool
159 174
         /// <summary>
160 175
         /// 停止
161 176
         /// </summary>
162
-        /// <param name="sender"></param>
163
-        /// <param name="e"></param>
177
+        /// <param name="sender">
178
+        /// </param>
179
+        /// <param name="e">
180
+        /// </param>
164 181
         private void BtnCameraStop_Click(object sender, RoutedEventArgs e)
165 182
         {
166 183
             if (Camera != null)
@@ -176,8 +193,10 @@ namespace XHWK.WKTool
176 193
         /// <summary>
177 194
         /// 扬声器
178 195
         /// </summary>
179
-        /// <param name="sender"></param>
180
-        /// <param name="e"></param>
196
+        /// <param name="sender">
197
+        /// </param>
198
+        /// <param name="e">
199
+        /// </param>
181 200
         private void Speaker_Check()
182 201
         {
183 202
             closeCamera();
@@ -189,8 +208,10 @@ namespace XHWK.WKTool
189 208
         /// <summary>
190 209
         /// 检测扬声器
191 210
         /// </summary>
192
-        /// <param name="sender"></param>
193
-        /// <param name="e"></param>
211
+        /// <param name="sender">
212
+        /// </param>
213
+        /// <param name="e">
214
+        /// </param>
194 215
         private void BtnSpeakerDetection_Click(object sender, RoutedEventArgs e)
195 216
         {
196 217
             Console.WriteLine("播放");
@@ -205,8 +226,10 @@ namespace XHWK.WKTool
205 226
         /// <summary>
206 227
         /// 音频播放 同步进度条和视频进度
207 228
         /// </summary>
208
-        /// <param name="sender"></param>
209
-        /// <param name="e"></param>
229
+        /// <param name="sender">
230
+        /// </param>
231
+        /// <param name="e">
232
+        /// </param>
210 233
         private void MediaAudio_MediaOpened(object sender, RoutedEventArgs e)
211 234
         {
212 235
             Console.WriteLine("播放中。。。");
@@ -227,20 +250,21 @@ namespace XHWK.WKTool
227 250
         /// <summary>
228 251
         /// 麦克风
229 252
         /// </summary>
230
-        /// <param name="sender"></param>
231
-        /// <param name="e"></param>
232
-        private void Microphone_Check()
253
+        /// <param name="sender">
254
+        /// </param>
255
+        /// <param name="e">
256
+        /// </param>
257
+        private async void Microphone_Check()
233 258
         {
234 259
             MediaAudio.Stop();
235 260
             ImgAcousticWave.Visibility = Visibility.Collapsed;
236 261
             HidePage();
237 262
             GridMicrophone.Visibility = Visibility.Visible;
238
-
239
-            ThreadPool.QueueUserWorkItem(s =>
263
+            DataTable data = new DataTable();
264
+            data.Columns.Add("Value");
265
+            data.Columns.Add("Key");
266
+            await Task.Run(() =>
240 267
             {
241
-                DataTable data = new DataTable();
242
-                data.Columns.Add("Value");
243
-                data.Columns.Add("Key");
244 268
                 for (int n = 0; n < WaveIn.DeviceCount; n++)
245 269
                 {
246 270
                     var caps = WaveIn.GetCapabilities(n);
@@ -252,15 +276,13 @@ namespace XHWK.WKTool
252 276
                     data.Rows[n]["Value"] = caps.ProductName;
253 277
                     data.Rows[n]["Key"] = n + "";
254 278
                 }
255
-                Dispatcher.Invoke(() =>
256
-                {
257
-                    CmbMicrophoneList.ItemsSource = data.DefaultView;
258
-                    if (WaveIn.DeviceCount > 0)
259
-                    {
260
-                        CmbMicrophoneList.SelectedIndex = 0;
261
-                    }
262
-                });
263 279
             });
280
+
281
+            CmbMicrophoneList.ItemsSource = data.DefaultView;
282
+            if (WaveIn.DeviceCount > 0)
283
+            {
284
+                CmbMicrophoneList.SelectedIndex = 0;
285
+            }
264 286
         }
265 287
 
266 288
         private WaveInEvent waveIn = null;
@@ -275,39 +297,43 @@ namespace XHWK.WKTool
275 297
 
276 298
             if (CmbMicrophoneList.SelectedIndex >= 0)
277 299
             {
278
-                waveIn = new WaveInEvent();
279
-                waveIn.DeviceNumber = CmbMicrophoneList.SelectedIndex;
280
-
281
-                //开始录音,写数据
282
-                waveIn.DataAvailable += (o, e1) =>
300
+                var select_index = CmbMicrophoneList.SelectedIndex;
301
+                ThreadPool.QueueUserWorkItem((item) =>
283 302
                 {
284
-                    byte[] buf = e1.Buffer;
285
-                    float maxNumber = 0;
286
-                    for (int index = 0; index < buf.Length; index += 2)
287
-                    {
288
-                        short sample = (short)((buf[index + 1] << 8) | buf[index + 0]);
289
-                        float sample32 = sample / 32768f;
290
-                        sample32 = Math.Abs(sample32);
303
+                    waveIn = new WaveInEvent();
304
+                    waveIn.DeviceNumber = select_index;
291 305
 
292
-                        if (sample32 > maxNumber)
306
+                    //开始录音,写数据
307
+                    waveIn.DataAvailable += (o, e1) =>
308
+                    {
309
+                        byte[] buf = e1.Buffer;
310
+                        float maxNumber = 0;
311
+                        for (int index = 0; index < buf.Length; index += 2)
293 312
                         {
294
-                            maxNumber = sample32;
313
+                            short sample = (short)((buf[index + 1] << 8) | buf[index + 0]);
314
+                            float sample32 = sample / 32768f;
315
+                            sample32 = Math.Abs(sample32);
316
+
317
+                            if (sample32 > maxNumber)
318
+                            {
319
+                                maxNumber = sample32;
320
+                            }
295 321
                         }
296
-                    }
297 322
 
298
-                    Dispatcher.Invoke(() =>
299
-                    {
300
-                        volumeProgressBar.Value = maxNumber * 100;
301
-                    });
302
-                };
323
+                        Dispatcher.Invoke(() =>
324
+                        {
325
+                            volumeProgressBar.Value = maxNumber * 100;
326
+                        });
327
+                    };
303 328
 
304
-                //结束录音
305
-                waveIn.RecordingStopped += (s, a) =>
306
-                {
307
-                    waveIn.Dispose();
308
-                };
329
+                    //结束录音
330
+                    waveIn.RecordingStopped += (s, a) =>
331
+                    {
332
+                        waveIn.Dispose();
333
+                    };
309 334
 
310
-                waveIn.StartRecording();
335
+                    waveIn.StartRecording();
336
+                });
311 337
             }
312 338
         }
313 339
 
@@ -422,8 +448,10 @@ namespace XHWK.WKTool
422 448
         /// <summary>
423 449
         /// 重新
424 450
         /// </summary>
425
-        /// <param name="sender"></param>
426
-        /// <param name="e"></param>
451
+        /// <param name="sender">
452
+        /// </param>
453
+        /// <param name="e">
454
+        /// </param>
427 455
         private void BtnDetection_Click(object sender, RoutedEventArgs e)
428 456
         {
429 457
             cameraCheck();

+ 1
- 0
XHWK.WKTool/MainWindow.xaml.cs Dosyayı Görüntüle

@@ -3223,6 +3223,7 @@ namespace XHWK.WKTool
3223 3223
                     );
3224 3224
 
3225 3225
                     waveIn = new WaveInEvent();
3226
+
3226 3227
                     waveIn_runing = true;
3227 3228
                     writer = new WaveFileWriter(TempAudioPathName, waveIn.WaveFormat);
3228 3229
                     //开始录音,写数据

+ 1
- 1
星火微课/星火微课-正式.iss Dosyayı Görüntüle

@@ -3,7 +3,7 @@
3 3
 
4 4
 #define MyAppName "星火微课"  
5 5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "3.1.13"
6
+#define MyAppVersion "3.1.14"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9 9
 #define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"

+ 1
- 1
星火微课/星火微课-测试.iss Dosyayı Görüntüle

@@ -3,7 +3,7 @@
3 3
 
4 4
 #define MyAppName "星火微课"  
5 5
 #define MyAppDir "xhwk"
6
-#define MyAppVersion "3.1.13"
6
+#define MyAppVersion "3.1.14"
7 7
 #define MyAppPublisher "河南星火燎原软件科技有限公司"
8 8
 #define MyAppURL "http://www.xhkjedu.com/"
9 9
 #define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"

Loading…
İptal
Kaydet