OpenAL Operation

OpenAL Fundamentals

TBA.

Primitive Types

As OpenAL is meant to allow for seamless integration with OpenGL code if needed, the OpenAL primitive (scalar) data types mimic the OpenGL data types. Guaranteed minimum sizes are stated for OpenGL data types (see table 2.2 of the OpenGL 1.2 Specification), but the actual choice of C datatype is left to the implementation. All implementations on a given binary architecture, however, must use a common definition of these datatypes.

Note that this table uses explicit AL prefixes for clarity, while they might be omitted from the rest of the document for brevity. GCC equivalents are given for IA32, i.e. a portable and widely available compiler on the most common target architecture.

Table 1. OpenAL Primitive Data Types

AL TypeDescriptionGL TypeGCC IA32
ALboolean 8-bit boolean GLboolean unsigned char
ALbyte signed 8-bit 2's-complement integer GLbyte signed char
ALubyte unsigned 8-bit integer GLubyte unsigned char
ALshort signed 16-bit 2's-complement integer GLshort short
ALushort unsigned 16-bit integer GLushort unsigned short
ALint signed 32-bit 2's-complement integer GLint int
ALuint unsigned 32-bit integer GLuint unsigned int
ALsizei non-negative 32-bit binary integer size GLsizei int
ALenum enumerated 32-bit value GLenum unsigned int
ALbitfield 32 bit bitfield GLbitfield unsigned int
ALfloat 32-bit IEEE754 floating-point GLfloat float
ALclampf Same as ALfloat, but in range [0, 1] GLclampf float
ALdouble 64-bit IEEE754 floating-point GLdouble double
ALclampd Same as ALdouble, but in range [0, 1] GLclampd double

NoteAnnotation on Type Sizes
 

It would be desirable to guarantee the bit size of OpenAL data types, but this might affect the mapping to OpenGL types for which the OpenGL specification only guarantees a minimum size.

NoteAnnotation on 64bit integral
 

It would be desirable to define ulong and long, but again we defer to OpenGL in this decision.

NoteAnnotation on Enumeration
 

enum is not a C or C++ enumaration, but implemented as C preprocesor defines. This makes it easier to handle extensions to the OpenAL namespace, in particular in dealing with delays in distributing updated reference headers.