pygame2.openal

The pygame2.openal C API contains various objects and functions for math and vector operations.

Import

Include headers:

pygame2/pgopenal.h
int import_pygame2_openal(void)
Imports the pygame2.openal module. This returns 0 on success and -1 on failure.

Macros

CONTEXT_IS_CURRENT(ctxt)
Gets, whether the passed context is the current one. This returns 0, if the context is not the current one
ASSERT_CONTEXT_IS_CURRENT(ctxt, ret)
Checks, whether the passed context is the current one. If not, this will set a PyExc_PyGameError and return retval.

PyDevice

PyDevice
PyDevice_Type

The PyDevice object is an OpenAL device implementation, which interoperates with the underlying audio hardware or software driver and is used for audio playback.

Members

ALCdevice* PyDevice.device
Pointer to the underlying OpenAL device.

Functions

int PyDevice_Check(PyObject *obj)
Returns true, if the argument is a PyDevice or a subclass of PyDevice.
ALCdevice* PyDevice_AsDevice(PyObject *obj)
Macro for accessing the device member of the PyDevice. This does not perform any type or argument checks.
PyObject* PyDevice_New(const char *name)
Creates a new PyDevice object for the passed OpenAL device identifier. name can bu NULL to use the default device. On failure, this returns NULL.

PyCaptureDevice

PyCaptureDevice
PyCaptureDevice_Type

The PyCaptureDevice object is an OpenAL device implementation, which interoperates with the underlying audio hardware or software driver and is used for audio recording.

Members

PyDevice PyCaptureDevice.device
The parent PyDevice class the PyCaptureDevice inherits from.
ALCsizei PyCaptureDevice.size
The default buffer size to use for capturing sound.
ALCenum PyCaptureDevice.format
The format of the sound to capture.
ALCuint PyCaptureDevice.frequency
The frequency in Hz of the sound to capture.

Functions

int PyCaptureDevice_Check(PyObject *obj)
Returns true, if the argument is a PyCaptureDevice or a subclass of PyCaptureDevice.
ALCdevice* PyCaptureDevice_AsDevice(PyObject *obj)
Macro for accessing the (inherited) device member of the PyCaptureDevice. This does not perform any type or argument checks.
PyObject* PyCaptureDevice_New(const char *name, ALCuint frequency, ALCenum format, ALCsizei size)
Creates a new PyCaptureDevice object for the passed OpenAL device identifier. name can bu NULL to use the default capture device. On failure, this returns NULL.

PyContext

PyContext
PyContext_Type
PyContext objects represent logical state groups, where sources and a listener are managed and audio data is correctly streamed to the underlying output device.

Members

ALCcontext* context
Pointer to the underlying OpenAL context.
PyObject* device
The PyDevice bound to the context.
PyObject* listener
The PyListener bound to the context. This will be NULL until the first call to the pygame2.openal.Context.listener property.

Functions

int PyContext_Check(PyObject *obj)
Returns true, if the argument is a PyContext or a subclass of PyContext.
ALCcontext* PyContext_AsContext(PyObject *obj)
Macro for accessing the context member of the PyContext. This does not perform any type or argument checks.

PyBuffers

PyBuffers
PyBuffers_Type
PyBuffer objects are used by OpenAL to buffer and provide PCM data for playback, recording and manipulation.

Members

PyObject* context
The PyContext the PyBuffers was created from.
ALCsizei count
The amount of buffers reserved.
ALuint* buffers
OpenAL identifiers for the single buffers.

Functions

int PyBuffers_Check(PyObject *obj)
Returns true, if the argument is a PyBuffers or a subclass of PyBuffers.
ALuint* PyBuffers_AsBuffers(PyObject *obj)
Macro for accessing the buffers member of the PyBuffers. This does not perform any type or argument checks.

PySources

PySources
PySources_Type
Sources store locations, directions, and other attributes of an object in 3D space and have a buffer associated with them for playback. When the program wants to play a sound, it controls execution through a source object. Sources are processed independently from each other.

Members

PyObject* context
The PyContext the PySources was created from.
ALCsizei count
The amount of sources reserved.
ALuint* sources
OpenAL identifiers for the single sources.

Functions

int PySources_Check(PyObject *obj)
Returns true, if the argument is a PySources or a subclass of PySources.
ALuint* PySources_AsSources(PyObject *obj)
Macro for accessing the sources member of the PySources. This does not perform any type or argument checks.

PyListner

PyListener
PyListener_Type
The PyListener represents the user hearing the sounds played by OpenAL in a specific PyContext. Source playback is done relative to the position of the PyListener in the 3D space.

Members

PyObject* context
The PyContext the PyListener belongs to.

Functions

int PyListener_Check(PyObject *obj)
Returns true, if the argument is a PyListener or a subclass of PyListener.