From 624497098e8303bf2b18b199a78c482b85f39c5a Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 6 Apr 2008 15:03:52 +0000 Subject: [PATCH] Fixed EfxExtension.GenEffects bindings --- Source/OpenTK/Audio/OpenAL/AL/Efx.cs | 88 ++++++++-------------------- 1 file changed, 25 insertions(+), 63 deletions(-) diff --git a/Source/OpenTK/Audio/OpenAL/AL/Efx.cs b/Source/OpenTK/Audio/OpenAL/AL/Efx.cs index ed612fda..157b15fb 100644 --- a/Source/OpenTK/Audio/OpenAL/AL/Efx.cs +++ b/Source/OpenTK/Audio/OpenAL/AL/Efx.cs @@ -146,81 +146,43 @@ namespace OpenTK.Audio /// After creation an Effect has no type (EfxEffectType.Null), so before it can be used to store a set of parameters, the application must specify what type of effect should be stored in the object, using Effect() with EfxEffecti. /// Number of Effects to be created. /// Pointer addressing sufficient memory to store n Effect object identifiers. - - public void GenEffects(int n, out int[] effects) - { - uint[] temp = new uint[n]; - GenEffects(n, out temp[0]); - effects = new int[n]; - for (int i = 0; i < n; i++) - { - effects[i] = (int)temp[i]; - } - } - - /// The GenEffects function is used to create one or more Effect objects. An Effect object stores an effect type and a set of parameter values to control that Effect. In order to use an Effect it must be attached to an Auxiliary Effect Slot object - /// After creation an Effect has no type (EfxEffectType.Null), so before it can be used to store a set of parameters, the application must specify what type of effect should be stored in the object, using Effect() with EfxEffecti. - /// Pointer addressing sufficient memory to store n Effect object identifiers. - - public void GenEffects(int[] effects) - { - uint[] temp = new uint[effects.Length]; - GenEffects(temp.Length, out temp[0]); - for (int i = 0; i < temp.Length; i++) - { - effects[i] = (int)temp[i]; - } - } - - /// The GenEffects function is used to create one or more Effect objects. An Effect object stores an effect type and a set of parameter values to control that Effect. In order to use an Effect it must be attached to an Auxiliary Effect Slot object - /// After creation an Effect has no type (EfxEffectType.Null), so before it can be used to store a set of parameters, the application must specify what type of effect should be stored in the object, using Effect() with EfxEffecti. - /// Number of Effects to be created. - /// Pointer addressing sufficient memory to store n Effect object identifiers. - - public int[] GenEffects(int n) - { - uint[] temp = new uint[n]; - GenEffects(temp.Length, out temp[0]); - int[] effects = new int[n]; - for (int i = 0; i < temp.Length; i++) - { - effects[i] = (int)temp[i]; - } - return effects; - } - - /// This function generates only one Effect. - /// Storage UInt32 for the new effect name/handle. - [CLSCompliant(false)] - public void GenEffects(out uint effect) + public void GenEffects(int n, out int effects) { unsafe { - fixed (uint* ptr = &effect) + fixed (int* ptr = &effects) { - Imported_alGenEffects(1, ptr); + Imported_alGenEffects(n, (uint*)ptr); + effects = *ptr; } } } - /// This function generates only one Effect. - /// Storage UInt32 for the new effect name/handle. - - public void GenEffects(out int effect) + /// Generates one or more effect objects. + /// Number of Effect object identifiers to generate. + /// + /// The GenEffects function is used to create one or more Effect objects. An Effect object stores an effect type and a set of parameter values to control that Effect. In order to use an Effect it must be attached to an Auxiliary Effect Slot object. + /// After creation an Effect has no type (EfxEffectType.Null), so before it can be used to store a set of parameters, the application must specify what type of effect should be stored in the object, using Effect() with EfxEffecti. + /// + public int[] GenEffects(int n) { - uint temp; - GenEffects(out temp); - effect = (int)temp; + if (n <= 0) throw new ArgumentOutOfRangeException("n", "Must be higher than 0."); + int[] effects = new int[n]; + GenEffects(n, out effects[0]); + return effects; } - - /// This function generates only one Effect. - /// Storage UInt32 for the new effect name/handle. - public int GenEffects() + /// Generates a single effect object. + /// A handle to the generated effect object. + /// + /// The GenEffects function is used to create one or more Effect objects. An Effect object stores an effect type and a set of parameter values to control that Effect. In order to use an Effect it must be attached to an Auxiliary Effect Slot object. + /// After creation an Effect has no type (EfxEffectType.Null), so before it can be used to store a set of parameters, the application must specify what type of effect should be stored in the object, using Effect() with EfxEffecti. + /// + public int GenEffect() { - uint temp; - GenEffects(out temp); - return (int)temp; + int temp; + GenEffects(1, out temp); + return temp; } #endregion alGenEffects