From: Bellai Ádám Date: Mon, 13 Nov 2017 09:55:56 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=c5ed93b3f2870e9198df419b4ffa606d2b1bb87a;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30717 --- diff --git a/client/AudioRecorder/MainForm.cs b/client/AudioRecorder/MainForm.cs index 77535103..9bcda0ff 100644 --- a/client/AudioRecorder/MainForm.cs +++ b/client/AudioRecorder/MainForm.cs @@ -8,6 +8,8 @@ using System.IO; namespace AudioRecorder { + public delegate void RefreshPanelDelegate(); + public partial class MainForm : Form, IMainForm { @@ -29,6 +31,7 @@ namespace AudioRecorder private MMDevice currentDevice; private bool pausing; private float volumeHeight; + private RefreshPanelDelegate refreshPanel; public MainForm() { @@ -117,6 +120,15 @@ namespace AudioRecorder volumeHeight = height; //volumePanel.Invalidate(); //volumePanel.Update(); + if (volumePanel.InvokeRequired) { + refreshPanel = RefreshVolumePanel; + this.Invoke(refreshPanel); + } else { + volumePanel.Refresh(); + } + } + + private void RefreshVolumePanel() { volumePanel.Refresh(); } @@ -233,7 +245,7 @@ namespace AudioRecorder this.currentFileName = currentFileName; currentFilePath = String.Format("{0}\\{1}", path, currentFileName); while (File.Exists(this.currentFilePath)) { - this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("_{0}", i)) : currentFileName; + this.currentFileName = File.Exists(filePath) ? currentFileName.Insert(currentFileName.IndexOf("."), String.Format("-{0}", i)) : currentFileName; currentFilePath = String.Format("{0}\\{1}", path, this.currentFileName); i++; } @@ -313,7 +325,7 @@ namespace AudioRecorder { Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = new FileInfo(currentFileName).FullName; + startInfo.FileName = new FileInfo(currentFilePath).FullName; process.StartInfo = startInfo; process.Start(); } diff --git a/client/AudioRecorder/WavRecorder.cs b/client/AudioRecorder/WavRecorder.cs index b4a3a3a2..7fd38ca2 100644 --- a/client/AudioRecorder/WavRecorder.cs +++ b/client/AudioRecorder/WavRecorder.cs @@ -57,8 +57,9 @@ namespace AudioRecorder { waveWriter.Write(e.Buffer, 0, e.BytesRecorded); waveWriter.Flush(); try { - float panelHeight = (device.AudioMeterInformation.MasterPeakValue + device.AudioSessionManager.SimpleAudioVolume.Volume) * 100; - mainForm.setPanelSizeHeight(panelHeight); + //float panelHeight = device.AudioEndpointVolume.MasterVolumeLevelScalar * 100;//(device.AudioMeterInformation.MasterPeakValue + device.AudioSessionManager.SimpleAudioVolume.Volume) * 100; + //Debug.WriteLine(string.Format("panelHeight {0}", panelHeight) ); + //mainForm.setPanelSizeHeight(panelHeight); } catch (Exception ex) { Debug.WriteLine(ex.Message);