Add option for OpenAL on Windows.

This commit is contained in:
jdpurcell 2015-02-19 03:22:20 +00:00
parent 8bf7c960cf
commit 730694644d
7 changed files with 28 additions and 11 deletions

View File

@ -18,7 +18,7 @@
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\output\dll\</OutputPath> <OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DEBUG;DOTNET20;UNMANAGED;COMPRESS</DefineConstants> <DefineConstants>TRACE;DEBUG;DOTNET20;UNMANAGED;COMPRESS;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\output\dll\</OutputPath> <OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DOTNET20;UNMANAGED;COMPRESS</DefineConstants> <DefineConstants>TRACE;DOTNET20;UNMANAGED;COMPRESS;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>

View File

@ -226,7 +226,11 @@ namespace BizHawk.Client.Common
public int DispCustomUserARHeight = 1; public int DispCustomUserARHeight = 1;
// Sound options // Sound options
#if WINDOWS
public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.DirectSound; public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.DirectSound;
#else
public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.OpenAL;
#endif
public bool SoundEnabled = true; public bool SoundEnabled = true;
public bool MuteFrameAdvance = true; public bool MuteFrameAdvance = true;
public int SoundVolume = 100; // Range 0-100 public int SoundVolume = 100; // Range 0-100

View File

@ -276,9 +276,6 @@ namespace BizHawk.Client.EmuHawk
Global.ActiveController = Global.NullControls; Global.ActiveController = Global.NullControls;
Global.AutoFireController = Global.AutofireNullControls; Global.AutoFireController = Global.AutofireNullControls;
Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig(); Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig();
#if !WINDOWS
Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.OpenAL;
#endif
try { GlobalWin.Sound = new Sound(Handle); } try { GlobalWin.Sound = new Sound(Handle); }
catch catch
{ {

View File

@ -35,11 +35,6 @@ namespace BizHawk.Client.EmuHawk
_disposed = true; _disposed = true;
} }
public static IEnumerable<string> GetDeviceNames()
{
return Enumerable.Empty<string>();
}
private int BufferSizeSamples { get; set; } private int BufferSizeSamples { get; set; }
public int MaxSamplesDeficit { get; private set; } public int MaxSamplesDeficit { get; private set; }

View File

@ -43,6 +43,7 @@
this.grpOutputMethod = new System.Windows.Forms.GroupBox(); this.grpOutputMethod = new System.Windows.Forms.GroupBox();
this.rbOutputMethodXAudio2 = new System.Windows.Forms.RadioButton(); this.rbOutputMethodXAudio2 = new System.Windows.Forms.RadioButton();
this.rbOutputMethodDirectSound = new System.Windows.Forms.RadioButton(); this.rbOutputMethodDirectSound = new System.Windows.Forms.RadioButton();
this.rbOutputMethodOpenAL = new System.Windows.Forms.RadioButton();
this.SoundVolGroup.SuspendLayout(); this.SoundVolGroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SoundVolBar)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SoundVolBar)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.SoundVolNumeric)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SoundVolNumeric)).BeginInit();
@ -190,11 +191,12 @@
// //
// grpOutputMethod // grpOutputMethod
// //
this.grpOutputMethod.Controls.Add(this.rbOutputMethodOpenAL);
this.grpOutputMethod.Controls.Add(this.rbOutputMethodXAudio2); this.grpOutputMethod.Controls.Add(this.rbOutputMethodXAudio2);
this.grpOutputMethod.Controls.Add(this.rbOutputMethodDirectSound); this.grpOutputMethod.Controls.Add(this.rbOutputMethodDirectSound);
this.grpOutputMethod.Location = new System.Drawing.Point(292, 12); this.grpOutputMethod.Location = new System.Drawing.Point(292, 12);
this.grpOutputMethod.Name = "grpOutputMethod"; this.grpOutputMethod.Name = "grpOutputMethod";
this.grpOutputMethod.Size = new System.Drawing.Size(100, 68); this.grpOutputMethod.Size = new System.Drawing.Size(100, 90);
this.grpOutputMethod.TabIndex = 5; this.grpOutputMethod.TabIndex = 5;
this.grpOutputMethod.TabStop = false; this.grpOutputMethod.TabStop = false;
this.grpOutputMethod.Text = "Output Method"; this.grpOutputMethod.Text = "Output Method";
@ -223,6 +225,18 @@
this.rbOutputMethodDirectSound.UseVisualStyleBackColor = true; this.rbOutputMethodDirectSound.UseVisualStyleBackColor = true;
this.rbOutputMethodDirectSound.CheckedChanged += new System.EventHandler(this.OutputMethodRadioButtons_CheckedChanged); this.rbOutputMethodDirectSound.CheckedChanged += new System.EventHandler(this.OutputMethodRadioButtons_CheckedChanged);
// //
// rbOutputMethodOpenAL
//
this.rbOutputMethodOpenAL.AutoSize = true;
this.rbOutputMethodOpenAL.Location = new System.Drawing.Point(6, 65);
this.rbOutputMethodOpenAL.Name = "rbOutputMethodOpenAL";
this.rbOutputMethodOpenAL.Size = new System.Drawing.Size(64, 17);
this.rbOutputMethodOpenAL.TabIndex = 2;
this.rbOutputMethodOpenAL.TabStop = true;
this.rbOutputMethodOpenAL.Text = "OpenAL";
this.rbOutputMethodOpenAL.UseVisualStyleBackColor = true;
this.rbOutputMethodOpenAL.CheckedChanged += new System.EventHandler(this.OutputMethodRadioButtons_CheckedChanged);
//
// SoundConfig // SoundConfig
// //
this.AcceptButton = this.OK; this.AcceptButton = this.OK;
@ -276,5 +290,6 @@
private System.Windows.Forms.GroupBox grpOutputMethod; private System.Windows.Forms.GroupBox grpOutputMethod;
private System.Windows.Forms.RadioButton rbOutputMethodXAudio2; private System.Windows.Forms.RadioButton rbOutputMethodXAudio2;
private System.Windows.Forms.RadioButton rbOutputMethodDirectSound; private System.Windows.Forms.RadioButton rbOutputMethodDirectSound;
private System.Windows.Forms.RadioButton rbOutputMethodOpenAL;
} }
} }

View File

@ -22,8 +22,13 @@ namespace BizHawk.Client.EmuHawk
SoundOnCheckBox.Checked = Global.Config.SoundEnabled; SoundOnCheckBox.Checked = Global.Config.SoundEnabled;
MuteFrameAdvance.Checked = Global.Config.MuteFrameAdvance; MuteFrameAdvance.Checked = Global.Config.MuteFrameAdvance;
#if !WINDOWS
rbOutputMethodDirectSound.Enabled = false;
rbOutputMethodXAudio2.Enabled = false;
#endif
rbOutputMethodDirectSound.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound; rbOutputMethodDirectSound.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.DirectSound;
rbOutputMethodXAudio2.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.XAudio2; rbOutputMethodXAudio2.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.XAudio2;
rbOutputMethodOpenAL.Checked = Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL;
BufferSizeNumeric.Value = Global.Config.SoundBufferSizeMs; BufferSizeNumeric.Value = Global.Config.SoundBufferSizeMs;
SoundVolBar.Value = Global.Config.SoundVolume; SoundVolBar.Value = Global.Config.SoundVolume;
SoundVolNumeric.Value = Global.Config.SoundVolume; SoundVolNumeric.Value = Global.Config.SoundVolume;
@ -44,6 +49,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.MuteFrameAdvance = MuteFrameAdvance.Checked; Global.Config.MuteFrameAdvance = MuteFrameAdvance.Checked;
if (rbOutputMethodDirectSound.Checked) Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.DirectSound; if (rbOutputMethodDirectSound.Checked) Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.DirectSound;
if (rbOutputMethodXAudio2.Checked) Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.XAudio2; if (rbOutputMethodXAudio2.Checked) Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.XAudio2;
if (rbOutputMethodOpenAL.Checked) Global.Config.SoundOutputMethod = Config.ESoundOutputMethod.OpenAL;
Global.Config.SoundBufferSizeMs = (int)BufferSizeNumeric.Value; Global.Config.SoundBufferSizeMs = (int)BufferSizeNumeric.Value;
Global.Config.SoundVolume = SoundVolBar.Value; Global.Config.SoundVolume = SoundVolBar.Value;
Global.Config.SoundDevice = (string)listBoxSoundDevices.SelectedItem ?? "<default>"; Global.Config.SoundDevice = (string)listBoxSoundDevices.SelectedItem ?? "<default>";

BIN
output/dll/openal32.dll Normal file

Binary file not shown.