Move static GlobalWin.Sound to static Sound.Instance, mirroring Input
This commit is contained in:
parent
c3a7ec047f
commit
bf968acd57
|
@ -150,14 +150,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public static DialogResult ShowHawkDialog(this Form form, IWin32Window owner = null, Point position = default)
|
||||
{
|
||||
GlobalWin.Sound.StopSound();
|
||||
Sound.Instance.StopSound();
|
||||
if (position != default)
|
||||
{
|
||||
form.StartPosition = FormStartPosition.Manual;
|
||||
form.Location = position;
|
||||
}
|
||||
var result = (owner == null ? form.ShowDialog(new Form { TopMost = true }) : form.ShowDialog(owner));
|
||||
GlobalWin.Sound.StartSound();
|
||||
Sound.Instance.StartSound();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -166,13 +166,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public static DialogResult ShowHawkDialog(this CommonDialog form, IWin32Window owner)
|
||||
{
|
||||
GlobalWin.Sound.StopSound();
|
||||
Sound.Instance.StopSound();
|
||||
DialogResult result;
|
||||
if(owner != null)
|
||||
result = form.ShowDialog(owner);
|
||||
else
|
||||
result = form.ShowDialog();
|
||||
GlobalWin.Sound.StartSound();
|
||||
Sound.Instance.StartSound();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
// ReSharper disable StyleCop.SA1401
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public static class GlobalWin
|
||||
{
|
||||
public static Sound Sound;
|
||||
}
|
||||
}
|
|
@ -416,7 +416,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
InputManager.AutofireStickyXorAdapter.SetOnOffPatternFromConfig(Config.AutofireOn, Config.AutofireOff);
|
||||
try
|
||||
{
|
||||
GlobalWin.Sound = new Sound(Handle, Config, Emulator.VsyncRate);
|
||||
Sound = new Sound(Handle, Config, Emulator.VsyncRate);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -429,7 +429,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
MessageBox.Show(message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
|
||||
Config.SoundOutputMethod = ESoundOutputMethod.Dummy;
|
||||
GlobalWin.Sound = new Sound(Handle, Config, Emulator.VsyncRate);
|
||||
Sound = new Sound(Handle, Config, Emulator.VsyncRate);
|
||||
}
|
||||
|
||||
Sound.StartSound();
|
||||
|
@ -880,8 +880,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private Sound Sound
|
||||
{
|
||||
get => GlobalWin.Sound;
|
||||
set => GlobalWin.Sound = value;
|
||||
get => Sound.Instance;
|
||||
set => Sound.Instance = value;
|
||||
}
|
||||
|
||||
public CheatCollection CheatList { get; }
|
||||
|
|
|
@ -252,8 +252,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
finally
|
||||
{
|
||||
GlobalWin.Sound?.Dispose();
|
||||
GlobalWin.Sound = null;
|
||||
Sound.Instance?.Dispose();
|
||||
Sound.Instance = null;
|
||||
workingGL.Dispose();
|
||||
Input.Instance?.Adapter?.DeInitAll();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <remarks>TODO rename to <c>HostAudioManager</c></remarks>
|
||||
public class Sound : IHostAudioManager, IDisposable
|
||||
{
|
||||
public static Sound Instance;
|
||||
|
||||
public int SampleRate { get; } = 44100;
|
||||
|
||||
public int BytesPerSample { get; } = 2;
|
||||
|
|
Loading…
Reference in New Issue