Source

pygame / src / openal / constantsmod.c

/*
  pygame - Python Game Library
  Copyright (C) 2010 Marcus von Appen

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Library General Public License for more details.

  You should have received a copy of the GNU Library General Public
  License along with this library; if not, write to the Free
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/
#define PYGAME_OPENALCONSTANTS_INTERNAL

#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#include "pgopenal.h"

/* macros used to create each constant */
#define DEC_CONST(x)  PyModule_AddIntConstant(module, #x, (long) x)

#ifdef IS_PYTHON_3
PyMODINIT_FUNC PyInit_constants (void)
#else
PyMODINIT_FUNC initconstants (void)
#endif
{
    PyObject *module;

#ifdef IS_PYTHON_3
    static struct PyModuleDef _module = {
        PyModuleDef_HEAD_INIT,
        "constants",
        "Pygame OpenAL constants",
        -1,
        NULL,
        NULL, NULL, NULL, NULL
    };
    module = PyModule_Create (&_module);
#else
    module = Py_InitModule3 ("constants", NULL, "Pygame OpenAL constants");
#endif
    if (!module)
        goto fail;

    DEC_CONST(AL_INVALID);
    DEC_CONST(AL_ILLEGAL_ENUM);
    DEC_CONST(AL_ILLEGAL_COMMAND);
    
    DEC_CONST(AL_NONE);
    DEC_CONST(AL_FALSE);
    DEC_CONST(AL_TRUE);
    
    DEC_CONST(AL_SOURCE_RELATIVE);
    DEC_CONST(AL_CONE_INNER_ANGLE);
    DEC_CONST(AL_CONE_OUTER_ANGLE);
    DEC_CONST(AL_PITCH);
    DEC_CONST(AL_POSITION);
    DEC_CONST(AL_DIRECTION);
    DEC_CONST(AL_VELOCITY);
    DEC_CONST(AL_LOOPING);
    DEC_CONST(AL_BUFFER);
    DEC_CONST(AL_GAIN);
    DEC_CONST(AL_MIN_GAIN);
    DEC_CONST(AL_MAX_GAIN);
    DEC_CONST(AL_ORIENTATION);
    
    DEC_CONST(AL_SOURCE_STATE);
    DEC_CONST(AL_INITIAL);
    DEC_CONST(AL_PLAYING);
    DEC_CONST(AL_PAUSED);
    DEC_CONST(AL_STOPPED);
    
    DEC_CONST(AL_BUFFERS_QUEUED);
    DEC_CONST(AL_BUFFERS_PROCESSED);
    
    DEC_CONST(AL_SEC_OFFSET);
    DEC_CONST(AL_SAMPLE_OFFSET);
    DEC_CONST(AL_BYTE_OFFSET);
    
    DEC_CONST(AL_SOURCE_TYPE);
    DEC_CONST(AL_STATIC);
    DEC_CONST(AL_STREAMING);
    DEC_CONST(AL_UNDETERMINED);
    
    DEC_CONST(AL_FORMAT_MONO8);
    DEC_CONST(AL_FORMAT_MONO16);
    DEC_CONST(AL_FORMAT_STEREO8);
    DEC_CONST(AL_FORMAT_STEREO16);
    
    DEC_CONST(AL_REFERENCE_DISTANCE);
    DEC_CONST(AL_ROLLOFF_FACTOR);
    DEC_CONST(AL_CONE_OUTER_GAIN);
    DEC_CONST(AL_MAX_DISTANCE);
    
    DEC_CONST(AL_FREQUENCY);
    DEC_CONST(AL_BITS);
    DEC_CONST(AL_CHANNELS);
    DEC_CONST(AL_SIZE);
    
    DEC_CONST(AL_UNUSED);
    DEC_CONST(AL_PENDING);
    DEC_CONST(AL_PROCESSED);
    
    DEC_CONST(AL_NO_ERROR);
    DEC_CONST(AL_INVALID_NAME);
    DEC_CONST(AL_INVALID_ENUM);
    DEC_CONST(AL_INVALID_VALUE);
    DEC_CONST(AL_INVALID_OPERATION);
    DEC_CONST(AL_OUT_OF_MEMORY);
    
    DEC_CONST(AL_VENDOR);
    DEC_CONST(AL_VERSION);
    DEC_CONST(AL_RENDERER);
    DEC_CONST(AL_EXTENSIONS);
    
    DEC_CONST(AL_DOPPLER_FACTOR);
    DEC_CONST(AL_DOPPLER_VELOCITY);
    
    DEC_CONST(AL_SPEED_OF_SOUND);
    
    DEC_CONST(AL_DISTANCE_MODEL);
    DEC_CONST(AL_INVERSE_DISTANCE);
    DEC_CONST(AL_INVERSE_DISTANCE_CLAMPED);
    DEC_CONST(AL_LINEAR_DISTANCE);
    DEC_CONST(AL_LINEAR_DISTANCE_CLAMPED);
    DEC_CONST(AL_EXPONENT_DISTANCE);
    DEC_CONST(AL_EXPONENT_DISTANCE_CLAMPED);

    /* ALC constants */
    DEC_CONST(ALC_INVALID);
    DEC_CONST(ALC_FALSE);
    DEC_CONST(ALC_TRUE);
    DEC_CONST(ALC_FREQUENCY);
    DEC_CONST(ALC_REFRESH);
    DEC_CONST(ALC_SYNC);
    
    DEC_CONST(ALC_MONO_SOURCES);
    DEC_CONST(ALC_STEREO_SOURCES);
    
    DEC_CONST(ALC_NO_ERROR);
    DEC_CONST(ALC_INVALID_DEVICE);
    DEC_CONST(ALC_INVALID_CONTEXT);
    DEC_CONST(ALC_INVALID_ENUM);
    DEC_CONST(ALC_INVALID_VALUE);
    DEC_CONST(ALC_OUT_OF_MEMORY);
    
    DEC_CONST(ALC_DEFAULT_DEVICE_SPECIFIER);
    DEC_CONST(ALC_DEVICE_SPECIFIER);
    DEC_CONST(ALC_EXTENSIONS);
    
    DEC_CONST(ALC_MAJOR_VERSION);
    DEC_CONST(ALC_MINOR_VERSION);
    
    DEC_CONST(ALC_ATTRIBUTES_SIZE);
    DEC_CONST(ALC_ALL_ATTRIBUTES);
    
    DEC_CONST(ALC_CAPTURE_DEVICE_SPECIFIER);
    DEC_CONST(ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
    DEC_CONST(ALC_CAPTURE_SAMPLES);
    
    /* AL/ALC extensions */
    DEC_CONST(AL_FORMAT_IMA_ADPCM_MONO16_EXT);
    DEC_CONST(AL_FORMAT_IMA_ADPCM_STEREO16_EXT);
    
    DEC_CONST(AL_FORMAT_WAVE_EXT);
    
    DEC_CONST(AL_FORMAT_VORBIS_EXT);
    
    DEC_CONST(AL_FORMAT_QUAD8_LOKI);
    DEC_CONST(AL_FORMAT_QUAD16_LOKI);
    
    DEC_CONST(AL_FORMAT_MONO_FLOAT32);
    DEC_CONST(AL_FORMAT_STEREO_FLOAT32);
    
    DEC_CONST(AL_FORMAT_MONO_DOUBLE_EXT);
    DEC_CONST(AL_FORMAT_STEREO_DOUBLE_EXT);
    
    DEC_CONST(ALC_CHAN_MAIN_LOKI);
    DEC_CONST(ALC_CHAN_PCM_LOKI);
    DEC_CONST(ALC_CHAN_CD_LOKI);
    
    DEC_CONST(ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
    DEC_CONST(ALC_ALL_DEVICES_SPECIFIER);
    
    DEC_CONST(AL_FORMAT_QUAD8);
    DEC_CONST(AL_FORMAT_QUAD16);
    DEC_CONST(AL_FORMAT_QUAD32);
    DEC_CONST(AL_FORMAT_REAR8);
    DEC_CONST(AL_FORMAT_REAR16);
    DEC_CONST(AL_FORMAT_REAR32);
    DEC_CONST(AL_FORMAT_51CHN8);
    DEC_CONST(AL_FORMAT_51CHN16);
    DEC_CONST(AL_FORMAT_51CHN32);
    DEC_CONST(AL_FORMAT_61CHN8);
    DEC_CONST(AL_FORMAT_61CHN16);
    DEC_CONST(AL_FORMAT_61CHN32);
    DEC_CONST(AL_FORMAT_71CHN8);
    DEC_CONST(AL_FORMAT_71CHN16);
    DEC_CONST(AL_FORMAT_71CHN32);
    
    DEC_CONST(AL_FORMAT_MONO_IMA4);
    DEC_CONST(AL_FORMAT_STEREO_IMA4);
    
    DEC_CONST(AL_BYTE_RW_OFFSETS_EXT);
    DEC_CONST(AL_SAMPLE_RW_OFFSETS_EXT);
    DEC_CONST(AL_SEC_RW_OFFSETS_EXT);
    
    DEC_CONST(AL_SAMPLE_SOURCE_EXT);
    DEC_CONST(AL_SAMPLE_SINK_EXT);
    DEC_CONST(AL_READ_ONLY_EXT);
    DEC_CONST(AL_WRITE_ONLY_EXT);
    DEC_CONST(AL_READ_WRITE_EXT);
    DEC_CONST(AL_STREAM_WRITE_EXT);
    DEC_CONST(AL_STREAM_READ_EXT);
    DEC_CONST(AL_STREAM_COPY_EXT);
    DEC_CONST(AL_STATIC_WRITE_EXT);
    DEC_CONST(AL_STATIC_READ_EXT);
    DEC_CONST(AL_STATIC_COPY_EXT);
    DEC_CONST(AL_DYNAMIC_WRITE_EXT);
    DEC_CONST(AL_DYNAMIC_READ_EXT);
    DEC_CONST(AL_DYNAMIC_COPY_EXT);
    
    DEC_CONST(ALC_CONNECTED);
    
    DEC_CONST(AL_SOURCE_DISTANCE_MODEL);
    
    MODINIT_RETURN(module);
fail:
    Py_XDECREF (module);
    MODINIT_RETURN (NULL);
}