/// <summary> /// Gets a named property on the context. /// </summary> /// <param name="device">The device for the context.</param> /// <param name="param">The named property.</param> /// <returns>The value.</returns> [DllImport(Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = AlcCallingConv)][return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ConstCharPtrMarshaler))] public static extern string GetString(ALDevice device, GetEnumerationString param);
/// <summary> /// Gets a named property on the context. /// </summary> /// <param name="device">The device for the context.</param> /// <param name="param">The named property.</param> /// <returns>The value.</returns> [DllImport(Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = AlcCallingConv)] public static unsafe extern byte *GetStringListPtr(ALDevice device, GetEnumerationStringList param);
// ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); /// <summary>This function creates a context using a specified device.</summary> /// <param name="device">A pointer to a device.</param> /// <param name="attributeList">A zero terminated array of a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC.</param> /// <returns>Returns a pointer to the new context (NULL on failure).</returns> /// <remarks>The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</remarks> [DllImport(Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = AlcCallingConv)] public static extern ALContext CreateContext([In] ALDevice device, [In] int[] attributeList);
// -------- ALC_ENUMERATION_EXT -------- /// <summary> /// Checks to see that the ALC_ENUMERATION_EXT extension is present. This will always be available in 1.1 devices or later. /// </summary> /// <param name="device">The device to check the extension is present for.</param> /// <returns>If the ALC_ENUMERATION_EXT extension was present.</returns> public static bool IsEnumerationExtensionPresent(ALDevice device) => IsExtensionPresent(device, "ALC_ENUMERATION_EXT");
/// <summary>This function returns integers related to the context.</summary> /// <param name="device">A pointer to the device to be queried.</param> /// <param name="param">An attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES.</param> /// <returns>The value returned.</returns> public static int GetInteger(ALDevice device, AlcGetInteger param) { GetInteger(device, param, 1, out int data); return(data); }
// -------- ALC_EXT_CAPTURE -------- /// <summary> /// Checks to see that the ALC_EXT_CAPTURE extension is present. This will always be available in 1.1 devices or later. /// </summary> /// <param name="device">The device to check the extension is present for.</param> /// <returns>If the ALC_EXT_CAPTURE extension was present.</returns> public static bool IsCaptureExtensionPresent(ALDevice device) => IsExtensionPresent(device, "ALC_EXT_CAPTURE");
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); /// <summary>This function returns integers related to the context.</summary> /// <param name="device">A pointer to the device to be queried.</param> /// <param name="param">An attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES.</param> /// <param name="size">The size of the destination buffer provided, in number of integers.</param> /// <param name="data">A pointer to the buffer to be returned.</param> [DllImport(Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = AlcCallingConv, CharSet = CharSet.Ansi)] public static extern void GetInteger(ALDevice device, AlcGetInteger param, int size, out int data);
// 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(Lib, EntryPoint = "alcGetError", ExactSpelling = true, CallingConvention = AlcCallingConv)] public static extern AlcError GetError([In] ALDevice device);
// ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname ); /// <summary>This strings related to the context.</summary> /// <remarks> /// ALC_DEFAULT_DEVICE_SPECIFIER will return the name of the default output device. /// ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER will return the name of the default capture device. /// ALC_DEVICE_SPECIFIER will return the name of the specified output device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied. A list is a pointer to a series of strings separated by NULL characters, with the list terminated by two NULL characters. See Enumeration Extension for more details. /// ALC_CAPTURE_DEVICE_SPECIFIER will return the name of the specified capture device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied. /// ALC_EXTENSIONS returns a list of available context extensions, with each extension separated by a space and the list terminated by a NULL character. /// </remarks> /// <param name="device">A pointer to the device to be queried.</param> /// <param name="param">An attribute to be retrieved: ALC_DEFAULT_DEVICE_SPECIFIER, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER, ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_EXTENSIONS.</param> /// <returns>A string containing the name of the Device.</returns> [DllImport(Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = AlcCallingConv, CharSet = CharSet.Ansi)] public static unsafe extern byte *GetStringPtr([In] ALDevice device, AlcGetString param);
// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param ); /// <summary>This function returns a List of strings related to the context.</summary> /// <remarks> /// ALC_DEVICE_SPECIFIER will return the name of the specified output device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied. A list is a pointer to a series of strings separated by NULL characters, with the list terminated by two NULL characters. See Enumeration Extension for more details. /// ALC_CAPTURE_DEVICE_SPECIFIER will return the name of the specified capture device if a pointer is supplied, or will return a list of all available devices if a NULL device pointer is supplied. /// ALC_EXTENSIONS returns a list of available context extensions, with each extension separated by a space and the list terminated by a NULL character. /// </remarks> /// <param name="device">A pointer to the device to be queried.</param> /// <param name="param">An attribute to be retrieved: ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_ALL_DEVICES_SPECIFIER.</param> /// <returns>A List of strings containing the names of the Devices.</returns> public static unsafe List <string> GetString(ALDevice device, AlcGetStringList param) { var result = GetStringPtr(device, (AlcGetString)param); return(ALStringListToList(result)); }
// 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(Lib, EntryPoint = "alcGetEnumValue", ExactSpelling = true, CallingConvention = AlcCallingConv, CharSet = CharSet.Ansi)] public static extern int GetEnumValue([In] ALDevice device, [In] string enumname);
// 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(Lib, EntryPoint = "alcGetProcAddress", ExactSpelling = true, CallingConvention = AlcCallingConv, CharSet = CharSet.Ansi)] public static extern IntPtr GetProcAddress([In] ALDevice device, [In] string funcname);
// 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(Lib, EntryPoint = "alcIsExtensionPresent", ExactSpelling = true, CallingConvention = AlcCallingConv, CharSet = CharSet.Ansi)] public static extern bool IsExtensionPresent([In] ALDevice device, [In] string extname);
// ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); /// <summary>This function creates a context using a specified device.</summary> /// <param name="device">A pointer to a device.</param> /// <param name="attributeList">A zero terminated span of a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC.</param> /// <returns>Returns a pointer to the new context (NULL on failure).</returns> /// <remarks>The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</remarks> public static ALContext CreateContext(ALDevice device, Span <int> attributeList) => CreateContext(device, ref attributeList[0]);
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); /// <summary>This function returns integers related to the context.</summary> /// <param name="device">A pointer to the device to be queried.</param> /// <param name="param">An attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES.</param> /// <param name="data">A pointer to the buffer to be returned.</param> public static void GetInteger(ALDevice device, AlcGetInteger param, out int data) => GetInteger(device, param, 1, out data);
/// <summary>This function creates a context using a specified device.</summary> /// <param name="device">A pointer to a device.</param> /// <param name="attributes">The ALContext attributes to request.</param> /// <returns>Returns a pointer to the new context (NULL on failure).</returns> /// <remarks>The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.</remarks> public static ALContext CreateContext(ALDevice device, ALContextAttributes attributes) => CreateContext(device, attributes.CreateAttributeArray());
// 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(Lib, EntryPoint = "alcCloseDevice", ExactSpelling = true, CallingConvention = AlcCallingConv)] public static extern bool CloseDevice([In] ALDevice device);