diff --git a/ISCamRecorder/MainForm.cs b/ISCamRecorder/MainForm.cs index 7603c10..4401c26 100644 --- a/ISCamRecorder/MainForm.cs +++ b/ISCamRecorder/MainForm.cs @@ -47,6 +47,7 @@ Task _CvCameraThread; // opencvカメラスレッド Task _RecodingThread; // 録画スレッド SubjectList _SubjectList; // 非測定者一覧フォーム + List _Sounds = new List (); public Setting Setting { get; private set; } // 設定ダイアログ public Chart SensorChart { get { return chart1; } } // 外部からのアクセス用 @@ -66,6 +67,12 @@ _CvCamera = new CvCamera(this); _SubjectList = new SubjectList(); Setting = new Setting(); + _Sounds.Add(new SoundPlayer(@"StartRecoding.wav")); + _Sounds.Add(new SoundPlayer(@"StopRecoding.wav")); + _Sounds.Add(new SoundPlayer(@"EndSaving.wav")); + _Sounds.Add(new SoundPlayer(@"ReverseBlood.wav")); + _Sounds.Add(new SoundPlayer(@"SnapShot.wav")); + _Sounds.ForEach(s => { s.Load(); }); } /// @@ -168,7 +175,7 @@ case STATE.Init: LblState.Text = "初期化中"; PnlState.BackColor = Color.LightBlue; - BtnRecodeMovie.Text = "録画"; + BtnRecodeMovie.Text = $"{ButtonSymbol(Setting.ACTION.movie)}録画"; BtnRecodeMovie.Enabled = false; BtnSnapImage.Enabled = false; BtnSetProperty.Enabled = true; @@ -180,7 +187,7 @@ case STATE.Idle: LblState.Text = "待機中"; PnlState.BackColor = Color.MediumSpringGreen; - BtnRecodeMovie.Text = "録画"; + BtnRecodeMovie.Text = $"{ButtonSymbol(Setting.ACTION.movie)}録画"; BtnRecodeMovie.Enabled = true; BtnSnapImage.Enabled = true; BtnSetProperty.Enabled = true; @@ -192,7 +199,7 @@ case STATE.Recoding: LblState.Text = "録画中"; PnlState.BackColor = Color.OrangeRed; - BtnRecodeMovie.Text = "停止"; + BtnRecodeMovie.Text = $"{ButtonSymbol(Setting.ACTION.movie)}停止"; BtnRecodeMovie.Enabled = true; BtnSnapImage.Enabled = false; BtnSetProperty.Enabled = false; @@ -204,7 +211,7 @@ case STATE.Saving: LblState.Text = "保存中"; PnlState.BackColor = Color.Goldenrod; - BtnRecodeMovie.Text = "停止"; + BtnRecodeMovie.Text = $"{ButtonSymbol(Setting.ACTION.movie)}停止"; BtnRecodeMovie.Enabled = false; BtnSnapImage.Enabled = false; BtnSetProperty.Enabled = false; @@ -229,6 +236,8 @@ Setting.ShowDialog(); + this.UpdateStateLabel(); + BtnSnapImage.Text = $"{ButtonSymbol(Setting.ACTION.image)}撮影"; if (Setting.SWTrigger != lastTriggerSetting) { _Cameras.ForEach(c => c.SetTriggerMode(Setting.SWTrigger)); } @@ -292,8 +301,7 @@ private void RecodingThread() { // 録画開始サウンド - var player = new SoundPlayer(@"start.wav"); - player.Play(); + _Sounds[0].Play(); // 録画モードへ変更 this.Invoke((MethodInvoker)delegate { @@ -315,8 +323,7 @@ Task.WaitAll(tasks); // 保存準備 - player = new SoundPlayer(@"end.wav"); - player.Play(); + _Sounds[1].Play(); this.Invoke((MethodInvoker)delegate { State = STATE.Saving; this.UpdateStateLabel(); @@ -338,6 +345,7 @@ State = STATE.Idle; this.UpdateStateLabel(); }); + _Sounds[2].Play(); } /// @@ -346,9 +354,7 @@ private void SnapImage() { if (State != STATE.Idle) return; - var player = new SoundPlayer(@"snap.wav"); - player.Play(); - + _Sounds[4].Play(); var outDir = Path.Combine(Setting.SaveDir, "image"); Directory.CreateDirectory(outDir); this.Invoke((MethodInvoker)delegate { @@ -451,5 +457,15 @@ TxtSubjectName.Text = _SubjectList.Previous(TxtSubjectName.Text); TxtCounter.Text = "1"; } + + /// + /// スイッチ連動の表示ラベル + /// + /// + /// + private string ButtonSymbol(Setting.ACTION action) { + return Setting.ButtonAction == action ? "● " : ""; + + } } } diff --git a/ISCamRecorder/media/EndSaving.wav b/ISCamRecorder/media/EndSaving.wav new file mode 100644 index 0000000..55fd3f3 --- /dev/null +++ b/ISCamRecorder/media/EndSaving.wav Binary files differ diff --git a/ISCamRecorder/media/ReverseBlood.wav b/ISCamRecorder/media/ReverseBlood.wav new file mode 100644 index 0000000..7edfcc0 --- /dev/null +++ b/ISCamRecorder/media/ReverseBlood.wav Binary files differ diff --git a/ISCamRecorder/media/SnapShot.wav b/ISCamRecorder/media/SnapShot.wav new file mode 100644 index 0000000..5448f8d --- /dev/null +++ b/ISCamRecorder/media/SnapShot.wav Binary files differ diff --git a/ISCamRecorder/media/StartRecoding.wav b/ISCamRecorder/media/StartRecoding.wav new file mode 100644 index 0000000..26e8d05 --- /dev/null +++ b/ISCamRecorder/media/StartRecoding.wav Binary files differ diff --git a/ISCamRecorder/media/StopRecoding.wav b/ISCamRecorder/media/StopRecoding.wav new file mode 100644 index 0000000..a5160f0 --- /dev/null +++ b/ISCamRecorder/media/StopRecoding.wav Binary files differ diff --git a/ISCamRecorder/media/end.wav b/ISCamRecorder/media/end.wav deleted file mode 100644 index a5160f0..0000000 --- a/ISCamRecorder/media/end.wav +++ /dev/null Binary files differ diff --git a/ISCamRecorder/media/snap.wav b/ISCamRecorder/media/snap.wav deleted file mode 100644 index 5448f8d..0000000 --- a/ISCamRecorder/media/snap.wav +++ /dev/null Binary files differ diff --git a/ISCamRecorder/media/start.wav b/ISCamRecorder/media/start.wav deleted file mode 100644 index 26e8d05..0000000 --- a/ISCamRecorder/media/start.wav +++ /dev/null Binary files differ