Made AudioContext.Device private. Added AudioContext.SupportsExtension.
This commit is contained in:
parent
19b1d1a424
commit
143d217468
3 changed files with 37 additions and 19 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the specified OpenAL extension is supported.
|
||||
/// </summary>
|
||||
/// <param name="extension">The name of the extension to check (e.g. "ALC_EXT_EFX").</param>
|
||||
/// <returns>true if the extension is supported; false otherwise.</returns>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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.");
|
||||
|
|
Loading…
Reference in a new issue