diff --git a/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs b/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs index a2b313f5..31e610d4 100644 --- a/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs +++ b/Source/OpenTK/Audio/OpenAL/Alc/Alc.cs @@ -87,9 +87,9 @@ namespace OpenTK.Audio /// 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] + [DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity] [CLSCompliant(false)] - unsafe public static extern IntPtr CreateContext( [In] IntPtr device,[In] int* attrlist ); + unsafe public static extern IntPtr CreateContext([In] IntPtr device, [In] int* attrlist); // ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); /// This function creates a context using a specified device. @@ -97,13 +97,13 @@ namespace OpenTK.Audio /// an array of 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. - public static IntPtr CreateContext( IntPtr device,int[] attriblist ) + public static IntPtr CreateContext(IntPtr device, int[] attriblist) { unsafe { - fixed ( int* attriblist_ptr = attriblist ) + fixed (int* attriblist_ptr = attriblist) { - return CreateContext(device,attriblist_ptr); + return CreateContext(device, attriblist_ptr); } } } @@ -113,39 +113,39 @@ namespace OpenTK.Audio /// 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 bool MakeContextCurrent( [In] IntPtr context ); + [DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] + public static extern bool MakeContextCurrent([In] IntPtr context); // ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *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 ); + [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 ); /// 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 ); + [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 ); /// 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 ); + [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 ); /// 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( ); + [DllImport(Alc.Lib, EntryPoint = "alcGetCurrentContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] + public static extern IntPtr GetCurrentContext(); // ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void ); /// 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 ); + [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 ); #endregion Context Management @@ -155,15 +155,15 @@ namespace OpenTK.Audio /// 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 ); + [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 bool CloseDevice( [In] IntPtr device ); + [DllImport(Alc.Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] + public static extern bool CloseDevice([In] IntPtr device); // ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device ); #endregion Device Management @@ -173,8 +173,8 @@ namespace OpenTK.Audio /// 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 AlcError GetError( [In] IntPtr device ); + [DllImport(Alc.Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] + public static extern AlcError GetError([In] IntPtr device); // ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device ); #endregion Error support. @@ -185,32 +185,32 @@ namespace OpenTK.Audio /// 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 bool IsExtensionPresent( [In] IntPtr device,[In] string extname ); + [DllImport(Alc.Lib, EntryPoint = "alcIsExtensionPresent", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] + public static extern bool IsExtensionPresent([In] IntPtr device, [In] string extname); // ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *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 ); + [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 ); /// 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 ); + [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 ); #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,AlcGetString param ); + [DllImport(Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] + private static extern IntPtr GetStringPrivate([In] IntPtr device, AlcGetString param); // ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param ); /// This function returns pointers to strings related to the context. @@ -224,9 +224,9 @@ namespace OpenTK.Audio /// 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 /// A string containing the name of the Device. - public static string GetString( IntPtr device,AlcGetString param ) + public static string GetString(IntPtr device, AlcGetString param) { - return Marshal.PtrToStringAnsi(GetStringPrivate(device,param)); + return Marshal.PtrToStringAnsi(GetStringPrivate(device, param)); } /// This function returns a List of strings related to the context. @@ -268,8 +268,8 @@ namespace OpenTK.Audio /// 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 buffer to be returned - [DllImport(Alc.Lib,EntryPoint = "alcGetIntegerv",ExactSpelling = true,CallingConvention = Alc.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )] - public static extern void GetInteger( [In] IntPtr device,AlcGetInteger param,int size,[Out] out int data ); + [DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] + public static extern void GetInteger([In] IntPtr device, AlcGetInteger param, int size, [Out] out int data); // ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); #endregion Query functions @@ -282,36 +282,36 @@ namespace OpenTK.Audio /// 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,ALFormat format,int buffersize ); + [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, ALFormat format, int buffersize); // ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei 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 bool CaptureCloseDevice( [In] IntPtr device ); + [DllImport(Alc.Lib, EntryPoint = "alcCaptureCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] + public static extern bool CaptureCloseDevice([In] IntPtr device); // ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *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 ); + [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 ); /// 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 ); + [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 ); /// This function completes a capture operation, and does not block. /// a pointer to a capture device. /// a pointer to a buffer 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 ); + [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 ); #endregion Capture functions