git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorBellai Ádám <USER\adam.bellai>
Mon, 13 Nov 2017 09:55:56 +0000 (09:55 +0000)
committerBellai Ádám <USER\adam.bellai>
Mon, 13 Nov 2017 09:55:56 +0000 (09:55 +0000)
client/AudioRecorder/MainForm.cs
client/AudioRecorder/WavRecorder.cs

index 77535103ef328cd02e91fdad61cd5fd847a77d57..9bcda0ffa22e94d2984b43c0d750b57b366190ed 100644 (file)
@@ -8,6 +8,8 @@ using System.IO;
 \r
 namespace AudioRecorder\r
 {\r
+    public delegate void RefreshPanelDelegate();\r
+\r
     public partial class MainForm : Form, IMainForm\r
     {\r
 \r
@@ -29,6 +31,7 @@ namespace AudioRecorder
         private MMDevice currentDevice;\r
         private bool pausing;\r
         private float volumeHeight;\r
+        private RefreshPanelDelegate refreshPanel;\r
 \r
         public MainForm()\r
         {\r
@@ -117,6 +120,15 @@ namespace AudioRecorder
             volumeHeight = height;\r
             //volumePanel.Invalidate();\r
             //volumePanel.Update();\r
+            if (volumePanel.InvokeRequired) {\r
+                refreshPanel = RefreshVolumePanel;\r
+                this.Invoke(refreshPanel);\r
+            } else {\r
+                volumePanel.Refresh();\r
+            }\r
+        }\r
+\r
+        private void RefreshVolumePanel() {\r
             volumePanel.Refresh();\r
         }\r
 \r
@@ -233,7 +245,7 @@ namespace AudioRecorder
             this.currentFileName = currentFileName;\r
             currentFilePath = String.Format("{0}\\{1}", path, currentFileName);\r
             while (File.Exists(this.currentFilePath)) {\r
-                this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("_{0}", i)) : currentFileName;\r
+                this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("-{0}", i)) : currentFileName;\r
                 currentFilePath = String.Format("{0}\\{1}", path, this.currentFileName);\r
                 i++;\r
             }\r
@@ -313,7 +325,7 @@ namespace AudioRecorder
         {\r
             Process process = new Process();\r
             ProcessStartInfo startInfo = new ProcessStartInfo();\r
-            startInfo.FileName = new FileInfo(currentFileName).FullName;\r
+            startInfo.FileName = new FileInfo(currentFilePath).FullName;\r
             process.StartInfo = startInfo;\r
             process.Start();\r
         }\r
index b4a3a3a24b838f20f26a05897b4366f0272ad726..7fd38ca2eb692f0d9cbdbeb84b93f30fd3413f84 100644 (file)
@@ -57,8 +57,9 @@ namespace AudioRecorder {
                 waveWriter.Write(e.Buffer, 0, e.BytesRecorded);\r
                 waveWriter.Flush();\r
                 try {\r
-                    float panelHeight = (device.AudioMeterInformation.MasterPeakValue + device.AudioSessionManager.SimpleAudioVolume.Volume) * 100;\r
-                    mainForm.setPanelSizeHeight(panelHeight);\r
+                    //float panelHeight = device.AudioEndpointVolume.MasterVolumeLevelScalar * 100;//(device.AudioMeterInformation.MasterPeakValue + device.AudioSessionManager.SimpleAudioVolume.Volume) * 100;\r
+                    //Debug.WriteLine(string.Format("panelHeight {0}", panelHeight) );\r
+                    //mainForm.setPanelSizeHeight(panelHeight);\r
                 }\r
                 catch (Exception ex) {\r
                     Debug.WriteLine(ex.Message);\r