some cleanup

This commit is contained in:
adelikat 2020-01-03 14:36:13 -06:00
parent ee84c92ada
commit 9ab62d8cd3
2 changed files with 5 additions and 8 deletions

View File

@ -12,8 +12,8 @@ namespace BizHawk.Client.EmuHawk
{
public class DirectSoundSoundOutput : ISoundOutput
{
private readonly Sound _sound;
private bool _disposed;
private Sound _sound;
private DirectSound _device;
private SecondarySoundBuffer _deviceBuffer;
private int _actualWriteOffsetBytes = -1;
@ -21,11 +21,11 @@ namespace BizHawk.Client.EmuHawk
private long _lastWriteTime;
private int _lastWriteCursor;
public DirectSoundSoundOutput(Sound sound, IntPtr mainWindowHandle)
public DirectSoundSoundOutput(Sound sound, IntPtr mainWindowHandle, string soundDevice)
{
_sound = sound;
var deviceInfo = DirectSound.GetDevices().FirstOrDefault(d => d.Description == Global.Config.SoundDevice);
var deviceInfo = DirectSound.GetDevices().FirstOrDefault(d => d.Description == soundDevice);
_device = deviceInfo != null ? new DirectSound(deviceInfo.DriverGuid) : new DirectSound();
_device.SetCooperativeLevel(mainWindowHandle, CooperativeLevel.Priority);
}
@ -47,10 +47,7 @@ namespace BizHawk.Client.EmuHawk
private int BufferSizeSamples { get; set; }
private int BufferSizeBytes
{
get { return BufferSizeSamples * Sound.BlockAlign; }
}
private int BufferSizeBytes => BufferSizeSamples * Sound.BlockAlign;
public int MaxSamplesDeficit { get; private set; }

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL)
_outputDevice = new OpenALSoundOutput(this);
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound)
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle);
_outputDevice = new DirectSoundSoundOutput(this, mainWindowHandle, Global.Config.SoundDevice);
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.XAudio2)
_outputDevice = new XAudio2SoundOutput(this);
}