From 946691d8536fd88fe15fbfc7291517a16193a672 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 6 Apr 2008 14:52:22 +0000 Subject: [PATCH] Fixed DeleteAuxiliaryEffectSlots bindings. --- Source/OpenTK/Audio/OpenAL/AL/Efx.cs | 59 +++++++++++----------------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/Source/OpenTK/Audio/OpenAL/AL/Efx.cs b/Source/OpenTK/Audio/OpenAL/AL/Efx.cs index c786d103..2d1fd837 100644 --- a/Source/OpenTK/Audio/OpenAL/AL/Efx.cs +++ b/Source/OpenTK/Audio/OpenAL/AL/Efx.cs @@ -1049,11 +1049,11 @@ namespace OpenTK.Audio /// Number of Auxiliary Effect Slots to be deleted. /// Pointer to n Effect Slot object identifiers. [CLSCompliant(false)] - public void DeleteAuxiliaryEffectSlots(int n, ref uint[] slots) + public void DeleteAuxiliaryEffectSlots(int n, ref uint slots) { - unsafe + unsafe { - fixed (uint* ptr = slots) + fixed (uint* ptr = &slots) { Imported_alDeleteAuxiliaryEffectSlots(n, ptr); } @@ -1063,61 +1063,48 @@ namespace OpenTK.Audio /// The DeleteAuxiliaryEffectSlots function is used to delete and free resources for Auxiliary Effect Slots previously created with GenAuxiliaryEffectSlots. /// Number of Auxiliary Effect Slots to be deleted. /// Pointer to n Effect Slot object identifiers. - [CLSCompliant(true)] - public void DeleteAuxiliaryEffectSlots(int n, ref int[] slots) + public void DeleteAuxiliaryEffectSlots(int n, ref int slots) { - uint[] temp = new uint[n]; - for (int i = 0; i < n; i++) + unsafe { - temp[i] = (uint)slots[i]; + fixed (int* ptr = &slots) + { + Imported_alDeleteAuxiliaryEffectSlots(n, (uint*)ptr); + } } - DeleteAuxiliaryEffectSlots(n, ref temp); } /// The DeleteAuxiliaryEffectSlots function is used to delete and free resources for Auxiliary Effect Slots previously created with GenAuxiliaryEffectSlots. /// Number of Auxiliary Effect Slots to be deleted. /// Pointer to n Effect Slot object identifiers. - [CLSCompliant(true)] public void DeleteAuxiliaryEffectSlots(int[] slots) { - uint[] temp = new uint[slots.Length]; - for (int i = 0; i < temp.Length; i++) - { - temp[i] = (uint)slots[i]; - } - DeleteAuxiliaryEffectSlots(temp.Length, ref temp); + if (slots == null) throw new ArgumentNullException("slots"); + DeleteAuxiliaryEffectSlots(slots.Length, ref slots[0]); } /// This function deletes one AuxiliaryEffectSlot only. /// Pointer to an auxiliary effect slot name/handle identifying the Auxiliary Effect Slot Object to be deleted. [CLSCompliant(false)] - public void DeleteAuxiliaryEffectSlots(ref uint slot) + public void DeleteAuxiliaryEffectSlots(uint[] slots) { - unsafe - { - fixed (uint* ptr = &slot) - { - Imported_alDeleteAuxiliaryEffectSlots(1, ptr); - } - } + if (slots == null) throw new ArgumentNullException("slots"); + DeleteAuxiliaryEffectSlots(slots.Length, ref slots[0]); } /// This function deletes one AuxiliaryEffectSlot only. /// Pointer to an auxiliary effect slot name/handle identifying the Auxiliary Effect Slot Object to be deleted. - [CLSCompliant(true)] - public void DeleteAuxiliaryEffectSlots(ref int slot) - { - uint temp = (uint)slot; - DeleteAuxiliaryEffectSlots(ref temp); - } - - /// This function deletes one AuxiliaryEffectSlot only. - /// Pointer to an auxiliary effect slot name/handle identifying the Auxiliary Effect Slot Object to be deleted. - [CLSCompliant(true)] public void DeleteAuxiliaryEffectSlots(int slot) { - uint temp = (uint)slot; - DeleteAuxiliaryEffectSlots(ref temp); + DeleteAuxiliaryEffectSlots(1, ref slot); + } + + /// This function deletes one AuxiliaryEffectSlot only. + /// Pointer to an auxiliary effect slot name/handle identifying the Auxiliary Effect Slot Object to be deleted. + [CLSCompliant(false)] + public void DeleteAuxiliaryEffectSlots(uint slot) + { + DeleteAuxiliaryEffectSlots(1, ref slot); } #endregion alDeleteAuxiliaryEffectSlots