dynamically load openal libs using mellinoe's code

This commit is contained in:
emmaus 2018-06-19 14:14:46 +00:00
parent a01978c895
commit cc02000e6d
3 changed files with 257 additions and 177 deletions

View file

@ -67,30 +67,57 @@ namespace OpenTK.Audio.OpenAL
public static partial class AL
{
internal const string Lib = "openal32.dll";
private const CallingConvention Style = CallingConvention.Cdecl;
internal static readonly NativeLibrary ALNativeLib = NativeLibrary.Load(AL.GetOpenALLibName());
internal static string GetOpenALLibName()
{
#if NETSTANDARD
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return "openal32.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return "libopenal.so.1";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return "/System/Library/Frameworks/OpenAL.framework/OpenAL";
}
else
{
return "openal32.dll";
}
#else
return "openal32.dll";
#endif
}
private unsafe delegate void alEnable_d(ALCapability capability);
private static alEnable_d alEnable_ptr = ALNativeLib.LoadFunctionPointer<alEnable_d>("alEnable");
/// <summary>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.</summary>
/// <param name="capability">The name of a capability to enable.</param>
[DllImport(AL.Lib, EntryPoint = "alEnable", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Enable(ALCapability capability);
public static void Enable(ALCapability capability) => alEnable_ptr(capability);
//AL_API void AL_APIENTRY alEnable( ALenum capability );
private unsafe delegate void alDisable_d(ALCapability capability);
private static alDisable_d alDisable_ptr = ALNativeLib.LoadFunctionPointer<alDisable_d>("alDisable");
/// <summary>This function disables a feature of the OpenAL driver.</summary>
/// <param name="capability">The name of a capability to disable.</param>
[DllImport(AL.Lib, EntryPoint = "alDisable", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Disable(ALCapability capability);
// AL_API void AL_APIENTRY alDisable( ALenum capability );
public static void Disable(ALCapability capability) => alDisable_ptr(capability);
// AL_API void AL_APIENTRY alDisable( ALenum capability );
private unsafe delegate bool IsEnabled_d(ALCapability capability);
private static IsEnabled_d alIsEnabled_ptr = ALNativeLib.LoadFunctionPointer<IsEnabled_d>("alIsEnabled");
/// <summary>This function returns a boolean indicating if a specific feature is enabled in the OpenAL driver.</summary>
/// <param name="capability">The name of a capability to enable.</param>
/// <returns>True if enabled, False if disabled.</returns>
[DllImport(AL.Lib, EntryPoint = "alIsEnabled", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern bool IsEnabled(ALCapability capability);
public static bool IsEnabled(ALCapability capability) => alIsEnabled_ptr(capability);
// AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
[DllImport(AL.Lib, EntryPoint = "alGetString", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
private static extern IntPtr GetStringPrivate(ALGetString param); // accepts the enums AlError, AlContextString
private unsafe delegate IntPtr GetStringPrivate_d(ALGetString param);
private static GetStringPrivate_d alGetString_ptr = ALNativeLib.LoadFunctionPointer<GetStringPrivate_d>("alGetString");
private static IntPtr GetStringPrivate(ALGetString param) => alGetString_ptr(param); // accepts the enums AlError, AlContextString
// AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
/// <summary>This function retrieves an OpenAL string property.</summary>
@ -125,18 +152,20 @@ namespace OpenTK.Audio.OpenAL
// AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
*/
private unsafe delegate int Get_d(ALGetInteger param);
private static Get_d alGetInteger_ptr = ALNativeLib.LoadFunctionPointer<Get_d>("alGetInteger");
/// <summary>This function returns an integer OpenAL state.</summary>
/// <param name="param">the state to be queried: DistanceModel.</param>
/// <returns>The integer state described by param will be returned.</returns>
[DllImport(AL.Lib, EntryPoint = "alGetInteger", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern int Get(ALGetInteger param);
public static int Get(ALGetInteger param) => alGetInteger_ptr(param);
// AL_API ALint AL_APIENTRY alGetInteger( ALenum param );
private unsafe delegate float GetFloat_d(ALGetFloat param);
private static GetFloat_d alGetFloat_ptr = ALNativeLib.LoadFunctionPointer<GetFloat_d>("alGetFloat");
/// <summary>This function returns a floating-point OpenAL state.</summary>
/// <param name="param">the state to be queried: DopplerFactor, SpeedOfSound.</param>
/// <returns>The floating-point state described by param will be returned.</returns>
[DllImport(AL.Lib, EntryPoint = "alGetFloat", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern float Get(ALGetFloat param);
public static float Get(ALGetFloat param) => alGetFloat_ptr(param);
// AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param );
/* disabled due to no token using it
@ -148,31 +177,35 @@ namespace OpenTK.Audio.OpenAL
// AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
*/
private unsafe delegate ALError GetError_d();
private static GetError_d alGetError_ptr = ALNativeLib.LoadFunctionPointer<GetError_d>("alGetError");
/// <summary>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.</summary>
/// <returns>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.</returns>
[DllImport(AL.Lib, EntryPoint = "alGetError", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern ALError GetError();
public static ALError GetError() => alGetError_ptr();
// AL_API ALenum AL_APIENTRY alGetError( void );
///<summary>This function tests if a specific Extension is available for the OpenAL driver.</summary>
/// <param name="extname">A string naming the desired extension. Example: "EAX-RAM"</param>
/// <returns>Returns True if the Extension is available or False if not available.</returns>
[DllImport(AL.Lib, EntryPoint = "alIsExtensionPresent", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
public static extern bool IsExtensionPresent([In] string extname);
public static bool IsExtensionPresent([In] string extname) => IsExtensionPresent_dptr(extname);
private static IsExtensionPresent_d IsExtensionPresent_dptr = ALNativeLib.LoadFunctionPointer<IsExtensionPresent_d>("alIsExtensionPresent");
private unsafe delegate bool IsExtensionPresent_d([In] string extname);
// AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname );
/// <summary>This function returns the address of an OpenAL extension function. Handle with care.</summary>
/// <param name="fname">A string containing the function name.</param>
/// <returns>The return value is a pointer to the specified function. The return value will be IntPtr.Zero if the function is not found.</returns>
[DllImport(AL.Lib, EntryPoint = "alGetProcAddress", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
public static extern IntPtr GetProcAddress([In] string fname);
public static IntPtr GetProcAddress([In] string fname) => GetProcAddress_dptr(fname);
private static GetProcAddress_d GetProcAddress_dptr = ALNativeLib.LoadFunctionPointer<GetProcAddress_d>("alGetProcAddress");
private unsafe delegate IntPtr GetProcAddress_d([In] string fname);
// AL_API void* AL_APIENTRY alGetProcAddress( const ALchar* fname );
/// <summary>This function returns the enumeration value of an OpenAL token, described by a string.</summary>
/// <param name="ename">A string describing an OpenAL token. Example "AL_DISTANCE_MODEL"</param>
/// <returns>Returns the actual ALenum described by a string. Returns 0 if the string doesnt describe a valid OpenAL token.</returns>
[DllImport(AL.Lib, EntryPoint = "alGetEnumValue", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
public static extern int GetEnumValue([In] string ename);
public static int GetEnumValue([In] string ename) => GetEnumValue_dptr(ename);
private static GetEnumValue_d GetEnumValue_dptr = ALNativeLib.LoadFunctionPointer<GetEnumValue_d>("alGetEnumValue");
private unsafe delegate int GetEnumValue_d([In] string ename);
// AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
/* Listener
@ -190,8 +223,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function sets a floating-point property for the listener.</summary>
/// <param name="param">The name of the attribute to be set: ALListenerf.Gain</param>
/// <param name="value">The float value to set the attribute to.</param>
[DllImport(AL.Lib, EntryPoint = "alListenerf", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Listener(ALListenerf param, float value);
public static void Listener(ALListenerf param, float value) => Listener_dptr(param, value);
private static Listener_d Listener_dptr = ALNativeLib.LoadFunctionPointer<Listener_d>("alListenerf");
private unsafe delegate void Listener_d(ALListenerf param, float value);
// AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
/// <summary>This function sets a floating-point property for the listener.</summary>
@ -199,8 +233,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="value1">The value to set the attribute to.</param>
/// <param name="value2">The value to set the attribute to.</param>
/// <param name="value3">The value to set the attribute to.</param>
[DllImport(AL.Lib, EntryPoint = "alListener3f", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Listener(ALListener3f param, float value1, float value2, float value3);
public static void Listener(ALListener3f param, float value1, float value2, float value3) => Listener3_dptr(param, value1, value2, value3);
private static Listener3_d Listener3_dptr = ALNativeLib.LoadFunctionPointer<Listener3_d>("alListener3f");
private unsafe delegate void Listener3_d(ALListener3f param, float value1, float value2, float value3);
// AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
/// <summary>This function sets a Math.Vector3 property for the listener.</summary>
@ -211,8 +246,9 @@ namespace OpenTK.Audio.OpenAL
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(ALListenerfv param, float* values);
private unsafe delegate void ListenerPrivate_d(ALListenerfv param, float* values);
private static ListenerPrivate_d alListenerfv_ptr = ALNativeLib.LoadFunctionPointer<ListenerPrivate_d>("alListenerfv");
unsafe private static void ListenerPrivate(ALListenerfv param, float* values) => alListenerfv_ptr(param, values);
// AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
/// <summary>This function sets a floating-point vector property of the listener.</summary>
@ -262,8 +298,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function retrieves a floating-point property of the listener.</summary>
/// <param name="param">the name of the attribute to be retrieved: ALListenerf.Gain</param>
/// <param name="value">a pointer to the floating-point value being retrieved.</param>
[DllImport(AL.Lib, EntryPoint = "alGetListenerf", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void GetListener(ALListenerf param, [Out] out float value);
public static void GetListener(ALListenerf param, [Out] out float value) => GetListener_dptr(param, out value);
private static GetListener_d GetListener_dptr = ALNativeLib.LoadFunctionPointer<GetListener_d>("alGetListenerf");
private unsafe delegate void GetListener_d(ALListenerf param, [Out] out float value);
// AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
/// <summary>This function retrieves a set of three floating-point values from a property of the listener.</summary>
@ -271,8 +308,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="value1">The first floating-point value being retrieved.</param>
/// <param name="value2">The second floating-point value being retrieved.</param>
/// <param name="value3">The third floating-point value being retrieved.</param>
[DllImport(AL.Lib, EntryPoint = "alGetListener3f", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void GetListener(ALListener3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3);
public static void GetListener(ALListener3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3) => GetListener3_dptr(param, out value1, out value2, out value3);
private static GetListener3_d GetListener3_dptr = ALNativeLib.LoadFunctionPointer<GetListener3_d>("alGetListener3f");
private unsafe delegate void GetListener3_d(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 );
/// <summary>This function retrieves a Math.Vector3 from a property of the listener.</summary>
@ -286,8 +324,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function retrieves a floating-point vector property of the listener. You must pin it manually.</summary>
/// <param name="param">the name of the attribute to be retrieved: ALListener3f.Position, ALListener3f.Velocity, ALListenerfv.Orientation</param>
/// <param name="values">A pointer to the floating-point vector value being retrieved.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alGetListenerfv", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
unsafe public static extern void GetListener(ALListenerfv param, float* values);
unsafe public static void GetListener(ALListenerfv param, float* values) => GetListenerfv_dptr(param, values);
private static GetListenerfv_d GetListenerfv_dptr = ALNativeLib.LoadFunctionPointer<GetListenerfv_d>("alGetListenerfv");
private unsafe delegate void GetListenerfv_d(ALListenerfv param, float* values);
// AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
/// <summary>This function retrieves two Math.Vector3 properties of the listener.</summary>
@ -356,8 +395,9 @@ namespace OpenTK.Audio.OpenAL
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
*/
[DllImport(AL.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
unsafe private static extern void GenSourcesPrivate(int n, [Out] uint* sources);
private unsafe delegate void GenSourcesPrivate_D(int n, [Out] uint* sources);
private static GenSourcesPrivate_D alGenSources_ptr = ALNativeLib.LoadFunctionPointer<GenSourcesPrivate_D>("alGenSources");
unsafe private static void GenSourcesPrivate(int n, [Out] uint* sources) => alGenSources_ptr(n, sources);
// AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* Sources );
/// <summary>This function generates one or more sources. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
@ -437,22 +477,25 @@ namespace OpenTK.Audio.OpenAL
/// <param name="n">The number of sources to be deleted.</param>
/// <param name="sources">Pointer to an array of source names identifying the sources to be deleted.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alDeleteSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
unsafe public static extern void DeleteSources(int n, [In] uint* sources); // Delete Source objects
// AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* Sources );
unsafe public static void DeleteSources(int n, [In] uint* sources) => DeleteSources_dptr(n, sources);
private static DeleteSources_d DeleteSources_dptr = ALNativeLib.LoadFunctionPointer<DeleteSources_d>("alDeleteSources");
private unsafe delegate void DeleteSources_d(int n, [In] uint* sources); // Delete Source objects
// AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* Sources );
/// <summary>This function deletes one or more sources.</summary>
/// <param name="n">The number of sources to be deleted.</param>
/// <param name="sources">Reference to a single source, or an array of source names identifying the sources to be deleted.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alDeleteSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void DeleteSources(int n, ref uint sources);
public static void DeleteSources(int n, ref uint sources) => DeleteSources1_dptr(n, ref sources);
private static DeleteSources1_d DeleteSources1_dptr = AL.ALNativeLib.LoadFunctionPointer<DeleteSources1_d>("alDeleteSources");
private delegate void DeleteSources1_d(int n, ref uint sources);
/// <summary>This function deletes one or more sources.</summary>
/// <param name="n">The number of sources to be deleted.</param>
/// <param name="sources">Reference to a single source, or an array of source names identifying the sources to be deleted.</param>
[DllImport(AL.Lib, EntryPoint = "alDeleteSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void DeleteSources(int n, ref int sources);
public static void DeleteSources(int n, ref int sources) => DeleteSources2_dptr(n, ref sources);
private static DeleteSources2_d DeleteSources2_dptr = AL.ALNativeLib.LoadFunctionPointer<DeleteSources2_d>("alDeleteSources");
private delegate void DeleteSources2_d(int n, ref int sources);
/// <summary>This function deletes one or more sources.</summary>
/// <param name="sources">An array of source names identifying the sources to be deleted.</param>
@ -503,8 +546,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function tests if a source name is valid, returning True if valid and False if not.</summary>
/// <param name="sid">A source name to be tested for validity</param>
/// <returns>Success.</returns>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alIsSource", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern bool IsSource(uint sid);
public static bool IsSource(uint sid) => IsSource_dptr(sid);
private static IsSource_d IsSource_dptr = ALNativeLib.LoadFunctionPointer<IsSource_d>("alIsSource");
private unsafe delegate bool IsSource_d(uint sid);
// AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid );
/// <summary>This function tests if a source name is valid, returning True if valid and False if not.</summary>
@ -519,8 +563,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sid">Source name whose attribute is being set</param>
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
/// <param name="value">The value to set the attribute to.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcef", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Source(uint sid, ALSourcef param, float value);
public static void Source(uint sid, ALSourcef param, float value) => Source_dptr(sid, param, value);
private static Source_d Source_dptr = ALNativeLib.LoadFunctionPointer<Source_d>("alSourcef");
private unsafe delegate void Source_d(uint sid, ALSourcef param, float value);
// AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
/// <summary>This function sets a floating-point property of a source.</summary>
@ -538,8 +583,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="value1">The three ALfloat values which the attribute will be set to.</param>
/// <param name="value2">The three ALfloat values which the attribute will be set to.</param>
/// <param name="value3">The three ALfloat values which the attribute will be set to.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSource3f", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Source(uint sid, ALSource3f param, float value1, float value2, float value3);
public static void Source(uint sid, ALSource3f param, float value1, float value2, float value3) => Source3_dptr(sid, param, value1, value2, value3);
private static Source3_d Source3_dptr = ALNativeLib.LoadFunctionPointer<Source3_d>("alSource3f");
private unsafe delegate void Source3_d(uint sid, ALSource3f param, float value1, float value2, float value3);
// AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
/// <summary>This function sets a source property requiring three floating-point values.</summary>
@ -576,9 +622,10 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sid">Source name whose attribute is being set.</param>
/// <param name="param">The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState.</param>
/// <param name="value">The value to set the attribute to.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcei", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Source(uint sid, ALSourcei param, int value);
// AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
public static void Source(uint sid, ALSourcei param, int value) => Sourcei_dptr(sid, param, value);
private static Sourcei_d Sourcei_dptr = ALNativeLib.LoadFunctionPointer<Sourcei_d>("alSourcei");
private unsafe delegate void Sourcei_d(uint sid, ALSourcei param, int value);
// AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
/// <summary>This function sets an integer property of a source.</summary>
/// <param name="sid">Source name whose attribute is being set.</param>
@ -631,9 +678,10 @@ namespace OpenTK.Audio.OpenAL
/// <param name="value1">The value to set the attribute to. (EFX Extension) The destination Auxiliary Effect Slot ID</param>
/// <param name="value2">The value to set the attribute to. (EFX Extension) The Auxiliary Send number.</param>
///<param name="value3">The value to set the attribute to. (EFX Extension) optional Filter ID.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSource3i", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void Source(uint sid, ALSource3i param, int value1, int value2, int value3);
// AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
public static void Source(uint sid, ALSource3i param, int value1, int value2, int value3) => Source3i_dptr(sid, param, value1, value2, value3);
private static Source3i_d Source3i_dptr = ALNativeLib.LoadFunctionPointer<Source3i_d>("alSource3i");
private unsafe delegate void Source3i_d(uint sid, ALSource3i param, int value1, int value2, int value3);
// AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
/// <summary>This function sets 3 integer properties of a source. This property is used to establish connections between Sources and Auxiliary Effect Slots.</summary>
/// <param name="sid">Source name whose attribute is being set.</param>
@ -654,8 +702,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sid">Source name whose attribute is being retrieved.</param>
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
/// <param name="value">A pointer to the floating-point value being retrieved</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alGetSourcef", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void GetSource(uint sid, ALSourcef param, [Out] out float value);
public static void GetSource(uint sid, ALSourcef param, [Out] out float value) => GetSource_dptr(sid, param, out value);
private static GetSource_d GetSource_dptr = ALNativeLib.LoadFunctionPointer<GetSource_d>("alGetSourcef");
private unsafe delegate void GetSource_d(uint sid, ALSourcef param, [Out] out float value);
// AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
/// <summary>This function retrieves a floating-point property of a source.</summary>
@ -673,8 +722,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="value1">Pointer to the value to retrieve.</param>
/// <param name="value2">Pointer to the value to retrieve.</param>
/// <param name="value3">Pointer to the value to retrieve.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alGetSource3f", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void GetSource(uint sid, ALSource3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3);
public static void GetSource(uint sid, ALSource3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3) => GetSource3_dptr(sid, param, out value1, out value2, out value3);
private static GetSource3_d GetSource3_dptr = ALNativeLib.LoadFunctionPointer<GetSource3_d>("alGetSource3f");
private unsafe delegate void GetSource3_d(uint sid, 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);
/// <summary>This function retrieves three floating-point values representing a property of a source.</summary>
@ -711,8 +761,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sid">Source name whose attribute is being retrieved.</param>
/// <param name="param">The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed.</param>
/// <param name="value">A pointer to the integer value being retrieved.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alGetSourcei", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void GetSource(uint sid, ALGetSourcei param, [Out] out int value);
public static void GetSource(uint sid, ALGetSourcei param, [Out] out int value) => GetSourcei_dptr(sid, param, out value);
private static GetSourcei_d GetSourcei_dptr = ALNativeLib.LoadFunctionPointer<GetSourcei_d>("alGetSourcei");
private unsafe delegate void GetSourcei_d(uint sid, ALGetSourcei param, [Out] out int value);
// AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
/// <summary>This function retrieves an integer property of a source.</summary>
@ -755,8 +806,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary>
/// <param name="ns">The number of sources to be played.</param>
/// <param name="sids">A pointer to an array of sources to be played.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePlayv"), SuppressUnmanagedCodeSecurity]
unsafe public static extern void SourcePlay(int ns, [In] uint* sids);
unsafe public static void SourcePlay(int ns, [In] uint* sids) => SourcePlayv_dptr(ns, sids);
private static SourcePlayv_d SourcePlayv_dptr = ALNativeLib.LoadFunctionPointer<SourcePlayv_d>("alSourcePlayv");
private unsafe delegate void SourcePlayv_d(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
/// <summary>This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary>
@ -805,8 +857,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped.</summary>
/// <param name="ns">The number of sources to stop.</param>
/// <param name="sids">A pointer to an array of sources to be stopped.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceStopv"), SuppressUnmanagedCodeSecurity]
unsafe public static extern void SourceStop(int ns, [In] uint* sids);
unsafe public static void SourceStop(int ns, [In] uint* sids) => SourceStopv_dptr(ns, sids);
private static SourceStopv_d SourceStopv_dptr = ALNativeLib.LoadFunctionPointer<SourceStopv_d>("alSourceStopv");
private unsafe delegate void SourceStopv_d(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
/// <summary>This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped.</summary>
@ -855,8 +908,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function stops a set of sources and sets all their states to ALSourceState.Initial.</summary>
/// <param name="ns">The number of sources to be rewound.</param>
/// <param name="sids">A pointer to an array of sources to be rewound.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceRewindv"), SuppressUnmanagedCodeSecurity]
unsafe public static extern void SourceRewind(int ns, [In] uint* sids);
unsafe public static void SourceRewind(int ns, [In] uint* sids) => SourceRewindv_dptr(ns, sids);
private static SourceRewindv_d SourceRewindv_dptr = ALNativeLib.LoadFunctionPointer<SourceRewindv_d>("alSourceRewindv");
private unsafe delegate void SourceRewindv_d(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
/// <summary>This function stops a set of sources and sets all their states to ALSourceState.Initial.</summary>
@ -905,8 +959,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused.</summary>
/// <param name="ns">The number of sources to be paused.</param>
/// <param name="sids">A pointer to an array of sources to be paused.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePausev"), SuppressUnmanagedCodeSecurity]
unsafe public static extern void SourcePause(int ns, [In] uint* sids);
unsafe public static void SourcePause(int ns, [In] uint* sids) => SourcePausev_dptr(ns, sids);
private static SourcePausev_d SourcePausev_dptr = ALNativeLib.LoadFunctionPointer<SourcePausev_d>("alSourcePausev");
private unsafe delegate void SourcePausev_d(int ns, [In] uint* sids);
// AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
/// <summary>This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused.</summary>
@ -953,8 +1008,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function plays, replays or resumes a source. The playing source will have it's state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary>
/// <param name="sid">The name of the source to be played.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePlay", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void SourcePlay(uint sid);
public static void SourcePlay(uint sid) => SourcePlay_dptr(sid);
private static SourcePlay_d SourcePlay_dptr = ALNativeLib.LoadFunctionPointer<SourcePlay_d>("alSourcePlay");
private unsafe delegate void SourcePlay_d(uint sid);
// AL_API void AL_APIENTRY alSourcePlay( ALuint sid );
/// <summary>This function plays, replays or resumes a source. The playing source will have it's state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary>
@ -963,11 +1019,12 @@ namespace OpenTK.Audio.OpenAL
{
SourcePlay((uint)sid);
}
/// <summary>This function stops a source. The stopped source will have it's state changed to ALSourceState.Stopped.</summary>
/// <param name="sid">The name of the source to be stopped.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceStop", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void SourceStop(uint sid);
public static void SourceStop(uint sid) => SourceStop_dptr(sid);
private static SourceStop_d SourceStop_dptr = ALNativeLib.LoadFunctionPointer<SourceStop_d>("alSourceStop");
private unsafe delegate void SourceStop_d(uint sid);
// AL_API void AL_APIENTRY alSourceStop( ALuint sid );
/// <summary>This function stops a source. The stopped source will have it's state changed to ALSourceState.Stopped.</summary>
@ -976,11 +1033,12 @@ namespace OpenTK.Audio.OpenAL
{
SourceStop((uint)sid);
}
/// <summary>This function stops the source and sets its state to ALSourceState.Initial.</summary>
/// <param name="sid">The name of the source to be rewound.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceRewind", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void SourceRewind(uint sid);
public static void SourceRewind(uint sid) => SourceRewind_dptr(sid);
private static SourceRewind_d SourceRewind_dptr = ALNativeLib.LoadFunctionPointer<SourceRewind_d>("alSourceRewind");
private unsafe delegate void SourceRewind_d(uint sid);
// AL_API void AL_APIENTRY alSourceRewind( ALuint sid );
/// <summary>This function stops the source and sets its state to ALSourceState.Initial.</summary>
@ -992,8 +1050,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function pauses a source. The paused source will have its state changed to ALSourceState.Paused.</summary>
/// <param name="sid">The name of the source to be paused.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePause", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void SourcePause(uint sid);
public static void SourcePause(uint sid) => SourcePause_dptr(sid);
private static SourcePause_d SourcePause_dptr = ALNativeLib.LoadFunctionPointer<SourcePause_d>("alSourcePause");
private unsafe delegate void SourcePause_d(uint sid);
// AL_API void AL_APIENTRY alSourcePause( ALuint sid );
/// <summary>This function pauses a source. The paused source will have its state changed to ALSourceState.Paused.</summary>
@ -1007,8 +1066,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sid">The name of the source to queue buffers onto.</param>
/// <param name="numEntries">The number of buffers to be queued.</param>
/// <param name="bids">A pointer to an array of buffer names to be queued.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceQueueBuffers"), SuppressUnmanagedCodeSecurity]
unsafe public static extern void SourceQueueBuffers(uint sid, int numEntries, [In] uint* bids);
unsafe public static void SourceQueueBuffers(uint sid, int numEntries, [In] uint* bids) => SourceQueueBuffers_dptr(sid, numEntries, bids);
private static SourceQueueBuffers_d SourceQueueBuffers_dptr = ALNativeLib.LoadFunctionPointer<SourceQueueBuffers_d>("alSourceQueueBuffers");
private unsafe delegate void SourceQueueBuffers_d(uint sid, int numEntries, [In] uint* bids);
// AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
/// <summary>This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming.</summary>
@ -1069,8 +1129,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sid">The name of the source to unqueue buffers from.</param>
/// <param name="numEntries">The number of buffers to be unqueued.</param>
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
unsafe public static extern void SourceUnqueueBuffers(uint sid, int numEntries, [In] uint* bids);
unsafe public static void SourceUnqueueBuffers(uint sid, int numEntries, [In] uint* bids) => SourceUnqueueBuffers1_dptr(sid, numEntries, bids);
private static SourceUnqueueBuffers1_d SourceUnqueueBuffers1_dptr = ALNativeLib.LoadFunctionPointer<SourceUnqueueBuffers1_d>("alSourceUnqueueBuffers");
private unsafe delegate void SourceUnqueueBuffers1_d(uint sid, int numEntries, [In] uint* bids);
// AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
@ -1078,30 +1139,34 @@ namespace OpenTK.Audio.OpenAL
/// <param name="numEntries">The number of buffers to be unqueued.</param>
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
public static extern void SourceUnqueueBuffers(uint sid, int numEntries, [Out] uint[] bids);
public static void SourceUnqueueBuffers(uint sid, int numEntries, [Out] uint[] bids) => SourceUnqueueBuffers2_dptr(sid, numEntries, bids);
private static SourceUnqueueBuffers2_d SourceUnqueueBuffers2_dptr = ALNativeLib.LoadFunctionPointer<SourceUnqueueBuffers2_d>("alSourceUnqueueBuffers");
private delegate void SourceUnqueueBuffers2_d(uint sid, int numEntries, [Out] uint[] bids);
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
/// <param name="sid">The name of the source to unqueue buffers from.</param>
/// <param name="numEntries">The number of buffers to be unqueued.</param>
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
public static extern void SourceUnqueueBuffers(int sid, int numEntries, [Out] int[] bids);
public static void SourceUnqueueBuffers(int sid, int numEntries, [Out] int[] bids) => SourceUnqueueBuffers3_dptr(sid, numEntries, bids);
private static SourceUnqueueBuffers3_d SourceUnqueueBuffers3_dptr = ALNativeLib.LoadFunctionPointer<SourceUnqueueBuffers3_d>("alSourceUnqueueBuffers");
private delegate void SourceUnqueueBuffers3_d(int sid, int numEntries, [Out] int[] bids);
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
/// <param name="sid">The name of the source to unqueue buffers from.</param>
/// <param name="numEntries">The number of buffers to be unqueued.</param>
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
public static extern void SourceUnqueueBuffers(uint sid, int numEntries, ref uint bids);
public static void SourceUnqueueBuffers(uint sid, int numEntries, ref uint bids) => SourceUnqueueBuffers4_dptr(sid, numEntries, ref bids);
private static SourceUnqueueBuffers4_d SourceUnqueueBuffers4_dptr = ALNativeLib.LoadFunctionPointer<SourceUnqueueBuffers4_d>("alSourceUnqueueBuffers");
private delegate void SourceUnqueueBuffers4_d(uint sid, int numEntries, ref uint bids);
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
/// <param name="sid">The name of the source to unqueue buffers from.</param>
/// <param name="numEntries">The number of buffers to be unqueued.</param>
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
public static extern void SourceUnqueueBuffers(int sid, int numEntries, ref int bids);
public static void SourceUnqueueBuffers(int sid, int numEntries, ref int bids) => SourceUnqueueBuffers5_dptr(sid, numEntries, ref bids);
private static SourceUnqueueBuffers5_d SourceUnqueueBuffers5_dptr = ALNativeLib.LoadFunctionPointer<SourceUnqueueBuffers5_d>("alSourceUnqueueBuffers");
private delegate void SourceUnqueueBuffers5_d(int sid, int numEntries, ref int bids);
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
/// <param name="sid">The name of the source to unqueue buffers from.</param>
@ -1144,16 +1209,14 @@ namespace OpenTK.Audio.OpenAL
/// <param name="n">The number of buffers to be generated.</param>
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity]
unsafe public static extern void GenBuffers(int n, [Out] uint* buffers);
// AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* Buffers );
unsafe public static void GenBuffers(int n, [Out] uint* buffers) => GenBuffers_dptr(n, buffers);
private static GenBuffers_d GenBuffers_dptr = ALNativeLib.LoadFunctionPointer<GenBuffers_d>("alGenBuffers");
private unsafe delegate void GenBuffers_d(int n, [Out] uint* buffers);
/// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
/// <param name="n">The number of buffers to be generated.</param>
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity]
unsafe public static extern void GenBuffers(int n, [Out] int* buffers);
unsafe public static void GenBuffers(int n, [Out] int* buffers) => GenBuffersS_dptr(n, buffers);
private static GenBuffersS_d GenBuffersS_dptr = ALNativeLib.LoadFunctionPointer<GenBuffersS_d>("alGenBuffers");
private unsafe delegate void GenBuffersS_d(int n, [Out] int* buffers);
// AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* Buffers );
/// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
/// <param name="n">The number of buffers to be generated.</param>
@ -1215,16 +1278,18 @@ namespace OpenTK.Audio.OpenAL
/// <param name="n">The number of buffers to be deleted.</param>
/// <param name="buffers">Pointer to an array of buffer names identifying the buffers to be deleted.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alDeleteBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
unsafe public static extern void DeleteBuffers(int n, [In] uint* buffers);
unsafe public static void DeleteBuffers(int n, [In] uint* buffers) => DeleteBuffers_dptr(n, buffers);
private static DeleteBuffers_d DeleteBuffers_dptr = ALNativeLib.LoadFunctionPointer<DeleteBuffers_d>("alDeleteBuffers");
private unsafe delegate void DeleteBuffers_d(int n, [In] uint* buffers);
// AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* Buffers );
/// <summary>This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source.</summary>
/// <param name="n">The number of buffers to be deleted.</param>
/// <param name="buffers">Pointer to an array of buffer names identifying the buffers to be deleted.</param>
[CLSCompliant(false)]
[DllImport(AL.Lib, EntryPoint = "alDeleteBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
unsafe public static extern void DeleteBuffers(int n, [In] int* buffers);
unsafe public static void DeleteBuffers(int n, [In] int* buffers) => DeleteBuffersS_dptr(n, buffers);
private static DeleteBuffersS_d DeleteBuffersS_dptr = ALNativeLib.LoadFunctionPointer<DeleteBuffersS_d>("alDeleteBuffers");
private unsafe delegate void DeleteBuffersS_d(int n, [In] int* buffers);
/// <summary>This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source.</summary>
/// <param name="n">The number of buffers to be deleted.</param>
@ -1304,8 +1369,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function tests if a buffer name is valid, returning True if valid, False if not.</summary>
/// <param name="bid">A buffer Handle previously allocated with <see cref="GenBuffers(int)"/>.</param>
/// <returns>Success.</returns>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alIsBuffer", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern bool IsBuffer(uint bid);
public static bool IsBuffer(uint bid) => IsBuffer_dptr(bid);
private static IsBuffer_d IsBuffer_dptr = ALNativeLib.LoadFunctionPointer<IsBuffer_d>("alIsBuffer");
private unsafe delegate bool IsBuffer_d(uint bid);
// AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid );
/// <summary>This function tests if a buffer name is valid, returning True if valid, False if not.</summary>
@ -1323,8 +1389,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="buffer">Pointer to a pinned audio buffer.</param>
/// <param name="size">The size of the audio buffer in bytes.</param>
/// <param name="freq">The frequency of the audio buffer.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alBufferData", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void BufferData(uint bid, ALFormat format, IntPtr buffer, int size, int freq);
public static void BufferData(uint bid, ALFormat format, IntPtr buffer, int size, int freq) => BufferData_dptr(bid, format, buffer, size, freq);
private static BufferData_d BufferData_dptr = ALNativeLib.LoadFunctionPointer<BufferData_d>("alBufferData");
private unsafe delegate void BufferData_d(uint bid, ALFormat format, IntPtr buffer, int size, int freq);
// AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* buffer, ALsizei size, ALsizei freq );
/// <summary>This function fills a buffer with audio buffer. All the pre-defined formats are PCM buffer, but this function may be used by extensions to load other buffer types as well.</summary>
@ -1383,8 +1450,9 @@ namespace OpenTK.Audio.OpenAL
/// <param name="bid">Buffer name whose attribute is being retrieved</param>
/// <param name="param">The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous).</param>
/// <param name="value">A pointer to an int to hold the retrieved buffer</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alGetBufferi", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void GetBuffer(uint bid, ALGetBufferi param, [Out] out int value);
public static void GetBuffer(uint bid, ALGetBufferi param, [Out] out int value) => GetBuffer_dptr(bid, param, out value);
private static GetBuffer_d GetBuffer_dptr = ALNativeLib.LoadFunctionPointer<GetBuffer_d>("alGetBufferi");
private unsafe delegate void GetBuffer_d(uint bid, ALGetBufferi param, [Out] out int value);
// AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
/// <summary>This function retrieves an integer property of a buffer.</summary>
@ -1404,20 +1472,23 @@ namespace OpenTK.Audio.OpenAL
/// <summary>AL.DopplerFactor is a simple scaling of source and listener velocities to exaggerate or deemphasize the Doppler (pitch) shift resulting from the calculation.</summary>
/// <param name="value">A negative value will result in an error, the command is then ignored. The default value is 1f. The current setting can be queried using AL.Get with parameter ALGetFloat.SpeedOfSound.</param>
[DllImport(AL.Lib, EntryPoint = "alDopplerFactor", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void DopplerFactor(float value);
public static void DopplerFactor(float value) => DopplerFactor_dptr(value);
private static DopplerFactor_d DopplerFactor_dptr = ALNativeLib.LoadFunctionPointer<DopplerFactor_d>("alDopplerFactor");
private unsafe delegate void DopplerFactor_d(float value);
// AL_API void AL_APIENTRY alDopplerFactor( ALfloat value );
/// <summary>This function is deprecated and should not be used.</summary>
/// <param name="value">The default is 1.0f.</param>
[DllImport(AL.Lib, EntryPoint = "alDopplerVelocity", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void DopplerVelocity(float value);
public static void DopplerVelocity(float value) => DopplerVelocity_dptr(value);
private static DopplerVelocity_d DopplerVelocity_dptr = ALNativeLib.LoadFunctionPointer<DopplerVelocity_d>("alDopplerVelocity");
private unsafe delegate void DopplerVelocity_d(float value);
// AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value );
/// <summary>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.</summary>
/// <param name="value">A negative or zero value will result in an error, and the command is ignored. Default: 343.3f (appropriate for velocity units of meters and air as the propagation medium). The current setting can be queried using AL.Get with parameter ALGetFloat.SpeedOfSound.</param>
[DllImport(AL.Lib, EntryPoint = "alSpeedOfSound", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void SpeedOfSound(float value);
public static void SpeedOfSound(float value) => SpeedOfSound_dptr(value);
private static SpeedOfSound_d SpeedOfSound_dptr = ALNativeLib.LoadFunctionPointer<SpeedOfSound_d>("alSpeedOfSound");
private unsafe delegate void SpeedOfSound_d(float value);
// AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value );
/// <summary>This function selects the OpenAL distance model ALDistanceModel.InverseDistance, ALDistanceModel.InverseDistanceClamped, ALDistanceModel.LinearDistance, ALDistanceModel.LinearDistanceClamped, ALDistanceModel.ExponentDistance, ALDistanceModel.ExponentDistanceClamped, or ALDistanceModel.None. The default distance model in OpenAL is ALDistanceModel.InverseDistanceClamped.</summary>
@ -1451,8 +1522,9 @@ namespace OpenTK.Audio.OpenAL
/// gain = 1f;
/// </remarks>
/// <param name="distancemodel"></param>
[DllImport(AL.Lib, EntryPoint = "alDistanceModel", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
public static extern void DistanceModel(ALDistanceModel distancemodel);
public static void DistanceModel(ALDistanceModel distancemodel) => DistanceModel_dptr(distancemodel);
private static DistanceModel_d DistanceModel_dptr = ALNativeLib.LoadFunctionPointer<DistanceModel_d>("alDistanceModel");
private unsafe delegate void DistanceModel_d(ALDistanceModel distancemodel);
// AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
/// <summary>(Helper) Returns Source state information.</summary>

View file

@ -71,11 +71,9 @@ namespace OpenTK.Audio.OpenAL
/// <summary>Alc = Audio Library Context</summary>
public static class Alc
{
private const string Lib = AL.Lib;
private const CallingConvention Style = CallingConvention.Cdecl;
[DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity]
private unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist);
private unsafe delegate IntPtr d_alcCreateContext(IntPtr device, int* attrList);
private static d_alcCreateContext ptr_alcCreateContext = AL.ALNativeLib.LoadFunctionPointer<d_alcCreateContext>("alcCreateContext");
unsafe static IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist) => ptr_alcCreateContext(device, attrlist);
/// <summary>This function creates a context using a specified device.</summary>
/// <param name="device">a pointer to a device</param>
@ -105,20 +103,22 @@ namespace OpenTK.Audio.OpenAL
}
}
[DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
private static extern bool MakeContextCurrent(IntPtr context);
static bool MakeContextCurrent(IntPtr context) => MakeContextCurrent_dptr(context);
private static MakeContextCurrent_d MakeContextCurrent_dptr = AL.ALNativeLib.LoadFunctionPointer<MakeContextCurrent_d>("alcMakeContextCurrent");
private delegate bool MakeContextCurrent_d(IntPtr context);
/// <summary>This function makes a specified context the current context.</summary>
/// <param name="context">A pointer to the new context.</param>
/// <returns>Returns True on success, or False on failure.</returns>
public static bool MakeContextCurrent(ContextHandle context)
public static bool MakeContextCurrent(ContextHandle context)
{
return MakeContextCurrent(context.Handle);
}
// ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
private static extern void ProcessContext(IntPtr context);
static void ProcessContext(IntPtr context) => ProcessContext_dptr(context);
private static ProcessContext_d ProcessContext_dptr = AL.ALNativeLib.LoadFunctionPointer<ProcessContext_d>("alcProcessContext");
private delegate void ProcessContext_d(IntPtr context);
/// <summary>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.</summary>
/// <param name="context">a pointer to the new context</param>
@ -128,8 +128,9 @@ namespace OpenTK.Audio.OpenAL
}
// ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
private static extern void SuspendContext(IntPtr context);
static void SuspendContext(IntPtr context) => SuspendContext_dptr(context);
private static SuspendContext_d SuspendContext_dptr = AL.ALNativeLib.LoadFunctionPointer<SuspendContext_d>("alcSuspendContext");
private delegate void SuspendContext_d(IntPtr context);
/// <summary>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.</summary>
/// <param name="context">a pointer to the context to be suspended.</param>
@ -139,8 +140,9 @@ namespace OpenTK.Audio.OpenAL
}
// ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
private static extern void DestroyContext(IntPtr context);
static void DestroyContext(IntPtr context) => DestroyContext_dptr(context);
private static DestroyContext_d DestroyContext_dptr = AL.ALNativeLib.LoadFunctionPointer<DestroyContext_d>("alcDestroyContext");
private delegate void DestroyContext_d(IntPtr context);
/// <summary>This function destroys a context.</summary>
/// <param name="context">a pointer to the new context.</param>
@ -150,8 +152,9 @@ namespace OpenTK.Audio.OpenAL
}
// ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcGetCurrentContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
private static extern IntPtr sys_GetCurrentContext();
private static IntPtr sys_GetCurrentContext() => sys_GetCurrentContext_dptr();
private static sys_GetCurrentContext_d sys_GetCurrentContext_dptr = AL.ALNativeLib.LoadFunctionPointer<sys_GetCurrentContext_d>("alcGetCurrentContext");
private delegate IntPtr sys_GetCurrentContext_d();
/// <summary>This function retrieves the current context.</summary>
/// <returns>Returns a pointer to the current context.</returns>
@ -161,8 +164,9 @@ namespace OpenTK.Audio.OpenAL
}
// ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
[DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
private static extern IntPtr GetContextsDevice(IntPtr context);
static IntPtr GetContextsDevice(IntPtr context) => GetContextsDevice_dptr(context);
private static GetContextsDevice_d GetContextsDevice_dptr = AL.ALNativeLib.LoadFunctionPointer<GetContextsDevice_d>("alcGetContextsDevice");
private delegate IntPtr GetContextsDevice_d(IntPtr context);
/// <summary>This function retrieves a context's device pointer.</summary>
/// <param name="context">a pointer to a context.</param>
@ -176,50 +180,57 @@ namespace OpenTK.Audio.OpenAL
/// <summary>This function opens a device by name.</summary>
/// <param name="devicename">a null-terminated string describing a device.</param>
/// <returns>Returns a pointer to the opened device. The return value will be NULL if there is an error.</returns>
[DllImport(Alc.Lib, EntryPoint = "alcOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
public static extern IntPtr OpenDevice([In] string devicename);
public static IntPtr OpenDevice([In] string devicename) => OpenDevice_dptr(devicename);
private static OpenDevice_d OpenDevice_dptr = AL.ALNativeLib.LoadFunctionPointer<OpenDevice_d>("alcOpenDevice");
private delegate IntPtr OpenDevice_d([In] string devicename);
// ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename );
/// <summary>This function closes a device by name.</summary>
/// <param name="device">a pointer to an opened device</param>
/// <returns>True will be returned on success or False on failure. Closing a device will fail if the device contains any contexts or buffers.</returns>
[DllImport(Alc.Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
public static extern bool CloseDevice([In] IntPtr device);
public static bool CloseDevice([In] IntPtr device) => CloseDevice_dptr(device);
private static CloseDevice_d CloseDevice_dptr = AL.ALNativeLib.LoadFunctionPointer<CloseDevice_d>("alcCloseDevice");
private delegate bool CloseDevice_d([In] IntPtr device);
// ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
/// <summary>This function retrieves the current context error state.</summary>
/// <param name="device">a pointer to the device to retrieve the error state from</param>
/// <returns>Errorcode Int32.</returns>
[DllImport(Alc.Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
public static extern AlcError GetError([In] IntPtr device);
public static AlcError GetError([In] IntPtr device) => GetError_dptr(device);
private static GetError_d GetError_dptr = AL.ALNativeLib.LoadFunctionPointer<GetError_d>("alcGetError");
private delegate AlcError GetError_d([In] IntPtr device);
// ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
/// <summary>This function queries if a specified context extension is available.</summary>
/// <param name="device">a pointer to the device to be queried for an extension.</param>
/// <param name="extname">a null-terminated string describing the extension.</param>
/// <returns>Returns True if the extension is available, False if the extension is not available.</returns>
[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);
public static bool IsExtensionPresent([In] IntPtr device, [In] string extname) => IsExtensionPresent_dptr(device, extname);
private static IsExtensionPresent_d IsExtensionPresent_dptr = AL.ALNativeLib.LoadFunctionPointer<IsExtensionPresent_d>("alcIsExtensionPresent");
private delegate bool IsExtensionPresent_d([In] IntPtr device, [In] string extname);
// ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
/// <summary>This function retrieves the address of a specified context extension function.</summary>
/// <param name="device">a pointer to the device to be queried for the function.</param>
/// <param name="funcname">a null-terminated string describing the function.</param>
/// <returns>Returns the address of the function, or NULL if it is not found.</returns>
[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);
public static IntPtr GetProcAddress([In] IntPtr device, [In] string funcname) => GetProcAddress_dptr(device, funcname);
private static GetProcAddress_d GetProcAddress_dptr = AL.ALNativeLib.LoadFunctionPointer<GetProcAddress_d>("alcGetProcAddress");
private delegate IntPtr GetProcAddress_d([In] IntPtr device, [In] string funcname);
// ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
/// <summary>This function retrieves the enum value for a specified enumeration name.</summary>
/// <param name="device">a pointer to the device to be queried.</param>
/// <param name="enumname">a null terminated string describing the enum value.</param>
/// <returns>Returns the enum value described by the enumName string. This is most often used for querying an enum value for an ALC extension.</returns>
[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);
public static int GetEnumValue([In] IntPtr device, [In] string enumname) => GetEnumValue_dptr(device, enumname);
private static GetEnumValue_d GetEnumValue_dptr = AL.ALNativeLib.LoadFunctionPointer<GetEnumValue_d>("alcGetEnumValue");
private delegate int GetEnumValue_d([In] IntPtr device, [In] string enumname);
// ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
[DllImport(Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
private static extern IntPtr GetStringPrivate([In] IntPtr device, AlcGetString param);
private delegate IntPtr GetStringPrivate_d([In] IntPtr device, AlcGetString param);
private static GetStringPrivate_d alcGetString_ptr = AL.ALNativeLib.LoadFunctionPointer<GetStringPrivate_d>("alcGetString");
private static IntPtr GetStringPrivate([In] IntPtr device, AlcGetString param) => alcGetString_ptr(device, param);
// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
/// <summary>This function returns pointers to strings related to the context.</summary>
@ -306,8 +317,9 @@ namespace OpenTK.Audio.OpenAL
return result;
}
[DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
private unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data);
unsafe static void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data) => GetInteger_dptr(device, param, size, data);
private static GetInteger_d GetInteger_dptr = AL.ALNativeLib.LoadFunctionPointer<GetInteger_d>("alcGetIntegerv");
private unsafe delegate void GetInteger_d(IntPtr device, AlcGetInteger param, int size, int* data);
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer );
/// <summary>This function returns integers related to the context.</summary>
@ -348,46 +360,44 @@ namespace OpenTK.Audio.OpenAL
/// <param name="format">the requested capture buffer format.</param>
/// <param name="buffersize">the size of the capture buffer in samples, not bytes.</param>
/// <returns>Returns the capture device pointer, or NULL on failure.</returns>
[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);
public static IntPtr CaptureOpenDevice(string devicename, uint frequency, ALFormat format, int buffersize) => CaptureOpenDevice_dptr(devicename, frequency, format, buffersize);
private static CaptureOpenDevice_d CaptureOpenDevice_dptr = AL.ALNativeLib.LoadFunctionPointer<CaptureOpenDevice_d>("alcCaptureOpenDevice");
private delegate IntPtr CaptureOpenDevice_d(string devicename, uint frequency, ALFormat format, int buffersize);
/// <summary>This function opens a capture device by name. </summary>
/// <param name="devicename">a pointer to a device name string.</param>
/// <param name="frequency">the frequency that the buffer should be captured at.</param>
/// <param name="format">the requested capture buffer format.</param>
/// <param name="buffersize">the size of the capture buffer in samples, not bytes.</param>
/// <returns>Returns the capture device pointer, or NULL on failure.</returns>
[DllImport(Alc.Lib, EntryPoint = "alcCaptureOpenDevice", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
public static extern IntPtr CaptureOpenDevice(string devicename, int frequency, ALFormat format, int buffersize);
// ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
public static IntPtr CaptureOpenDevice(string devicename, int frequency, ALFormat format, int buffersize) => CaptureOpenDeviceS_dptr(devicename, frequency, format, buffersize);
private static CaptureOpenDeviceS_d CaptureOpenDeviceS_dptr = AL.ALNativeLib.LoadFunctionPointer<CaptureOpenDeviceS_d>("alcCaptureOpenDevice");
private delegate IntPtr CaptureOpenDeviceS_d(string devicename, int frequency, ALFormat format, int buffersize);
/// <summary>This function closes the specified capture device.</summary>
/// <param name="device">a pointer to a capture device.</param>
/// <returns>Returns True if the close operation was successful, False on failure.</returns>
[DllImport(Alc.Lib, EntryPoint = "alcCaptureCloseDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
public static extern bool CaptureCloseDevice([In] IntPtr device);
public static bool CaptureCloseDevice([In] IntPtr device) => CaptureCloseDevice_dptr(device);
private static CaptureCloseDevice_d CaptureCloseDevice_dptr = AL.ALNativeLib.LoadFunctionPointer<CaptureCloseDevice_d>("alcCaptureCloseDevice");
private delegate bool CaptureCloseDevice_d([In] IntPtr device);
// ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device );
/// <summary>This function begins a capture operation.</summary>
/// <remarks>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.</remarks>
/// <param name="device">a pointer to a capture device.</param>
[DllImport(Alc.Lib, EntryPoint = "alcCaptureStart", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
public static extern void CaptureStart([In] IntPtr device);
public static void CaptureStart([In] IntPtr device) => CaptureStart_dptr(device);
private static CaptureStart_d CaptureStart_dptr = AL.ALNativeLib.LoadFunctionPointer<CaptureStart_d>("alcCaptureStart");
private delegate void CaptureStart_d([In] IntPtr device);
// ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device );
/// <summary>This function stops a capture operation.</summary>
/// <param name="device">a pointer to a capture device.</param>
[DllImport(Alc.Lib, EntryPoint = "alcCaptureStop", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
public static extern void CaptureStop([In] IntPtr device);
public static void CaptureStop([In] IntPtr device) => CaptureStop_dptr(device);
private static CaptureStop_d CaptureStop_dptr = AL.ALNativeLib.LoadFunctionPointer<CaptureStop_d>("alcCaptureStop");
private delegate void CaptureStop_d([In] IntPtr device);
// ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device );
/// <summary>This function completes a capture operation, and does not block.</summary>
/// <param name="device">a pointer to a capture device.</param>
/// <param name="buffer">a pointer to a buffer, which must be large enough to accommodate the number of samples.</param>
/// <param name="samples">the number of samples to be retrieved.</param>
[DllImport(Alc.Lib, EntryPoint = "alcCaptureSamples", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
public static extern void CaptureSamples(IntPtr device, IntPtr buffer, int samples);
public static void CaptureSamples(IntPtr device, IntPtr buffer, int samples) => CaptureSamples_dptr(device, buffer, samples);
private static CaptureSamples_d CaptureSamples_dptr = AL.ALNativeLib.LoadFunctionPointer<CaptureSamples_d>("alcCaptureSamples");
private delegate void CaptureSamples_d(IntPtr device, IntPtr buffer, int samples);
// ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
/// <summary>This function completes a capture operation, and does not block.</summary>
@ -440,7 +450,5 @@ namespace OpenTK.Audio.OpenAL
{
CaptureSamples(device, ref buffer[0, 0, 0], samples);
}
}
}

View file

@ -402,9 +402,9 @@ namespace OpenTK.Platform.SDL2
public static JoystickGuid JoystickGetGUID(IntPtr joystick) => SDL_JoystickGetGUID_ptr(joystick);
[SuppressUnmanagedCodeSecurity]
private delegate JoystickGuid SDL_JoystickInstanceID_d(IntPtr joystick);
private delegate int SDL_JoystickInstanceID_d(IntPtr joystick);
private static SDL_JoystickInstanceID_d SDL_JoystickInstanceID_ptr = NativeLib.LoadFunctionPointer<SDL_JoystickInstanceID_d>("SDL_JoystickInstanceID");
public static JoystickGuid JoystickInstanceID(IntPtr joystick) => SDL_JoystickInstanceID_ptr(joystick);
public static int JoystickInstanceID(IntPtr joystick) => SDL_JoystickInstanceID_ptr(joystick);
[SuppressUnmanagedCodeSecurity]
private delegate IntPtr SDL_JoystickName_d(IntPtr joystick);