From 15a97e4628d2066f9a1bcaaf66349bb46e8e8b82 Mon Sep 17 00:00:00 2001 From: chrisbrandtner Date: Mon, 11 Feb 2008 09:16:25 +0000 Subject: [PATCH] at least 1 CLSCompliant overload per function. --- Source/OpenTK/Audio/OpenAL/AL/AL.cs | 862 ++++++++++++++++++++------ Source/OpenTK/Audio/OpenAL/AL/XRam.cs | 27 +- 2 files changed, 712 insertions(+), 177 deletions(-) diff --git a/Source/OpenTK/Audio/OpenAL/AL/AL.cs b/Source/OpenTK/Audio/OpenAL/AL/AL.cs index de1b3a5d..2188dcd4 100644 --- a/Source/OpenTK/Audio/OpenAL/AL/AL.cs +++ b/Source/OpenTK/Audio/OpenAL/AL/AL.cs @@ -67,7 +67,8 @@ namespace OpenTK.OpenAL { // AL = Audio Library - public static class AL + [CLSCompliant( true )] + public static partial class AL { #region Constants @@ -80,20 +81,20 @@ namespace OpenTK.OpenAL /// This function enables a feature of the OpenAL driver. There are no capabilities defined in OpenAL 1.1 to be used with this function, but it may be used by an extension. /// The name of a capability to enable. - [DllImport(AL.Lib,EntryPoint = "alEnable",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alEnable", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void Enable( Enums.ALCapability capability ); //AL_API void AL_APIENTRY alEnable( ALenum capability ); /// This function disables a feature of the OpenAL driver. /// The name of a capability to disable. - [DllImport(AL.Lib,EntryPoint = "alDisable",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alDisable", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void Disable( Enums.ALCapability capability ); // AL_API void AL_APIENTRY alDisable( ALenum capability ); /// This function returns a boolean indicating if a specific feature is enabled in the OpenAL driver. /// The name of a capability to enable. /// True if enabled, False if disabled. - [DllImport(AL.Lib,EntryPoint = "alIsEnabled",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alIsEnabled", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern bool IsEnabled( Enums.ALCapability capability ); // AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability ); @@ -101,7 +102,7 @@ namespace OpenTK.OpenAL #region State retrieval - [DllImport(AL.Lib,EntryPoint = "alGetString",ExactSpelling = true,CallingConvention = AL.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alGetString", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )] private static extern IntPtr GetStringPrivate( Enums.ALGetString param ); // accepts the enums Enums.AlError, Enums.AlContextString // AL_API const ALchar* AL_APIENTRY alGetString( ALenum param ); @@ -110,7 +111,7 @@ namespace OpenTK.OpenAL /// Returns a pointer to a null-terminated string. public static string Get( Enums.ALGetString param ) { - return Marshal.PtrToStringAnsi(GetStringPrivate(param)); + return Marshal.PtrToStringAnsi( GetStringPrivate( param ) ); } /// This function retrieves an OpenAL string property. @@ -118,7 +119,7 @@ namespace OpenTK.OpenAL /// Returns a pointer to a null-terminated string. public static string GetErrorString( Enums.ALError param ) { - return Marshal.PtrToStringAnsi(GetStringPrivate((Enums.ALGetString) param)); + return Marshal.PtrToStringAnsi( GetStringPrivate( (Enums.ALGetString) param ) ); } /* no functions return more than 1 result .. @@ -140,14 +141,14 @@ namespace OpenTK.OpenAL /// This function returns an integer OpenAL state. /// the state to be queried: DistanceModel. /// The integer state described by param will be returned. - [DllImport(AL.Lib,EntryPoint = "alGetInteger",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alGetInteger", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern int Get( Enums.ALGetInteger param ); // AL_API ALint AL_APIENTRY alGetInteger( ALenum param ); /// This function returns a floating point OpenAL state. /// the state to be queried: DopplerFactor, SpeedOfSound. /// The floating point state described by param will be returned. - [DllImport(AL.Lib,EntryPoint = "alGetFloat",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alGetFloat", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern float Get( Enums.ALGetFloat param ); // AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param ); @@ -162,7 +163,7 @@ namespace OpenTK.OpenAL /// Error support. Obtain the most recent error generated in the AL state machine. When an error is detected by AL, a flag is set and the error code is recorded. Further errors, if they occur, do not affect this recorded code. When alGetError is called, the code is returned and the flag is cleared, so that a further error will again record its code. /// The first error that occured. can be used with AL.GetString. Returns an Alenum representing the error state. When an OpenAL error occurs, the error state is set and will not be changed until the error state is retrieved using alGetError. Whenever alGetError is called, the error state is cleared and the last state (the current state when the call was made) is returned. To isolate error detection to a specific portion of code, alGetError should be called before the isolated section to clear the current error state. - [DllImport(AL.Lib,EntryPoint = "alGetError",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alGetError", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern Enums.ALError GetError( ); // AL_API ALenum AL_APIENTRY alGetError( void ); @@ -173,26 +174,26 @@ namespace OpenTK.OpenAL ///This function tests if a specific Extension is available for the OpenAL driver. /// A string naming the desired extension. Example: "EAX-RAM" /// Returns True if the Extension is available or False if not available. - [DllImport(AL.Lib,EntryPoint = "alIsExtensionPresent",ExactSpelling = true,CallingConvention = AL.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alIsExtensionPresent", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )] public static extern bool IsExtensionPresent( [In] string extname ); // AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname ); /// This function returns the address of an OpenAL extension function. Handle with care. /// A string containing the function name. /// The return value is a pointer to the specified function. The return value will be IntPtr.Zero if the function is not found. - [DllImport(AL.Lib,EntryPoint = "alGetProcAddress",ExactSpelling = true,CallingConvention = AL.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alGetProcAddress", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )] public static extern IntPtr GetProcAddress( [In] string fname ); // AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname ); /// This function returns the enumeration value of an OpenAL token, described by a string. /// A string describing an OpenAL token. Example "AL_DISTANCE_MODEL" /// Returns the actual ALenum described by a string. Returns 0 if the string doesn’t describe a valid OpenAL token. - [DllImport(AL.Lib,EntryPoint = "alGetEnumValue",ExactSpelling = true,CallingConvention = AL.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alGetEnumValue", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )] public static extern int GetEnumValue( [In] string ename ); // AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename ); #endregion Extension support. - + /* Listener * Listener represents the location and orientation of the * 'user' in 3D-space. @@ -210,8 +211,8 @@ namespace OpenTK.OpenAL /// This function sets a floating point property for the listener. /// The name of the attribute to be set: ALListenerf.Gain /// The float value to set the attribute to. - [DllImport(AL.Lib,EntryPoint = "alListenerf",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void Listener( Enums.ALListenerf param,float value ); + [DllImport( AL.Lib, EntryPoint = "alListenerf", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void Listener( Enums.ALListenerf param, float value ); // AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value ); /// This function sets a floating point property for the listener. @@ -219,32 +220,32 @@ namespace OpenTK.OpenAL /// The value to set the attribute to. /// The value to set the attribute to. /// The value to set the attribute to. - [DllImport(AL.Lib,EntryPoint = "alListener3f",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void Listener( Enums.ALListener3f param,float value1,float value2,float value3 ); + [DllImport( AL.Lib, EntryPoint = "alListener3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void Listener( Enums.ALListener3f param, float value1, float value2, float value3 ); // AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); /// This function sets a Math.Vector3 property for the listener. /// The name of the attribute to set: ALListener3f.Position, ALListener3f.Velocity /// The Math.Vector3 to set the attribute to. - public static void Listener( Enums.ALListener3f param,ref Vector3 values ) + public static void Listener( Enums.ALListener3f param, ref Vector3 values ) { - Listener(param,values.X,values.Y,values.Z); + Listener( param, values.X, values.Y, values.Z ); } - [DllImport(AL.Lib,EntryPoint = "alListenerfv",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - unsafe private static extern void ListenerPrivate( Enums.ALListenerfv param,float* values ); + [DllImport( AL.Lib, EntryPoint = "alListenerfv", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + unsafe private static extern void ListenerPrivate( Enums.ALListenerfv param, float* values ); // AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values ); /// This function sets a floating point-vector property of the listener. /// The name of the attribute to be set: ALListener3f.Position, ALListener3f.Velocity, ALListenerfv.Orientation /// Pointer to floating point-vector values. - public static void Listener( Enums.ALListenerfv param,ref float[] values ) + public static void Listener( Enums.ALListenerfv param, ref float[] values ) { unsafe { fixed ( float* ptr = &values[0] ) { - ListenerPrivate(param,ptr); + ListenerPrivate( param, ptr ); } } } @@ -253,7 +254,7 @@ namespace OpenTK.OpenAL /// The name of the attribute to be set: ALListenerfv.Orientation /// A Math.Vector3 for the At-Vector. /// A Math.Vector3 for the Up-Vector. - public static void Listener( Enums.ALListenerfv param,ref Vector3 at,ref Vector3 up ) + public static void Listener( Enums.ALListenerfv param, ref Vector3 at, ref Vector3 up ) { float[] temp = new float[6]; @@ -269,7 +270,7 @@ namespace OpenTK.OpenAL { fixed ( float* ptr = &temp[0] ) { - ListenerPrivate(param,ptr); + ListenerPrivate( param, ptr ); } } } @@ -286,8 +287,8 @@ namespace OpenTK.OpenAL /// This function retrieves a floating point property of the listener. /// the name of the attribute to be retrieved: ALListenerf.Gain /// a pointer to the floating point value being retrieved. - [DllImport(AL.Lib,EntryPoint = "alGetListenerf",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetListener( Enums.ALListenerf param,[Out] out float value ); + [DllImport( AL.Lib, EntryPoint = "alGetListenerf", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void GetListener( Enums.ALListenerf param, [Out] out float value ); // AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value ); /// This function retrieves a set of three floating point values from a property of the listener. @@ -295,37 +296,37 @@ namespace OpenTK.OpenAL /// Pointers to the three floating point being retrieved. /// Pointers to the three floating point being retrieved. /// Pointers to the three floating point being retrieved. - [DllImport(AL.Lib,EntryPoint = "alGetListener3f",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetListener( Enums.ALListener3f param,[Out] out float value1,[Out] out float value2,[Out] out float value3 ); + [DllImport( AL.Lib, EntryPoint = "alGetListener3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void GetListener( Enums.ALListener3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3 ); // AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); /// This function retrieves a Math.Vector3 from a property of the listener. /// The name of the attribute to be retrieved: ALListener3f.Position, ALListener3f.Velocity /// A Math.Vector3 to hold the three floats being retrieved. - public static void GetListener( Enums.ALListener3f param,out Vector3 values ) + public static void GetListener( Enums.ALListener3f param, out Vector3 values ) { - GetListener(param,out values.X,out values.Y,out values.Z); + GetListener( param, out values.X, out values.Y, out values.Z ); } /// This function retrieves a floating point-vector property of the listener. You must pin it manually. /// the name of the attribute to be retrieved: ALListener3f.Position, ALListener3f.Velocity, ALListenerfv.Orientation /// A pointer to the floating point-vector value being retrieved. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGetListenerfv",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - unsafe public static extern void GetListener( Enums.ALListenerfv param,float* values ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetListenerfv", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + unsafe public static extern void GetListener( Enums.ALListenerfv param, float* values ); // AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values ); /// This function retrieves two Math.Vector3 properties of the listener. /// the name of the attribute to be retrieved: ALListenerfv.Orientation /// A Math.Vector3 for the At-Vector. /// A Math.Vector3 for the Up-Vector. - public static void GetListener( Enums.ALListenerfv param,out Vector3 at,out Vector3 up ) + public static void GetListener( Enums.ALListenerfv param, out Vector3 at, out Vector3 up ) { float[] pinned = new float[6]; // should lose scope when the function exits unsafe { fixed ( float* ptr = &pinned[0] ) { - GetListener(param,ptr); + GetListener( param, ptr ); at.X = pinned[0]; at.Y = pinned[1]; @@ -384,139 +385,298 @@ namespace OpenTK.OpenAL #region Create Source objects - [DllImport(AL.Lib,EntryPoint = "alGenSources",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - unsafe private static extern void GenSourcesPrivate( int n,[Out] uint* sources ); + #region GenSources() + + [DllImport( AL.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + unsafe private static extern void GenSourcesPrivate( int n, [Out] uint* sources ); // AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* Sources ); /// This function generates one or more sources. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei). /// The number of sources to be generated. /// Pointer to an array of uint values which will store the names of the new sources. - [CLSCompliant(false)] - public static void GenSources( int n,out uint sources ) + [CLSCompliant( false )] + public static void GenSources( int n, out uint sources ) { unsafe { fixed ( uint* ptr = &sources ) { - GenSourcesPrivate(n,(uint*) ptr); + GenSourcesPrivate( n, (uint*) ptr ); sources = *ptr; } } } - /// This function generates one source only. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei). - /// Pointer to an uint value which will store the name of the new source. - [CLSCompliant(false)] - public static void GenSources( out uint source ) + /// This function generates one or more sources. References to sources are int values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei). + /// The number of sources to be generated. + /// Pointer to an array of int values which will store the names of the new sources. + [CLSCompliant( true )] + public static void GenSources( int n, out int[] sources ) { - GenSources(1,out source); + uint[] temp = new uint[n]; + GenSources( n, out temp[0] ); + sources = new int[n]; + for ( int i = 0; i < n; i++ ) + { + sources[i] = (int) temp[i]; + } } - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alDeleteSources",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - unsafe public static extern void DeleteSources( int n,[In] uint* sources ); // Delete Source objects + /// This function generates one source only. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei). + /// Pointer to an uint value which will store the name of the new source. + [CLSCompliant( false )] + public static void GenSources( out uint source ) + { + GenSources( 1, out source ); + } + + /// This function generates one source only. References to sources are int values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei). + /// Pointer to an int value which will store the name of the new source. + [CLSCompliant( true )] + public static void GenSources( out int source ) + { + uint temp; + GenSources( 1, out temp ); + source = (int) temp; + } + + #endregion GenSources() + + #region DeleteSources() + + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alDeleteSources", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + unsafe public static extern void DeleteSources( int n, [In] uint* sources ); // Delete Source objects // AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* Sources ); /// This function deletes one or more sources. /// The number of sources to be deleted. /// Pointer to an array of source names identifying the sources to be deleted. - [CLSCompliant(false)] - public static void DeleteSources( int n,ref uint[] sources ) + [CLSCompliant( false )] + public static void DeleteSources( int n, ref uint[] sources ) { unsafe { fixed ( uint* ptr = sources ) { - DeleteSources(n,(uint*) ptr); + DeleteSources( n, (uint*) ptr ); } } } + /// This function deletes one or more sources. + /// The number of sources to be deleted. + /// Pointer to an array of source names identifying the sources to be deleted. + [CLSCompliant( true )] + public static void DeleteSources( int n, ref int[] sources ) + { + uint[] temp = new uint[n]; + for ( int i = 0; i < n; i++ ) + { + temp[i] = (uint) sources[i]; + } + DeleteSources( n, ref temp ); + } + /// This function deletes one source only. /// Pointer to a source name identifying the source to be deleted. - [CLSCompliant(false)] + [CLSCompliant( false )] public static void DeleteSources( ref uint source ) { - uint[] t = new uint[1]; - t[0] = source; - DeleteSources(1,ref t); + uint[] temp = new uint[1]; + temp[0] = source; + DeleteSources( 1, ref temp ); } + /// This function deletes one source only. + /// Pointer to a source name identifying the source to be deleted. + [CLSCompliant( true )] + public static void DeleteSources( ref int source ) + { + uint[] temp = new uint[1]; + temp[0] = (uint) source; + DeleteSources( 1, ref temp ); + } + + #endregion DeleteSources() + + #region IsSource() + /// This function tests if a source name is valid, returning True if valid and False if not. /// A source name to be tested for validity /// Success. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alIsSource",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern bool IsSource( uint sid ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alIsSource", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern bool IsSource( uint sid ); // AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid ); + /// This function tests if a source name is valid, returning True if valid and False if not. + /// A source name to be tested for validity + /// Success. + [CLSCompliant( true )] + public static bool IsSource( int sid ) + { + return IsSource( (uint) sid ); + } + + #endregion IsSource() + #endregion Create Source objects #region Set Source parameters + #region Sourcef + /// This function sets a floating point property of a source. /// Source name whose attribute is being set /// The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency. /// The value to set the attribute to. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourcef",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void Source( uint sid,Enums.ALSourcef param,float value ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcef", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void Source( uint sid, Enums.ALSourcef param, float value ); // AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value ); - + + /// This function sets a floating point property of a source. + /// Source name whose attribute is being set + /// The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency. + /// The value to set the attribute to. + [CLSCompliant( true )] + public static void Source( int sid, Enums.ALSourcef param, float value ) + { + Source( (uint) sid, param, value ); + } + + #endregion Sourcef + + #region Source3f + /// This function sets a source property requiring three floating point values. /// Source name whose attribute is being set. /// The name of the attribute to set: ALSource3f.Position, Velocity, Direction. /// The three ALfloat values which the attribute will be set to. /// The three ALfloat values which the attribute will be set to. /// The three ALfloat values which the attribute will be set to. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSource3f",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void Source( uint sid,Enums.ALSource3f param,float value1,float value2,float value3 ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSource3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void Source( uint sid, Enums.ALSource3f param, float value1, float value2, float value3 ); // AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); /// This function sets a source property requiring three floating point values. /// Source name whose attribute is being set. /// The name of the attribute to set: ALSource3f.Position, Velocity, Direction. - /// A Math.Vector3 which the attribute will be set to. - [CLSCompliant(false)] - public static void Source( uint sid,Enums.ALSource3f param,ref Vector3 values ) + /// The three ALfloat values which the attribute will be set to. + /// The three ALfloat values which the attribute will be set to. + /// The three ALfloat values which the attribute will be set to. + [CLSCompliant( true )] + public static void Source( int sid, Enums.ALSource3f param, float value1, float value2, float value3 ) { - Source(sid,param,values.X,values.Y,values.Z); + Source( (uint) sid, param, value1, value2, value3 ); } + /// This function sets a source property requiring three floating point values. + /// Source name whose attribute is being set. + /// The name of the attribute to set: ALSource3f.Position, Velocity, Direction. + /// A Math.Vector3 which the attribute will be set to. + [CLSCompliant( false )] + public static void Source( uint sid, Enums.ALSource3f param, ref Vector3 values ) + { + Source( sid, param, values.X, values.Y, values.Z ); + } + + /// This function sets a source property requiring three floating point values. + /// Source name whose attribute is being set. + /// The name of the attribute to set: ALSource3f.Position, Velocity, Direction. + /// A Math.Vector3 which the attribute will be set to. + [CLSCompliant( true )] + public static void Source( int sid, Enums.ALSource3f param, ref Vector3 values ) + { + Source( (uint) sid, param, values.X, values.Y, values.Z ); + } + + #endregion Source3f + + #region Sourcei + /// This function sets an integer property of a source. /// Source name whose attribute is being set. /// The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState. /// The value to set the attribute to. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourcei",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void Source( uint sid,Enums.ALSourcei param,int value ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcei", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void Source( uint sid, Enums.ALSourcei param, int value ); // AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value ); + /// This function sets an integer property of a source. + /// Source name whose attribute is being set. + /// The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState. + /// The value to set the attribute to. + [CLSCompliant( true )] + public static void Source( int sid, Enums.ALSourcei param, int value ) + { + Source( (uint) sid, param, value ); + } + /// This function sets an bool property of a source. /// Source name whose attribute is being set. /// The name of the attribute to set: ALSourceb.SourceRelative, Looping. /// The value to set the attribute to. - [CLSCompliant(false)] - public static void Source( uint sid,Enums.ALSourceb param,bool value ) + [CLSCompliant( false )] + public static void Source( uint sid, Enums.ALSourceb param, bool value ) { - Source(sid,(Enums.ALSourcei) param,( value ) ? 1 : 0); + Source( sid, (Enums.ALSourcei) param, ( value ) ? 1 : 0 ); + } + + /// This function sets an bool property of a source. + /// Source name whose attribute is being set. + /// The name of the attribute to set: ALSourceb.SourceRelative, Looping. + /// The value to set the attribute to. + [CLSCompliant( true )] + public static void Source( int sid, Enums.ALSourceb param, bool value ) + { + Source( (uint) sid, (Enums.ALSourcei) param, ( value ) ? 1 : 0 ); } /// (Helper) Binds a Buffer to a Source handle. /// Source name to attach the Buffer to. /// Buffer name which is attached to the Source. - [CLSCompliant(false)] - public static void BindBufferToSource( uint source,uint buffer ) + [CLSCompliant( false )] + public static void BindBufferToSource( uint source, uint buffer ) { - Source(source,Enums.ALSourcei.Buffer,(int)buffer); + Source( source, Enums.ALSourcei.Buffer, (int) buffer ); } + /// (Helper) Binds a Buffer to a Source handle. + /// Source name to attach the Buffer to. + /// Buffer name which is attached to the Source. + [CLSCompliant( true )] + public static void BindBufferToSource( int source, int buffer ) + { + Source( (uint) source, Enums.ALSourcei.Buffer, buffer ); + } + + #endregion Sourcei + + #region Source3i + /// This function sets 3 integer properties of a source. This property is used to establish connections between Sources and Auxiliary Effect Slots. /// Source name whose attribute is being set. /// The name of the attribute to set: EfxAuxiliarySendFilter /// The value to set the attribute to. (EFX Extension) The destination Auxiliary Effect Slot ID /// The value to set the attribute to. (EFX Extension) The Auxiliary Send number. ///The value to set the attribute to. (EFX Extension) optional Filter ID. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSource3i",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void Source( uint sid,Enums.ALSource3i param,int value1,int value2,int value3 ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSource3i", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void Source( uint sid, Enums.ALSource3i param, int value1, int value2, int value3 ); // AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); + /// This function sets 3 integer properties of a source. This property is used to establish connections between Sources and Auxiliary Effect Slots. + /// Source name whose attribute is being set. + /// The name of the attribute to set: EfxAuxiliarySendFilter + /// The value to set the attribute to. (EFX Extension) The destination Auxiliary Effect Slot ID + /// The value to set the attribute to. (EFX Extension) The Auxiliary Send number. + ///The value to set the attribute to. (EFX Extension) optional Filter ID. + [CLSCompliant( true )] + public static void Source( int sid, Enums.ALSource3i param, int value1, int value2, int value3 ) + { + Source( (uint) sid, param, value1, value2, value3 ); + } + + #endregion Source3i + // Not used by any Enum: // AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values ); // AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values ); @@ -525,57 +685,126 @@ namespace OpenTK.OpenAL #region Get Source parameters + #region GetSourcef + /// This function retrieves a floating point property of a source. /// Source name whose attribute is being retrieved. /// The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency. /// A pointer to the floating point value being retrieved - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGetSourcef",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetSource( uint sid,Enums.ALSourcef param,[Out] out float value ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetSourcef", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void GetSource( uint sid, Enums.ALSourcef param, [Out] out float value ); // AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value ); + /// This function retrieves a floating point property of a source. + /// Source name whose attribute is being retrieved. + /// The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency. + /// A pointer to the floating point value being retrieved + [CLSCompliant( true )] + public static void GetSource( int sid, Enums.ALSourcef param, out float value ) + { + GetSource( (uint) sid, param, out value ); + } + + #endregion GetSourcef + + #region GetSource3f + /// This function retrieves three floating point values representing a property of a source. /// Source name whose attribute is being retrieved. /// the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction. /// Pointer to the value to retrieve. /// Pointer to the value to retrieve. /// Pointer to the value to retrieve. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGetSource3f",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetSource( uint sid,Enums.ALSource3f param,[Out] out float value1,[Out] out float value2,[Out] out float value3 ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetSource3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void GetSource( uint sid, Enums.ALSource3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3 ); // AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); /// This function retrieves three floating point values representing a property of a source. /// Source name whose attribute is being retrieved. /// the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction. - /// A Math.Vector3 to retrieve the values to. - [CLSCompliant(false)] - public static void GetSource( uint sid,Enums.ALSource3f param,out Vector3 values ) + /// Pointer to the value to retrieve. + /// Pointer to the value to retrieve. + /// Pointer to the value to retrieve. + [CLSCompliant( true )] + public static void GetSource( int sid, Enums.ALSource3f param, out float value1, out float value2, out float value3 ) { - GetSource(sid,param,out values.X,out values.Y,out values.Z); + GetSource( (uint) sid, param, out value1, out value2, out value3 ); } + /// This function retrieves three floating point values representing a property of a source. + /// Source name whose attribute is being retrieved. + /// the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction. + /// A Math.Vector3 to retrieve the values to. + [CLSCompliant( false )] + public static void GetSource( uint sid, Enums.ALSource3f param, out Vector3 values ) + { + GetSource( sid, param, out values.X, out values.Y, out values.Z ); + } + + /// This function retrieves three floating point values representing a property of a source. + /// Source name whose attribute is being retrieved. + /// the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction. + /// A Math.Vector3 to retrieve the values to. + [CLSCompliant( true )] + public static void GetSource( int sid, Enums.ALSource3f param, out Vector3 values ) + { + GetSource( (uint) sid, param, out values.X, out values.Y, out values.Z ); + } + + #endregion GetSource3f + + #region GetSourcei + /// This function retrieves an integer property of a source. /// Source name whose attribute is being retrieved. /// The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed. /// A pointer to the integer value being retrieved. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGetSourcei",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetSource( uint sid,Enums.ALGetSourcei param,[Out] out int value ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetSourcei", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void GetSource( uint sid, Enums.ALGetSourcei param, [Out] out int value ); // AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value ); + /// This function retrieves an integer property of a source. + /// Source name whose attribute is being retrieved. + /// The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed. + /// A pointer to the integer value being retrieved. + [CLSCompliant( true )] + public static void GetSource( int sid, Enums.ALGetSourcei param, out int value ) + { + GetSource( (uint) sid, param, out value ); + } + /// This function retrieves a bool property of a source. /// Source name whose attribute is being retrieved. /// The name of the attribute to get: ALSourceb.SourceRelative, Looping. /// A pointer to the bool value being retrieved. - [CLSCompliant(false)] - public static void GetSource( uint sid,Enums.ALSourceb param,[Out] out bool value ) + [CLSCompliant( false )] + public static void GetSource( uint sid, Enums.ALSourceb param, out bool value ) { int result; - GetSource(sid,(Enums.ALGetSourcei) param,out result); + GetSource( sid, (Enums.ALGetSourcei) param, out result ); if ( result == 1 ) value = true; else value = false; } + /// This function retrieves a bool property of a source. + /// Source name whose attribute is being retrieved. + /// The name of the attribute to get: ALSourceb.SourceRelative, Looping. + /// A pointer to the bool value being retrieved. + [CLSCompliant( true )] + public static void GetSource( int sid, Enums.ALSourceb param, out bool value ) + { + int result; + GetSource( (uint) sid, (Enums.ALGetSourcei) param, out result ); + if ( result == 1 ) + value = true; + else + value = false; + } + + #endregion GetSourcei + // Not used by any Enum: // AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); // AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values ); @@ -585,21 +814,26 @@ namespace OpenTK.OpenAL #region Source vector based playback calls - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourcePlayv"),SuppressUnmanagedCodeSecurity] - unsafe public static extern void SourcePlay( int ns,[In] uint* sids ); + #region SourcePlay + + /// This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state. + /// The number of sources to be played. + /// A pointer to an array of sources to be played. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcePlayv" ), SuppressUnmanagedCodeSecurity] + unsafe public static extern void SourcePlay( int ns, [In] uint* sids ); // AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids ); /// This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state. /// The number of sources to be played. /// A pointer to an array of sources to be played. - [CLSCompliant(false)] - public static void SourcePlay( int ns,[In] uint[] sids ) + [CLSCompliant( false )] + public static void SourcePlay( int ns, uint[] sids ) { unsafe { fixed ( uint* ptr = sids ) { - SourcePlay(ns,ptr); + SourcePlay( ns, ptr ); } } } @@ -607,33 +841,54 @@ namespace OpenTK.OpenAL /// This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state. /// The number of sources to be played. /// A pointer to an array of sources to be played. - [CLSCompliant(false)] - public static void SourcePlay( int ns,[In] ref uint sids ) + [CLSCompliant( true )] + public static void SourcePlay( int ns, int[] sids ) + { + uint[] temp = new uint[ns]; + for ( int i = 0; i < ns; i++ ) + { + temp[i] = (uint) sids[i]; + } + SourcePlay( ns, temp ); + } + + /// This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state. + /// The number of sources to be played. + /// A pointer to an array of sources to be played. + [CLSCompliant( false )] + public static void SourcePlay( int ns, ref uint sids ) { unsafe { fixed ( uint* ptr = &sids ) { - SourcePlay(ns,ptr); + SourcePlay( ns, ptr ); } } } - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourceStopv"),SuppressUnmanagedCodeSecurity] - unsafe public static extern void SourceStop( int ns,[In] uint* sids ); + #endregion SourcePlay + + #region SourceStop + + /// This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped. + /// The number of sources to stop. + /// A pointer to an array of sources to be stopped. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceStopv" ), SuppressUnmanagedCodeSecurity] + unsafe public static extern void SourceStop( int ns, [In] uint* sids ); // AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids ); /// This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped. /// The number of sources to stop. /// A pointer to an array of sources to be stopped. - [CLSCompliant(false)] - public static void SourceStop( int ns,[In] uint[] sids ) + [CLSCompliant( false )] + public static void SourceStop( int ns, uint[] sids ) { unsafe { fixed ( uint* ptr = sids ) { - SourceStop(ns,ptr); + SourceStop( ns, ptr ); } } } @@ -641,33 +896,54 @@ namespace OpenTK.OpenAL /// This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped. /// The number of sources to stop. /// A pointer to an array of sources to be stopped. - [CLSCompliant(false)] - public static void SourceStop( int ns,[In] ref uint sids ) + [CLSCompliant( true )] + public static void SourceStop( int ns, int[] sids ) + { + uint[] temp = new uint[ns]; + for ( int i = 0; i < ns; i++ ) + { + temp[i] = (uint) sids[i]; + } + SourceStop( ns, temp ); + } + + /// This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped. + /// The number of sources to stop. + /// A pointer to an array of sources to be stopped. + [CLSCompliant( false )] + public static void SourceStop( int ns, ref uint sids ) { unsafe { fixed ( uint* ptr = &sids ) { - SourceStop(ns,ptr); + SourceStop( ns, ptr ); } } } - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourceRewindv"),SuppressUnmanagedCodeSecurity] - unsafe public static extern void SourceRewind( int ns,[In] uint* sids ); + #endregion SourceStop + + #region SourceRewind + + /// This function stops a set of sources and sets all their states to ALSourceState.Initial. + /// The number of sources to be rewound. + /// A pointer to an array of sources to be rewound. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceRewindv" ), SuppressUnmanagedCodeSecurity] + unsafe public static extern void SourceRewind( int ns, [In] uint* sids ); // AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids ); /// This function stops a set of sources and sets all their states to ALSourceState.Initial. /// The number of sources to be rewound. /// A pointer to an array of sources to be rewound. - [CLSCompliant(false)] - public static void SourceRewind( int ns,[In] uint[] sids ) + [CLSCompliant( false )] + public static void SourceRewind( int ns, uint[] sids ) { unsafe { fixed ( uint* ptr = sids ) { - SourceRewind(ns,ptr); + SourceRewind( ns, ptr ); } } } @@ -675,156 +951,286 @@ namespace OpenTK.OpenAL /// This function stops a set of sources and sets all their states to ALSourceState.Initial. /// The number of sources to be rewound. /// A pointer to an array of sources to be rewound. - [CLSCompliant(false)] - public static void SourceRewind( int ns,[In] ref uint sids ) + [CLSCompliant( true )] + public static void SourceRewind( int ns, int[] sids ) + { + uint[] temp = new uint[ns]; + for ( int i = 0; i < ns; i++ ) + { + temp[i] = (uint) sids[i]; + } + SourceRewind( ns, temp ); + } + + /// This function stops a set of sources and sets all their states to ALSourceState.Initial. + /// The number of sources to be rewound. + /// A pointer to an array of sources to be rewound. + [CLSCompliant( false )] + public static void SourceRewind( int ns, ref uint sids ) { unsafe { fixed ( uint* ptr = &sids ) { - SourceRewind(ns,ptr); + SourceRewind( ns, ptr ); } } } - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourcePausev"),SuppressUnmanagedCodeSecurity] - unsafe public static extern void SourcePause( int ns,[In] uint* sids ); + #endregion SourceRewind + + #region SourcePause + + /// This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused. + /// The number of sources to be paused. + /// A pointer to an array of sources to be paused. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcePausev" ), SuppressUnmanagedCodeSecurity] + unsafe public static extern void SourcePause( int ns, [In] uint* sids ); // AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids ); /// This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused. /// The number of sources to be paused. /// A pointer to an array of sources to be paused. - [CLSCompliant(false)] - public static void SourcePause( int ns,[In] uint[] sids ) + [CLSCompliant( false )] + public static void SourcePause( int ns, uint[] sids ) { unsafe { fixed ( uint* ptr = sids ) { - SourcePause(ns,ptr); + SourcePause( ns, ptr ); } } } + /// This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused. + /// The number of sources to be paused. + /// A pointer to an array of sources to be paused. + [CLSCompliant( true )] + public static void SourcePause( int ns, int[] sids ) + { + uint[] temp = new uint[ns]; + for ( int i = 0; i < ns; i++ ) + { + temp[i] = (uint) sids[i]; + } + SourcePause( ns, temp ); + } /// This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused. /// The number of sources to be paused. /// A pointer to an array of sources to be paused. - [CLSCompliant(false)] - public static void SourcePause( int ns,[In] ref uint sids ) + [CLSCompliant( false )] + public static void SourcePause( int ns, ref uint sids ) { unsafe { fixed ( uint* ptr = &sids ) { - SourcePause(ns,ptr); + SourcePause( ns, ptr ); } } } + #endregion SourcePause + #endregion Source vector based playback calls #region Source based playback calls + #region SourcePlay + /// This function plays, replays or resumes a source. The playing source will have it's state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state. /// The name of the source to be played. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourcePlay",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcePlay", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void SourcePlay( uint sid ); // AL_API void AL_APIENTRY alSourcePlay( ALuint sid ); + /// This function plays, replays or resumes a source. The playing source will have it's state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state. + /// The name of the source to be played. + [CLSCompliant( true )] + public static void SourcePlay( int sid ) + { + SourcePlay( (uint) sid ); + } + + #endregion SourcePlay + + #region SourceStop + /// This function stops a source. The stopped source will have it's state changed to ALSourceState.Stopped. /// The name of the source to be stopped. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourceStop",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void SourceStop( uint sid ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceStop", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void SourceStop( uint sid ); // AL_API void AL_APIENTRY alSourceStop( ALuint sid ); + /// This function stops a source. The stopped source will have it's state changed to ALSourceState.Stopped. + /// The name of the source to be stopped. + [CLSCompliant( true )] + public static void SourceStop( int sid ) + { + SourceStop( (uint) sid ); + } + + #endregion SourceStop + + #region SourceRewind + /// This function stops the source and sets its state to ALSourceState.Initial. /// The name of the source to be rewound. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourceRewind",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void SourceRewind( uint sid ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceRewind", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void SourceRewind( uint sid ); // AL_API void AL_APIENTRY alSourceRewind( ALuint sid ); + /// This function stops the source and sets its state to ALSourceState.Initial. + /// The name of the source to be rewound. + [CLSCompliant( true )] + public static void SourceRewind( int sid ) + { + SourceRewind( (uint) sid ); + } + + #endregion SourceRewind + + #region SourcePause + /// This function pauses a source. The paused source will have its state changed to ALSourceState.Paused. /// The name of the source to be paused. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourcePause",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void SourcePause( uint sid ); + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcePause", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void SourcePause( uint sid ); // AL_API void AL_APIENTRY alSourcePause( ALuint sid ); + /// This function pauses a source. The paused source will have its state changed to ALSourceState.Paused. + /// The name of the source to be paused. + [CLSCompliant( true )] + public static void SourcePause( int sid ) + { + SourcePause( (uint) sid ); + } + + #endregion SourcePause + #endregion Source based playback calls #region Source Queuing - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourceQueueBuffers"),SuppressUnmanagedCodeSecurity] - unsafe public static extern void SourceQueueBuffers( uint sid,int numEntries,[In] uint* bids ); + #region SourceQueueBuffers + + /// This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming. + /// The name of the source to queue buffers onto. + /// The number of buffers to be queued. + /// A pointer to an array of buffer names to be queued. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceQueueBuffers" ), SuppressUnmanagedCodeSecurity] + unsafe public static extern void SourceQueueBuffers( uint sid, int numEntries, [In] uint* bids ); // AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids ); - /// This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using an alSourcei call to retrieve AL_BUFFERS_PROCESSED. When first created, a source will be of type AL_UNDETERMINED. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming. + /// This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming. /// The name of the source to queue buffers onto. /// The number of buffers to be queued. /// A pointer to an array of buffer names to be queued. - [CLSCompliant(false)] - public static void SourceQueueBuffers( uint sid,int numEntries,[In] uint[] bids ) + [CLSCompliant( false )] + public static void SourceQueueBuffers( uint sid, int numEntries, uint[] bids ) { unsafe { fixed ( uint* ptr = bids ) { - SourceQueueBuffers(sid,numEntries,ptr); + SourceQueueBuffers( sid, numEntries, ptr ); } } } - /// This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using an alSourcei call to retrieve AL_BUFFERS_PROCESSED. When first created, a source will be of type AL_UNDETERMINED. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming. + /// This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming. /// The name of the source to queue buffers onto. /// The number of buffers to be queued. /// A pointer to an array of buffer names to be queued. - [CLSCompliant(false)] - public static void SourceQueueBuffers( uint sid,int numEntries,[In] ref uint bids ) + [CLSCompliant( true )] + public static void SourceQueueBuffers( int sid, int numEntries, int[] bids ) + { + uint[] temp = new uint[numEntries]; + for ( int i = 0; i < numEntries; i++ ) + { + temp[i] = (uint) bids[i]; + } + SourceQueueBuffers( (uint) sid, numEntries, temp ); + } + + /// This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming. + /// The name of the source to queue buffers onto. + /// The number of buffers to be queued. + /// A pointer to an array of buffer names to be queued. + [CLSCompliant( false )] + public static void SourceQueueBuffers( uint sid, int numEntries, ref uint bids ) { unsafe { fixed ( uint* ptr = &bids ) { - SourceQueueBuffers(sid,numEntries,ptr); + SourceQueueBuffers( sid, numEntries, ptr ); } } } - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alSourceUnqueueBuffers"),SuppressUnmanagedCodeSecurity] - unsafe public static extern void SourceUnqueueBuffers( uint sid,int numEntries,[In] uint* bids ); + #endregion SourceQueueBuffers + + #region SourceUnqueueBuffers + + /// This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue. + /// The name of the source to unqueue buffers from. + /// The number of buffers to be unqueued. + /// A pointer to an array of buffer names that were removed. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceUnqueueBuffers" ), SuppressUnmanagedCodeSecurity] + unsafe public static extern void SourceUnqueueBuffers( uint sid, int numEntries, [In] uint* bids ); // AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); - /// This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using an alSourcei call to retrieve AL_BUFFERS_PROCESSED, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue. + /// This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue. /// The name of the source to unqueue buffers from. /// The number of buffers to be unqueued. /// A pointer to an array of buffer names that were removed. - [CLSCompliant(false)] - public static void SourceUnqueueBuffers( uint sid,int numEntries,[In] uint[] bids ) + [CLSCompliant( false )] + public static void SourceUnqueueBuffers( uint sid, int numEntries, uint[] bids ) { unsafe { fixed ( uint* ptr = bids ) { - SourceUnqueueBuffers(sid,numEntries,ptr); + SourceUnqueueBuffers( sid, numEntries, ptr ); } } } - /// This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using an alSourcei call to retrieve AL_BUFFERS_PROCESSED, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue. + /// This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue. /// The name of the source to unqueue buffers from. /// The number of buffers to be unqueued. /// A pointer to an array of buffer names that were removed. - [CLSCompliant(false)] - public static void SourceUnqueueBuffers( uint sid,int numEntries,[In] ref uint bids ) + [CLSCompliant( true )] + public static void SourceUnqueueBuffers( int sid, int numEntries, int[] bids ) + { + uint[] temp = new uint[numEntries]; + for ( int i = 0; i < numEntries; i++ ) + { + temp[i] = (uint) bids[i]; + } + SourceUnqueueBuffers( (uint) sid, numEntries, temp ); + } + + /// This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue. + /// The name of the source to unqueue buffers from. + /// The number of buffers to be unqueued. + /// A pointer to an array of buffer names that were removed. + [CLSCompliant( false )] + public static void SourceUnqueueBuffers( uint sid, int numEntries, ref uint bids ) { unsafe { fixed ( uint* ptr = &bids ) { - SourceUnqueueBuffers(sid,numEntries,ptr); + SourceUnqueueBuffers( sid, numEntries, ptr ); } } } + #endregion SourceUnqueueBuffers + #endregion Source Queuing /* @@ -843,84 +1249,176 @@ namespace OpenTK.OpenAL #region Buffer objects - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGenBuffers",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - unsafe public static extern void GenBuffers( int n,[Out] uint* buffers ); + #region GenBuffers + + /// This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers). + /// The number of buffers to be generated. + /// Pointer to an array of uint values which will store the names of the new buffers. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + unsafe public static extern void GenBuffers( int n, [Out] uint* buffers ); // AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* Buffers ); /// This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers). /// The number of buffers to be generated. /// Pointer to an array of uint values which will store the names of the new buffers. - [CLSCompliant(false)] - public static void GenBuffers( int n,out uint buffers ) + [CLSCompliant( false )] + public static void GenBuffers( int n, out uint buffers ) { unsafe { fixed ( uint* ptr = &buffers ) { - GenBuffers(n,(uint*) ptr); + GenBuffers( n, (uint*) ptr ); buffers = *ptr; } } } - /// This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers). - /// Pointer to an uint value which will store the name of the new buffer. - [CLSCompliant(false)] - public static void GenBuffers( out uint buffer ) + /// This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers). + /// The number of buffers to be generated. + /// Pointer to an array of uint values which will store the names of the new buffers. + [CLSCompliant( true )] + public static void GenBuffers( int n, out int[] buffers ) { - GenBuffers(1,out buffer); + uint[] temp = new uint[n]; + GenBuffers( n, out temp[0] ); + buffers = new int[n]; + for ( int i = 0; i < n; i++ ) + { + buffers[i] = (int) temp[i]; + } } - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alDeleteBuffers",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - unsafe public static extern void DeleteBuffers( int n,[In] uint* buffers ); + /// This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers). + /// Pointer to an uint value which will store the name of the new buffer. + [CLSCompliant( false )] + public static void GenBuffers( out uint buffer ) + { + GenBuffers( 1, out buffer ); + } + + /// This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers). + /// Pointer to an uint value which will store the name of the new buffer. + [CLSCompliant( true )] + public static void GenBuffers( out int buffer ) + { + uint temp; + GenBuffers( 1, out temp ); + buffer = (int) temp; + } + + #endregion GenBuffers + + #region DeleteBuffers + + /// This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source. + /// The number of buffers to be deleted. + /// Pointer to an array of buffer names identifying the buffers to be deleted. + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alDeleteBuffers", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + unsafe public static extern void DeleteBuffers( int n, [In] uint* buffers ); // AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* Buffers ); /// This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source. /// The number of buffers to be deleted. /// Pointer to an array of buffer names identifying the buffers to be deleted. - [CLSCompliant(false)] - public static void DeleteBuffers( int n,ref uint[] buffers ) + [CLSCompliant( false )] + public static void DeleteBuffers( int n, ref uint[] buffers ) { unsafe { fixed ( uint* ptr = buffers ) { - DeleteBuffers(n,(uint*) ptr); + DeleteBuffers( n, (uint*) ptr ); } } } + /// This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source. + /// The number of buffers to be deleted. + /// Pointer to an array of buffer names identifying the buffers to be deleted. + [CLSCompliant( true )] + public static void DeleteBuffers( int n, ref int[] buffers ) + { + uint[] temp = new uint[n]; + for ( int i = 0; i < n; i++ ) + { + temp[i] = (uint) buffers[i]; + } + DeleteBuffers( n, ref temp ); + } + /// This function deletes one buffer only, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source. /// Pointer to a buffer name identifying the buffer to be deleted. - [CLSCompliant(false)] + [CLSCompliant( false )] public static void DeleteBuffers( ref uint buffer ) { unsafe { fixed ( uint* ptr = &buffer ) { - DeleteBuffers(1,(uint*) ptr); + DeleteBuffers( 1, (uint*) ptr ); } } } + /// This function deletes one buffer only, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source. + /// Pointer to a buffer name identifying the buffer to be deleted. + [CLSCompliant( true )] + public static void DeleteBuffers( ref int buffer ) + { + uint temp = (uint) buffer; + DeleteBuffers( ref temp ); + } + + #endregion DeleteBuffers + + #region IsBuffer + /// This function tests if a buffer name is valid, returning True if valid, False if not. /// A buffer Handle previously allocated with . /// Success. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alIsBuffer",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alIsBuffer", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern bool IsBuffer( uint bid ); // AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid ); + /// This function tests if a buffer name is valid, returning True if valid, False if not. + /// A buffer Handle previously allocated with . + /// Success. + [CLSCompliant( true )] + public static bool IsBuffer( int bid ) + { + uint temp = (uint) bid; + return IsBuffer( temp ); + } + + #endregion IsBuffer + + #region BufferData + /// This function fills a buffer with audio data. All the pre-defined formats are PCM data, but this function may be used by extensions to load other data types as well. /// buffer Handle/Name to be filled with data. /// Format type from among the following: ALFormat.Mono8, ALFormat.Mono16, ALFormat.Stereo8, ALFormat.Stereo16. /// Pointer to the audio data. YOU MUST PIN THIS MANUALLY. /// The size of the audio data in bytes. /// The frequency of the audio data. - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alBufferData",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void BufferData( uint bid,Enums.ALFormat format,IntPtr data,int size,int freq ); // Specify the data to be copied into a Buffer + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alBufferData", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void BufferData( uint bid, Enums.ALFormat format, IntPtr data, int size, int freq ); // AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq ); + /// This function fills a buffer with audio data. All the pre-defined formats are PCM data, but this function may be used by extensions to load other data types as well. + /// buffer Handle/Name to be filled with data. + /// Format type from among the following: ALFormat.Mono8, ALFormat.Mono16, ALFormat.Stereo8, ALFormat.Stereo16. + /// Pointer to the audio data. YOU MUST PIN THIS MANUALLY. + /// The size of the audio data in bytes. + /// The frequency of the audio data. + [CLSCompliant( true )] + public static void BufferData( int bid, Enums.ALFormat format, IntPtr data, int size, int freq ) + { + BufferData( (uint) bid, format, data, size, freq ); + } + + #endregion BufferData + #endregion Buffer objects #region Set Buffer parameters (currently parameters can only be read) @@ -951,14 +1449,28 @@ namespace OpenTK.OpenAL #region Get Buffer parameters + #region GetBufferi + /// This function retrieves an integer property of a buffer. /// Buffer name whose attribute is being retrieved /// The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous). - /// A pointer to an ALint to hold the retrieved data - [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGetBufferi",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetBuffer( uint bid,Enums.ALGetBufferi param,[Out] out int value ); + /// A pointer to an int to hold the retrieved data + [CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetBufferi", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] + public static extern void GetBuffer( uint bid, Enums.ALGetBufferi param, [Out] out int value ); // AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value ); + /// This function retrieves an integer property of a buffer. + /// Buffer name whose attribute is being retrieved + /// The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous). + /// A pointer to an int to hold the retrieved data + [CLSCompliant( true )] + public static void GetBuffer( int bid, Enums.ALGetBufferi param, out int value ) + { + GetBuffer( (uint) bid, param, out value ); + } + + #endregion GetBufferi + // AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value ); // AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); // AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values ); @@ -971,19 +1483,19 @@ namespace OpenTK.OpenAL /// AL.DopplerFactor is a simple scaling of source and listener velocities to exaggerate or deemphasize the Doppler (pitch) shift resulting from the calculation. /// A negative value will result in an error, the command is then ignored. The default value is 1f. The current setting can be queried using AL.Get with parameter ALGetFloat.SpeedOfSound. - [DllImport(AL.Lib,EntryPoint = "alDopplerFactor",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alDopplerFactor", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void DopplerFactor( float value ); // AL_API void AL_APIENTRY alDopplerFactor( ALfloat value ); /// This function is deprecated and should not be used. /// The default is 1.0f. - [DllImport(AL.Lib,EntryPoint = "alDopplerVelocity",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alDopplerVelocity", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void DopplerVelocity( float value ); // AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value ); /// AL.SpeedOfSound allows the application to change the reference (propagation) speed used in the Doppler calculation. The source and listener velocities should be expressed in the same units as the speed of sound. /// A negative or zero value will result in an error, and the command is ignored. Default: 343.3f (appropriate for velocity units of meters and air as the propagation medium). The current setting can be queried using AL.Get with parameter ALGetFloat.SpeedOfSound. - [DllImport(AL.Lib,EntryPoint = "alSpeedOfSound",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alSpeedOfSound", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void SpeedOfSound( float value ); // AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value ); @@ -1018,7 +1530,7 @@ namespace OpenTK.OpenAL /// gain = 1f; /// /// - [DllImport(AL.Lib,EntryPoint = "alDistanceModel",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] + [DllImport( AL.Lib, EntryPoint = "alDistanceModel", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )] public static extern void DistanceModel( Enums.ALDistanceModel distancemodel ); // AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel ); diff --git a/Source/OpenTK/Audio/OpenAL/AL/XRam.cs b/Source/OpenTK/Audio/OpenAL/AL/XRam.cs index 9680d874..38c6f1f7 100644 --- a/Source/OpenTK/Audio/OpenAL/AL/XRam.cs +++ b/Source/OpenTK/Audio/OpenAL/AL/XRam.cs @@ -15,6 +15,7 @@ namespace OpenTK.OpenAL { /// The X-Ram Extension is provided on the top-end Sound Blaster X-Fi solutions (Sound Blaster X-Fi Fatal1ty, Sound Blaster X-Fi Elite Pro, or later). These products feature 64MB of X-Ram that can only be used for audio purposes, which can be controlled by this Extension. + [CLSCompliant( true )] public class XRamExtension { #region Instance state @@ -31,11 +32,11 @@ namespace OpenTK.OpenAL #region X-RAM Function pointer definitions - //[CLSCompliant(false)] + // [CLSCompliant(false)] private delegate bool Delegate_SetBufferMode( int n, ref uint buffers, int value ); //typedef ALboolean (__cdecl *EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value); - [CLSCompliant( false )] + // [CLSCompliant( false )] private delegate int Delegate_GetBufferMode( uint buffer, IntPtr value ); //typedef ALenum (__cdecl *EAXGetBufferMode)(ALuint buffer, ALint *value); @@ -140,6 +141,18 @@ namespace OpenTK.OpenAL } } + /// This function is used to set the storage Mode of an array of OpenAL Buffers. + /// The number of OpenAL Buffers pointed to by buffer. + /// An array of OpenAL Buffer handles. + /// The storage mode that should be used for all the given buffers. Should be the value of one of the following enum names: XRamStorage.Automatic, XRamStorage.Hardware, XRamStorage.Accessible + /// True if all the Buffers were successfully set to the requested storage mode, False otherwise. + [CLSCompliant( true )] + public bool SetBufferMode( int n, ref int buffer, XRamStorage mode ) + { + uint temp = (uint) buffer; + return SetBufferMode( n, ref temp, mode ); + } + /// This function is used to retrieve the storage Mode of a single OpenAL Buffer. /// The handle of an OpenAL Buffer. /// The current Mode of the Buffer. @@ -156,6 +169,16 @@ namespace OpenTK.OpenAL return XRamStorage.Automatic; } + /// This function is used to retrieve the storage Mode of a single OpenAL Buffer. + /// The handle of an OpenAL Buffer. + /// The current Mode of the Buffer. + [CLSCompliant( true )] + public XRamStorage GetBufferMode( ref int buffer ) + { + uint temp = (uint) buffer; + return GetBufferMode( ref temp ); + } + #endregion Public Methods }