diff --git a/Source/Examples/OpenAL/TestAudioContext.cs b/Source/Examples/OpenAL/TestAudioContext.cs index be3ed853..e3d4f604 100644 --- a/Source/Examples/OpenAL/TestAudioContext.cs +++ b/Source/Examples/OpenAL/TestAudioContext.cs @@ -16,7 +16,7 @@ using System.Diagnostics; namespace Examples { - [Example("AudioContext Test", ExampleCategory.Test)] + [Example("AudioContext Test", ExampleCategory.Test, 0, false)] class TestApp { public static void PrintOpenALErrors( IntPtr device ) @@ -65,21 +65,21 @@ namespace Examples #region Get Attribs - int AttribCount; - Alc.GetInteger(context.Device, AlcGetInteger.AttributesSize, sizeof(int), out AttribCount); - Console.WriteLine("AttributeSize: " + AttribCount); + //int AttribCount; + //Alc.GetInteger(context.Device, AlcGetInteger.AttributesSize, sizeof(int), out AttribCount); + //Console.WriteLine("AttributeSize: " + AttribCount); - if (AttribCount > 0) - { - int[] Attribs = new int[AttribCount]; - Alc.GetInteger(context.Device, AlcGetInteger.AllAttributes, AttribCount, out Attribs[0]); - for (int i = 0; i < Attribs.Length; i++) - { - Console.Write(Attribs[i]); - Console.Write(" "); - } - Console.WriteLine(); - } + //if (AttribCount > 0) + //{ + // int[] Attribs = new int[AttribCount]; + // Alc.GetInteger(context.Device, AlcGetInteger.AllAttributes, AttribCount, out Attribs[0]); + // for (int i = 0; i < Attribs.Length; i++) + // { + // Console.Write(Attribs[i]); + // Console.Write(" "); + // } + // Console.WriteLine(); + //} #endregion Get Attribs diff --git a/Source/OpenTK/Audio/AudioContext.cs b/Source/OpenTK/Audio/AudioContext.cs index b666db73..487254c9 100644 --- a/Source/OpenTK/Audio/AudioContext.cs +++ b/Source/OpenTK/Audio/AudioContext.cs @@ -374,10 +374,13 @@ namespace OpenTK.Audio #endregion + #region IntPtr Device + + IntPtr Device { get { return device_handle.Handle; } } + #endregion - // TODO: Remove before release! - public IntPtr Device { get { return device_handle.Handle; } } + #endregion #region --- Public Members --- @@ -477,6 +480,21 @@ namespace OpenTK.Audio #endregion + #region public bool SupportsExtension(string extension) + + /// + /// Checks whether the specified OpenAL extension is supported. + /// + /// The name of the extension to check (e.g. "ALC_EXT_EFX"). + /// true if the extension is supported; false otherwise. + public bool SupportsExtension(string extension) + { + if (disposed) throw new ObjectDisposedException(this.GetType().FullName); + return Alc.IsExtensionPresent(this.Device, extension); + } + + #endregion + #region public static AudioContext CurrentContext /// diff --git a/Source/OpenTK/Audio/OpenAL/AL/EffectsExtension.cs b/Source/OpenTK/Audio/OpenAL/AL/EffectsExtension.cs index 5db0ed01..85271670 100644 --- a/Source/OpenTK/Audio/OpenAL/AL/EffectsExtension.cs +++ b/Source/OpenTK/Audio/OpenAL/AL/EffectsExtension.cs @@ -1138,9 +1138,9 @@ namespace OpenTK.Audio if (AudioContext.CurrentContext == null) throw new InvalidOperationException("AL.LoadAll() needs a current AudioContext."); - if (Alc.IsExtensionPresent(AudioContext.CurrentContext.Device, "ALC_EXT_EFX") == false) + if (!AudioContext.CurrentContext.SupportsExtension("ALC_EXT_EFX")) { - Debug.WriteLine("EFX Extension (ALC_EXT_EFX) is not known to device: {0}.", AudioContext.CurrentContext.Device.ToString()); + Debug.WriteLine("EFX Extension (ALC_EXT_EFX) is not supported(AudioContext: {0}).", AudioContext.CurrentContext.ToString()); return; } // Console.WriteLine("ALC_EXT_EFX found. Efx can be used.");