Parcourir la source

设备检测 麦克风检测重做

tags/3.0.0
张剑 il y a 3 ans
Parent
révision
267ec8caa7

+ 6
- 6
XHWK.WKTool/App.config Voir le fichier

@@ -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="89" />
13
-    <add key="VersionName" value="2.6.9" />
12
+    <add key="VersionCode" value="90" />
13
+    <add key="VersionName" value="2.7.0" />
14 14
     <!--皮肤样式 0白 1蓝 2黑色 -->
15 15
     <add key="SkinStyle" value="0" />
16 16
     <!--是否输出视频记录日志:0否-->
@@ -34,11 +34,11 @@
34 34
     <!--是否为校外 1是 -->
35 35
     <add key="IsOutsideSchool" value="1" />
36 36
     <!--API请求地址-->
37
-    <add key="APIRequestAddress" value="https://zwwx.zzfls.com.cn:9001" />
37
+    <add key="APIRequestAddress" value="https://schoolapi.xhkjedu.com" />
38 38
     <!--文件平台请求地址-->
39
-    <add key="FileRequestAddress" value="https://zwwx.zzfls.com.cn:9002" />
39
+    <add key="FileRequestAddress" value="https://schoolfile.xhkjedu.com" />
40 40
     <!--展示文件服务器请求地址-->
41
-    <add key="SchoolfileRequestAddress" value="https://zwwx.zzfls.com.cn:9003" />
41
+    <add key="SchoolfileRequestAddress" value="https://schoolstatic.xhkjedu.com" />
42 42
     <!--认证请求地址-->
43 43
     <add key="CertapiRequestAddress" value="https://scapi.xhkjedu.com" />
44 44
     <!--摄像头位置 1.右上 2.左上 3.右下 4.左下-->

+ 1
- 6
XHWK.WKTool/App.xaml.cs Voir le fichier

@@ -321,14 +321,10 @@ namespace XHWK.WKTool
321 321
         /// </summary>
322 322
         public static VideoClipWindow W_VideoClipWindow = null;
323 323
 
324
-        /// <summary>
325
-        /// 设备检测
326
-        /// </summary>
327
-        public static DeviceWindow W_DeviceWindow = null;
328
-
329 324
         #endregion 页面
330 325
 
331 326
         #endregion 全局变量
327
+
332 328
         public APP()
333 329
         {
334 330
             Console.WriteLine("初始化APP");
@@ -642,7 +638,6 @@ namespace XHWK.WKTool
642 638
 
643 639
         #endregion 服务地址数据
644 640
 
645
- 
646 641
         #region 内存处理 -创建人:赵耀 -创建时间:2020年8月12日
647 642
 
648 643
         /// <summary>

+ 14
- 53
XHWK.WKTool/DeviceWindow.xaml Voir le fichier

@@ -6,6 +6,7 @@
6 6
     xmlns:gif="http://wpfanimatedgif.codeplex.com"
7 7
     xmlns:local="clr-namespace:XHWK.WKTool"
8 8
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9
+    xmlns:view="clr-namespace:XHWK.WKTool.View"
9 10
     Title="设备检测"
10 11
     Width="569"
11 12
     Height="367"
@@ -195,8 +196,6 @@
195 196
                                     FontSize="16"
196 197
                                     Text="摄像头" />
197 198
                             </StackPanel>
198
-
199
-
200 199
                         </Button>
201 200
                         <Button
202 201
                             x:Name="BtnSpeaker"
@@ -419,7 +418,7 @@
419 418
                     </StackPanel>
420 419
                 </Grid>
421 420
                 <Grid Grid.Row="1">
422
-                    <!--<MediaElement Source="/SkinImages/Other/Dev_AcousticWave2.gif" OpacityMask="#FF000000" HorizontalAlignment="Left" Margin="10,0,0,0" LoadedBehavior="{Binding ElementName=MediaAudio,Path=LoadedBehavior}" />-->
421
+
423 422
                     <Grid
424 423
                         Width="300"
425 424
                         Height="100"
@@ -511,6 +510,7 @@
511 510
                         DisplayMemberPath="Value"
512 511
                         FontSize="14"
513 512
                         SelectedValuePath="Key"
513
+                        SelectionChanged="CmbMicrophoneList_SelectionChanged"
514 514
                         Style="{StaticResource stlComboBox}"
515 515
                         Text="请选择" />
516 516
                 </StackPanel>
@@ -520,61 +520,22 @@
520 520
                         <RowDefinition Height="Auto" />
521 521
                         <RowDefinition Height="64" />
522 522
                     </Grid.RowDefinitions>
523
-                    <Grid
523
+                    <view:ZClippingBorder
524 524
                         x:Name="GridMicImg"
525 525
                         Width="300"
526
-                        Height="100"
526
+                        Height="20"
527 527
                         Margin="30,0,0,0"
528 528
                         HorizontalAlignment="Left"
529 529
                         VerticalAlignment="Top"
530 530
                         Background="#FFF1F2F8"
531
+                        ClipToBounds="True"
532
+                        CornerRadius="10"
531 533
                         Visibility="Visible">
532
-                        <Image
533
-                            x:Name="ImgMicAcousticWave"
534
-                            gif:ImageBehavior.AnimatedSource="/SkinImages/Other/Dev_AcousticWave2.gif"
535
-                            gif:ImageBehavior.AutoStart="True"
536
-                            gif:ImageBehavior.RepeatBehavior="Forever"
537
-                            Visibility="Hidden" />
538
-                    </Grid>
539
-
540
-                    <StackPanel
541
-                        Grid.Row="1"
542
-                        Margin="30,0,0,0"
543
-                        HorizontalAlignment="Left"
544
-                        VerticalAlignment="Center"
545
-                        Orientation="Horizontal">
546
-                        <Button
547
-                            x:Name="BtnMicrophoneDetection"
548
-                            Width="100"
549
-                            Height="30"
550
-                            Margin="0"
551
-                            HorizontalAlignment="Stretch"
552
-                            VerticalAlignment="Stretch"
553
-                            Background="#3f6fff"
554
-                            Click="BtnMicrophoneDetection_Click"
555
-                            Content="回响测试"
556
-                            Cursor="Hand"
557
-                            FontSize="15"
558
-                            Foreground="White"
559
-                            IsDefault="True" />
560
-
561
-                        <TextBlock
562
-                            x:Name="TbxMicrophoneDetection"
563
-                            Margin="10,0,0,0"
564
-                            HorizontalAlignment="Left"
565
-                            VerticalAlignment="Center"
566
-                            FontSize="16"
567
-                            Foreground="#FF000000"
568
-                            Text="待检测" />
569
-                        <MediaElement
570
-                            x:Name="MediaAudioMicPlay"
571
-                            Width="0"
572
-                            LoadedBehavior="Manual"
573
-                            MediaEnded="MediaAudioMicPlay_MediaEnded"
574
-                            Stretch="Fill"
575
-                            Visibility="Hidden"
576
-                            Volume="1" />
577
-                    </StackPanel>
534
+                        <ProgressBar
535
+                            x:Name="volumeProgressBar"
536
+                            BorderThickness="0"
537
+                            Maximum="100" />
538
+                    </view:ZClippingBorder>
578 539
                 </Grid>
579 540
 
580 541
                 <Grid Grid.Row="2">
@@ -592,7 +553,7 @@
592 553
                             VerticalAlignment="Center"
593 554
                             Background="#3f6fff"
594 555
                             Click="btn_microphone_good_Click"
595
-                            Content="可以见"
556
+                            Content="可以见"
596 557
                             Cursor="Hand"
597 558
                             FontSize="15"
598 559
                             Foreground="White"
@@ -606,7 +567,7 @@
606 567
                             VerticalAlignment="Center"
607 568
                             Background="#F1F2F3"
608 569
                             Click="btn_microphone_bad_Click"
609
-                            Content="不见"
570
+                            Content="不见"
610 571
                             Cursor="Hand"
611 572
                             FontSize="15"
612 573
                             Foreground="#333333"

+ 64
- 98
XHWK.WKTool/DeviceWindow.xaml.cs Voir le fichier

@@ -3,14 +3,13 @@ using Accord.Video.DirectShow;
3 3
 
4 4
 using Common.system;
5 5
 
6
-using NAudio.CoreAudioApi;
6
+using NAudio.Wave;
7 7
 
8 8
 using System;
9 9
 using System.Collections.Generic;
10 10
 using System.Data;
11 11
 using System.Drawing.Imaging;
12 12
 using System.IO;
13
-using System.Linq;
14 13
 using System.Threading;
15 14
 using System.Windows;
16 15
 using System.Windows.Input;
@@ -44,7 +43,6 @@ namespace XHWK.WKTool
44 43
             TxbCamera.Text = "";
45 44
             TxbSpeaker.Text = "";
46 45
             TxbMicrophone.Text = "";
47
-       
48 46
         }
49 47
 
50 48
         /// <summary>
@@ -65,6 +63,11 @@ namespace XHWK.WKTool
65 63
         private void BtnDown_Click(object sender, RoutedEventArgs e)
66 64
         {
67 65
             imgPlayer.Visibility = Visibility.Hidden;
66
+            closeCamera();
67
+            if (waveIn != null)
68
+            {
69
+                waveIn.StopRecording();
70
+            }
68 71
 
69 72
             Close();
70 73
         }
@@ -233,127 +236,79 @@ namespace XHWK.WKTool
233 236
             HidePage();
234 237
             GridMicrophone.Visibility = Visibility.Visible;
235 238
 
236
-            ImgMicAcousticWave.Visibility = Visibility.Hidden;
237
-            string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
238
-            FileToolsCommon.DeleteDirectory(AudioPath);
239
-
240
-            DataTable data = new DataTable();
241
-            List<string> MicrophoneList = APP.FFmpeg.GetMicrophoneNameList();
242
-            if (MicrophoneList.Count > 0)
239
+            ThreadPool.QueueUserWorkItem(s =>
243 240
             {
241
+                DataTable data = new DataTable();
244 242
                 data.Columns.Add("Value");
245 243
                 data.Columns.Add("Key");
246
-                for (int i = 0; i < MicrophoneList.Count; i++)
244
+                for (int n = 0; n < WaveIn.DeviceCount; n++)
247 245
                 {
246
+                    var caps = WaveIn.GetCapabilities(n);
247
+
248 248
                     //创建一行
249 249
                     DataRow row = data.NewRow();
250 250
                     //将此行添加到table中
251 251
                     data.Rows.Add(row);
252
-                    data.Rows[i]["Value"] = MicrophoneList[i];
253
-                    data.Rows[i]["Key"] = i.ToString();
252
+                    data.Rows[n]["Value"] = caps.ProductName;
253
+                    data.Rows[n]["Key"] = n + "";
254 254
                 }
255
-                CmbMicrophoneList.ItemsSource = data.DefaultView;
256
-                int CameraIndex = 0;
257
-                if (MicrophoneList.Exists(x => x == APP.MicrophoneName))
255
+                Dispatcher.Invoke(() =>
258 256
                 {
259
-                    CameraIndex = MicrophoneList.FindIndex(x => x == APP.MicrophoneName);
260
-                }
261
-                CmbMicrophoneList.SelectedIndex = CameraIndex;
262
-            }
257
+                    CmbMicrophoneList.ItemsSource = data.DefaultView;
258
+                    if (WaveIn.DeviceCount > 0)
259
+                    {
260
+                        CmbMicrophoneList.SelectedIndex = 0;
261
+                    }
262
+                });
263
+            });
263 264
         }
264 265
 
265
-        /// <summary>
266
-        /// 检测麦克风
267
-        /// </summary>
268
-        /// <param name="sender"></param>
269
-        /// <param name="e"></param>
270
-        private void BtnMicrophoneDetection_Click(object sender, RoutedEventArgs e)
266
+        private WaveInEvent waveIn = null;
267
+
268
+        private void CmbMicrophoneList_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
271 269
         {
272
-            ImgMicAcousticWave.Visibility = Visibility.Hidden;
273
-            //GridMicImg.Visibility = Visibility.Hidden;
274
-            string AudioPath = FileToolsCommon.GetFileAbsolutePath("/temp/audio/");
275
-            FileToolsCommon.CreateDirectory(AudioPath);
276
-            string audioMicrophonePath = AudioPath + "adoM" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".mp3";
277
-            TbxMicrophoneDetection.Text = "录制中...";
278
-            BtnMicrophoneDetection.Content = "正在录制";
279
-            BtnMicrophoneDetection.IsEnabled = false;
280
-            new Thread(new ThreadStart(new Action(() =>
270
+            if (waveIn != null)
281 271
             {
282
-                #region 检测麦克风
272
+                waveIn.StopRecording();
273
+            }
274
+            volumeProgressBar.Value = 0;
283 275
 
284
-                bool Record = APP.FFmpeg.StartRecordAudio(audioMicrophonePath, APP.MicrophoneName, false);
285
-                for (int i = 5; i > 0; i--)
286
-                {
287
-                    Dispatcher.Invoke(() =>
288
-                    {
289
-                        TbxMicrophoneDetection.Text = "请说话(" + i + "s)";
290
-                    });
291
-                    Thread.Sleep(1000);
292
-                }
293
-                if (Record)
276
+            if (CmbMicrophoneList.SelectedIndex >= 0)
277
+            {
278
+                waveIn = new WaveInEvent();
279
+                waveIn.DeviceNumber = CmbMicrophoneList.SelectedIndex;
280
+
281
+                //开始录音,写数据
282
+                waveIn.DataAvailable += (o, e1) =>
294 283
                 {
295
-                    if (FileToolsCommon.IsExistFile(audioMicrophonePath))
284
+                    byte[] buf = e1.Buffer;
285
+                    float maxNumber = 0;
286
+                    for (int index = 0; index < buf.Length; index += 2)
296 287
                     {
297
-                        Dispatcher.Invoke(() =>
298
-                        {
299
-                            TbxMicrophoneDetection.Text = "录制成功";
300
-
301
-                            MediaAudioMicPlay.Source = new Uri(audioMicrophonePath);
288
+                        short sample = (short)((buf[index + 1] << 8) | buf[index + 0]);
289
+                        float sample32 = sample / 32768f;
290
+                        sample32 = Math.Abs(sample32);
302 291
 
303
-                            ImgMicAcousticWave.Visibility = Visibility.Visible;
304
-                            MediaAudioMicPlay.Play();
305
-
306
-                            BtnMicrophoneDetection.Content = "回响中";
307
-                        });
308
-                    }
309
-                    else
310
-                    {
311
-                        //无法录制麦克风
312
-                        Dispatcher.Invoke(() =>
292
+                        if (sample32 > maxNumber)
313 293
                         {
314
-                            TbxMicrophoneDetection.Text = "不可用";
315
-
316
-                            FileToolsCommon.SetConfigValue("IsRecordingMicrophone", "0");
317
-                            //GridMicImg.Visibility = Visibility.Hidden;
318
-                        });
294
+                            maxNumber = sample32;
295
+                        }
319 296
                     }
320
-                }
321
-                else
322
-                {
323
-                    //无法录制麦克风
297
+
324 298
                     Dispatcher.Invoke(() =>
325 299
                     {
326
-                        TbxMicrophoneDetection.Text = "不可用";
327
-
328
-                        FileToolsCommon.SetConfigValue("IsRecordingMicrophone", "0");
329
-                        //GridMicImg.Visibility = Visibility.Hidden;
300
+                        volumeProgressBar.Value = maxNumber * 100;
330 301
                     });
331
-                }
332
-                APP.FFmpeg.StopRecordAudio(1);
333
-
334
-                #endregion 检测麦克风
302
+                };
335 303
 
336
-                Dispatcher.Invoke(() =>
304
+                //结束录音
305
+                waveIn.RecordingStopped += (s, a) =>
337 306
                 {
338
-                    BtnMicrophoneDetection.Content = "重新测试";
339
-                    BtnMicrophoneDetection.IsEnabled = true;
340
-                });
341
-            }))).Start();
342
-        }
307
+                    waveIn.Dispose();
308
+                };
343 309
 
344
-        /// <summary>
345
-        /// 播放结束
346
-        /// </summary>
347
-        /// <param name="sender"></param>
348
-        /// <param name="e"></param>
349
-        private void MediaAudioMicPlay_MediaEnded(object sender, RoutedEventArgs e)
350
-        {
351
-            MediaAudioMicPlay.Stop();
352
-            MediaAudioMicPlay.Position = TimeSpan.Zero;
353
-
354
-            ImgMicAcousticWave.Visibility = Visibility.Hidden;
355
-            BtnMicrophoneDetection.Content = "重新测试";
356
-            BtnMicrophoneDetection.IsEnabled = true;
310
+                waveIn.StartRecording();
311
+            }
357 312
         }
358 313
 
359 314
         #endregion 麦克风
@@ -443,14 +398,25 @@ namespace XHWK.WKTool
443 398
 
444 399
         private void btn_microphone_good_Click(object sender, RoutedEventArgs e)
445 400
         {
401
+            if (waveIn != null)
402
+            {
403
+                waveIn.StopRecording();
404
+            }
405
+
446 406
             microphoneGood = true;
447 407
             result_show();
408
+            CmbMicrophoneList.SelectedIndex = -1;
448 409
         }
449 410
 
450 411
         private void btn_microphone_bad_Click(object sender, RoutedEventArgs e)
451 412
         {
413
+            if (waveIn != null)
414
+            {
415
+                waveIn.StopRecording();
416
+            }
452 417
             microphoneGood = false;
453 418
             result_show();
419
+            CmbMicrophoneList.SelectedIndex = -1;
454 420
         }
455 421
 
456 422
         /// <summary>

+ 94
- 0
XHWK.WKTool/View/ZClippingBorder.cs Voir le fichier

@@ -0,0 +1,94 @@
1
+using System;
2
+using System.Windows;
3
+using System.Windows.Controls;
4
+using System.Windows.Media;
5
+
6
+namespace XHWK.WKTool.View
7
+{
8
+    public class ZClippingBorder : Border
9
+    {
10
+        private object _oldClip;
11
+
12
+        protected override void OnRender(DrawingContext dc)
13
+        {
14
+            OnApplyChildClip();
15
+            base.OnRender(dc);
16
+        }
17
+
18
+        public override UIElement Child
19
+        {
20
+            get => base.Child;
21
+            set
22
+            {
23
+                if (Child != value)
24
+                {
25
+                    if (Child != null)
26
+                    {
27
+                        Child.SetValue(ClipProperty, _oldClip);
28
+                    }
29
+
30
+                    if (value != null)
31
+                    {
32
+                        _oldClip = value.ReadLocalValue(ClipProperty);
33
+                    }
34
+                    else
35
+                    {
36
+                        // If we dont set it to null we could leak a Geometry object
37
+                        _oldClip = null;
38
+                    }
39
+
40
+                    base.Child = value;
41
+                }
42
+            }
43
+        }
44
+
45
+        protected virtual void OnApplyChildClip()
46
+        {
47
+            UIElement child = Child;
48
+            if (child != null)
49
+            {
50
+                double top = Math.Max(CornerRadius.TopLeft, CornerRadius.TopRight);
51
+                double bottom = Math.Max(CornerRadius.BottomLeft, CornerRadius.BottomRight);
52
+                double max = Math.Max(top, bottom);
53
+                Size size = RenderSize;
54
+                double width = size.Width - (BorderThickness.Left + BorderThickness.Right);
55
+                double height = size.Height - (BorderThickness.Top + BorderThickness.Bottom);
56
+                Geometry result = new RectangleGeometry(new Rect(0, 0, width, height), max, max);
57
+                double halfWidth = width / 2;
58
+                double halfHeight = height / 2;
59
+
60
+                if (CornerRadius.TopLeft == 0)
61
+                {
62
+                    result = new CombinedGeometry(
63
+                        GeometryCombineMode.Union,
64
+                        result,
65
+                        new RectangleGeometry(new Rect(0, 0, halfWidth, halfHeight))
66
+                    );
67
+                }
68
+
69
+                if (CornerRadius.TopRight == 0)
70
+                {
71
+                    result = new CombinedGeometry(GeometryCombineMode.Union, result, new RectangleGeometry
72
+                (new Rect(halfWidth, 0, halfWidth, halfHeight)));
73
+                }
74
+
75
+                if (CornerRadius.BottomLeft == 0)
76
+                {
77
+                    result = new CombinedGeometry
78
+                  (GeometryCombineMode.Union, result, new RectangleGeometry
79
+                  (new Rect(0, halfHeight, halfWidth, halfHeight)));
80
+                }
81
+                if (CornerRadius.BottomRight == 0)
82
+                {
83
+                    result = new CombinedGeometry
84
+                  (
85
+                GeometryCombineMode.Union,
86
+                result,
87
+                new RectangleGeometry(new Rect(halfWidth, halfHeight, halfWidth, halfHeight))
88
+                );
89
+                }
90
+                child.Clip = result;
91
+            }
92
+        }
93
+    }
94
+}

+ 3
- 28
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Voir le fichier

@@ -126,7 +126,6 @@ namespace XHWK.WKTool
126 126
 
127 127
         #endregion 上传
128 128
 
129
-
130 129
         /// <summary>
131 130
         /// 键盘钩子
132 131
         /// </summary>
@@ -147,7 +146,6 @@ namespace XHWK.WKTool
147 146
             new Aspose.Slides.License().SetLicense(new MemoryStream(license));
148 147
             InitializeComponent();
149 148
 
150
-
151 149
             #region 调整文字大小
152 150
 
153 151
             APP.PageContextData.WordSize20 = 20.00;
@@ -2185,7 +2183,6 @@ namespace XHWK.WKTool
2185 2183
                 GridMain.Visibility = Visibility.Visible;
2186 2184
                 GridM.IsEnabled = true;
2187 2185
                 GridRecordingTitle.Visibility = Visibility.Visible;
2188
-
2189 2186
             }
2190 2187
             else
2191 2188
             {
@@ -2193,7 +2190,6 @@ namespace XHWK.WKTool
2193 2190
                 GridMyVideo.Visibility = Visibility.Visible;
2194 2191
                 LoadUploadInitData();
2195 2192
             }
2196
-
2197 2193
         }
2198 2194
 
2199 2195
         /// <summary>
@@ -2208,7 +2204,6 @@ namespace XHWK.WKTool
2208 2204
             //加载视频列表
2209 2205
             LoadingVideoList();
2210 2206
 
2211
-
2212 2207
             Currpage = 0;
2213 2208
             PageNum = 0;
2214 2209
 
@@ -2278,9 +2273,6 @@ namespace XHWK.WKTool
2278 2273
             }
2279 2274
         }
2280 2275
 
2281
-
2282
-
2283
-
2284 2276
         /// <summary>
2285 2277
         /// 搜索集合匹配的索引
2286 2278
         /// </summary>
@@ -2561,15 +2553,10 @@ namespace XHWK.WKTool
2561 2553
         /// <param name="e"></param>
2562 2554
         private void BtnDevice_Click(object sender, RoutedEventArgs e)
2563 2555
         {
2564
-            if (APP.W_DeviceWindow == null)
2565
-            {
2566
-                APP.W_DeviceWindow = new DeviceWindow();
2567
-                APP.W_DeviceWindow.Owner = this;
2568
-            }
2569 2556
             rbnTurnOff.IsChecked = true;
2570 2557
             RbnTurnOff_Click(null, null);
2571
-            APP.W_DeviceWindow.Initialize();
2572
-            APP.W_DeviceWindow.ShowDialog();
2558
+            DeviceWindow deviceWin = new DeviceWindow();
2559
+            deviceWin.Show();
2573 2560
         }
2574 2561
 
2575 2562
         #endregion 设备检测
@@ -2583,7 +2570,6 @@ namespace XHWK.WKTool
2583 2570
         /// <param name="e"></param>
2584 2571
         private void BtnScreenRecording_Click(object sender, RoutedEventArgs e)
2585 2572
         {
2586
-
2587 2573
             ThreadPool.QueueUserWorkItem(o =>
2588 2574
             {
2589 2575
                 bool microphoneGood = ZAudioRecordHelper.IsDeviceGood(ZAudioRecordHelper.RecordType.microphone);
@@ -2605,7 +2591,6 @@ namespace XHWK.WKTool
2605 2591
 
2606 2592
                     Record();
2607 2593
 
2608
-
2609 2594
                     k_hook.Stop();
2610 2595
                     if (APP.W_ScreenRecordingToolbarWindow == null)
2611 2596
                     {
@@ -2632,9 +2617,6 @@ namespace XHWK.WKTool
2632 2617
                     Hide();
2633 2618
                 });
2634 2619
             });
2635
-
2636
-
2637
-
2638 2620
         }
2639 2621
 
2640 2622
         /// <summary>
@@ -2686,6 +2668,7 @@ namespace XHWK.WKTool
2686 2668
         /// 视频保存路径名
2687 2669
         /// </summary>
2688 2670
         private string VideoSavePathName;
2671
+
2689 2672
         /// <summary>
2690 2673
         /// 截图定时器
2691 2674
         /// </summary>
@@ -2740,7 +2723,6 @@ namespace XHWK.WKTool
2740 2723
 
2741 2724
             #endregion 防止连击
2742 2725
 
2743
-
2744 2726
             if (APP.PageContextData.currpage == 0)
2745 2727
             {
2746 2728
                 MessageWindow.Show("请先导入文档或截图!");
@@ -2749,15 +2731,12 @@ namespace XHWK.WKTool
2749 2731
 
2750 2732
             if (RecordType == 0)
2751 2733
             {
2752
-
2753 2734
                 ThreadPool.QueueUserWorkItem(o =>
2754 2735
                 {
2755
-
2756 2736
                     bool microphoneGood = ZAudioRecordHelper.IsDeviceGood(ZAudioRecordHelper.RecordType.microphone);
2757 2737
 
2758 2738
                     Dispatcher.Invoke(() =>
2759 2739
                     {
2760
-
2761 2740
                         if (!microphoneGood)
2762 2741
                         {
2763 2742
                             MessageWindow.Show("麦克风不可用");
@@ -2818,10 +2797,7 @@ namespace XHWK.WKTool
2818 2797
                             StartRecord();
2819 2798
                         }))).Start();
2820 2799
                     });
2821
-
2822 2800
                 });
2823
-
2824
-
2825 2801
             }
2826 2802
             else if (RecordType == 1)
2827 2803
             {
@@ -3023,7 +2999,6 @@ namespace XHWK.WKTool
3023 2999
         {
3024 3000
             try
3025 3001
             {
3026
-
3027 3002
                 //保存图片
3028 3003
 
3029 3004
                 try

+ 1
- 0
XHWK.WKTool/XHWK.WKTool.csproj Voir le fichier

@@ -334,6 +334,7 @@
334 334
     <Compile Include="VideoClipWindow.xaml.cs">
335 335
       <DependentUpon>VideoClipWindow.xaml</DependentUpon>
336 336
     </Compile>
337
+    <Compile Include="View\ZClippingBorder.cs" />
337 338
     <Compile Include="Welcome.xaml.cs">
338 339
       <DependentUpon>Welcome.xaml</DependentUpon>
339 340
     </Compile>

+ 7
- 6
XHWK.WKTool/system/FFMpeg.cs Voir le fichier

@@ -434,7 +434,7 @@ namespace Common.system
434 434
             ErrMessage = null;
435 435
             string Extension = FileToolsCommon.GetIOExtension(VideoSavePath);//扩展名
436 436
             Process[] KillProcessArray = Process.GetProcessesByName("ffmpeg");
437
-       
437
+
438 438
             foreach (Process KillProcess in KillProcessArray)
439 439
             {
440 440
                 KillProcess.Kill();
@@ -801,7 +801,7 @@ namespace Common.system
801 801
                 myProcess = new Process();
802 802
                 LogPath = CreateffmpegLog();
803 803
                 myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
804
-                                                                                                                 //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
804
+                                                             //myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2 -s " + thubWidth + "*" + thubHeight + " -f image2 \"" + ImagePath + "\"";
805 805
                 myProcess.StartInfo.Arguments = "-i \"" + VideoPath + "\" -ss 1 -vframes 1 -r 1 -ac 1 -ab 2" + WHStr + " -f image2 \"" + ImagePath + "\"";
806 806
 
807 807
                 if (OutputVideoLog)
@@ -920,8 +920,7 @@ namespace Common.system
920 920
             }
921 921
         }
922 922
 
923
-
924
-        public bool VideoAudioMerge(string VideoPathName, string mp3path,string VideoSavePathName, int Width, int Height)
923
+        public bool VideoAudioMerge(string VideoPathName, string mp3path, string VideoSavePathName, int Width, int Height)
925 924
         {
926 925
             while (myProcess != null)
927 926
             {
@@ -939,7 +938,7 @@ namespace Common.system
939 938
                 myProcess.StartInfo.FileName = ffmpegPath;   //ffmpeg.exe的绝对路径
940 939
 
941 940
                 string ffmpegstr = "-i " + VideoPathName + " -i " + mp3path + " -acodec copy -vcodec libx264 " + "-s " + Width + "*" + Height + " " + VideoSavePathName;
942
-                Console.WriteLine("ffmpegstr:"+ ffmpegstr);
941
+                Console.WriteLine("ffmpegstr:" + ffmpegstr);
943 942
                 myProcess.StartInfo.Arguments = ffmpegstr;
944 943
 
945 944
                 if (OutputVideoLog)
@@ -1351,7 +1350,6 @@ namespace Common.system
1351 1350
             return devices;
1352 1351
         }
1353 1352
 
1354
- 
1355 1353
         #endregion 获取麦克风
1356 1354
 
1357 1355
         #region 录音
@@ -1447,6 +1445,9 @@ namespace Common.system
1447 1445
                 waveIn.DataAvailable += (s, a) =>
1448 1446
                 {
1449 1447
                     writer.Write(a.Buffer, 0, a.BytesRecorded);
1448
+                    short s1 = BitConverter.ToInt16(a.Buffer, 0);//这样采样比较少,反正是int16型的
1449
+                    int s2 = Math.Abs(s1 / 50);
1450
+                    Console.WriteLine("声音大小:" + s2);
1450 1451
                 };
1451 1452
 
1452 1453
                 //结束录音

+ 1
- 1
打包脚本/Inno Setup星火微课.iss Voir le fichier

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

Chargement…
Annuler
Enregistrer