Update the Alc.CreateContext function.

This commit is contained in:
the_fiddler 2008-01-17 14:06:31 +00:00
parent a875f40354
commit d925ff5f17
2 changed files with 30 additions and 9 deletions

View file

@ -81,14 +81,35 @@ namespace OpenTK.OpenAL
#region Context Management #region Context Management
#region CreateContext
/// <summary>This function creates a context using a specified device.</summary> /// <summary>This function creates a context using a specified device.</summary>
/// <param name="device">a pointer to a device</param> /// <param name="device">a pointer to a device</param>
/// <param name="attrlist">a pointer to a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC</param> /// <param name="attrlist">a pointer to a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC</param>
/// <returns>Returns a pointer to the new context (NULL on failure). The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</returns> /// <returns>Returns a pointer to the new context (NULL on failure). The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</returns>
[DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity]
public static extern IntPtr CreateContext([In] IntPtr device, [In] IntPtr attrlist); [CLSCompliant(false)]
unsafe public static extern IntPtr CreateContext([In] IntPtr device, [In] int* attrlist);
// ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); // ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
/// <summary>This function creates a context using a specified device.</summary>
/// <param name="device">a pointer to a device</param>
/// <param name="attrlist">an array of a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC</param>
/// <returns>Returns a pointer to the new context (NULL on failure).</returns>
/// <remarks>The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</remarks>
public static IntPtr CreateContext(IntPtr device, int[] attriblist)
{
unsafe
{
fixed (int* attriblist_ptr = attriblist)
{
return CreateContext(device, attriblist_ptr);
}
}
}
#endregion
/// <summary>This function makes a specified context the current context.</summary> /// <summary>This function makes a specified context the current context.</summary>
/// <param name="context">A pointer to the new context.</param> /// <param name="context">A pointer to the new context.</param>
/// <returns>Returns True on success, or False on failure.</returns> /// <returns>Returns True on success, or False on failure.</returns>
@ -217,7 +238,7 @@ namespace OpenTK.OpenAL
/// <param name="device">a pointer to the device to be queried.</param> /// <param name="device">a pointer to the device to be queried.</param>
/// <param name="param">an attribute to be retrieved: ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_ALL_DEVICES_SPECIFIER</param> /// <param name="param">an attribute to be retrieved: ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_ALL_DEVICES_SPECIFIER</param>
/// <returns>A List of strings containing the names of the Devices.</returns> /// <returns>A List of strings containing the names of the Devices.</returns>
public static List<string> GetString(IntPtr device, Enums.AlcGetStringList param) public static IList<string> GetString(IntPtr device, Enums.AlcGetStringList param)
{ {
List<string> result = new List<string>(); List<string> result = new List<string>();
IntPtr t = GetStringPrivate(AL.Null, (Enums.AlcGetString)Enums.AlcGetStringList.DeviceSpecifier); IntPtr t = GetStringPrivate(AL.Null, (Enums.AlcGetString)Enums.AlcGetStringList.DeviceSpecifier);
@ -239,7 +260,7 @@ namespace OpenTK.OpenAL
} }
} while (true); } while (true);
return result; return (IList<string>)result;
} }
/// <summary>This function returns integers related to the context.</summary> /// <summary>This function returns integers related to the context.</summary>

View file

@ -14,19 +14,19 @@ namespace OpenTK.OpenAL.Enums
public enum AlcContextAttributes : int public enum AlcContextAttributes : int
{ {
///<summary>followed by <int> Hz</summary> ///<summary>Followed by System.Int32 Hz</summary>
Frequency = 0x1007, Frequency = 0x1007,
///<summary>followed by <int> Hz</summary> ///<summary>Followed by System.Int32 Hz</summary>
Refresh = 0x1008, Refresh = 0x1008,
///<summary>followed by AlBoolean.True, or AlBoolean.False</summary> ///<summary>Followed by AlBoolean.True, or AlBoolean.False</summary>
Sync = 0x1009, Sync = 0x1009,
///<summary>followed by <int> Num of requested Mono (3D) Sources</summary> ///<summary>Followed by System.Int32 Num of requested Mono (3D) Sources</summary>
MonoSources = 0x1010, MonoSources = 0x1010,
///<summary>followed by <int> Num of requested Stereo Sources</summary> ///<summary>Followed by System.Int32 Num of requested Stereo Sources</summary>
StereoSources = 0x1011, StereoSources = 0x1011,
} }