Sounds.cs - pass in some dependencies instead of using GlobalWIn
This commit is contained in:
parent
bae75157f2
commit
750e1d8980
|
@ -919,7 +919,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (form.ApplyNewSoundDevice)
|
if (form.ApplyNewSoundDevice)
|
||||||
{
|
{
|
||||||
Sound.Dispose();
|
Sound.Dispose();
|
||||||
Sound = new Sound(Handle);
|
Sound = new Sound(Handle, Config.SoundOutputMethod, Config.SoundDevice);
|
||||||
Sound.StartSound();
|
Sound.StartSound();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -413,7 +413,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InputManager.AutofireStickyXorAdapter.SetOnOffPatternFromConfig(Config.AutofireOn, Config.AutofireOff);
|
InputManager.AutofireStickyXorAdapter.SetOnOffPatternFromConfig(Config.AutofireOn, Config.AutofireOff);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GlobalWin.Sound = new Sound(Handle);
|
GlobalWin.Sound = new Sound(Handle, Config.SoundOutputMethod, Config.SoundDevice);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -426,7 +426,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
MessageBox.Show(message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(message, "Initialization Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
|
||||||
Config.SoundOutputMethod = ESoundOutputMethod.Dummy;
|
Config.SoundOutputMethod = ESoundOutputMethod.Dummy;
|
||||||
GlobalWin.Sound = new Sound(Handle);
|
GlobalWin.Sound = new Sound(Handle, Config.SoundOutputMethod, Config.SoundDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sound.StartSound();
|
Sound.StartSound();
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public int ConfigBufferSizeMs => GlobalWin.Config.SoundBufferSizeMs;
|
public int ConfigBufferSizeMs => GlobalWin.Config.SoundBufferSizeMs;
|
||||||
|
|
||||||
public Sound(IntPtr mainWindowHandle)
|
public Sound(IntPtr mainWindowHandle, ESoundOutputMethod soundOutputMethod, string soundDevice)
|
||||||
{
|
{
|
||||||
BlockAlign = BytesPerSample * ChannelCount;
|
BlockAlign = BytesPerSample * ChannelCount;
|
||||||
|
|
||||||
|
@ -36,15 +36,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// if DirectSound or XAudio is chosen, use OpenAL, otherwise comply with the user's choice
|
// if DirectSound or XAudio is chosen, use OpenAL, otherwise comply with the user's choice
|
||||||
_outputDevice = GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.Dummy
|
_outputDevice = GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.Dummy
|
||||||
? (ISoundOutput) new DummySoundOutput(this)
|
? (ISoundOutput) new DummySoundOutput(this)
|
||||||
: new OpenALSoundOutput(this, GlobalWin.Config.SoundDevice);
|
: new OpenALSoundOutput(this, soundDevice);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_outputDevice = GlobalWin.Config.SoundOutputMethod switch
|
_outputDevice = soundOutputMethod switch
|
||||||
{
|
{
|
||||||
ESoundOutputMethod.DirectSound => new DirectSoundSoundOutput(this, mainWindowHandle, GlobalWin.Config.SoundDevice),
|
ESoundOutputMethod.DirectSound => new DirectSoundSoundOutput(this, mainWindowHandle, soundDevice),
|
||||||
ESoundOutputMethod.XAudio2 => new XAudio2SoundOutput(this, GlobalWin.Config.SoundDevice),
|
ESoundOutputMethod.XAudio2 => new XAudio2SoundOutput(this, soundDevice),
|
||||||
ESoundOutputMethod.OpenAL => new OpenALSoundOutput(this, GlobalWin.Config.SoundDevice),
|
ESoundOutputMethod.OpenAL => new OpenALSoundOutput(this, soundDevice),
|
||||||
_ => new DummySoundOutput(this)
|
_ => new DummySoundOutput(this)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue