Class Alc
Alc = Audio Library Context
Inherited Members
Namespace: OpenTK.Audio.OpenAL
Assembly: OpenTK.dll
Syntax
public static class Alc
Methods
CaptureCloseDevice(IntPtr)
This function closes the specified capture device.
Declaration
public static extern bool CaptureCloseDevice(IntPtr device)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
Returns
Type | Description |
---|---|
Boolean | Returns True if the close operation was successful, False on failure. |
CaptureOpenDevice(String, Int32, ALFormat, Int32)
This function opens a capture device by name.
Declaration
public static extern IntPtr CaptureOpenDevice(string devicename, int frequency, ALFormat format, int buffersize)
Parameters
Type | Name | Description |
---|---|---|
String | devicename | a pointer to a device name string. |
Int32 | frequency | the frequency that the buffer should be captured at. |
ALFormat | format | the requested capture buffer format. |
Int32 | buffersize | the size of the capture buffer in samples, not bytes. |
Returns
Type | Description |
---|---|
IntPtr | Returns the capture device pointer, or NULL on failure. |
CaptureOpenDevice(String, UInt32, ALFormat, Int32)
This function opens a capture device by name.
Declaration
[CLSCompliant(false)]
public static extern IntPtr CaptureOpenDevice(string devicename, uint frequency, ALFormat format, int buffersize)
Parameters
Type | Name | Description |
---|---|---|
String | devicename | a pointer to a device name string. |
UInt32 | frequency | the frequency that the buffer should be captured at. |
ALFormat | format | the requested capture buffer format. |
Int32 | buffersize | the size of the capture buffer in samples, not bytes. |
Returns
Type | Description |
---|---|
IntPtr | Returns the capture device pointer, or NULL on failure. |
CaptureSamples(IntPtr, IntPtr, Int32)
This function completes a capture operation, and does not block.
Declaration
public static extern void CaptureSamples(IntPtr device, IntPtr buffer, int samples)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
IntPtr | buffer | a pointer to a buffer, which must be large enough to accommodate the number of samples. |
Int32 | samples | the number of samples to be retrieved. |
CaptureSamples<T>(IntPtr, ref T, Int32)
This function completes a capture operation, and does not block.
Declaration
public static void CaptureSamples<T>(IntPtr device, ref T buffer, int samples)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
T | buffer | a reference to a buffer, which must be large enough to accommodate the number of samples. |
Int32 | samples | the number of samples to be retrieved. |
Type Parameters
Name | Description |
---|---|
T |
CaptureSamples<T>(IntPtr, T[], Int32)
This function completes a capture operation, and does not block.
Declaration
[CLSCompliant(false)]
public static void CaptureSamples<T>(IntPtr device, T[] buffer, int samples)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
T[] | buffer | a buffer, which must be large enough to accommodate the number of samples. |
Int32 | samples | the number of samples to be retrieved. |
Type Parameters
Name | Description |
---|---|
T |
CaptureSamples<T>(IntPtr, T[,,], Int32)
This function completes a capture operation, and does not block.
Declaration
[CLSCompliant(false)]
public static void CaptureSamples<T>(IntPtr device, T[,, ] buffer, int samples)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
T[,,] | buffer | a buffer, which must be large enough to accommodate the number of samples. |
Int32 | samples | the number of samples to be retrieved. |
Type Parameters
Name | Description |
---|---|
T |
CaptureSamples<T>(IntPtr, T[,], Int32)
This function completes a capture operation, and does not block.
Declaration
[CLSCompliant(false)]
public static void CaptureSamples<T>(IntPtr device, T[, ] buffer, int samples)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
T[,] | buffer | a buffer, which must be large enough to accommodate the number of samples. |
Int32 | samples | the number of samples to be retrieved. |
Type Parameters
Name | Description |
---|---|
T |
CaptureStart(IntPtr)
This function begins a capture operation.
Declaration
public static extern void CaptureStart(IntPtr device)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
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.
CaptureStop(IntPtr)
This function stops a capture operation.
Declaration
public static extern void CaptureStop(IntPtr device)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a capture device. |
CloseDevice(IntPtr)
This function closes a device by name.
Declaration
public static extern bool CloseDevice(IntPtr device)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to an opened device |
Returns
Type | Description |
---|---|
Boolean | True will be returned on success or False on failure. Closing a device will fail if the device contains any contexts or buffers. |
CreateContext(IntPtr, Int32*)
This function creates a context using a specified device.
Declaration
[CLSCompliant(false)]
public static ContextHandle CreateContext(IntPtr device, int *attrlist)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a device |
Int32* | attrlist | a pointer to a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC |
Returns
Type | Description |
---|---|
ContextHandle | 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. |
CreateContext(IntPtr, Int32[])
This function creates a context using a specified device.
Declaration
public static ContextHandle CreateContext(IntPtr device, int[] attriblist)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to a device |
Int32[] | attriblist | an array of a set of attributes: ALC_FREQUENCY, ALC_MONO_SOURCES, ALC_REFRESH, ALC_STEREO_SOURCES, ALC_SYNC |
Returns
Type | Description |
---|---|
ContextHandle | Returns a pointer to the new context (NULL on failure). |
Remarks
The attribute list can be NULL, or a zero terminated list of integer pairs composed of valid ALC attribute tokens and requested values.
DestroyContext(ContextHandle)
This function destroys a context.
Declaration
public static void DestroyContext(ContextHandle context)
Parameters
Type | Name | Description |
---|---|---|
ContextHandle | context | a pointer to the new context. |
GetContextsDevice(ContextHandle)
This function retrieves a context's device pointer.
Declaration
public static IntPtr GetContextsDevice(ContextHandle context)
Parameters
Type | Name | Description |
---|---|---|
ContextHandle | context | a pointer to a context. |
Returns
Type | Description |
---|---|
IntPtr | Returns a pointer to the specified context's device. |
GetCurrentContext()
This function retrieves the current context.
Declaration
public static ContextHandle GetCurrentContext()
Returns
Type | Description |
---|---|
ContextHandle | Returns a pointer to the current context. |
GetEnumValue(IntPtr, String)
This function retrieves the enum value for a specified enumeration name.
Declaration
public static extern int GetEnumValue(IntPtr device, string enumname)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried. |
String | enumname | a null terminated string describing the enum value. |
Returns
Type | Description |
---|---|
Int32 | Returns the enum value described by the enumName string. This is most often used for querying an enum value for an ALC extension. |
GetError(IntPtr)
This function retrieves the current context error state.
Declaration
public static extern AlcError GetError(IntPtr device)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to retrieve the error state from |
Returns
Type | Description |
---|---|
AlcError | Errorcode Int32. |
GetInteger(IntPtr, AlcGetInteger, Int32, out Int32)
This function returns integers related to the context.
Declaration
public static void GetInteger(IntPtr device, AlcGetInteger param, int size, out int data)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried. |
AlcGetInteger | param | an attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES |
Int32 | size | the size of the destination buffer provided, in number of integers. |
Int32 | data | a pointer to the buffer to be returned |
GetInteger(IntPtr, AlcGetInteger, Int32, Int32[])
This function returns integers related to the context.
Declaration
public static void GetInteger(IntPtr device, AlcGetInteger param, int size, int[] data)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried. |
AlcGetInteger | param | an attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES |
Int32 | size | the size of the destination buffer provided, in number of integers. |
Int32[] | data | a pointer to the buffer to be returned |
GetProcAddress(IntPtr, String)
This function retrieves the address of a specified context extension function.
Declaration
public static extern IntPtr GetProcAddress(IntPtr device, string funcname)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried for the function. |
String | funcname | a null-terminated string describing the function. |
Returns
Type | Description |
---|---|
IntPtr | Returns the address of the function, or NULL if it is not found. |
GetString(IntPtr, AlcGetString)
This function returns pointers to strings related to the context.
Declaration
public static string GetString(IntPtr device, AlcGetString param)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried. |
AlcGetString | param | an attribute to be retrieved: ALC_DEFAULT_DEVICE_SPECIFIER, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER, ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_EXTENSIONS |
Returns
Type | Description |
---|---|
String | A string containing the name of the Device. |
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.
GetString(IntPtr, AlcGetStringList)
This function returns a List of strings related to the context.
Declaration
public static IList<string> GetString(IntPtr device, AlcGetStringList param)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried. |
AlcGetStringList | param | an attribute to be retrieved: ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_ALL_DEVICES_SPECIFIER |
Returns
Type | Description |
---|---|
IList<String> | A List of strings containing the names of the Devices. |
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.
IsExtensionPresent(IntPtr, String)
This function queries if a specified context extension is available.
Declaration
public static extern bool IsExtensionPresent(IntPtr device, string extname)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | device | a pointer to the device to be queried for an extension. |
String | extname | a null-terminated string describing the extension. |
Returns
Type | Description |
---|---|
Boolean | Returns True if the extension is available, False if the extension is not available. |
MakeContextCurrent(ContextHandle)
This function makes a specified context the current context.
Declaration
public static bool MakeContextCurrent(ContextHandle context)
Parameters
Type | Name | Description |
---|---|---|
ContextHandle | context | A pointer to the new context. |
Returns
Type | Description |
---|---|
Boolean | Returns True on success, or False on failure. |
OpenDevice(String)
This function opens a device by name.
Declaration
public static extern IntPtr OpenDevice(string devicename)
Parameters
Type | Name | Description |
---|---|---|
String | devicename | a null-terminated string describing a device. |
Returns
Type | Description |
---|---|
IntPtr | Returns a pointer to the opened device. The return value will be NULL if there is an error. |
ProcessContext(ContextHandle)
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.
Declaration
public static void ProcessContext(ContextHandle context)
Parameters
Type | Name | Description |
---|---|---|
ContextHandle | context | a pointer to the new context |
SuspendContext(ContextHandle)
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.
Declaration
public static void SuspendContext(ContextHandle context)
Parameters
Type | Name | Description |
---|---|---|
ContextHandle | context | a pointer to the context to be suspended. |