diff --git a/src/BizHawk.Client.Common/config/MovieConfig.cs b/src/BizHawk.Client.Common/config/MovieConfig.cs index c40b0d35fa..0fa61f325c 100644 --- a/src/BizHawk.Client.Common/config/MovieConfig.cs +++ b/src/BizHawk.Client.Common/config/MovieConfig.cs @@ -7,6 +7,7 @@ public bool MoviesOnDisk { get; } public int MovieCompressionLevel { get; } public bool VBAStyleMovieLoadState { get; } + public bool PlaySoundOnMovieEnd { get; set; } ZwinderStateManagerSettings DefaultTasStateManagerSettings { get; } } @@ -17,6 +18,7 @@ public bool MoviesOnDisk { get; set; } public int MovieCompressionLevel { get; set; } = 2; public bool VBAStyleMovieLoadState { get; set; } + public bool PlaySoundOnMovieEnd { get; set; } public ZwinderStateManagerSettings DefaultTasStateManagerSettings { get; set; } = new ZwinderStateManagerSettings(); } diff --git a/src/BizHawk.Client.Common/movie/MovieSession.cs b/src/BizHawk.Client.Common/movie/MovieSession.cs index 79680e62a2..544bcd0cd9 100644 --- a/src/BizHawk.Client.Common/movie/MovieSession.cs +++ b/src/BizHawk.Client.Common/movie/MovieSession.cs @@ -16,6 +16,7 @@ namespace BizHawk.Client.Common private readonly Action _pauseCallback; private readonly Action _modeChangedCallback; + private readonly Action _movieEndSound; private IMovie _queuedMovie; @@ -24,7 +25,8 @@ namespace BizHawk.Client.Common string backDirectory, IDialogParent dialogParent, Action pauseCallback, - Action modeChangedCallback) + Action modeChangedCallback, + Action movieEndSound = null) { Settings = settings; BackupDirectory = backDirectory; @@ -33,6 +35,7 @@ namespace BizHawk.Client.Common ?? throw new ArgumentNullException(paramName: nameof(pauseCallback)); _modeChangedCallback = modeChangedCallback ?? throw new ArgumentNullException(paramName: nameof(modeChangedCallback)); + _movieEndSound = movieEndSound; } public IMovieConfig Settings { get; } @@ -396,6 +399,9 @@ namespace BizHawk.Client.Common break; } + if (Settings.MovieEndAction is not MovieEndAction.Record && Settings.PlaySoundOnMovieEnd) + _movieEndSound?.Invoke(); + _modeChangedCallback(); } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs index 83c877d3f8..ee3fdabce0 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -84,10 +84,11 @@ namespace BizHawk.Client.EmuHawk this.PlayMovieMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.StopMovieMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.PlayFromBeginningMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); - this.ImportMoviesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.SaveMovieMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.SaveMovieAsMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.StopMovieWithoutSavingMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); + this.toolStripSeparator25 = new System.Windows.Forms.ToolStripSeparator(); + this.ImportMoviesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.toolStripSeparator14 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx(); this.AutomaticallyBackupMoviesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.FullMovieLoadstatesMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); @@ -96,6 +97,8 @@ namespace BizHawk.Client.EmuHawk this.MovieEndRecordMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.MovieEndStopMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.MovieEndPauseMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); + this.toolStripSeparator32 = new System.Windows.Forms.ToolStripSeparator(); + this.MovieEndPlaySoundMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AVSubMenu = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.RecordAVMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.ConfigAndRecordAVMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); @@ -375,7 +378,6 @@ namespace BizHawk.Client.EmuHawk this.ShowMenuContextMenuSeparator = new BizHawk.WinForms.Controls.ToolStripSeparatorEx(); this.ShowMenuContextMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.timerMouseIdle = new System.Windows.Forms.Timer(this.components); - this.toolStripSeparator25 = new System.Windows.Forms.ToolStripSeparator(); this.MainformMenu.SuspendLayout(); this.MainStatusBar.SuspendLayout(); this.MainFormContextMenu.SuspendLayout(); @@ -771,11 +773,6 @@ namespace BizHawk.Client.EmuHawk this.PlayFromBeginningMenuItem.Text = "Play from Beginning"; this.PlayFromBeginningMenuItem.Click += new System.EventHandler(this.PlayFromBeginningMenuItem_Click); // - // ImportMoviesMenuItem - // - this.ImportMoviesMenuItem.Text = "Import Movies..."; - this.ImportMoviesMenuItem.Click += new System.EventHandler(this.ImportMovieMenuItem_Click); - // // SaveMovieMenuItem // this.SaveMovieMenuItem.Text = "&Save Movie"; @@ -791,6 +788,16 @@ namespace BizHawk.Client.EmuHawk this.StopMovieWithoutSavingMenuItem.Text = "Stop Movie without Saving"; this.StopMovieWithoutSavingMenuItem.Click += new System.EventHandler(this.StopMovieWithoutSavingMenuItem_Click); // + // toolStripSeparator25 + // + this.toolStripSeparator25.Name = "toolStripSeparator25"; + this.toolStripSeparator25.Size = new System.Drawing.Size(228, 6); + // + // ImportMoviesMenuItem + // + this.ImportMoviesMenuItem.Text = "Import Movies..."; + this.ImportMoviesMenuItem.Click += new System.EventHandler(this.ImportMovieMenuItem_Click); + // // AutomaticallyBackupMoviesMenuItem // this.AutomaticallyBackupMoviesMenuItem.Text = "Automatically Backup Movies"; @@ -807,7 +814,9 @@ namespace BizHawk.Client.EmuHawk this.MovieEndFinishMenuItem, this.MovieEndRecordMenuItem, this.MovieEndStopMenuItem, - this.MovieEndPauseMenuItem}); + this.MovieEndPauseMenuItem, + this.toolStripSeparator32, + this.MovieEndPlaySoundMenuItem}); this.MovieEndSubMenu.Text = "On Movie End"; this.MovieEndSubMenu.DropDownOpened += new System.EventHandler(this.MovieEndSubMenu_DropDownOpened); // @@ -831,6 +840,18 @@ namespace BizHawk.Client.EmuHawk this.MovieEndPauseMenuItem.Text = "Pause"; this.MovieEndPauseMenuItem.Click += new System.EventHandler(this.MovieEndPauseMenuItem_Click); // + // toolStripSeparator32 + // + this.toolStripSeparator32.Name = "toolStripSeparator32"; + this.toolStripSeparator32.Size = new System.Drawing.Size(177, 6); + // + // MovieEndPlaySoundMenuItem + // + this.MovieEndPlaySoundMenuItem.Name = "MovieEndPlaySoundMenuItem"; + this.MovieEndPlaySoundMenuItem.Size = new System.Drawing.Size(180, 22); + this.MovieEndPlaySoundMenuItem.Text = "Play sound"; + this.MovieEndPlaySoundMenuItem.Click += new System.EventHandler(this.MovieEndPlaySoundMenuItem_Click); + // // AVSubMenu // this.AVSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -869,7 +890,7 @@ namespace BizHawk.Client.EmuHawk // this.CaptureLuaMenuItem.CheckOnClick = true; this.CaptureLuaMenuItem.Name = "CaptureLuaMenuItem"; - this.CaptureLuaMenuItem.Size = new System.Drawing.Size(232, 22); + this.CaptureLuaMenuItem.Size = new System.Drawing.Size(205, 22); this.CaptureLuaMenuItem.Text = "Capture Lua"; this.CaptureLuaMenuItem.Click += new System.EventHandler(this.CaptureLuaMenuItem_Click); // @@ -986,7 +1007,7 @@ namespace BizHawk.Client.EmuHawk this.WindowSizeSubMenu.Text = "&Window Size"; this.WindowSizeSubMenu.DropDownOpened += new System.EventHandler(this.WindowSizeSubMenu_DropDownOpened); // - // ResizeWithFramebufferMenuItem + // DisableResizeWithFramebufferMenuItem // this.DisableResizeWithFramebufferMenuItem.CheckOnClick = true; this.DisableResizeWithFramebufferMenuItem.Text = "&Static Size"; @@ -2389,11 +2410,6 @@ namespace BizHawk.Client.EmuHawk this.timerMouseIdle.Interval = 2000; this.timerMouseIdle.Tick += new System.EventHandler(this.TimerMouseIdle_Tick); // - // toolStripSeparator25 - // - this.toolStripSeparator25.Name = "toolStripSeparator25"; - this.toolStripSeparator25.Size = new System.Drawing.Size(228, 6); - // // MainForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -2779,5 +2795,7 @@ namespace BizHawk.Client.EmuHawk private System.Windows.Forms.ToolStripSeparator toolStripSeparator25; private ToolStripMenuItemEx DisableResizeWithFramebufferMenuItem; private ToolStripSeparatorEx toolStripSeparator26; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator32; + private System.Windows.Forms.ToolStripMenuItem MovieEndPlaySoundMenuItem; } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 1a00062559..d1501cca31 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -183,6 +183,7 @@ namespace BizHawk.Client.EmuHawk MovieEndRecordMenuItem.Checked = Config.Movies.MovieEndAction == MovieEndAction.Record; MovieEndStopMenuItem.Checked = Config.Movies.MovieEndAction == MovieEndAction.Stop; MovieEndPauseMenuItem.Checked = Config.Movies.MovieEndAction == MovieEndAction.Pause; + MovieEndPlaySoundMenuItem.Checked = Config.Movies.PlaySoundOnMovieEnd; } private void AVSubMenu_DropDownOpened(object sender, EventArgs e) @@ -1625,5 +1626,12 @@ namespace BizHawk.Client.EmuHawk private void FormDragDrop(object sender, DragEventArgs e) => PathsFromDragDrop = (string[]) e.Data.GetData(DataFormats.FileDrop); + + private void MovieEndPlaySoundMenuItem_Click(object sender, EventArgs e) + { + MovieEndPlaySoundMenuItem.Checked = !MovieEndPlaySoundMenuItem.Checked; + + Config.Movies.PlaySoundOnMovieEnd = MovieEndPlaySoundMenuItem.Checked; + } } } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index c3f025e706..76950ed7bd 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -444,7 +444,8 @@ namespace BizHawk.Client.EmuHawk Config.PathEntries.MovieBackupsAbsolutePath(), this, PauseEmulator, - SetMainformMovieInfo); + SetMainformMovieInfo, + () => Sound.PlayWavFile(Properties.Resources.GetNotHawkCallSFX(), Config.SoundVolume / 100f)); void MainForm_MouseClick(object sender, MouseEventArgs e) {