diff --git a/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs b/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs index 69d22d05..d7033c3b 100644 --- a/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs +++ b/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs @@ -263,14 +263,41 @@ namespace OpenTK.Audio return (IList)result; } + [DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] + unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data); + // ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); + /// This function returns integers related to the context. /// a pointer to the device to be queried. /// an attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES - /// the size of the destination buffer provided. In bytes. + /// the size of the destination buffer provided, in number of integers. /// a pointer to the buffer to be returned - [DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] - public static extern void GetInteger([In] IntPtr device, AlcGetInteger param, int size, [Out] out int data); - // ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); + public static void GetInteger(IntPtr device, AlcGetInteger param, int size, out int data) + { + unsafe + { + fixed (int* data_ptr = &data) + { + GetInteger(device, param, size, data_ptr); + } + } + } + + /// This function returns integers related to the context. + /// a pointer to the device to be queried. + /// an attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES + /// the size of the destination buffer provided, in number of integers. + /// a pointer to the buffer to be returned + public static void GetInteger(IntPtr device, AlcGetInteger param, int size, int[] data) + { + unsafe + { + fixed (int* data_ptr = data) + { + GetInteger(device, param, size, data_ptr); + } + } + } #endregion Query functions