diff --git a/Source/OpenTK/OpenAL/AlFunctions.cs b/Source/OpenTK/OpenAL/AlFunctions.cs
index ab4e076a..fe59770d 100644
--- a/Source/OpenTK/OpenAL/AlFunctions.cs
+++ b/Source/OpenTK/OpenAL/AlFunctions.cs
@@ -3,16 +3,8 @@
* C header: \OpenAL 1.1 SDK\include\Al.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
- * See license.txt for license details (MIT)
- * http://www.OpenTK.net
- */
-
-/* Version History:
- * 0.1
- *
- *
- *
- */
+ * See license.txt for license details
+ * http://www.OpenTK.net */
#endregion
using System;
@@ -73,15 +65,19 @@ typedef void ALvoid;
namespace OpenTK.OpenAL
{
+
// Al = Audio Library
- public static class Al
+ public static class AL
{
#region Constants
- public const string Lib = "OpenAL32.dll";
+
+ public const string Lib = "openal32.dll";
private const CallingConvention Style = CallingConvention.Cdecl;
+
#endregion Constants
#region Type Helpers
+
/// An IntPtr.Zero that can be used as Al.Null, for convenience.
public static readonly IntPtr Null = IntPtr.Zero; // do NOT touch.
@@ -93,30 +89,52 @@ namespace OpenTK.OpenAL
///Boolean True.
True = 1,
}
+
#endregion Type Helpers
#region Renderer State management
- [DllImport( Al.Lib, EntryPoint = "alEnable", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Enable( Enums.AlCapability capability );
+
+ /// 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()]
+ public static extern void Enable(Enums.ALCapability capability);
//AL_API void AL_APIENTRY alEnable( ALenum capability );
- [DllImport( Al.Lib, EntryPoint = "alDisable", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Disable( Enums.AlCapability 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()]
+ public static extern void Disable(Enums.ALCapability capability);
// AL_API void AL_APIENTRY alDisable( ALenum capability );
- [DllImport( Al.Lib, EntryPoint = "alIsEnabled", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool IsEnabled( Enums.AlCapability 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()]
+ public static extern AL.Bool IsEnabled(Enums.ALCapability capability);
// AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
+
#endregion Renderer State management
#region State retrieval
- [DllImport( Al.Lib, EntryPoint = "alGetString", ExactSpelling = true, CallingConvention = Al.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- private static extern IntPtr GetStringInternal( int param ); // accepts the enums Enums.AlError, Enums.AlContextString
+
+ [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 );
- internal static string GetString( int param )
+ /// This function retrieves an OpenAL string property.
+ /// The property to be returned: AL_VENDOR, AL_VERSION, AL_RENDERER, AL_EXTENSIONS
+ /// Returns a pointer to a null-terminated string.
+ public static string Get(Enums.ALGetString param)
{
- return Marshal.PtrToStringAnsi( GetStringInternal( param ) );
+ return Marshal.PtrToStringAnsi(GetStringPrivate(param));
+ }
+
+ /// This function retrieves an OpenAL string property.
+ /// The human-readable errorstring to be returned.
+ /// Returns a pointer to a null-terminated string.
+ public static string GetErrorString(Enums.ALError param)
+ {
+ return Marshal.PtrToStringAnsi(GetStringPrivate((Enums.ALGetString)param));
}
/* no functions return more than 1 result ..
@@ -126,111 +144,220 @@ namespace OpenTK.OpenAL
// AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
*/
- [DllImport( Al.Lib, EntryPoint = "alGetBoolean", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool alGetBoolean( Enums.AlGlobalTweakage param );
+ /* disabled due to no token using it
+ /// This function returns a boolean OpenAL state.
+ /// the state to be queried: AL_DOPPLER_FACTOR, AL_SPEED_OF_SOUND, AL_DISTANCE_MODEL
+ /// The boolean state described by param will be returned.
+ [DllImport( AL.Lib, EntryPoint = "alGetBoolean", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
+ public static extern AL.Bool Get( Enums.ALGetBoolean param );
// AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
+ */
- [DllImport( Al.Lib, EntryPoint = "alGetInteger", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern int GetInteger( Enums.AlGlobalTweakage param );
+ /// This function returns an integer OpenAL state.
+ /// the state to be queried: AL_DOPPLER_FACTOR, AL_SPEED_OF_SOUND, AL_DISTANCE_MODEL
+ /// The integer state described by param will be returned.
+ [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 );
- [DllImport( Al.Lib, EntryPoint = "alGetFloat", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern float GetFloat( Enums.AlGlobalTweakage param );
+ /// This function returns a floating point OpenAL state.
+ /// the state to be queried: AL_DOPPLER_FACTOR, AL_SPEED_OF_SOUND, AL_DISTANCE_MODEL
+ /// The floating point state described by param will be returned.
+ [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 );
- [DllImport( Al.Lib, EntryPoint = "alGetDouble", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern double GetDouble( Enums.AlGlobalTweakage param );
- // AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
+ /* disabled due to no token using it
+ /// This function returns a double precision floating point OpenAL state.
+ /// the state to be queried: AL_DOPPLER_FACTOR, AL_SPEED_OF_SOUND, AL_DISTANCE_MODEL
+ /// The double value described by param will be returned.
+ [DllImport( AL.Lib, EntryPoint = "alGetDouble", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
+ public static extern double Get( Enums.ALGetDouble param );
+ // AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
+ */
/// 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
- [DllImport( Al.Lib, EntryPoint = "alGetError", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Enums.AlError GetError( );
+ /// 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()]
+ public static extern Enums.ALError GetError();
// AL_API ALenum AL_APIENTRY alGetError( void );
+
#endregion State retrieval
#region Extension support.
- // Query for the presence of an extension, and obtain any appropriate function pointers and enum values.
- [DllImport( Al.Lib, EntryPoint = "alIsExtensionPresent", ExactSpelling = true, CallingConvention = Al.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool IsExtensionPresent( [In] string extname );
+ /// This function tests if a specific extension is available for the OpenAL driver.
+ /// A null-terminated string describing the desired extension.
+ /// Returns AL_TRUE if the extension is available, AL_FALSE if the extension is not available.
+ [DllImport(AL.Lib, EntryPoint = "alIsExtensionPresent", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool IsExtensionPresent([In] string extname);
// AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname );
- [DllImport( Al.Lib, EntryPoint = "alGetProcAddress", ExactSpelling = true, CallingConvention = Al.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr GetProcAddress( [In] string fname );
+ /// This function returns the address of an OpenAL extension function. Handle with care.
+ /// A null-terminated string containing the function name.
+ /// The return value is a pointer to the specified function. The return value will be NULL if the function is not found.
+ [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 );
- [DllImport( Al.Lib, EntryPoint = "alGetEnumValue", ExactSpelling = true, CallingConvention = Al.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern int GetEnumValue( [In] string ename );
+ /// This function returns the enumeration value of an OpenAL enum described by a string.
+ /// A null-terminated string describing an OpenAL enum.
+ /// Returns the actual ALenum described by a string. Returns NULL if the string doesn’t describe a valid OpenAL enum.
+ [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.
- *
- * Properties include: -
- *
- * Gain AL_GAIN ALfloat
- * Position AL_POSITION ALfloat[3]
- * Velocity AL_VELOCITY ALfloat[3]
- * Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
- */
+ * Listener
+ * Listener represents the location and orientation of the
+ * 'user' in 3D-space.
+ *
+ * Properties include: -
+ *
+ * Gain AL_GAIN ALfloat
+ * Position AL_POSITION ALfloat[3]
+ * Velocity AL_VELOCITY ALfloat[3]
+ * Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
+ */
#region Set Listener parameters
+ /// This function sets a floating point property for the listener.
+ /// The name of the attribute to be set: AL_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);
// AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
- [DllImport( Al.Lib, EntryPoint = "alListenerf", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Listenerf( Enums.AlListenerf param, float value );
+ /// This function sets a floating point property for the listener.
+ /// The name of the attribute to set: AL_POSITION, AL_VELOCITY
+ /// 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);
// AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
- [DllImport( Al.Lib, EntryPoint = "alListener3f", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Listener3f( Enums.AlListener3f param, float value1, float value2, float value3 );
- internal static void Listener3f( Enums.AlListener3f param, Vector3 value )
+ /// This function sets a Math.Vector3 property for the listener.
+ /// The name of the attribute to set: AL_POSITION, AL_VELOCITY
+ /// The Math.Vector3 to set the attribute to.
+ public static void Listener(Enums.ALListener3f param, ref Vector3 values)
{
- Listener3f( param, value.X, value.Y, value.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);
// AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
- [DllImport( Al.Lib, EntryPoint = "alListenerfv", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe private static extern void Listenerfv( Enums.AlListenerfv param, float* values );
- internal static void Listenerfv( Enums.AlListenerfv param, ref float[] values )
+ /// This function sets a floating point-vector property of the listener.
+ /// The name of the attribute to be set: AL_POSITION, AL_VELOCITY, AL_ORIENTATION
+ /// Pointer to floating point-vector values.
+ public static void Listener(Enums.ALListenerfv param, ref float[] values)
{
unsafe
{
- fixed ( float* ptr = &values[0] )
+ fixed (float* ptr = &values[0])
{
- Listenerfv( param, ptr );
+ ListenerPrivate(param, ptr);
}
}
}
+ /// This function sets two Math.Vector3 properties of the listener.
+ /// The name of the attribute to be set: AL_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)
+ {
+ float[] temp = new float[6];
+
+ temp[0] = at.X;
+ temp[1] = at.Y;
+ temp[2] = at.Z;
+
+ temp[3] = up.X;
+ temp[4] = up.Y;
+ temp[5] = up.Z;
+
+ unsafe
+ {
+ fixed (float* ptr = &temp[0])
+ {
+ ListenerPrivate(param, ptr);
+ }
+ }
+ }
// AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value );
// AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
// AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
+
#endregion Set Listener parameters
#region Get Listener parameters
+ /// This function retrieves a floating point property of the listener.
+ /// the name of the attribute to be retrieved: AL_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);
// AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
- [DllImport( Al.Lib, EntryPoint = "alGetListenerf", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe internal static extern void GetListenerf( Enums.AlListenerf param, float* value );
+ /// This function retrieves a set of three floating point values from a property of the listener.
+ /// The name of the attribute to be retrieved: AL_POSITION, AL_VELOCITY
+ /// 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);
// AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
- [DllImport( Al.Lib, EntryPoint = "alGetListener3f", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe internal static extern void GetListener3f( Enums.AlListener3f param, float* value1, float* value2, float* value3 );
+ /// This function retrieves a Math.Vector3 from a property of the listener.
+ /// The name of the attribute to be retrieved: AL_POSITION, AL_VELOCITY
+ /// A Math.Vector3 to hold the three floats being retrieved.
+ public static void GetListener(Enums.ALListener3f param, out Vector3 values)
+ {
+ 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: AL_POSITION, AL_VELOCITY, AL_ORIENTATION
+ /// A pointer to the floating point-vector value being retrieved.
+ [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 );
- [DllImport( Al.Lib, EntryPoint = "alGetListenerfv", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe internal static extern void GetListenerfv( Enums.AlListenerfv param, float* values );
+
+ /// This function retrieves two Math.Vector3 properties of the listener.
+ /// the name of the attribute to be retrieved: AL_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)
+ {
+ float[] pinned = new float[6]; // should lose scope when the function exits
+ unsafe
+ {
+ fixed (float* ptr = &pinned[0])
+ {
+ GetListener(param, ptr);
+
+ at.X = pinned[0];
+ at.Y = pinned[1];
+ at.Z = pinned[2];
+
+ up.X = pinned[3];
+ up.Y = pinned[4];
+ up.Z = pinned[5];
+ }
+ }
+ }
// AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value );
// AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
// AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
+
#endregion Get Listener parameters
/*
@@ -272,93 +399,175 @@ namespace OpenTK.OpenAL
*/
#region Create Source objects
- [DllImport( Al.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe private static extern void GenSourcesInternal( int n, [Out] uint* sources );
+
+ [CLSCompliant(false), 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 );
- internal static void GenSources( int n, [Out] out uint sources )
+ /// This function generates one or more sources. References to sources are ALuint values, which are used wherever a source reference is needed (in calls such as alDeleteSources and 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)
{
unsafe
{
- fixed ( uint* ptr = &sources )
+ fixed (uint* ptr = &sources)
{
- GenSourcesInternal( n, (uint*) ptr );
+ GenSourcesPrivate(n, (uint*)ptr);
sources = *ptr;
}
}
}
- [DllImport( Al.Lib, EntryPoint = "alDeleteSources", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe private static extern void DeleteSourcesInternal( int n, [In] uint* sources ); // Delete Source objects
+ /// This function generates one source only. References to sources are ALuint values, which are used wherever a source reference is needed (in calls such as alDeleteSources and 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);
+ }
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alDeleteSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
+ unsafe private static extern void DeleteSourcesPrivate(int n, [In] uint* sources); // Delete Source objects
// AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* Sources );
- internal static void DeleteSources( int n, uint[] 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)
{
unsafe
{
- fixed ( uint* ptr = sources )
+ fixed (uint* ptr = sources)
{
- DeleteSourcesInternal( n, (uint*) ptr );
+ DeleteSourcesPrivate(n, (uint*)ptr);
}
}
}
- [DllImport( Al.Lib, EntryPoint = "alIsSource", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool IsSource( uint sid ); // Verify a handle is a valid Source
+ /// This function deletes one source only.
+ /// Pointer to a source name identifying the source to be deleted.
+ [CLSCompliant(false)]
+ public static void DeleteSources(ref uint source)
+ {
+ uint[] t = new uint[1];
+ t[0] = source;
+ DeleteSources(1, ref t);
+ }
+
+ /// 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 AL.Bool IsSource(uint sid); // Verify a handle is a valid Source
// AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
+
#endregion Create Source objects
#region Set Source parameters
- [DllImport( Al.Lib, EntryPoint = "alSourcef", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Sourcef( uint sid, Enums.AlSourcef param, float 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: AL_PITCH, AL_GAIN, AL_MIN_GAIN, AL_MAX_GAIN, AL_MAX_DISTANCE, AL_ROLLOFF_FACTOR, AL_CONE_OUTER_GAIN, AL_CONE_INNER_ANGLE, AL_CONE_OUTER_ANGLE, AL_REFERENCE_DISTANCE
+ /// 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);
// AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
- [DllImport( Al.Lib, EntryPoint = "alSource3f", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Source3f( uint sid, Enums.AlSource3f param, float value1, float value2, float 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: AL_POSITION, AL_VELOCITY, AL_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);
// AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
- internal static void Sourcev3( uint sid, Enums.AlSource3f param, ref Vector3 values )
+ /// 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: AL_POSITION, AL_VELOCITY, AL_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)
{
- Source3f( sid, param, values.X, values.Y, values.Z );
+ Source(sid, param, values.X, values.Y, values.Z);
}
- [DllImport( Al.Lib, EntryPoint = "alSourcei", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void alSourcei( uint sid, Enums.AlSourcei param, int value );
+ /// This function sets an integer property of a source.
+ /// Source name whose attribute is being set.
+ /// The name of the attribute to set: AL_SOURCE_RELATIVE, AL_CONE_INNER_ANGLE, AL_CONE_OUTER_ANGLE, AL_LOOPING, AL_BUFFER, AL_SOURCE_STATE
+ /// 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);
// AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
- internal static void alSourceBool( uint sid, Enums.AlSourceBool param, bool value )
+ /// This function sets an bool property of a source.
+ /// Source name whose attribute is being set.
+ /// The name of the attribute to set: AL_SOURCE_RELATIVE, AL_LOOPING
+ /// The value to set the attribute to.
+ [CLSCompliant(false)]
+ public static void Source(uint sid, Enums.ALSourceb param, bool value)
{
- alSourcei( sid, (Enums.AlSourcei) param, ( value ) ? 1 : 0 );
+ Source(sid, (Enums.ALSourcei)param, (value) ? 1 : 0);
}
// AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
// AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
// AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
+
#endregion Set Source parameters
#region Get Source parameters
- [DllImport( Al.Lib, EntryPoint = "alGetSourcef", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void GetSourcef( uint sid, Enums.AlSourcef param, [Out] out float value );
+
+ /// This function retrieves a floating point property of a source.
+ /// Source name whose attribute is being retrieved.
+ /// The name of the attribute to retrieve: AL_PITCH, AL_GAIN, AL_MIN_GAIN, AL_MAX_GAIN, AL_MAX_DISTANCE, AL_ROLLOFF_FACTOR, AL_CONE_OUTER_GAIN, AL_CONE_INNER_ANGLE, AL_CONE_OUTER_ANGLE, AL_REFERENCE_DISTANCE
+ /// 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);
// AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
- [DllImport( Al.Lib, EntryPoint = "alGetSource3f", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void GetSource3f( uint sid, Enums.AlSource3f param, [Out] out float value1, [Out] out float value2, [Out] out float 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: AL_POSITION, AL_VELOCITY, AL_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);
// AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
- internal static void GetSource3f( uint sid, Enums.AlSource3f param, out Vector3 values )
+ /// 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: AL_POSITION, AL_VELOCITY, AL_DIRECTION
+ /// A Math.Vector3 to retrieve the values to.
+ [CLSCompliant(false)]
+ public static void GetSource(uint sid, Enums.ALSource3f param, out Vector3 values)
{
- GetSource3f( sid, param, out values.X, out values.Y, out values.Z );
+ GetSource(sid, param, out values.X, out values.Y, out values.Z);
}
- [DllImport( Al.Lib, EntryPoint = "alGetSourcei", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void GetSourcei( uint sid, Enums.AlSourceiGet param, [Out] out int value );
+ /// This function retrieves an integer property of a source.
+ /// Source name whose attribute is being retrieved.
+ /// The name of the attribute to retrieve: AL_SOURCE_RELATIVE, AL_BUFFER, AL_SOURCE_STATE, AL_BUFFERS_QUEUED, AL_BUFFERS_PROCESSED
+ /// 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.ALSourceiGet param, [Out] out int value);
// AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
- public static void GetSourceBool( uint sid, Enums.AlSourceBool param, [Out] out bool value )
+ /// This function retrieves a bool property of a source.
+ /// Source name whose attribute is being retrieved.
+ /// The name of the attribute to get: AL_SOURCE_RELATIVE, AL_LOOPING
+ /// A pointer to the bool value being retrieved.
+ [CLSCompliant(false)]
+ public static void GetSource(uint sid, Enums.ALSourceb param, [Out] out bool value)
{
int result;
- GetSourcei( sid, (Enums.AlSourceiGet) param, out result );
- if ( result == 1 )
+ GetSource(sid, (Enums.ALSourceiGet)param, out result);
+ if (result == 1)
value = true;
else
value = false;
@@ -367,45 +576,251 @@ namespace OpenTK.OpenAL
// AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
// AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
// AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
+
#endregion Get Source parameters
#region Source vector based playback calls
- // Play, replay, or resume (if paused) a list of Sources
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePlayv"), SuppressUnmanagedCodeSecurity]
+ unsafe private static extern void SourcePlayPrivate(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
- // Stop a list of Sources
+ /// This function plays a set of sources. The playing sources will have their state changed to AL_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 AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = sids)
+ {
+ SourcePlayPrivate(ns, ptr);
+ }
+ }
+ }
+
+ /// This function plays a set of sources. The playing sources will have their state changed to AL_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 AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &sids)
+ {
+ SourcePlayPrivate(ns, ptr);
+ }
+ }
+ }
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceStopv"), SuppressUnmanagedCodeSecurity]
+ unsafe private static extern void SourceStopPrivate(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
- // Rewind a list of Sources
+ /// This function stops a set of sources. The stopped sources will have their state changed to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = sids)
+ {
+ SourceStopPrivate(ns, ptr);
+ }
+ }
+ }
+
+ /// This function stops a set of sources. The stopped sources will have their state changed to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &sids)
+ {
+ SourceStopPrivate(ns, ptr);
+ }
+ }
+ }
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceRewindv"), SuppressUnmanagedCodeSecurity]
+ unsafe private static extern void SourceRewindPrivate(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
- // Pause a list of Sources
+ /// This function stops a set of sources and sets all their states to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = sids)
+ {
+ SourceRewindPrivate(ns, ptr);
+ }
+ }
+ }
+
+ /// This function stops a set of sources and sets all their states to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &sids)
+ {
+ SourceRewindPrivate(ns, ptr);
+ }
+ }
+ }
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePausev"), SuppressUnmanagedCodeSecurity]
+ unsafe private static extern void SourcePausePrivate(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 AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = sids)
+ {
+ SourcePausePrivate(ns, ptr);
+ }
+ }
+ }
+
+ /// This function pauses a set of sources. The paused sources will have their state changed to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &sids)
+ {
+ SourcePausePrivate(ns, ptr);
+ }
+ }
+ }
+
#endregion Source vector based playback calls
#region Source based playback calls
- [DllImport( Al.Lib, EntryPoint = "alSourcePlay", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void SourcePlay( uint sid );// Play, replay, or resume a Source
+
+ /// This function plays a source. The playing source will have its state changed to AL_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 AL_STOPPED state.
+ /// The name of the source to be played.
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePlay", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void SourcePlay(uint sid);// Play, replay, or resume a Source
// AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
- [DllImport( Al.Lib, EntryPoint = "alSourceStop", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void SourceStop( uint sid ); // Stop a Source
+ /// This function stops a source. The stopped source will have its state changed to AL_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); // Stop a Source
// AL_API void AL_APIENTRY alSourceStop( ALuint sid );
- [DllImport( Al.Lib, EntryPoint = "alSourceRewind", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void SourceRewind( uint sid );// Rewind a Source (set playback postiton to beginning)
+ /// This function stops the source and sets its state to AL_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);// Rewind a Source (set playback postiton to beginning)
// AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
- [DllImport( Al.Lib, EntryPoint = "alSourcePause", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void SourcePause( uint sid ); // Pause a Source
+ /// This function pauses a source. The paused source will have its state changed to AL_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); // Pause a Source
// AL_API void AL_APIENTRY alSourcePause( ALuint sid );
+
#endregion Source based playback calls
#region Source Queuing
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceQueueBuffers"), SuppressUnmanagedCodeSecurity]
+ unsafe private 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 alSourceQueueBuffers call will change the source type to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = bids)
+ {
+ 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 alSourceQueueBuffers call will change the source type to AL_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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &bids)
+ {
+ SourceQueueBuffers(sid, numEntries, ptr);
+ }
+ }
+ }
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
+ unsafe private 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.
+ /// 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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = bids)
+ {
+ 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.
+ /// 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)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &bids)
+ {
+ SourceUnqueueBuffers(sid, numEntries, ptr);
+ }
+ }
+ }
+
#endregion Source Queuing
/*
@@ -423,176 +838,186 @@ namespace OpenTK.OpenAL
*/
#region Buffer objects
- [DllImport( Al.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe private static extern void GenBuffersInternal( int n, [Out] uint* buffers );
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
+ unsafe private static extern void GenBuffersPrivate(int n, [Out] uint* buffers);
// AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* Buffers );
- internal static void GenBuffers( int n, [Out] out uint buffers )
+ /// This function generates one or more buffers, which contain audio data (see alBufferData). References to buffers are ALuint values, which are used wherever a buffer reference is needed (in calls such as alDeleteBuffers, alSourcei, alSourceQueueBuffers, and alSourceUnqueueBuffers).
+ /// 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)
{
unsafe
{
- fixed ( uint* ptr = &buffers )
+ fixed (uint* ptr = &buffers)
{
- GenBuffersInternal( n, (uint*) ptr );
+ GenBuffersPrivate(n, (uint*)ptr);
buffers = *ptr;
}
}
}
- [DllImport( Al.Lib, EntryPoint = "alDeleteBuffers", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- unsafe private static extern void DeleteBuffersInternal( int n, [In] uint* buffers ); // Delete Buffer objects
+ /// This function generates one buffer only, which contain audio data (see alBufferData). References to buffers are ALuint values, which are used wherever a buffer reference is needed (in calls such as alDeleteBuffers, alSourcei, alSourceQueueBuffers, and alSourceUnqueueBuffers).
+ /// 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);
+ }
+
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alDeleteBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
+ unsafe private static extern void DeleteBuffersPrivate(int n, [In] uint* buffers); // Delete Buffer objects
// AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* Buffers );
- internal static void DeleteBuffers( int n, uint[] 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 alSourcei and alSourceUnqueueBuffers 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)
{
unsafe
{
- fixed ( uint* ptr = buffers )
+ fixed (uint* ptr = buffers)
{
- DeleteBuffersInternal( n, (uint*) ptr );
+ DeleteBuffersPrivate(n, (uint*)ptr);
}
}
}
- ///
- /// Verify a handle is a valid Buffer
- ///
- /// a buffer previously allocated with .
- /// success
- [DllImport( Al.Lib, EntryPoint = "alIsBuffer", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool IsBuffer( uint bid );
+ /// 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 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)]
+ public static void DeleteBuffers(ref uint buffer)
+ {
+ unsafe
+ {
+ fixed (uint* ptr = &buffer)
+ {
+ DeleteBuffersPrivate(1, (uint*)ptr);
+ }
+ }
+ }
+
+ /// This function tests if a buffer name is valid, returning AL_TRUE if valid, AL_FALSE if not.
+ /// A buffer Handle previously allocated with .
+ /// Success.
+ [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alIsBuffer", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool IsBuffer(uint bid);
// AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
- [DllImport( Al.Lib, EntryPoint = "alBufferData", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void BufferData( uint bid, Enums.AlFormat format, IntPtr data, int size, int freq ); // Specify the data to be copied into a Buffer
+ /// 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: AL_FORMAT_MONO8, AL_FORMAT_MONO16, AL_FORMAT_STEREO8, AL_FORMAT_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
// AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
+
#endregion Buffer objects
#region Set Buffer parameters (currently parameters can only be read)
+
+ /*
+ Remarks (from Manual)
+ * There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by this call,
+ * but this function may be used by OpenAL extensions.
+
// AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
-
- // AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
- /* [DllImport( Al.Lib, EntryPoint = "alBuffer3f", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void Buffer3f( uint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-
- internal static void Bufferv3( uint bid, Alenum param, ref Vector3 values )
- {
- Buffer3f( bid, param, values.X, values.Y, values.Z );
- }*/
-
// AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
// AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
// AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
// AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
+ // AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
+ */
+ /*
+ [DllImport( Al.Lib, EntryPoint = "alBuffer3f", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
+ public static extern void Buffer3f( uint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
+
+ public static void Bufferv3( uint bid, Alenum param, ref Vector3 values )
+ {
+ Buffer3f( bid, param, values.X, values.Y, values.Z );
+ }*/
+
#endregion Set Buffer parameters
#region Get Buffer parameters
- [DllImport( Al.Lib, EntryPoint = "alGetBufferi", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool alGetBufferi( uint bid, Enums.AlBufferAttribute param, [Out] out float 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: AL_FREQUENCY, AL_BITS, AL_CHANNELS, AL_SIZE, and the currently hidden AL_DATA.
+ /// 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);
+ // AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
// 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 );
// AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
// AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
+
#endregion Get Buffer parameters
#region Global Parameters
- [DllImport( Al.Lib, EntryPoint = "alDopplerFactor", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void DopplerFactor( float value );
+
+ /// 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.GetFloat.
+ [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 );
- [DllImport( Al.Lib, EntryPoint = "alDopplerVelocity", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void DopplerVelocity( float 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()]
+ public static extern void DopplerVelocity(float value);
// AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
- [DllImport( Al.Lib, EntryPoint = "alSpeedOfSound", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void SpeedOfSound( float 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. The default value is 343.3f (appropriate for velocity units of meters and air as the propagation medium). The current setting can be queried using Al.GetFloat
+ [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 );
- [DllImport( Al.Lib, EntryPoint = "alDistanceModel", ExactSpelling = true, CallingConvention = Al.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void DistanceModel( Enums.AlDistanceModels distancemodel );
+ /// This function selects the OpenAL distance model – AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED, AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED, AL_EXPONENT_DISTANCE, AL_EXPONENT_DISTANCE_CLAMPED, or AL_NONE. The default distance model in OpenAL is AL_INVERSE_DISTANCE_CLAMPED.
+ ///
+ /// The AL_INVERSE_DISTANCE model works according to the following formula:
+ /// gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE));
+ ///
+ /// The AL_INVERSE_DISTANCE_CLAMPED model works according to the following formula:
+ /// distance = max(distance,AL_REFERENCE_DISTANCE);
+ /// distance = min(distance,AL_MAX_DISTANCE);
+ /// gain = AL_REFERENCE_DISTANCE / (AL_REFERENCE_DISTANCE + AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE));
+ ///
+ /// The AL_LINEAR_DISTANCE model works according to the following formula:
+ /// distance = min(distance, AL_MAX_DISTANCE) // avoid negative gain
+ /// gain = (1 – AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE) / (AL_MAX_DISTANCE – AL_REFERENCE_DISTANCE))
+ ///
+ /// The AL_LINEAR_DISTANCE_CLAMPED model works according to the following formula:
+ /// distance = max(distance, AL_REFERENCE_DISTANCE)
+ /// distance = min(distance, AL_MAX_DISTANCE)
+ /// gain = (1 – AL_ROLLOFF_FACTOR * (distance – AL_REFERENCE_DISTANCE) / (AL_MAX_DISTANCE – AL_REFERENCE_DISTANCE))
+ ///
+ /// The AL_EXPONENT_DISTANCE model works according to the following formula:
+ /// gain = (distance / AL_REFERENCE_DISTANCE) ^ (- AL_ROLLOFF_FACTOR)
+ ///
+ /// The AL_EXPONENT_DISTANCE_CLAMPED model works according to the following formula:
+ /// distance = max(distance, AL_REFERENCE_DISTANCE)
+ /// distance = min(distance, AL_MAX_DISTANCE)
+ /// gain = (distance / AL_REFERENCE_DISTANCE) ^ (- AL_ROLLOFF_FACTOR)
+ ///
+ /// The AL_NONE model works according to the following formula:
+ /// gain = 1f;
+ ///
+ ///
+ [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 );
+
#endregion Global Parameters
-
- /*
-#else // AL_NO_PROTOTYPES
-
-typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability );
-typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability );
-typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability );
-typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param );
-typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
-typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
-typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
-typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
-typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param );
-typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param );
-typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param );
-typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param );
-typedef ALenum (AL_APIENTRY *LPALGETERROR)( void );
-typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
-typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
-typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
-typedef void (AL_APIENTRY *LPALListenerF)( ALenum param, ALfloat value );
-typedef void (AL_APIENTRY *LPALListener3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-typedef void (AL_APIENTRY *LPALListenerFV)( ALenum param, const ALfloat* values );
-typedef void (AL_APIENTRY *LPALListenerI)( ALenum param, ALint value );
-typedef void (AL_APIENTRY *LPALListener3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
-typedef void (AL_APIENTRY *LPALListenerIV)( ALenum param, const ALint* values );
-typedef void (AL_APIENTRY *LPALGETListenerF)( ALenum param, ALfloat* value );
-typedef void (AL_APIENTRY *LPALGETListener3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
-typedef void (AL_APIENTRY *LPALGETListenerFV)( ALenum param, ALfloat* values );
-typedef void (AL_APIENTRY *LPALGETListenerI)( ALenum param, ALint* value );
-typedef void (AL_APIENTRY *LPALGETListener3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
-typedef void (AL_APIENTRY *LPALGETListenerIV)( ALenum param, ALint* values );
-typedef void (AL_APIENTRY *LPALGENSourceS)( ALsizei n, ALuint* Sources );
-typedef void (AL_APIENTRY *LPALDELETESourceS)( ALsizei n, const ALuint* Sources );
-typedef ALboolean (AL_APIENTRY *LPALISSource)( ALuint sid );
-typedef void (AL_APIENTRY *LPALSourceF)( ALuint sid, ALenum param, ALfloat value);
-typedef void (AL_APIENTRY *LPALSource3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-typedef void (AL_APIENTRY *LPALSourceFV)( ALuint sid, ALenum param, const ALfloat* values );
-typedef void (AL_APIENTRY *LPALSourceI)( ALuint sid, ALenum param, ALint value);
-typedef void (AL_APIENTRY *LPALSource3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
-typedef void (AL_APIENTRY *LPALSourceIV)( ALuint sid, ALenum param, const ALint* values );
-typedef void (AL_APIENTRY *LPALGETSourceF)( ALuint sid, ALenum param, ALfloat* value );
-typedef void (AL_APIENTRY *LPALGETSource3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-typedef void (AL_APIENTRY *LPALGETSourceFV)( ALuint sid, ALenum param, ALfloat* values );
-typedef void (AL_APIENTRY *LPALGETSourceI)( ALuint sid, ALenum param, ALint* value );
-typedef void (AL_APIENTRY *LPALGETSource3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-typedef void (AL_APIENTRY *LPALGETSourceIV)( ALuint sid, ALenum param, ALint* values );
-typedef void (AL_APIENTRY *LPALSourcePLAYV)( ALsizei ns, const ALuint *sids );
-typedef void (AL_APIENTRY *LPALSourceSTOPV)( ALsizei ns, const ALuint *sids );
-typedef void (AL_APIENTRY *LPALSourceREWINDV)( ALsizei ns, const ALuint *sids );
-typedef void (AL_APIENTRY *LPALSourcePAUSEV)( ALsizei ns, const ALuint *sids );
-typedef void (AL_APIENTRY *LPALSourcePLAY)( ALuint sid );
-typedef void (AL_APIENTRY *LPALSourceSTOP)( ALuint sid );
-typedef void (AL_APIENTRY *LPALSourceREWIND)( ALuint sid );
-typedef void (AL_APIENTRY *LPALSourcePAUSE)( ALuint sid );
-typedef void (AL_APIENTRY *LPALSourceQUEUEBufferS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
-typedef void (AL_APIENTRY *LPALSourceUNQUEUEBufferS)(ALuint sid, ALsizei numEntries, ALuint *bids );
-typedef void (AL_APIENTRY *LPALGENBufferS)( ALsizei n, ALuint* Buffers );
-typedef void (AL_APIENTRY *LPALDELETEBufferS)( ALsizei n, const ALuint* Buffers );
-typedef ALboolean (AL_APIENTRY *LPALISBuffer)( ALuint bid );
-typedef void (AL_APIENTRY *LPALBufferDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
-typedef void (AL_APIENTRY *LPALBufferF)( ALuint bid, ALenum param, ALfloat value);
-typedef void (AL_APIENTRY *LPALBuffer3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-typedef void (AL_APIENTRY *LPALBufferFV)( ALuint bid, ALenum param, const ALfloat* values );
-typedef void (AL_APIENTRY *LPALBufferI)( ALuint bid, ALenum param, ALint value);
-typedef void (AL_APIENTRY *LPALBuffer3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
-typedef void (AL_APIENTRY *LPALBufferIV)( ALuint bid, ALenum param, const ALint* values );
-typedef void (AL_APIENTRY *LPALGETBufferF)( ALuint bid, ALenum param, ALfloat* value );
-typedef void (AL_APIENTRY *LPALGETBuffer3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-typedef void (AL_APIENTRY *LPALGETBufferFV)( ALuint bid, ALenum param, ALfloat* values );
-typedef void (AL_APIENTRY *LPALGETBufferI)( ALuint bid, ALenum param, ALint* value );
-typedef void (AL_APIENTRY *LPALGETBuffer3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-typedef void (AL_APIENTRY *LPALGETBufferIV)( ALuint bid, ALenum param, ALint* values );
-typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
-typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
-typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
-typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
- */
}
-}
+
+}
\ No newline at end of file
diff --git a/Source/OpenTK/OpenAL/AlTokens.cs b/Source/OpenTK/OpenAL/AlTokens.cs
index 93e72792..6dd2e718 100644
--- a/Source/OpenTK/OpenAL/AlTokens.cs
+++ b/Source/OpenTK/OpenAL/AlTokens.cs
@@ -3,269 +3,284 @@
* C header: \OpenAL 1.1 SDK\include\Al.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
- * See license.txt for license details (MIT)
- * http://www.OpenTK.net
- */
-
-/* Version History:
- * 0.1
- * - Tokens AL_TRUE and AL_FALSE removed, created new type. see Al.Bool
- *
- *
- */
+ * See license.txt for license details
+ * http://www.OpenTK.net */
#endregion
using System;
-namespace OpenTK.OpenAL
+namespace OpenTK.OpenAL.Enums
{
- public partial class Enums
+
+ public enum ALCapability : int
{
- public enum AlCapability : int
- {
- ///Currently no state toggles exist for vanilla OpenAL.
- Invalid = -1,
- }
-
- public enum AlListenerf : int
- {
- ///Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.
- Gain = 0x100A,
- }
-
- public enum AlListener3f : int
- {
- ///Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.
- Position = 0x1004,
-
- ///Specify the current velocity in three dimensional space.
- Velocity = 0x1006,
- }
-
- public enum AlListenerfv : int
- {
- ///Indicate Listener orientation. (at/up)
- Orientation = 0x100F,
- }
-
- public enum AlSourcef : int
- {
- ///Source specific reference distance. Type: float Range: [0.0f - float.PositiveInfinity] At 0.0f, no distance attenuation occurs. Default is 1.0.
- ReferenceDistance = 0x1020,
-
- ///Indicate distance above which Sources are not attenuated using the inverse clamped distance model. Default: float.PositiveInfinity Type: ALfloat Range: [0.0f - float.PositiveInfinity]
- MaxDistance = 0x1023,
-
- ///Source specific rolloff factor. Type: float Range: [0.0f - float.PositiveInfinity]
- RolloffFactor = 0x1021,
-
- ///Specify the pitch to be applied, either at Source, or on mixer results, at Listener. Range: [0.5f - 2.0f] Default: 1.0f
- Pitch = 0x1003,
-
- ///Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.
- Gain = 0x100A,
-
- ///Indicate minimum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)
- MinGain = 0x100D,
-
- ///Indicate maximum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)
- MaxGain = 0x100E,
-
- ///Directional Source, inner cone angle, in degrees. Range: [0-360] Default: 360
- ConeInnerAngle = 0x1001,
-
- ///Directional Source, outer cone angle, in degrees. Range: [0-360] Default: 360
- ConeOuterAngle = 0x1002,
-
- ///Directional Source, outer cone gain. Default: 0.0f Range: [0.0f - 1.0] (Logarithmic)
- ConeOuterGain = 0x1022,
- }
-
- public enum AlSource3f : int
- {
- ///Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.
- Position = 0x1004,
-
- ///Specify the current velocity in three dimensional space.
- Velocity = 0x1006,
-
- ///Specify the current direction.
- Direction = 0x1005,
- }
-
- public enum AlSourcei : int
- {
- // Source Buffer position information
- MiliSecOffset = 0x1024, // AL_EXT_OFFSET extension.
- ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
- SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
-
- ///Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.
- Buffer = 0x1009,
- }
-
- public enum AlSourceBool : int
- {
- ///Indicate Source has relative coordinates.
- SourceRelative = 0x202,
-
- ///Indicate whether Source is looping. Type: Alboolean Range: [True, False] Default: False.
- Looping = 0x1007,
- }
-
- public enum AlSourceiGet : int
- {
- // Source Buffer position information
- MiliSecOffset = 0x1024, // AL_EXT_OFFSET extension.
- ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
- SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
-
- ///Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.
- Buffer = 0x1009,
-
- SourceState = 0x1010,
- BuffersQueued = 0x1015,
- BuffersProcessed = 0x1016,
- }
-
-
- public enum AlSourceParameterszzzzzzzzzzzzzzzzzz : int
- {
-
- ///Specify the channel mask. (Creative) Type: uint Range: [0 - 255]
- ChannelMask = 0x3000,
- }
-
- ///Source state information.
- public enum AlSourcestate : int
- {
- Initial = 0x1011,
- Playing = 0x1012,
- Paused = 0x1013,
- Stopped = 0x1014,
- }
-
- // AL_EXT_OFFSET extension.
- public enum AlSourceBufferPos : int
- {
-
- ///Source type (Static, Streaming or undetermined)
- SourceType = 0x1027,
- }
-
- ///Source type (Static, Streaming or undetermined)
- public enum AlSourceType : int
- {
- ///Source is Static if a Buffer has been attached using AL_Buffer
- Static = 0x1028,
- ///Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
- Streaming = 0x1029,
- ///Source is undetermined when it has the NULL Buffer attached
- Undetermined = 0x1030,
- }
-
- ///Sound samples: Format specifier.
- public enum AlFormat : int
- {
- ///1 Channel, 8 Bit.
- FormatMono8 = 0x1100,
-
- ///1 Channel, 16 Bit.
- FormatMono16 = 0x1101,
-
- ///2 Channels, 8 Bit each.
- FormatStereo8 = 0x1102,
-
- ///2 Channels, 16 Bit each.
- FormatStereo16 = 0x1103,
- }
-
- public enum AlBufferAttribute : int
- {
- ///Sound samples: frequency, in units of Hertz [Hz]. This is the number of samples per second. Half of the sample frequency marks the maximum significant frequency component.
- Frequency = 0x2001,
- Bits = 0x2002,
- Channels = 0x2003,
- Size = 0x2004,
- }
-
- ///Buffer state. Not supported for public use (yet).
- public enum AlBufferState : int
- {
- ///Buffer state. Not supported for public use (yet).
- Unused = 0x2010,
- ///Buffer state. Not supported for public use (yet).
- Pending = 0x2011,
- ///Buffer state. Not supported for public use (yet).
- Processed = 0x2012,
- }
-
- public enum AlError : int // alGetString
- {
- ///No OpenAL Error.
- NoError = 0,
-
- ///Invalid Name paramater passed to OpenAL call.
- InvalidName = 0xA001,
-
- ///Invalid parameter passed to OpenAL call.
- IllegalEnum = 0xA002,
- ///Invalid parameter passed to OpenAL call.
- InvalidEnum = 0xA002,
-
- ///Invalid OpenAL enum parameter value.
- InvalidValue = 0xA003,
-
- ///Illegal OpenAL call.
- IllegalCommand = 0xA004,
- ///Illegal OpenAL call.
- InvalidOperation = 0xA004,
-
- ///No mojo. No OpenAL Memory left.
- OutOfMemory = 0xA005,
- }
-
- public enum AlContextString : int // alGetString
- {// Context strings: Vendor Name.
- Vendor = 0xB001,
- Version = 0xB002,
- Renderer = 0xB003,
- Extensions = 0xB004,
- }
-
- public enum AlGlobalTweakage : int // alGetBool/Int/Float/Double
- {// Global tweakage.
- ///Doppler scale. Default 1.0
- DopplerFactor = 0xC000,
-
- ///Tweaks speed of propagation.
- DopplerVelocity = 0xC001, // TODO : Verify!
-
- ///Speed of Sound in units per second. default value 343.3f
- SpeedOfSound = 0xC003,
-
- ///
- DistanceModel = 0xD000,
- }
-
- // ALenum distanceModel
- public enum AlDistanceModels : int// used in conjunction with DistanceModel
- {
- ///bypasses all distance attenuation calculation for all sources.
- None = 0,
-
- ///InverseDistance is equivalent to the IASIG I3DL2 model with the exception that AL_REFERENCE_DISTANCE does not imply any clamping.
- InverseDistance = 0xD001,
- ///InverseDistanceClamped is the IASIG I3DL2 model, with AL_REFERENCE_DISTANCE indicating both the reference distance and the distance below which gain will be clamped.
- InverseDistanceClamped = 0xD002,
- ///
- LinearDistance = 0xD003, // AL_EXT_LINEAR_DISTANCE extension.
- ///
- LinearDistanceClamped = 0xD004, // AL_EXT_LINEAR_DISTANCE extension.
- ///
- ExponentDistance = 0xD005, // AL_EXT_EXPONENT_DISTANCE extension.
- ///
- ExponentDistanceClamped = 0xD006, // AL_EXT_EXPONENT_DISTANCE extension.
- }
+ ///Currently no state toggles exist for vanilla OpenAL.
+ Invalid = -1,
}
+
+ public enum ALListenerf : int
+ {
+ ///Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.
+ Gain = 0x100A,
+ }
+
+ public enum ALListener3f : int
+ {
+ ///Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.
+ Position = 0x1004,
+
+ ///Specify the current velocity in three dimensional space.
+ Velocity = 0x1006,
+ }
+
+ public enum ALListenerfv : int
+ {
+ ///Indicate Listener orientation. (at/up)
+ Orientation = 0x100F,
+ }
+
+ public enum ALSourcef : int
+ {
+ ///Source specific reference distance. Type: float Range: [0.0f - float.PositiveInfinity] At 0.0f, no distance attenuation occurs. Default is 1.0.
+ ReferenceDistance = 0x1020,
+
+ ///Indicate distance above which Sources are not attenuated using the inverse clamped distance model. Default: float.PositiveInfinity Type: ALfloat Range: [0.0f - float.PositiveInfinity]
+ MaxDistance = 0x1023,
+
+ ///Source specific rolloff factor. Type: float Range: [0.0f - float.PositiveInfinity]
+ RolloffFactor = 0x1021,
+
+ ///Specify the pitch to be applied, either at Source, or on mixer results, at Listener. Range: [0.5f - 2.0f] Default: 1.0f
+ Pitch = 0x1003,
+
+ ///Indicate the gain (volume amplification) applied. Type: float. Range: [0.0f - ? ] A value of 1.0 means un-attenuated/unchanged. Each division by 2 equals an attenuation of -6dB. Each multiplicaton with 2 equals an amplification of +6dB. A value of 0.0f is meaningless with respect to a logarithmic scale; it is interpreted as zero volume - the channel is effectively disabled.
+ Gain = 0x100A,
+
+ ///Indicate minimum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)
+ MinGain = 0x100D,
+
+ ///Indicate maximum Source attenuation. Type: float Range: [0.0f - 1.0f] (Logarthmic)
+ MaxGain = 0x100E,
+
+ ///Directional Source, inner cone angle, in degrees. Range: [0-360] Default: 360
+ ConeInnerAngle = 0x1001,
+
+ ///Directional Source, outer cone angle, in degrees. Range: [0-360] Default: 360
+ ConeOuterAngle = 0x1002,
+
+ ///Directional Source, outer cone gain. Default: 0.0f Range: [0.0f - 1.0] (Logarithmic)
+ ConeOuterGain = 0x1022,
+
+ /// The playback position, expressed in seconds.
+ SecOffset = 0x1024, // AL_EXT_OFFSET extension.
+ }
+
+ public enum ALSource3f : int
+ {
+ ///Specify the current location in three dimensional space. OpenAL, like OpenGL, uses a right handed coordinate system, where in a frontal default view X (thumb) points right, Y points up (index finger), and Z points towards the viewer/camera (middle finger). To switch from a left handed coordinate system, flip the sign on the Z coordinate. Listener position is always in the world coordinate system.
+ Position = 0x1004,
+
+ ///Specify the current velocity in three dimensional space.
+ Velocity = 0x1006,
+
+ ///Specify the current direction vector.
+ Direction = 0x1005,
+ }
+
+ public enum ALSourceb : int
+ {
+ ///Indicate Source has relative coordinates.
+ SourceRelative = 0x202,
+
+ ///Indicate whether Source is looping. Type: Al.Bool Range: [True, False] Default: False.
+ Looping = 0x1007,
+ }
+
+ public enum ALSourcei : int
+ {
+ ///The playback position, expressed in bytes.
+ ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
+
+ ///The playback position, expressed in samples.
+ SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
+
+ ///Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.
+ Buffer = 0x1009,
+
+ ///Source type (Static, Streaming or undetermined). Use enum AlSourceType for comparison
+ SourceType = 0x1027,
+ }
+
+ public enum ALSourceiGet : int
+ {
+ ///The playback position, expressed in bytes.
+ ByteOffset = 0x1026, // AL_EXT_OFFSET extension.
+
+ ///The playback position, expressed in samples.
+ SampleOffset = 0x1025, // AL_EXT_OFFSET extension.
+
+ ///Indicate the Buffer to provide sound samples. Type: uint Range: any valid Buffer id.
+ Buffer = 0x1009,
+
+ /// The state of the source (Stopped, Playing, etc.) Use the enum AlSourceState for comparison.
+ SourceState = 0x1010,
+
+ /// The number of buffers queued on this source.
+ BuffersQueued = 0x1015,
+
+ /// The number of buffers in the queue that have been processed.
+ BuffersProcessed = 0x1016,
+
+ ///Source type (Static, Streaming or undetermined). Use enum AlSourceType for comparison.
+ SourceType = 0x1027,
+ }
+
+ public enum ALDeprecated : int
+ {
+ ///Deprecated. Specify the channel mask. (Creative) Type: uint Range: [0 - 255]
+ ChannelMask = 0x3000,
+ }
+
+ ///Source state information.
+ public enum ALSourceState : int
+ {
+ ///Default State when loaded, can be manually set with Al.SourceRewind().
+ Initial = 0x1011,
+ ///The source is currently playing.
+ Playing = 0x1012,
+ ///The source has paused playback.
+ Paused = 0x1013,
+ ///The source is not playing.
+ Stopped = 0x1014,
+ }
+
+ ///Source type (Static, Streaming or undetermined)
+ public enum ALSourceType : int
+ {
+ ///Source is Static if a Buffer has been attached using AL_Buffer
+ Static = 0x1028,
+ ///Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
+ Streaming = 0x1029,
+ ///Source is undetermined when it has the NULL Buffer attached
+ Undetermined = 0x1030,
+ }
+
+ ///Sound samples: Format specifier.
+ public enum ALFormat : int
+ {
+ ///1 Channel, 8 Bit.
+ FormatMono8 = 0x1100,
+
+ ///1 Channel, 16 Bit.
+ FormatMono16 = 0x1101,
+
+ ///2 Channels, 8 Bit each.
+ FormatStereo8 = 0x1102,
+
+ ///2 Channels, 16 Bit each.
+ FormatStereo16 = 0x1103,
+ }
+
+ public enum ALGetBufferi : int
+ {
+ ///Sound sample's frequency, in units of Hertz [Hz]. This is the number of samples per second. Half of the sample frequency marks the maximum significant frequency component.
+ Frequency = 0x2001,
+ /// Bit depth of buffer. Should be 8 or 16.
+ Bits = 0x2002,
+ /// Number of channels in buffer. > 1 is valid, but buffer won’t be positioned when played. 1 for Mono, 2 for Stereo.
+ Channels = 0x2003,
+ /// size of buffer in bytes
+ Size = 0x2004,
+
+ // From Manual, not in header: AL_DATA ( i, iv ) original location where data was copied from generally useless, as was probably freed after buffer creation
+ }
+
+ ///Buffer state. Not supported for public use (yet).
+ public enum ALBufferState : int
+ {
+ ///Buffer state. Not supported for public use (yet).
+ Unused = 0x2010,
+ ///Buffer state. Not supported for public use (yet).
+ Pending = 0x2011,
+ ///Buffer state. Not supported for public use (yet).
+ Processed = 0x2012,
+ }
+
+ public enum ALError : int // alGetString
+ {
+ ///No OpenAL Error.
+ NoError = 0,
+
+ ///Invalid Name paramater passed to OpenAL call.
+ InvalidName = 0xA001,
+
+ ///Invalid parameter passed to OpenAL call.
+ IllegalEnum = 0xA002,
+ ///Invalid parameter passed to OpenAL call.
+ InvalidEnum = 0xA002,
+
+ ///Invalid OpenAL enum parameter value.
+ InvalidValue = 0xA003,
+
+ ///Illegal OpenAL call.
+ IllegalCommand = 0xA004,
+ ///Illegal OpenAL call.
+ InvalidOperation = 0xA004,
+
+ ///No mojo. No OpenAL Memory left.
+ OutOfMemory = 0xA005,
+ }
+
+ public enum ALGetString : int // alGetString
+ {
+ /// Gets the Vendor name.
+ Vendor = 0xB001,
+
+ /// Gets the driver version.
+ Version = 0xB002,
+
+ /// Gets the renderer mode.
+ Renderer = 0xB003,
+
+ /// Gets a list of all available Extensions, separated with spaces.
+ Extensions = 0xB004,
+ }
+
+ public enum ALGetFloat : int
+ {
+ ///Doppler scale. Default 1.0f
+ DopplerFactor = 0xC000,
+
+ ///Tweaks speed of propagation. This functionality is deprecated.
+ DopplerVelocity = 0xC001,
+
+ ///Speed of Sound in units per second. default value 343.3f
+ SpeedOfSound = 0xC003,
+ }
+
+ public enum ALGetInteger : int
+ {
+ ///See enum AlDistanceModel.
+ DistanceModel = 0xD000,
+ }
+
+ public enum ALDistanceModel : int // used in conjunction with Al.DistanceModel
+ {
+ ///bypasses all distance attenuation calculation for all sources.
+ None = 0,
+
+ ///InverseDistance is equivalent to the IASIG I3DL2 model with the exception that AL_REFERENCE_DISTANCE does not imply any clamping.
+ InverseDistance = 0xD001,
+ ///InverseDistanceClamped is the IASIG I3DL2 model, with AL_REFERENCE_DISTANCE indicating both the reference distance and the distance below which gain will be clamped.
+ InverseDistanceClamped = 0xD002,
+ ///
+ LinearDistance = 0xD003, // AL_EXT_LINEAR_DISTANCE extension.
+ ///
+ LinearDistanceClamped = 0xD004, // AL_EXT_LINEAR_DISTANCE extension.
+ ///
+ ExponentDistance = 0xD005, // AL_EXT_EXPONENT_DISTANCE extension.
+ ///
+ ExponentDistanceClamped = 0xD006, // AL_EXT_EXPONENT_DISTANCE extension.
+ }
+
}
diff --git a/Source/OpenTK/OpenAL/AlcFunctions.cs b/Source/OpenTK/OpenAL/AlcFunctions.cs
index 52afd94a..55bba7a3 100644
--- a/Source/OpenTK/OpenAL/AlcFunctions.cs
+++ b/Source/OpenTK/OpenAL/AlcFunctions.cs
@@ -3,19 +3,12 @@
* C header: \OpenAL 1.1 SDK\include\Alc.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
- * See license.txt for license details (MIT)
- * http://www.OpenTK.net
- */
-
-/* Version History:
- * 0.1
- *
- *
- *
- */
+ * See license.txt for license details
+ * http://www.OpenTK.net */
#endregion
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
@@ -72,147 +65,227 @@ typedef void ALCvoid;
* ALCcontext *context
* IntPtr
*/
-
+
namespace OpenTK.OpenAL
{
- /// Alc = Audio Library Context
+
+ /// Alc = Audio Library Context
public static class Alc
{
#region Constants
- private const string Lib = Al.Lib;
+
+ private const string Lib = AL.Lib;
private const CallingConvention Style = CallingConvention.Cdecl;
+
#endregion Constants
#region Context Management
+
+ /// This function creates a context using a specified device.
+ /// a pointer to a device
+ /// a pointer to a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC
+ /// Returns a pointer to the new context (NULL on failure). The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.
+ [DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern IntPtr CreateContext([In] IntPtr device, [In] IntPtr attrlist);
// ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
- [DllImport( Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr CreateContext( [In] IntPtr device, [In] IntPtr attrlist );
+ /// This function makes a specified context the current context.
+ /// A pointer to the new context.
+ /// Returns True on success, or False on failure.
+ [DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool MakeContextCurrent([In] IntPtr context);
// ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
- [DllImport( Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool MakeContextCurrent( [In] IntPtr context );
+ /// This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.
+ /// a pointer to the new context
+ [DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void ProcessContext([In] IntPtr context);
// ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
- [DllImport( Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void ProcessContext( [In] IntPtr context );
+ /// This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.
+ /// a pointer to the context to be suspended.
+ [DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void SuspendContext([In] IntPtr context);
// ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
- [DllImport( Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void SuspendContext( [In] IntPtr context );
-
+ /// This function destroys a context.
+ /// a pointer to the new context.
+ [DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void DestroyContext([In] IntPtr context);
// ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
- [DllImport( Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void DestroyContext( [In] IntPtr context );
+ /// This function retrieves the current context.
+ /// Returns a pointer to the current context.
+ [DllImport(Alc.Lib, EntryPoint = "alcGetCurrentContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern IntPtr GetCurrentContext();
// ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
- [DllImport( Alc.Lib, EntryPoint = "alcGetCurrentContext", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr GetCurrentContext( );
+ /// This function retrieves a context's device pointer.
+ /// a pointer to a context.
+ /// Returns a pointer to the specified context's device.
+ [DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern IntPtr GetContextsDevice([In] IntPtr context);
// ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
- [DllImport( Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr GetContextsDevice( [In] IntPtr context );
+
#endregion Context Management
#region Device Management
- // ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
- [DllImport( Alc.Lib, EntryPoint = "alcOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr OpenDevice( [In] string devicename );
+ /// This function opens a device by name.
+ /// a null-terminated string describing a device.
+ /// Returns a pointer to the opened device. The return value will be NULL if there is an error.
+ [DllImport(Alc.Lib, EntryPoint = "alcOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern IntPtr OpenDevice([In] string devicename);
+ // ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
+
+ /// This function closes a device by name.
+ /// a pointer to an opened device
+ /// True will be returned on success or False on failure. Closing a device will fail if the device contains any contexts or buffers.
+ [DllImport(Alc.Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool CloseDevice([In] IntPtr device);
// ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
- [DllImport( Alc.Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool CloseDevice( [In] IntPtr device );
+
#endregion Device Management
#region Error support.
- // Obtain the most recent Context error
+ /// This function retrieves the current context error state.
+ /// a pointer to the device to retrieve the error state from
+ /// Errorcode Int32.
+ [DllImport(Alc.Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern Enums.AlcError GetError([In] IntPtr device);
// ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
- [DllImport( Alc.Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Enums.AlcError GetError( [In] IntPtr device );
+
#endregion Error support.
#region Extension support.
- // Query for the presence of an extension, and obtain any appropriate function pointers and enum values.
+ /// This function queries if a specified context extension is available.
+ /// a pointer to the device to be queried for an extension.
+ /// a null-terminated string describing the extension.
+ /// Returns True if the extension is available, False if the extension is not available.
+ [DllImport(Alc.Lib, EntryPoint = "alcIsExtensionPresent", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool IsExtensionPresent([In] IntPtr device, [In] string extname);
// ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
- [DllImport( Alc.Lib, EntryPoint = "alcIsExtensionPresent", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool IsExtensionPresent( [In] IntPtr device, [In] string extname );
+ /// This function retrieves the address of a specified context extension function.
+ /// a pointer to the device to be queried for the function.
+ /// a null-terminated string describing the function.
+ /// Returns the address of the function, or NULL if it is not found.
+ [DllImport(Alc.Lib, EntryPoint = "alcGetProcAddress", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern IntPtr GetProcAddress([In] IntPtr device, [In] string funcname);
// ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
- [DllImport( Alc.Lib, EntryPoint = "alcGetProcAddress", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr GetProcAddress( [In] IntPtr device, [In] string funcname );
+ /// This function retrieves the enum value for a specified enumeration name.
+ /// a pointer to the device to be queried.
+ /// a null terminated string describing the enum value.
+ /// Returns the enum value described by the enumName string. This is most often used for querying an enum value for an ALC extension.
+ [DllImport(Alc.Lib, EntryPoint = "alcGetEnumValue", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern int GetEnumValue([In] IntPtr device, [In] string enumname);
// ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
- [DllImport( Alc.Lib, EntryPoint = "alcGetEnumValue", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern int GetEnumValue( [In] IntPtr device, [In] string enumname );
+
#endregion Extension support.
#region Query functions
+
+ [DllImport(Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ private static extern IntPtr GetStringPrivate([In] IntPtr device, Enums.AlcGetString param);
// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
- [DllImport( Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- private static extern IntPtr GetStringInternal( [In] IntPtr device, Enums.AlcGetString param );
-
- internal static string GetString( IntPtr device, Enums.AlcGetString param )
+
+ /// This function returns pointers to strings related to the context.
+ ///
+ /// ALC_DEFAULT_DEVICE_SPECIFIER will return the name of the default output device.
+ /// ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER will return the name of the default capture device.
+ /// 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.
+ ///
+ /// a pointer to the device to be queried.
+ /// an attribute to be retrieved: ALC_DEFAULT_DEVICE_SPECIFIER, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER, ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_EXTENSIONS
+ ///
+ public static string GetString(IntPtr device, Enums.AlcGetString param)
{
- return Marshal.PtrToStringAnsi( GetStringInternal( device, param ) );
+ return Marshal.PtrToStringAnsi(GetStringPrivate(device, param));
}
- internal static string GetStringDevices( )
+ public static List GetString(IntPtr device, Enums.AlcGetStringList param)
{
- return Marshal.PtrToStringBSTR( GetStringInternal( Al.Null, Enums.AlcGetString.DeviceSpecifier ));
+ List result = new List();
+ IntPtr t = GetStringPrivate(AL.Null, (Enums.AlcGetString)Enums.AlcGetStringList.DeviceSpecifier);
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ byte b;
+ int offset = 0;
+ do
+ {
+ b = Marshal.ReadByte(t, offset++);
+ if (b != 0) sb.Append((char)b);
+ else
+ {
+ if (Marshal.ReadByte(t, offset + 1) == 0)
+ break;
+ else
+ {
+ if (sb.Length > 1) result.Add(sb.ToString());
+ sb.Remove(0, sb.Length);
+ }
+ }
+ } while (true);
+
+ return result;
}
+ /// 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.
+ /// a pointer to the data 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, Enums.AlcGetInteger param, int size, [Out] out int data);
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
- [DllImport( Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void GetInteger( [In] IntPtr device, Enums.AlcGetInteger param, int sizeofdatainbytes, [Out] out int data );
+
#endregion Query functions
#region Capture functions
+
+ /// This function opens a capture device by name.
+ /// a pointer to a device name string
+ /// the frequency that the data should be captured at
+ /// the requested capture buffer format
+ /// the size of the capture buffer in bytes
+ /// Returns the capture device pointer, or NULL on failure.
+ [CLSCompliant(false), DllImport(Alc.Lib, EntryPoint = "alcCaptureOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern IntPtr CaptureOpenDevice(string devicename, uint frequency, Enums.ALFormat format, int buffersize);
// ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
- [DllImport( Alc.Lib, EntryPoint = "alcCaptureOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern IntPtr CaptureOpenDevice( string devicename, uint frequency, Enums.AlFormat format, int buffersize );
+ /// This function closes the specified capture device.
+ /// a pointer to a capture device.
+ /// Returns True if the close operation was successful, False on failure.
+ [DllImport(Alc.Lib, EntryPoint = "alcCaptureCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool CaptureCloseDevice([In] IntPtr device);
// ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
- [DllImport( Alc.Lib, EntryPoint = "alcCaptureCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool CaptureCloseDevice( [In] IntPtr device );
+ /// This function begins a capture operation.
+ /// alcCaptureStart will begin recording to an internal ring buffer of the size specified when opening the capture device. The application can then retrieve the number of samples currently available using the ALC_CAPTURE_SAPMPLES token with alcGetIntegerv. When the application determines that enough samples are available for processing, then it can obtain them with a call to alcCaptureSamples.
+ /// a pointer to a capture device.
+ [DllImport(Alc.Lib, EntryPoint = "alcCaptureStart", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void CaptureStart([In] IntPtr device);
// ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
- [DllImport( Alc.Lib, EntryPoint = "alcCaptureStart", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void CaptureStart( [In] IntPtr device );
+ /// This function stops a capture operation.
+ /// a pointer to a capture device.
+ [DllImport(Alc.Lib, EntryPoint = "alcCaptureStop", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void CaptureStop([In] IntPtr device);
// ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
- [DllImport( Alc.Lib, EntryPoint = "alcCaptureStop", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void CaptureStop( [In] IntPtr device );
+ /// This function completes a capture operation, and does not block.
+ /// a pointer to a capture device.
+ /// a pointer to a data buffer, which must be large enough to accommodate samples number of samples.
+ /// the number of samples to be retrieved.
+ [DllImport(Alc.Lib, EntryPoint = "alcCaptureSamples", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern void CaptureSamples([In] IntPtr device, [Out] out IntPtr buffer, [Out] out int samples);
// ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
- [DllImport( Alc.Lib, EntryPoint = "alcCaptureSamples", ExactSpelling = true, CallingConvention = Alc.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern void CaptureSamples( [In] IntPtr device, [Out] out IntPtr buffer, [Out] out int samples );
+
#endregion Capture functions
- /* delegates
- // Pointer-to-function types, useful for dynamically getting ALC entry points.
-
- typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
- typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
- typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
- typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
- typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
- typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( void );
- typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
- typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
- typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
- typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device );
- typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
- typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
- typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
- typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
- typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
- typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei Buffersize );
- typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
- typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
- typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
- typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *Buffer, ALCsizei samples );
- */
}
-}
+}
\ No newline at end of file
diff --git a/Source/OpenTK/OpenAL/AlcTokens.cs b/Source/OpenTK/OpenAL/AlcTokens.cs
index b80d469b..016b3a1f 100644
--- a/Source/OpenTK/OpenAL/AlcTokens.cs
+++ b/Source/OpenTK/OpenAL/AlcTokens.cs
@@ -3,102 +3,101 @@
* C header: \OpenAL 1.1 SDK\include\Alc.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
- * See license.txt for license details (MIT)
- * http://www.OpenTK.net
- */
-
-/* Version History:
- * 0.1
- * - Tokens ALC_TRUE and ALC_FALSE removed, created new type. see Al.Bool
- *
- *
- */
+ * See license.txt for license details
+ * http://www.OpenTK.net */
#endregion
using System;
-namespace OpenTK.OpenAL
+namespace OpenTK.OpenAL.Enums
{
- public partial class Enums
+
+ public enum AlcContextAttributes : int
{
- public enum AlcContextAttributes : int
- {
- ///followed by Hz
- Frequency = 0x1007,
+ ///followed by Hz
+ Frequency = 0x1007,
- ///followed by Hz
- Refresh = 0x1008,
+ ///followed by Hz
+ Refresh = 0x1008,
- ///followed by AlBoolean.True, or AlBoolean.False
- Sync = 0x1009,
+ ///followed by AlBoolean.True, or AlBoolean.False
+ Sync = 0x1009,
- ///followed by Num of requested Mono (3D) Sources
- MonoSources = 0x1010,
+ ///followed by Num of requested Mono (3D) Sources
+ MonoSources = 0x1010,
- ///followed by Num of requested Stereo Sources
- StereoSources = 0x1011,
- }
-
- public enum AlcError : int // errors
- {
- ///There is no current error.
- NoError = 0,
-
- ///No Device. The device handle or specifier names an inaccessible driver/server.
- InvalidDevice = 0xA001,
-
- ///Invalid context ID. The Context argument does not name a valid context.
- InvalidContext = 0xA002,
-
- ///Bad enum. A token used is not valid, or not applicable.
- InvalidEnum = 0xA003,
-
- ///Bad value. A value (e.g. Attribute) is not valid, or not applicable.
- InvalidValue = 0xA004,
-
- ///Out of memory. Unable to allocate memory.
- OutOfMemory = 0xA005,
- }
-
- public enum AlcGetString : int
- {
- ///The specifier string for the default device
- DefaultDeviceSpecifier = 0x1004,
-
- ///The specifier string for the device
- DeviceSpecifier = 0x1005,
-
- ///A list of available context extensions separated by spaces.
- Extensions = 0x1006,
-
- ///The name of the default capture device
- CaptureDefaultDeviceSpecifier = 0x311, // ALC_EXT_CAPTURE extension.
-
- ///The name of the specified capture device, or a list of all available capture devices if no capture device is specified.
- CaptureDeviceSpecifier = 0x310, // ALC_EXT_CAPTURE extension.
- }
-
- public enum AlcGetInteger : int
- {
- ///The specification revision for this implementation (major version). NULL is an acceptable device.
- MajorVersion = 0x1000,
- ///The specification revision for this implementation (minor version). NULL is an acceptable device.
- MinorVersion = 0x1001,
-
- ///The size (number of ALCint values) required for a zero-terminated attributes list, for the current context. NULL is an invalid device.
- AttributesSize = 0x1002,
- ///Expects a destination of ALC_ATTRIBUTES_SIZE, and provides an attribute list for the current context of the specified device. NULL is an invalid device.
- AllAttributes = 0x1003,
-
- ///The number of capture samples available. NULL is an invalid device.
- CaptureSamples = 0x312,
- }
-
- // ALC_ENUMERATE_ALL_EXT token
- public enum AlcEnumerateAll : int
- {
- DefaultAllDevicesSpecifier = 0x1012,
- AllDevicesSpecifier = 0x1013,
- }
+ ///followed by Num of requested Stereo Sources
+ StereoSources = 0x1011,
}
+
+ public enum AlcError : int
+ {
+ ///There is no current error.
+ NoError = 0,
+
+ ///No Device. The device handle or specifier names an inaccessible driver/server.
+ InvalidDevice = 0xA001,
+
+ ///Invalid context ID. The Context argument does not name a valid context.
+ InvalidContext = 0xA002,
+
+ ///Bad enum. A token used is not valid, or not applicable.
+ InvalidEnum = 0xA003,
+
+ ///Bad value. A value (e.g. Attribute) is not valid, or not applicable.
+ InvalidValue = 0xA004,
+
+ ///Out of memory. Unable to allocate memory.
+ OutOfMemory = 0xA005,
+ }
+
+ public enum AlcGetString : int
+ {
+ ///The specifier string for the default device.
+ DefaultDeviceSpecifier = 0x1004,
+
+ ///The specifier strings for all available devices.
+ DeviceSpecifier = 0x1005,
+
+ ///A list of available context extensions separated by spaces.
+ Extensions = 0x1006,
+
+ ///The name of the default capture device
+ CaptureDefaultDeviceSpecifier = 0x311, // ALC_EXT_CAPTURE extension.
+
+ /// a list of the default devices.
+ DefaultAllDevicesSpecifier = 0x1012,
+ }
+
+ public enum AlcGetStringList : int
+ {
+ ///The name of the specified capture device, or a list of all available capture devices if no capture device is specified.
+ CaptureDeviceSpecifier = 0x310, // ALC_EXT_CAPTURE extension.
+
+ ///The specifier string for the device.
+ DeviceSpecifier = 0x1005,
+
+ /// A list of all available devices.
+ AllDevicesSpecifier = 0x1013,
+ }
+
+ public enum AlcGetInteger : int
+ {
+ ///The specification revision for this implementation (major version). NULL is an acceptable device.
+ MajorVersion = 0x1000,
+
+ ///The specification revision for this implementation (minor version). NULL is an acceptable device.
+ MinorVersion = 0x1001,
+
+ ///The size (number of ALCint values) required for a zero-terminated attributes list, for the current context. NULL is an invalid device.
+ AttributesSize = 0x1002,
+
+ ///Expects a destination of ALC_ATTRIBUTES_SIZE, and provides an attribute list for the current context of the specified device. NULL is an invalid device.
+ AllAttributes = 0x1003,
+
+ ///The number of capture samples available. NULL is an invalid device.
+ CaptureSamples = 0x312,
+ }
+
+
}
diff --git a/Source/OpenTK/OpenAL/AlutFunctions.cs b/Source/OpenTK/OpenAL/AlutFunctions.cs
index 6383c669..4c400485 100644
--- a/Source/OpenTK/OpenAL/AlutFunctions.cs
+++ b/Source/OpenTK/OpenAL/AlutFunctions.cs
@@ -3,18 +3,8 @@
* C header: \freealut-1.1.0-src\include\AL\Alut.h
* Spec: http://www.openal.org/openal_webstf/specs/alut.html
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
- * See license.txt for license details (MIT)
- * http://www.OpenTK.net
- */
-
-/* Version History:
- * 0.1
- * - The following functions are not bound/imported. Issue of undoing C malloc to prevent memory leaks.
- * "alutLoadMemoryFromFile, alutLoadMemoryFromFileImage, alutLoadMemoryHelloWorld, alutLoadMemoryWaveform"
- * Please use Alut.CreateBuffer* functions instead, which have similar functionality and return a Buffer Handle instead.
- *
- *
- */
+ * See license.txt for license details
+ * http://www.OpenTK.net */
#endregion
using System;
@@ -23,91 +13,101 @@ using System.Security;
namespace OpenTK.OpenAL
{
+
/// Alut, FreeAlut = Free Audio Library Utilities
public static class Alut
{
#region Constants
- private const string Lib = "Alut.dll";
+
+ private const string Lib = "alut.dll";
private const CallingConvention Style = CallingConvention.Cdecl;
+
#endregion Constants
#region Init/Exit
+
/// Alut.Init initializes the ALUT internals and creates an OpenAL context on the default device and makes it the current OpenAL context. If you want something more complex than that (e.g. running on a non-default device or opening multiple contexts on multiple devices), you can use alutInitWithoutContext instead. alutInit examines the commandline arguments passed to it and remove those it recognizes. It is acceptable to pass two NULL pointers in settings where no useful information can be obtained from argc and argv.
- /// Application Main Parameters
- /// Application Main Parameters
+ /// Application Main Parameters. Can be IntPtr.Zero.
+ /// Application Main Parameters. Can be IntPtr.Zero.
/// Success.
- [DllImport( Alut.Lib, EntryPoint = "alutInit", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool Init( [In] IntPtr argcp, [In] IntPtr argv );
+ [DllImport(Alut.Lib, EntryPoint = "alutInit", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool Init([In] IntPtr argcp, [In] IntPtr argv);
// ALUT_API ALboolean ALUT_APIENTRY alutInit (int *argcp, char **argv);
-
+
/// Parameterless function for convenience. Internally passes IntPtr.Zero as parameters.
/// Success.
- internal static Al.Bool Init( ) // overload for convenience
+ public static AL.Bool Init() // overload for convenience
{
- return Init( IntPtr.Zero, IntPtr.Zero );
+ return Init(IntPtr.Zero, IntPtr.Zero);
}
/// Alut.InitWithoutContext initializes the ALUT internals. It does not create any OpenAL context or device, so this has to be done via the usual ALC calls. alutInitWithoutContext examines the commandline arguments passed to it and remove those it recognizes. It is acceptable to pass two NULL pointers in settings where no useful information can be obtained from argc and argv.
/// Application Main Parameters
/// Application Main Parameters
/// Success.
- [DllImport( Alut.Lib, EntryPoint = "alutInitWithoutContext", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool InitWithoutContext( [In] IntPtr argcp, [In] IntPtr argv );
+ [DllImport(Alut.Lib, EntryPoint = "alutInitWithoutContext", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool InitWithoutContext([In] IntPtr argcp, [In] IntPtr argv);
// ALUT_API ALboolean ALUT_APIENTRY alutInitWithoutContext (int *argcp, char **argv);
- internal static Al.Bool InitWithoutContext( ) // overload for convenience
+ /// Alut.InitWithoutContext initializes the ALUT internals. It does not create any OpenAL context or device, so this has to be done via the usual ALC calls. alutInitWithoutContext examines the commandline arguments passed to it and remove those it recognizes. It is acceptable to pass two NULL pointers in settings where no useful information can be obtained from argc and argv.
+ /// Success.
+ public static AL.Bool InitWithoutContext() // overload for convenience
{
- return InitWithoutContext( IntPtr.Zero, IntPtr.Zero );
+ return InitWithoutContext(IntPtr.Zero, IntPtr.Zero);
}
/// When the application has finished playing audio, it should shut down ALUT using Alut.Exit. This closes any OpenAL device/context that ALUT may have created in alutInit (but not any that the application created using ALC). After calling alutExit, you may subsequently call alutInit or alutInitWithoutContext again. Note that under well-behaved operating systems, it should be acceptable to simply exit from your program without bothering to call alutExit, relying on the OS to clean up after you. However, it is dangerous to rely on this behavior if portable operation is expected.
/// Success.
- [DllImport( Alut.Lib, EntryPoint = "alutExit", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool Exit( );
+ [DllImport(Alut.Lib, EntryPoint = "alutExit", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern AL.Bool Exit();
// ALUT_API ALboolean ALUT_APIENTRY alutExit (void);
+
#endregion Init/Exit
#region Error Checking
+
/// Any ALUT routine that fails will return AL_FALSE / AL_NONE / NULL and set the global error state. If a subsequent error occurs while there is still an error recorded internally, the second error will simply be ignored. Calling alutGetError will reset the error code to ALUT_ERROR_NO_ERROR. Note that the error state is not cleared by other successful ALUT calls. Alut.GetError can be called in any ALUT state and will never fail.
///
- [DllImport( Alut.Lib, EntryPoint = "alutGetError", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Enums.AlutError GetError( );
+ [DllImport(Alut.Lib, EntryPoint = "alutGetError", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern Enums.AlutError GetError();
// ALUT_API ALenum ALUT_APIENTRY alutGetError (void);
- [DllImport( Alut.Lib, EntryPoint = "alutGetErrorString", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- private static extern IntPtr GetErrorStringInternal( Enums.AlutError error );
+ [DllImport(Alut.Lib, EntryPoint = "alutGetErrorString", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ private static extern IntPtr GetErrorStringPrivate(Enums.AlutError error);
// ALUT_API const char *ALUT_APIENTRY alutGetErrorString (ALenum error);
/// Alut.GetErrorString can be used to convert an error code into a human-readable description. The precise text of these descriptions may vary from implementation to implementation and should not be relied upon by the application.
/// Retrieve first occured error with Alut.GetError
/// A human-readable description of the Error.
- internal static string GetErrorString( Enums.AlutError error )
+ public static string GetErrorString(Enums.AlutError error)
{
- return Marshal.PtrToStringAnsi( GetErrorStringInternal( error ) );
+ return Marshal.PtrToStringAnsi(GetErrorStringPrivate(error));
}
+
#endregion Error Checking
- #region File Loading
+ #region File Loading
+
/// Alut.CreateBufferFromFile tries to guess the sound data format by looking at the filename and/or the file contents and loads the sound data into an OpenAL buffer.
/// The file to be loaded
/// OpenAL Buffer, 0 on failure.
- [DllImport( Alut.Lib, EntryPoint = "alutCreateBufferFromFile", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- internal static extern uint CreateBufferFromFile( [In] string filename );
+ [CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferFromFile", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ public static extern uint CreateBufferFromFile([In] string filename);
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFile (const char *fileName);
/// Alut.CreateBufferFromFileImage tries to guess the sound data format by looking at the contents of the memory region given as parameters and loads the sound data into an OpenAL buffer.
/// A Pointer to the sound data in memory.
/// Size in Bytes of the sound data.
/// OpenAL Buffer, 0 on failure.
- [DllImport( Alut.Lib, EntryPoint = "alutCreateBufferFromFileImage", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern uint CreateBufferFromFileImage( [In] IntPtr data, int length );
+ [CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferFromFileImage", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern uint CreateBufferFromFileImage([In] IntPtr data, int length);
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFileImage (const ALvoid *data, ALsizei length);
/// Alut.CreateBufferHelloWorld returns a handle to an OpenAL buffer containing the sound of someone saying 'Hello, world!'.
/// OpenAL Buffer, 0 on failure.
- [DllImport( Alut.Lib, EntryPoint = "alutCreateBufferHelloWorld", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern uint CreateBufferHelloWorld( );
+ [CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferHelloWorld", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern uint CreateBufferHelloWorld();
//ALUT_API ALuint ALUT_APIENTRY alutCreateBufferHelloWorld (void);
/// Alut.CreateBufferWaveform returns a handle to an OpenAL buffer containing a snippet of audio with the specified waveshape at the specified frequency (in Hertz), phase (in degrees: -180 to +180) and duration (in seconds).
@@ -116,8 +116,8 @@ namespace OpenTK.OpenAL
/// Phase (in degrees: -180 to +180)
/// Duration (in seconds)
/// OpenAL Buffer, 0 on failure.
- [DllImport( Alut.Lib, EntryPoint = "alutCreateBufferWaveform", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern uint CreateBufferWaveform( Enums.AlutWaveform waveshape, float frequency, float phase, float duration );
+ [CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferWaveform", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern uint CreateBufferWaveform(Enums.AlutWaveform waveshape, float frequency, float phase, float duration);
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration);
// Warning: these leak memory if not properly free'd
@@ -125,11 +125,12 @@ namespace OpenTK.OpenAL
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFileImage (const ALvoid *data, ALsizei length, ALenum *format, ALsizei *size, ALfloat *frequency);
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryHelloWorld (ALenum *format, ALsizei *size, ALfloat *frequency);
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum *format, ALsizei *size, ALfloat *freq);
+
#endregion File Loading
#region Misc
- [DllImport( Alut.Lib, EntryPoint = "alutGetMIMETypes", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
- private static extern IntPtr GetMIMETypesInternal( Enums.AlutLoader loader );
+ [DllImport(Alut.Lib, EntryPoint = "alutGetMIMETypes", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
+ private static extern IntPtr GetMIMETypesPrivate(Enums.AlutLoader loader);
// ALUT_API const char *ALUT_APIENTRY alutGetMIMETypes (ALenum loader);
/// Alut.GetMIMETypes returns a comma-separated list of supported MIME types for the given loader type, e.g. something like "audio/basic,audio/mpeg,audio/x-wav".
@@ -137,31 +138,34 @@ namespace OpenTK.OpenAL
///
///
/// A comma-separated list of supported MIME types.
- internal static string GetMIMETypes( Enums.AlutLoader loader )
+ public static string GetMIMETypes(Enums.AlutLoader loader)
{
- return Marshal.PtrToStringAnsi( GetMIMETypesInternal( loader ) );
+ return Marshal.PtrToStringAnsi(GetMIMETypesPrivate(loader));
}
/// Alut.GetMajorVersion returns the major version number of the ALUT in use, which will match the major version number of the corresponding ALUT specification document. Can be compared using Enums.AlutVersions.
/// Major Version Number.
- [DllImport( Alut.Lib, EntryPoint = "alutGetMajorVersion", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern int GetMajorVersion( );
+ [DllImport(Alut.Lib, EntryPoint = "alutGetMajorVersion", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern int GetMajorVersion();
// ALUT_API ALint ALUT_APIENTRY alutGetMajorVersion (void);
/// Alut.GetMinorVersion returns the minor version number of the ALUT in use, which will match the minor version number of the corresponding ALUT specification document. Can be compared using Enums.AlutVersions.
/// Minor Version Number.
- [DllImport( Alut.Lib, EntryPoint = "alutGetMinorVersion", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern int GetMinorVersion( );
+ [DllImport(Alut.Lib, EntryPoint = "alutGetMinorVersion", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
+ public static extern int GetMinorVersion();
// ALUT_API ALint ALUT_APIENTRY alutGetMinorVersion (void);
+ /*
/// Alut.Sleep will delay the execution of the current thread for at least the given amount of seconds. It will only return earlier if a signal has been delivered to the thread, but this does not count as an error. Note that sleeping for zero seconds will give other runnable threads a chance to run.
/// Having a general utility function like the following in an audio-related toolkit might seem strange at first, but sleeping is a common task in a lot of audio demos and it can't be done portably without cluttering the source code with #ifdefs.
///
/// Number of seconds. May not be negative.
/// Success.
[DllImport( Alut.Lib, EntryPoint = "alutSleep", ExactSpelling = true, CallingConvention = Alut.Style ), SuppressUnmanagedCodeSecurity( )]
- internal static extern Al.Bool Sleep( float duration );
+ public static extern AL.Bool Sleep( float duration );
// ALUT_API ALboolean ALUT_APIENTRY alutSleep (ALfloat duration);
+ */
#endregion Misc
}
+
}
diff --git a/Source/OpenTK/OpenAL/AlutTokens.cs b/Source/OpenTK/OpenAL/AlutTokens.cs
index 9e874c99..46b49c43 100644
--- a/Source/OpenTK/OpenAL/AlutTokens.cs
+++ b/Source/OpenTK/OpenAL/AlutTokens.cs
@@ -3,89 +3,80 @@
* C header: \freealut-1.1.0-src\include\AL\Alut.h
* Spec: http://www.openal.org/openal_webstf/specs/alut.html
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
- * See license.txt for license details (MIT)
- * http://www.OpenTK.net
- */
-
-/* Version History:
- * 0.1
- * - Tokens AL_TRUE and AL_FALSE removed, created new type. see Al.Bool
- *
- *
- */
+ * See license.txt for license details
+ * http://www.OpenTK.net */
#endregion
using System;
-namespace OpenTK.OpenAL
+namespace OpenTK.OpenAL.Enums
{
- public partial class Enums
+
+ public enum AlutVersions : int
{
- public enum AlutVersions : int
- {
- /// Defines the A in OpenAL A.B
- ApiMajorVersion = 1,
- /// Defines the B in OpenAL A.B
- ApiMinorVersion = 1,
- }
-
- public enum AlutError : int
- {
- /// No ALUT error found.
- NoError = 0,
- /// ALUT ran out of memory.
- OutOfMemory = 0x200,
- /// ALUT was given an invalid enumeration token.
- InvalidEnum = 0x201,
- /// ALUT was given an invalid value.
- InvalidValue = 0x202,
- /// The operation is invalid in the current ALUT state.
- InvalidOperation = 0x203,
- /// There is no current AL context.
- NoCurrentContext = 0x204,
- /// There was already an AL error on entry to an ALUT function.
- AlErrorOnEntry = 0x205,
- /// There was already an ALC error on entry to an ALUT function.
- AlcErrorOnEntry = 0x206,
- /// There was an error opening the ALC device.
- OpenDevice = 0x207,
- /// There was an error closing the ALC device.
- CloseDevice = 0x208,
- /// There was an error creating an ALC context.
- CreateContext = 0x209,
- /// Could not change the current ALC context.
- MakeContextCurrent = 0x20A,
- /// There was an error destroying the ALC context.
- DestroyContext = 0x20B,
- /// There was an error generating an AL buffer.
- GenBuffers = 0x20C,
- /// There was an error passing buffer data to AL.
- BufferData = 0x20D,
- /// I/O error, consult errno for more details.
- IoError = 0x20E,
- /// Unsupported file type.
- UnsupportedFileType = 0x20F,
- /// Unsupported mode within an otherwise usable file type.
- UnsupportedFileSubtype = 0x210,
- /// The sound data was corrupt or truncated.
- CorruptOrTruncatedData = 0x211,
- }
-
- public enum AlutWaveform : int
- {
- Sine = 0x100,
- Square = 0x101,
- SawTooth = 0x102,
- WhiteNoise = 0x103,
- Impulse = 0x104,
- }
-
- public enum AlutLoader : int
- {
- ///For the loaders returning sound data in an OpenAL buffer, e.g. Alut.CreateBufferFromFile and Alut.CreateBufferFromFileImage
- Buffer = 0x300,
- ///For the loaders returning sound data in a newly allocated memory region, e.g. Alut.LoadMemoryFromFile and Alut.LoadMemoryFromFileImage.
- Memory = 0x301,
- }
+ /// Defines the A in OpenAL A.B
+ ApiMajorVersion = 1,
+ /// Defines the B in OpenAL A.B
+ ApiMinorVersion = 1,
}
+
+ public enum AlutError : int
+ {
+ /// No ALUT error found.
+ NoError = 0,
+ /// ALUT ran out of memory.
+ OutOfMemory = 0x200,
+ /// ALUT was given an invalid enumeration token.
+ InvalidEnum = 0x201,
+ /// ALUT was given an invalid value.
+ InvalidValue = 0x202,
+ /// The operation is invalid in the current ALUT state.
+ InvalidOperation = 0x203,
+ /// There is no current AL context.
+ NoCurrentContext = 0x204,
+ /// There was already an AL error on entry to an ALUT function.
+ AlErrorOnEntry = 0x205,
+ /// There was already an ALC error on entry to an ALUT function.
+ AlcErrorOnEntry = 0x206,
+ /// There was an error opening the ALC device.
+ OpenDevice = 0x207,
+ /// There was an error closing the ALC device.
+ CloseDevice = 0x208,
+ /// There was an error creating an ALC context.
+ CreateContext = 0x209,
+ /// Could not change the current ALC context.
+ MakeContextCurrent = 0x20A,
+ /// There was an error destroying the ALC context.
+ DestroyContext = 0x20B,
+ /// There was an error generating an AL buffer.
+ GenBuffers = 0x20C,
+ /// There was an error passing buffer data to AL.
+ BufferData = 0x20D,
+ /// I/O error, consult errno for more details.
+ IoError = 0x20E,
+ /// Unsupported file type.
+ UnsupportedFileType = 0x20F,
+ /// Unsupported mode within an otherwise usable file type.
+ UnsupportedFileSubtype = 0x210,
+ /// The sound data was corrupt or truncated.
+ CorruptOrTruncatedData = 0x211,
+ }
+
+ public enum AlutWaveform : int
+ {
+ Sine = 0x100,
+ Square = 0x101,
+ SawTooth = 0x102,
+ WhiteNoise = 0x103,
+ Impulse = 0x104,
+ }
+
+ public enum AlutLoader : int
+ {
+ ///For the loaders returning sound data in an OpenAL buffer, e.g. Alut.CreateBufferFromFile and Alut.CreateBufferFromFileImage
+ Buffer = 0x300,
+ ///For the loaders returning sound data in a newly allocated memory region, e.g. Alut.LoadMemoryFromFile and Alut.LoadMemoryFromFileImage.
+ Memory = 0x301,
+ }
+
}
diff --git a/Source/OpenTK/OpenAL/History.txt b/Source/OpenTK/OpenAL/History.txt
new file mode 100644
index 00000000..eeb124a8
--- /dev/null
+++ b/Source/OpenTK/OpenAL/History.txt
@@ -0,0 +1,47 @@
+Version History:
+
+0.1 Initial
+- Tokens AL_TRUE and AL_FALSE removed, created new type. see AL.Bool
+ Tokens ALC_TRUE and ALC_FALSE removed, created new type. see AL.Bool
+- Added AL.Null for convenience when working with C Manuals.
+- Alut: The following functions are not bound/imported. Issue of undoing C malloc to prevent memory leaks.
+ "alutLoadMemoryFromFile, alutLoadMemoryFromFileImage, alutLoadMemoryHelloWorld, alutLoadMemoryWaveform"
+ Please use Alut.CreateBuffer* functions instead, which have similar functionality and return a Buffer Handle instead.
+- AL: Functions not imported:
+ alListeneri, alListener3i, alListeneriv
+ alGetListeneri, alGetListener3i, alGetListeneriv
+ alGetBooleanv, alGetIntegerv, alGetFloatv, alGetDoublev
+ imported, but currently disabled: alGetBoolean, alGetDouble
+ alBufferf, alBufferfv, alBufferi, alBuffer3i, alBufferiv
+ imported, but currently disabled: alBuffer3f
+ alGetBufferf, alGetBuffer3f, alGetBufferfv, alGetBuffer3i, alGetBufferiv
+
+0.2
+- Largely improved documentation, found homes for previously orphaned Tokens.
+- The Token AL_DATA is hidden now, as it returns a pointer to unmanaged memory
+ where the buffer was located previously to calling AL.BufferData(). (It is usually freed after buffering)
+- Added Function AL.GetErrorString()
+- Added overloads for requesting/deleting a single buffer/source at a time.
+- Added Vector3 overloads where applicable.
+
+0.3 - breaks former written examples.
+- Using a single changelog now, as the number of issues per file has significantly shrunk.
+- Refactored -i -fv -3f functions to be overloads e.g AL.GetSource, AL.GetListener
+- Added XRam Extension prototype. Untested, as it requires special hardware.
+- Refactored extensively to match OpenTK naming conventions.
+- Moved functions into overloads
+- Removed all C prototype comments from AL/ALC/ALUT
+- Documented Alc properly
+
+0.4
+- changed Alc enum GetString/GetStringList
+- disabled Alut.Sleep, rather use Thread.Sleep
+- DopplerVelocity, ChannelMask are deprecated and marked.
+- functions with ushort, uint, ulong marked
+
+0.5 vanilla complete
+- Fix Alc.GetString( Enums.AlcGetStringList ) to terminate with 2 null, and split at 1 null
+
+Next Version:
+- EFX Extension
+- Enums themselves require summaries (do EFX 1st)
\ No newline at end of file
diff --git a/Source/OpenTK/OpenAL/XRamExtension.cs b/Source/OpenTK/OpenAL/XRamExtension.cs
new file mode 100644
index 00000000..a53bf9c6
--- /dev/null
+++ b/Source/OpenTK/OpenAL/XRamExtension.cs
@@ -0,0 +1,149 @@
+#region --- OpenTK.OpenAL License ---
+/* XRamExtension.cs
+ * C header: \OpenAL 1.1 SDK\include\xram.h
+ * Spec: ?
+ * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
+ * See license.txt for license details (MIT)
+ * http://www.OpenTK.net */
+#endregion
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace OpenTK.OpenAL
+{
+
+ public class XRamExtension
+ {
+ #region instance state
+
+ private bool _valid = false;
+
+ /// Returns True if the X-Ram Extension has been found and could be initialized.
+ public bool IsInitialized
+ {
+ get { return _valid; }
+ }
+
+ #endregion instance state
+
+ #region X-RAM Function pointer definitions
+
+ public unsafe delegate AL.Bool SetBufferMode(int n, ref uint buffers, int value);
+ //typedef ALboolean (__cdecl *EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value);
+
+ public delegate int GetBufferMode(uint buffer, out int value);
+ //typedef ALenum (__cdecl *EAXGetBufferMode)(ALuint buffer, ALint *value);
+
+ public SetBufferMode EAXSetBufferMode;
+ public GetBufferMode EAXGetBufferMode;
+
+ #endregion X-RAM Function pointer definitions
+
+ #region X-RAM Tokens
+
+ private int AL_EAX_RAM_SIZE, AL_EAX_RAM_FREE,
+ AL_STORAGE_AUTOMATIC, AL_STORAGE_HARDWARE, AL_STORAGE_ACCESSIBLE;
+
+ #endregion X-RAM Tokens
+
+ #region Constructor / Extension Loading
+
+ public XRamExtension()
+ { // Query if Extension supported and retrieve Tokens/Pointers if it is.
+ _valid = false;
+ if (AL.IsExtensionPresent("EAX-RAM") == AL.Bool.False)
+ return;
+
+ AL_EAX_RAM_SIZE = AL.GetEnumValue("AL_EAX_RAM_SIZE");
+ AL_EAX_RAM_FREE = AL.GetEnumValue("AL_EAX_RAM_FREE");
+ AL_STORAGE_AUTOMATIC = AL.GetEnumValue("AL_STORAGE_AUTOMATIC");
+ AL_STORAGE_HARDWARE = AL.GetEnumValue("AL_STORAGE_HARDWARE");
+ AL_STORAGE_ACCESSIBLE = AL.GetEnumValue("AL_STORAGE_ACCESSIBLE");
+
+ Console.WriteLine("RamSize: {0} RamFree: {1} StorageAuto: {2} StorageHW: {3} StorageAccess: {4}", AL_EAX_RAM_SIZE, AL_EAX_RAM_FREE, AL_STORAGE_AUTOMATIC, AL_STORAGE_HARDWARE, AL_STORAGE_ACCESSIBLE);
+
+ if (AL_EAX_RAM_SIZE == 0 ||
+ AL_EAX_RAM_FREE == 0 ||
+ AL_STORAGE_AUTOMATIC == 0 ||
+ AL_STORAGE_HARDWARE == 0 ||
+ AL_STORAGE_ACCESSIBLE == 0)
+ {
+ Console.WriteLine("Token values could not be retrieved.");
+ return;
+ }
+
+ Console.WriteLine("Free Ram: {0} / {1}", GetRamFree(), GetRamSize());
+
+ try
+ {
+ EAXGetBufferMode = (GetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXGetBufferMode"), typeof(GetBufferMode));
+ EAXSetBufferMode = (SetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXSetBufferMode"), typeof(SetBufferMode));
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Attempt to marshal AL.GetProcAddress failed. " + e.ToString());
+ return;
+ }
+
+ _valid = true;
+ }
+
+ #endregion Constructor / Extension Loading
+
+ #region Public Methods
+
+ /// Query total amount of X-RAM.
+ public int GetRamSize()
+ {
+ return AL.Get((Enums.ALGetInteger)AL_EAX_RAM_SIZE);
+ }
+
+ /// Query free X-RAM available.
+ public int GetRamFree()
+ {
+ return AL.Get((Enums.ALGetInteger)AL_EAX_RAM_FREE);
+ }
+
+ public enum XRamStorage : byte
+ {
+ /// Put an Open AL Buffer into X-RAM if memory is available, otherwise use host RAM. This is the default mode.
+ /// alGenBuffers(1, &uiBuffer);
+ /// eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_AUTOMATIC"));
+ /// alBufferData(...);
+ ///
+ Automatic,
+ /// Force an Open AL Buffer into X-RAM (good for non-streaming buffers)
+ // alGenBuffers(1, &uiBuffer);
+ // eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_HARDWARE"));
+ // alBufferData(...);
+ ///
+ Hardware = 1,
+ /// Force an Open AL Buffer into 'accessible' (currently host) RAM (good for streaming buffers)
+ /// alGenBuffers(1, &uiBuffer);
+ /// eaxSetBufferMode(1, &uiBuffer, alGetEnumValue("AL_STORAGE_ACCESSIBLE"));
+ /// alBufferData(...);
+ ///
+ Acessible = 2,
+
+ }
+
+ public void _SetBufferMode(ref uint buffer, XRamStorage mode)
+ {
+ switch (mode)
+ {
+ case XRamStorage.Acessible:
+ EAXSetBufferMode(1, ref buffer, AL_STORAGE_ACCESSIBLE);
+ break;
+ case XRamStorage.Hardware:
+ EAXSetBufferMode(1, ref buffer, AL_STORAGE_HARDWARE);
+ break;
+ default:
+ EAXSetBufferMode(1, ref buffer, AL_STORAGE_AUTOMATIC);
+ break;
+ }
+ }
+
+ #endregion Public Methods
+ }
+}
\ No newline at end of file