Merge pull request #3420 from Mailaender/sound-info

Display the current sound engine in the console
This commit is contained in:
Paul Chote
2013-06-21 18:42:06 -07:00

View File

@@ -53,7 +53,7 @@ namespace OpenRA
static ISoundEngine CreateEngine(string engine) static ISoundEngine CreateEngine(string engine)
{ {
engine = Game.Settings.Server.Dedicated?"Null":engine; engine = Game.Settings.Server.Dedicated ? "Null" : engine;
switch (engine) switch (engine)
{ /* TODO: if someone cares about pluggable crap here, ship this out */ { /* TODO: if someone cares about pluggable crap here, ship this out */
case "AL": return new OpenAlSoundEngine(); case "AL": return new OpenAlSoundEngine();
@@ -374,6 +374,7 @@ namespace OpenRA
public OpenAlSoundEngine() public OpenAlSoundEngine()
{ {
Console.WriteLine("Using OpenAL sound engine");
//var str = Alc.alcGetString(IntPtr.Zero, Alc.ALC_DEFAULT_DEVICE_SPECIFIER); //var str = Alc.alcGetString(IntPtr.Zero, Alc.ALC_DEFAULT_DEVICE_SPECIFIER);
var dev = Alc.alcOpenDevice(null); var dev = Alc.alcOpenDevice(null);
if (dev == IntPtr.Zero) if (dev == IntPtr.Zero)
@@ -645,6 +646,11 @@ namespace OpenRA
class NullSoundEngine : ISoundEngine class NullSoundEngine : ISoundEngine
{ {
public NullSoundEngine()
{
Console.WriteLine("Using Null sound engine which disables SFX completely");
}
public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate) public ISoundSource AddSoundSourceFromMemory(byte[] data, int channels, int sampleBits, int sampleRate)
{ {
return new NullSoundSource(); return new NullSoundSource();