Cleanup Sound ctor

This commit is contained in:
YoshiRulz 2020-06-07 18:06:35 +10:00
parent 0326bf63d3
commit 347ed0d404
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 15 additions and 17 deletions

View File

@ -22,25 +22,23 @@ namespace BizHawk.Client.EmuHawk
public Sound(IntPtr mainWindowHandle) public Sound(IntPtr mainWindowHandle)
{ {
if (GlobalWin.Config.SoundOutputMethod != ESoundOutputMethod.Dummy) if (OSTailoredCode.IsUnixHost)
{ {
if (OSTailoredCode.IsUnixHost) // if DirectSound or XAudio is chosen, use OpenAL, otherwise comply with the user's choice
{ _outputDevice = GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.Dummy
// at the moment unix/mono can only support OpenAL (so ignore whatever is set in the config) ? (ISoundOutput) new DummySoundOutput(this)
_outputDevice = new OpenALSoundOutput(this); : new OpenALSoundOutput(this);
} }
else else
{ {
if (GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.OpenAL) _outputDevice = GlobalWin.Config.SoundOutputMethod switch
_outputDevice = new OpenALSoundOutput(this); {
if (GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.DirectSound) ESoundOutputMethod.DirectSound => new DirectSoundSoundOutput(this, mainWindowHandle, GlobalWin.Config.SoundDevice),
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle, GlobalWin.Config.SoundDevice); ESoundOutputMethod.XAudio2 => new XAudio2SoundOutput(this),
if (GlobalWin.Config.SoundOutputMethod == ESoundOutputMethod.XAudio2) ESoundOutputMethod.OpenAL => new OpenALSoundOutput(this),
_outputDevice = new XAudio2SoundOutput(this); _ => new DummySoundOutput(this)
} };
} }
if (_outputDevice == null)
_outputDevice = new DummySoundOutput(this);
} }
/// <summary> /// <summary>