AL Contexts and the ALC API

This section of the AL specification describes ALC, the AL Context API. ALC is a portable API for managing AL contexts, including resource sharing, locking, and unlocking. Within the core AL API the existence of a Context is implied, but the Context is not exposed. The Context encapsulates the state of a given intance of the AL state machine.

To avoid confusion with the AL related prefixes implied throughout this document, the "alc" and "ALC_" prefixes have been made explicit in the ALC related sections.

ALC defines the following objects: Contexts.

NoteAnnotation (ALC entry points)
 

While the actual ALC implemention might be supplied as a separate library, or as part of a server or daemon, the specification requires that the AL library provides the actual ALC entry points.

NoteAnnotation (ALC OS independend)
 

ALC is meant to be OS-independent. OS specifics are expected to be adressed by defining proper device specifiers strings, and configuration attributes. In this, ALC differs from GLX/WGL, which (due to the tighter coupling with the window manager and operating system) attempt to abstract OS specifics to a much lesser degree.

NoteRFC/ Issues
 

Hardware init/deinit, mapping many processes with multiple contexts to many devices, sharing resources among processes.

Managing Devices

ALC introduces the notion of a Device. A Device can be, depending on the implementation, a hardware device, or a daemon/OS service/actual server. This mechanism also permits different drivers (and hardware) to coexist within the same system, as well as allowing several applications to share system resources for audio, including a single hardware output device. The details are left to the implementation, which has to map the available backends to uniq7ue device specifiers (represented as strings).

NoteAnnotation (Network transparency)
 

AL is meant for interoperability with OpenGL. Some implementations of OpenGL bindings (e.g. GLX) are network transparent. The Device API theoretically allows for a network transparent AL implementation. No wire protocol is specified, no specification or implementation is planned.

NoteAnnotation (Device Enumeration)
 

At this time, ALC does not provide mechanism to query for available devices, and request device enumerations. This might be added at a later time, depending on demand and the ability to abstract OS and configuration specifics.

NoteAnnotation (X11 Audio)
 

The ALC API intentionally mimicks XOpenDisplay and XCloseDisplay. There is no X Audio standard, although proposals have been made in the past. The ALC API design accounts for this possibility in a minimal way.

Connecting to a Device

The alcOpenDevice function allows the application (i.e. the client program) to connect to a device (i.e. the server).

ALCdevice * alcOpenDevice( const ubyte * deviceSpecifier);

If the function returns NULL, then no sound driver/device has been found. The argument is a null terminated string that requests a certain device or device configuration. If NULL is specified, the implementation will provide an implementation specific default.

NoteAnnotation (Operating system dependencies)
 

At this point, system specific configuration, and operating system specific details, are handled by leaving the details of the string specifier to the implementation. The application coder has to determine how he wants to obtain this information from the OS or the user. If, at a later point, device enumeration and configuration requests are supported through ALC, the resulting string might still be operating system and implementation specific.

Disconnecting from a Device

The alcCloseDevice function allows the application (i.e. the client program) to disconnect from a device (i.e. the server).

void alcCloseDevice( ALCdevice * deviceHandle);

If deviceHandle is NULL or invalid, an ALC_INVALID_DEVICE error will be generated. Once closed, a deviceHandle is invalid.