changed List<string> Alc.GetString() and enums again. Fixed docu.

This commit is contained in:
chrisbrandtner 2008-01-15 13:37:33 +00:00
parent cf5640d2a9
commit 9b2f71db5a
2 changed files with 32 additions and 13 deletions

View file

@ -202,12 +202,21 @@ namespace OpenTK.OpenAL
/// </remarks>
/// <param name="device">a pointer to the device to be queried.</param>
/// <param name="param">an attribute to be retrieved: ALC_DEFAULT_DEVICE_SPECIFIER, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER, ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_EXTENSIONS</param>
/// <returns></returns>
/// <returns>A string containing the name of the Device.</returns>
public static string GetString(IntPtr device, Enums.AlcGetString param)
{
return Marshal.PtrToStringAnsi(GetStringPrivate(device, param));
}
/// <summary>This function returns a List of strings related to the context.</summary>
/// <remarks>
/// ALC_DEVICE_SPECIFIER will return the name of the specified output device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied. A list is a pointer to a series of strings separated by NULL characters, with the list terminated by two NULL characters. See Enumeration Extension for more details.
/// ALC_CAPTURE_DEVICE_SPECIFIER will return the name of the specified capture device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied.
/// ALC_EXTENSIONS returns a list of available context extensions, with each extension separated by a space and the list terminated by a NULL character.
/// </remarks>
/// <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>
/// <returns>A List of strings containing the names of the Devices.</returns>
public static List<string> GetString(IntPtr device, Enums.AlcGetStringList param)
{
List<string> result = new List<string>();
@ -218,14 +227,18 @@ namespace OpenTK.OpenAL
do
{
b = Marshal.ReadByte(t, offset++);
if (b != 0) sb.Append((char)b);
else
if (b != 0)
sb.Append((char)b);
if (b == 0)
{
if (Marshal.ReadByte(t, offset + 1) == 0)
{
result.Add(sb.ToString());
break;
}
else
{
if (sb.Length > 1) result.Add(sb.ToString());
if (sb.Length > 0) result.Add(sb.ToString());
sb.Remove(0, sb.Length);
}
}

View file

@ -56,9 +56,6 @@ namespace OpenTK.OpenAL.Enums
///<summary>The specifier string for the default device.</summary>
DefaultDeviceSpecifier = 0x1004,
///<summary>The specifier strings for all available devices.</summary>
DeviceSpecifier = 0x1005,
///<summary>A list of available context extensions separated by spaces.</summary>
Extensions = 0x1006,
@ -67,17 +64,28 @@ namespace OpenTK.OpenAL.Enums
/// <summary>a list of the default devices.</summary>
DefaultAllDevicesSpecifier = 0x1012,
// duplicates from AlcGetStringList:
///<summary>Will only return the first Device, not a list. Use AlcGetStringList.CaptureDeviceSpecifier. ALC_EXT_CAPTURE_EXT </summary>
CaptureDeviceSpecifier = 0x310,
///<summary>Will only return the first Device, not a list. Use AlcGetStringList.DeviceSpecifier</summary>
DeviceSpecifier = 0x1005,
/// <summary>Will only return the first Device, not a list. Use AlcGetStringList.AllDevicesSpecifier</summary>
AllDevicesSpecifier = 0x1013,
}
public enum AlcGetStringList : int
{
///<summary>The name of the specified capture device, or a list of all available capture devices if no capture device is specified.</summary>
CaptureDeviceSpecifier = 0x310, // ALC_EXT_CAPTURE extension.
///<summary>The name of the specified capture device, or a list of all available capture devices if no capture device is specified. ALC_EXT_CAPTURE_EXT </summary>
CaptureDeviceSpecifier = 0x310,
///<summary>The specifier string for the device.</summary>
///<summary>The specifier strings for all available devices. ALC_ENUMERATION_EXT</summary>
DeviceSpecifier = 0x1005,
/// <summary>A list of all available devices.</summary>
/// <summary>The specifier strings for all available devices. ALC_ENUMERATE_ALL_EXT</summary>
AllDevicesSpecifier = 0x1013,
}
@ -98,6 +106,4 @@ namespace OpenTK.OpenAL.Enums
///<summary>The number of capture samples available. NULL is an invalid device.</summary>
CaptureSamples = 0x312,
}
}