OpenAL sound device configuration.
This commit is contained in:
parent
730694644d
commit
8f32899afd
|
@ -22,7 +22,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public OpenALSoundOutput(Sound sound)
|
||||
{
|
||||
_sound = sound;
|
||||
_context = new AudioContext();
|
||||
string deviceName = GetDeviceNames().FirstOrDefault(n => n == Global.Config.SoundDevice);
|
||||
_context = new AudioContext(deviceName, Sound.SampleRate);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -35,6 +36,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
_disposed = true;
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetDeviceNames()
|
||||
{
|
||||
if (!Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT")) return Enumerable.Empty<string>();
|
||||
return Alc.GetString(IntPtr.Zero, AlcGetStringList.AllDevicesSpecifier);
|
||||
}
|
||||
|
||||
private int BufferSizeSamples { get; set; }
|
||||
|
||||
public int MaxSamplesDeficit { get; private set; }
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
var oldOutputMethod = Global.Config.SoundOutputMethod;
|
||||
var oldDevice = Global.Config.SoundDevice;
|
||||
Global.Config.SoundEnabled = SoundOnCheckBox.Checked;
|
||||
Global.Config.MuteFrameAdvance = MuteFrameAdvance.Checked;
|
||||
if (rbOutputMethodDirectSound.Checked) Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.DirectSound;
|
||||
|
@ -54,7 +55,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.SoundVolume = SoundVolBar.Value;
|
||||
Global.Config.SoundDevice = (string)listBoxSoundDevices.SelectedItem ?? "<default>";
|
||||
GlobalWin.Sound.StopSound();
|
||||
if (Global.Config.SoundOutputMethod != oldOutputMethod)
|
||||
if (Global.Config.SoundOutputMethod != oldOutputMethod ||
|
||||
Global.Config.SoundDevice != oldDevice)
|
||||
{
|
||||
GlobalWin.Sound.Dispose();
|
||||
GlobalWin.Sound = new Sound(GlobalWin.MainForm.Handle);
|
||||
|
@ -77,6 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (rbOutputMethodDirectSound.Checked) deviceNames = DirectSoundSoundOutput.GetDeviceNames();
|
||||
if (rbOutputMethodXAudio2.Checked) deviceNames = XAudio2SoundOutput.GetDeviceNames();
|
||||
#endif
|
||||
if (rbOutputMethodOpenAL.Checked) deviceNames = OpenALSoundOutput.GetDeviceNames();
|
||||
listBoxSoundDevices.Items.Clear();
|
||||
listBoxSoundDevices.Items.Add("<default>");
|
||||
listBoxSoundDevices.SelectedIndex = 0;
|
||||
|
|
Loading…
Reference in New Issue