blob: 691175e56bf567b43105e38141b5fc2166682601 [file] [log] [blame]
Guido van Rossume3db8621991-09-09 23:33:34 +00001
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002#define OLD_INTERFACE /* define for pre-Irix 6 interface */
Jack Jansene8a3c281993-02-10 14:10:56 +00003
Roger E. Massea2a8b271997-01-03 22:40:34 +00004#include "Python.h"
Guido van Rossumd641d671997-04-03 17:06:32 +00005#include "stringobject.h"
6#include <audio.h>
7#include <stdarg.h>
Guido van Rossume3db8621991-09-09 23:33:34 +00008
Guido van Rossumd641d671997-04-03 17:06:32 +00009#ifndef AL_NO_ELEM
10#ifndef OLD_INTERFACE
11#define OLD_INTERFACE
12#endif /* OLD_INTERFACE */
13#endif /* AL_NO_ELEM */
14
15static PyObject *ErrorObject;
16
17/* ----------------------------------------------------- */
18
19/* Declarations for objects of type port */
Guido van Rossume3db8621991-09-09 23:33:34 +000020
21typedef struct {
Antoine Pitrouc83ea132010-05-09 14:46:46 +000022 PyObject_HEAD
23 /* XXXX Add your own stuff here */
24 ALport port;
Guido van Rossumd641d671997-04-03 17:06:32 +000025} alpobject;
Guido van Rossume3db8621991-09-09 23:33:34 +000026
Jeremy Hylton938ace62002-07-17 16:30:39 +000027static PyTypeObject Alptype;
Guido van Rossume3db8621991-09-09 23:33:34 +000028
Guido van Rossume3db8621991-09-09 23:33:34 +000029
Guido van Rossumd641d671997-04-03 17:06:32 +000030
31/* ---------------------------------------------------------------- */
32
33/* Declarations for objects of type config */
34
35typedef struct {
Antoine Pitrouc83ea132010-05-09 14:46:46 +000036 PyObject_HEAD
37 /* XXXX Add your own stuff here */
38 ALconfig config;
Guido van Rossumd641d671997-04-03 17:06:32 +000039} alcobject;
40
Jeremy Hylton938ace62002-07-17 16:30:39 +000041static PyTypeObject Alctype;
Guido van Rossumd641d671997-04-03 17:06:32 +000042
43
44static void
45ErrorHandler(long code, const char *fmt, ...)
46{
Antoine Pitrouc83ea132010-05-09 14:46:46 +000047 va_list args;
48 char buf[128];
Guido van Rossumd641d671997-04-03 17:06:32 +000049
Antoine Pitrouc83ea132010-05-09 14:46:46 +000050 va_start(args, fmt);
51 vsprintf(buf, fmt, args);
52 va_end(args);
53 PyErr_SetString(ErrorObject, buf);
Guido van Rossumd641d671997-04-03 17:06:32 +000054}
55
Antoine Pitrouc83ea132010-05-09 14:46:46 +000056#ifdef AL_NO_ELEM /* IRIX 6 */
Guido van Rossumfc58e581992-01-27 16:45:55 +000057
Roger E. Massea2a8b271997-01-03 22:40:34 +000058static PyObject *
Guido van Rossumd641d671997-04-03 17:06:32 +000059param2python(int resource, int param, ALvalue value, ALparamInfo *pinfo)
60{
Antoine Pitrouc83ea132010-05-09 14:46:46 +000061 ALparamInfo info;
Guido van Rossumd641d671997-04-03 17:06:32 +000062
Antoine Pitrouc83ea132010-05-09 14:46:46 +000063 if (pinfo == NULL) {
64 pinfo = &info;
65 if (alGetParamInfo(resource, param, &info) < 0)
66 return NULL;
67 }
68 switch (pinfo->elementType) {
69 case AL_PTR_ELEM:
70 /* XXXX don't know how to handle this */
71 case AL_NO_ELEM:
72 Py_INCREF(Py_None);
73 return Py_None;
74 case AL_INT32_ELEM:
75 case AL_RESOURCE_ELEM:
76 case AL_ENUM_ELEM:
77 return PyInt_FromLong((long) value.i);
78 case AL_INT64_ELEM:
79 return PyLong_FromLongLong(value.ll);
80 case AL_FIXED_ELEM:
81 return PyFloat_FromDouble(alFixedToDouble(value.ll));
82 case AL_CHAR_ELEM:
83 if (value.ptr == NULL) {
84 Py_INCREF(Py_None);
85 return Py_None;
86 }
87 return PyString_FromString((char *) value.ptr);
88 default:
89 PyErr_SetString(ErrorObject, "unknown element type");
90 return NULL;
91 }
Guido van Rossumd641d671997-04-03 17:06:32 +000092}
93
94static int
95python2elem(PyObject *item, void *ptr, int elementType)
96{
Antoine Pitrouc83ea132010-05-09 14:46:46 +000097 switch (elementType) {
98 case AL_INT32_ELEM:
99 case AL_RESOURCE_ELEM:
100 case AL_ENUM_ELEM:
101 if (!PyInt_Check(item)) {
102 PyErr_BadArgument();
103 return -1;
104 }
105 *((int *) ptr) = PyInt_AsLong(item);
106 break;
107 case AL_INT64_ELEM:
108 if (PyInt_Check(item))
109 *((long long *) ptr) = PyInt_AsLong(item);
110 else if (PyLong_Check(item))
111 *((long long *) ptr) = PyLong_AsLongLong(item);
112 else {
113 PyErr_BadArgument();
114 return -1;
115 }
116 break;
117 case AL_FIXED_ELEM:
118 if (PyInt_Check(item))
119 *((long long *) ptr) = alDoubleToFixed((double) PyInt_AsLong(item));
120 else if (PyFloat_Check(item))
121 *((long long *) ptr) = alDoubleToFixed(PyFloat_AsDouble(item));
122 else {
123 PyErr_BadArgument();
124 return -1;
125 }
126 break;
127 default:
128 PyErr_SetString(ErrorObject, "unknown element type");
129 return -1;
130 }
131 return 0;
Guido van Rossumd641d671997-04-03 17:06:32 +0000132}
133
134static int
135python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo)
136{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000137 ALparamInfo info;
138 int i, stepsize;
139 PyObject *item;
Guido van Rossumd641d671997-04-03 17:06:32 +0000140
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000141 if (pinfo == NULL) {
142 pinfo = &info;
143 if (alGetParamInfo(resource, param->param, &info) < 0)
144 return -1;
145 }
146 switch (pinfo->valueType) {
147 case AL_STRING_VAL:
148 if (pinfo->elementType != AL_CHAR_ELEM) {
149 PyErr_SetString(ErrorObject, "unknown element type");
150 return -1;
151 }
152 if (!PyString_Check(value)) {
153 PyErr_BadArgument();
154 return -1;
155 }
156 param->value.ptr = PyString_AS_STRING(value);
157 param->sizeIn = PyString_GET_SIZE(value)+1; /*account for NUL*/
158 break;
159 case AL_SET_VAL:
160 case AL_VECTOR_VAL:
161 if (!PyList_Check(value) && !PyTuple_Check(value)) {
162 PyErr_BadArgument();
163 return -1;
164 }
165 switch (pinfo->elementType) {
166 case AL_INT32_ELEM:
167 case AL_RESOURCE_ELEM:
168 case AL_ENUM_ELEM:
169 param->sizeIn = PySequence_Size(value);
170 param->value.ptr = PyMem_NEW(int, param->sizeIn);
171 stepsize = sizeof(int);
172 break;
173 case AL_INT64_ELEM:
174 case AL_FIXED_ELEM:
175 param->sizeIn = PySequence_Size(value);
176 param->value.ptr = PyMem_NEW(long long, param->sizeIn);
177 stepsize = sizeof(long long);
178 break;
179 }
180 for (i = 0; i < param->sizeIn; i++) {
181 item = PySequence_GetItem(value, i);
182 if (python2elem(item, (void *) ((char *) param->value.ptr + i*stepsize), pinfo->elementType) < 0) {
183 PyMem_DEL(param->value.ptr);
184 return -1;
185 }
186 }
187 break;
188 case AL_SCALAR_VAL:
189 switch (pinfo->elementType) {
190 case AL_INT32_ELEM:
191 case AL_RESOURCE_ELEM:
192 case AL_ENUM_ELEM:
193 return python2elem(value, (void *) &param->value.i,
194 pinfo->elementType);
195 case AL_INT64_ELEM:
196 case AL_FIXED_ELEM:
197 return python2elem(value, (void *) &param->value.ll,
198 pinfo->elementType);
199 default:
200 PyErr_SetString(ErrorObject, "unknown element type");
201 return -1;
202 }
203 }
204 return 0;
Guido van Rossumd641d671997-04-03 17:06:32 +0000205}
206
207static int
208python2params(int resource1, int resource2, PyObject *list, ALpv **pvsp, ALparamInfo **pinfop)
209{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000210 PyObject *item;
211 ALpv *pvs;
212 ALparamInfo *pinfo;
213 int npvs, i;
Guido van Rossumd641d671997-04-03 17:06:32 +0000214
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000215 npvs = PyList_Size(list);
216 pvs = PyMem_NEW(ALpv, npvs);
217 pinfo = PyMem_NEW(ALparamInfo, npvs);
218 for (i = 0; i < npvs; i++) {
219 item = PyList_GetItem(list, i);
220 if (!PyArg_ParseTuple(item, "iO", &pvs[i].param, &item))
221 goto error;
222 if (alGetParamInfo(resource1, pvs[i].param, &pinfo[i]) < 0 &&
223 alGetParamInfo(resource2, pvs[i].param, &pinfo[i]) < 0)
224 goto error;
225 if (python2param(resource1, &pvs[i], item, &pinfo[i]) < 0)
226 goto error;
227 }
Guido van Rossumd641d671997-04-03 17:06:32 +0000228
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000229 *pvsp = pvs;
230 *pinfop = pinfo;
231 return npvs;
Guido van Rossumd641d671997-04-03 17:06:32 +0000232
233 error:
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000234 /* XXXX we should clean up everything */
235 if (pvs)
236 PyMem_DEL(pvs);
237 if (pinfo)
238 PyMem_DEL(pinfo);
239 return -1;
Guido van Rossumd641d671997-04-03 17:06:32 +0000240}
241
242/* -------------------------------------------------------- */
243
244
245static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000246SetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig, int))
Guido van Rossumd641d671997-04-03 17:06:32 +0000247{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000248 int par;
Guido van Rossumd641d671997-04-03 17:06:32 +0000249
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000250 if (!PyArg_ParseTuple(args, "i:SetConfig", &par))
251 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000252
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000253 if ((*func)(self->config, par) == -1)
254 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000255
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000256 Py_INCREF(Py_None);
257 return Py_None;
Guido van Rossume3db8621991-09-09 23:33:34 +0000258}
259
Roger E. Massea2a8b271997-01-03 22:40:34 +0000260static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000261GetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig))
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000262{
263 int par;
Guido van Rossumd641d671997-04-03 17:06:32 +0000264
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000265 if (!PyArg_ParseTuple(args, ":GetConfig"))
266 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000267
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000268 if ((par = (*func)(self->config)) == -1)
269 return NULL;
270
271 return PyInt_FromLong((long) par);
Guido van Rossumd641d671997-04-03 17:06:32 +0000272}
273
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000274PyDoc_STRVAR(alc_SetWidth__doc__,
275"alSetWidth: set the wordsize for integer audio data.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000276
277static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000278alc_SetWidth(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000279{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000280 return SetConfig(self, args, alSetWidth);
Guido van Rossumd641d671997-04-03 17:06:32 +0000281}
282
283
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000284PyDoc_STRVAR(alc_GetWidth__doc__,
285"alGetWidth: get the wordsize for integer audio data.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000286
287static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000288alc_GetWidth(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000289{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000290 return GetConfig(self, args, alGetWidth);
Guido van Rossumd641d671997-04-03 17:06:32 +0000291}
292
293
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000294PyDoc_STRVAR(alc_SetSampFmt__doc__,
295"alSetSampFmt: set the sample format setting in an audio ALconfig "
296"structure.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000297
298static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000299alc_SetSampFmt(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000300{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000301 return SetConfig(self, args, alSetSampFmt);
Guido van Rossumd641d671997-04-03 17:06:32 +0000302}
303
304
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000305PyDoc_STRVAR(alc_GetSampFmt__doc__,
306"alGetSampFmt: get the sample format setting in an audio ALconfig "
307"structure.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000308
309static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000310alc_GetSampFmt(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000311{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000312 return GetConfig(self, args, alGetSampFmt);
Guido van Rossumd641d671997-04-03 17:06:32 +0000313}
314
315
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000316PyDoc_STRVAR(alc_SetChannels__doc__,
317"alSetChannels: set the channel settings in an audio ALconfig.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000318
319static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000320alc_SetChannels(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000321{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000322 return SetConfig(self, args, alSetChannels);
Guido van Rossumd641d671997-04-03 17:06:32 +0000323}
324
325
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000326PyDoc_STRVAR(alc_GetChannels__doc__,
327"alGetChannels: get the channel settings in an audio ALconfig.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000328
329static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000330alc_GetChannels(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000331{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000332 return GetConfig(self, args, alGetChannels);
Guido van Rossumd641d671997-04-03 17:06:32 +0000333}
334
335
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000336PyDoc_STRVAR(alc_SetFloatMax__doc__,
337"alSetFloatMax: set the maximum value of floating point sample data.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000338
339static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000340alc_SetFloatMax(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000341{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000342 double maximum_value;
Guido van Rossumd641d671997-04-03 17:06:32 +0000343
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000344 if (!PyArg_ParseTuple(args, "d:SetFloatMax", &maximum_value))
345 return NULL;
346 if (alSetFloatMax(self->config, maximum_value) < 0)
347 return NULL;
348 Py_INCREF(Py_None);
349 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +0000350}
351
352
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000353PyDoc_STRVAR(alc_GetFloatMax__doc__,
354"alGetFloatMax: get the maximum value of floating point sample data.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000355
356static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000357alc_GetFloatMax(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000358{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000359 double maximum_value;
Guido van Rossumd641d671997-04-03 17:06:32 +0000360
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000361 if (!PyArg_ParseTuple(args, ":GetFloatMax"))
362 return NULL;
363 if ((maximum_value = alGetFloatMax(self->config)) == 0)
364 return NULL;
365 return PyFloat_FromDouble(maximum_value);
Guido van Rossumd641d671997-04-03 17:06:32 +0000366}
367
368
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000369PyDoc_STRVAR(alc_SetDevice__doc__,
370"alSetDevice: set the device setting in an audio ALconfig structure.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000371
372static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000373alc_SetDevice(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000374{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000375 return SetConfig(self, args, alSetDevice);
Guido van Rossumd641d671997-04-03 17:06:32 +0000376}
377
378
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000379PyDoc_STRVAR(alc_GetDevice__doc__,
380"alGetDevice: get the device setting in an audio ALconfig structure.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000381
382static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000383alc_GetDevice(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000384{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000385 return GetConfig(self, args, alGetDevice);
Guido van Rossumd641d671997-04-03 17:06:32 +0000386}
387
388
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000389PyDoc_STRVAR(alc_SetQueueSize__doc__,
390"alSetQueueSize: set audio port buffer size.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000391
392static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000393alc_SetQueueSize(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000394{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000395 return SetConfig(self, args, alSetQueueSize);
Guido van Rossumd641d671997-04-03 17:06:32 +0000396}
397
398
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000399PyDoc_STRVAR(alc_GetQueueSize__doc__,
400"alGetQueueSize: get audio port buffer size.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000401
402static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000403alc_GetQueueSize(alcobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000404{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000405 return GetConfig(self, args, alGetQueueSize);
Guido van Rossumd641d671997-04-03 17:06:32 +0000406}
407
408#endif /* AL_NO_ELEM */
409
410static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000411setconfig(alcobject *self, PyObject *args, int (*func)(ALconfig, long))
Guido van Rossumd641d671997-04-03 17:06:32 +0000412{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000413 long par;
Guido van Rossumd641d671997-04-03 17:06:32 +0000414
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000415 if (!PyArg_ParseTuple(args, "l:SetConfig", &par))
416 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000417
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000418 if ((*func)(self->config, par) == -1)
419 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000420
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000421 Py_INCREF(Py_None);
422 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +0000423}
424
425static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000426getconfig(alcobject *self, PyObject *args, long (*func)(ALconfig))
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000427{
428 long par;
Guido van Rossume3db8621991-09-09 23:33:34 +0000429
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000430 if (!PyArg_ParseTuple(args, ":GetConfig"))
431 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +0000432
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000433 if ((par = (*func)(self->config)) == -1)
434 return NULL;
435
436 return PyInt_FromLong((long) par);
Guido van Rossume3db8621991-09-09 23:33:34 +0000437}
438
Roger E. Massea2a8b271997-01-03 22:40:34 +0000439static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000440alc_setqueuesize (alcobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000441{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000442 return setconfig(self, args, ALsetqueuesize);
Guido van Rossume3db8621991-09-09 23:33:34 +0000443}
444
Roger E. Massea2a8b271997-01-03 22:40:34 +0000445static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000446alc_getqueuesize (alcobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000447{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000448 return getconfig(self, args, ALgetqueuesize);
Guido van Rossume3db8621991-09-09 23:33:34 +0000449}
450
Roger E. Massea2a8b271997-01-03 22:40:34 +0000451static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000452alc_setwidth (alcobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000453{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000454 return setconfig(self, args, ALsetwidth);
Guido van Rossume3db8621991-09-09 23:33:34 +0000455}
456
Roger E. Massea2a8b271997-01-03 22:40:34 +0000457static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000458alc_getwidth (alcobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000459{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000460 return getconfig(self, args, ALgetwidth);
Guido van Rossume3db8621991-09-09 23:33:34 +0000461}
462
Roger E. Massea2a8b271997-01-03 22:40:34 +0000463static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000464alc_getchannels (alcobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000465{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000466 return getconfig(self, args, ALgetchannels);
Guido van Rossume3db8621991-09-09 23:33:34 +0000467}
468
Roger E. Massea2a8b271997-01-03 22:40:34 +0000469static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000470alc_setchannels (alcobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000471{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000472 return setconfig(self, args, ALsetchannels);
Guido van Rossume3db8621991-09-09 23:33:34 +0000473}
474
Jack Jansene8a3c281993-02-10 14:10:56 +0000475#ifdef AL_405
476
Roger E. Massea2a8b271997-01-03 22:40:34 +0000477static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000478alc_getsampfmt (alcobject *self, PyObject *args)
Jack Jansene8a3c281993-02-10 14:10:56 +0000479{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000480 return getconfig(self, args, ALgetsampfmt);
Jack Jansene8a3c281993-02-10 14:10:56 +0000481}
482
Roger E. Massea2a8b271997-01-03 22:40:34 +0000483static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000484alc_setsampfmt (alcobject *self, PyObject *args)
Jack Jansene8a3c281993-02-10 14:10:56 +0000485{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000486 return setconfig(self, args, ALsetsampfmt);
Jack Jansene8a3c281993-02-10 14:10:56 +0000487}
488
Roger E. Massea2a8b271997-01-03 22:40:34 +0000489static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000490alc_getfloatmax(alcobject *self, PyObject *args)
Jack Jansene8a3c281993-02-10 14:10:56 +0000491{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000492 double arg;
Jack Jansene8a3c281993-02-10 14:10:56 +0000493
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000494 if (!PyArg_ParseTuple(args, ":GetFloatMax"))
495 return 0;
496 if ((arg = ALgetfloatmax(self->config)) == 0)
497 return NULL;
498 return PyFloat_FromDouble(arg);
Jack Jansene8a3c281993-02-10 14:10:56 +0000499}
500
Roger E. Massea2a8b271997-01-03 22:40:34 +0000501static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000502alc_setfloatmax(alcobject *self, PyObject *args)
Jack Jansene8a3c281993-02-10 14:10:56 +0000503{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000504 double arg;
Jack Jansene8a3c281993-02-10 14:10:56 +0000505
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000506 if (!PyArg_ParseTuple(args, "d:SetFloatMax", &arg))
507 return 0;
508 if (ALsetfloatmax(self->config, arg) == -1)
509 return NULL;
510 Py_INCREF(Py_None);
511 return Py_None;
Jack Jansene8a3c281993-02-10 14:10:56 +0000512}
513#endif /* AL_405 */
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000514
Guido van Rossumd641d671997-04-03 17:06:32 +0000515static struct PyMethodDef alc_methods[] = {
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000516#ifdef AL_NO_ELEM /* IRIX 6 */
517 {"SetWidth", (PyCFunction)alc_SetWidth, METH_VARARGS, alc_SetWidth__doc__},
518 {"GetWidth", (PyCFunction)alc_GetWidth, METH_VARARGS, alc_GetWidth__doc__},
519 {"SetSampFmt", (PyCFunction)alc_SetSampFmt, METH_VARARGS, alc_SetSampFmt__doc__},
520 {"GetSampFmt", (PyCFunction)alc_GetSampFmt, METH_VARARGS, alc_GetSampFmt__doc__},
521 {"SetChannels", (PyCFunction)alc_SetChannels, METH_VARARGS, alc_SetChannels__doc__},
522 {"GetChannels", (PyCFunction)alc_GetChannels, METH_VARARGS, alc_GetChannels__doc__},
523 {"SetFloatMax", (PyCFunction)alc_SetFloatMax, METH_VARARGS, alc_SetFloatMax__doc__},
524 {"GetFloatMax", (PyCFunction)alc_GetFloatMax, METH_VARARGS, alc_GetFloatMax__doc__},
525 {"SetDevice", (PyCFunction)alc_SetDevice, METH_VARARGS, alc_SetDevice__doc__},
526 {"GetDevice", (PyCFunction)alc_GetDevice, METH_VARARGS, alc_GetDevice__doc__},
527 {"SetQueueSize", (PyCFunction)alc_SetQueueSize, METH_VARARGS, alc_SetQueueSize__doc__},
528 {"GetQueueSize", (PyCFunction)alc_GetQueueSize, METH_VARARGS, alc_GetQueueSize__doc__},
Guido van Rossumd641d671997-04-03 17:06:32 +0000529#endif /* AL_NO_ELEM */
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000530 {"getqueuesize", (PyCFunction)alc_getqueuesize, METH_VARARGS},
531 {"setqueuesize", (PyCFunction)alc_setqueuesize, METH_VARARGS},
532 {"getwidth", (PyCFunction)alc_getwidth, METH_VARARGS},
533 {"setwidth", (PyCFunction)alc_setwidth, METH_VARARGS},
534 {"getchannels", (PyCFunction)alc_getchannels, METH_VARARGS},
535 {"setchannels", (PyCFunction)alc_setchannels, METH_VARARGS},
Jack Jansene8a3c281993-02-10 14:10:56 +0000536#ifdef AL_405
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000537 {"getsampfmt", (PyCFunction)alc_getsampfmt, METH_VARARGS},
538 {"setsampfmt", (PyCFunction)alc_setsampfmt, METH_VARARGS},
539 {"getfloatmax", (PyCFunction)alc_getfloatmax, METH_VARARGS},
540 {"setfloatmax", (PyCFunction)alc_setfloatmax, METH_VARARGS},
Jack Jansene8a3c281993-02-10 14:10:56 +0000541#endif /* AL_405 */
Guido van Rossumd641d671997-04-03 17:06:32 +0000542
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000543 {NULL, NULL} /* sentinel */
Guido van Rossume3db8621991-09-09 23:33:34 +0000544};
545
Guido van Rossumd641d671997-04-03 17:06:32 +0000546/* ---------- */
547
548
549static PyObject *
550newalcobject(ALconfig config)
Guido van Rossume3db8621991-09-09 23:33:34 +0000551{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000552 alcobject *self;
553
554 self = PyObject_New(alcobject, &Alctype);
555 if (self == NULL)
556 return NULL;
557 /* XXXX Add your own initializers here */
558 self->config = config;
559 return (PyObject *) self;
Guido van Rossumd641d671997-04-03 17:06:32 +0000560}
561
562
563static void
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000564alc_dealloc(alcobject *self)
Guido van Rossumd641d671997-04-03 17:06:32 +0000565{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000566 /* XXXX Add your own cleanup code here */
567#ifdef AL_NO_ELEM /* IRIX 6 */
568 (void) alFreeConfig(self->config); /* ignore errors */
Guido van Rossumd641d671997-04-03 17:06:32 +0000569#else
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000570 (void) ALfreeconfig(self->config); /* ignore errors */
Guido van Rossumd641d671997-04-03 17:06:32 +0000571#endif
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000572 PyObject_Del(self);
Guido van Rossume3db8621991-09-09 23:33:34 +0000573}
574
Roger E. Massea2a8b271997-01-03 22:40:34 +0000575static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000576alc_getattr(alcobject *self, char *name)
Guido van Rossume3db8621991-09-09 23:33:34 +0000577{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000578 /* XXXX Add your own getattr code here */
579 return Py_FindMethod(alc_methods, (PyObject *)self, name);
Guido van Rossume3db8621991-09-09 23:33:34 +0000580}
581
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000582PyDoc_STRVAR(Alctype__doc__, "");
Guido van Rossumd641d671997-04-03 17:06:32 +0000583
584static PyTypeObject Alctype = {
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000585 PyObject_HEAD_INIT(&PyType_Type)
586 0, /*ob_size*/
587 "al.config", /*tp_name*/
588 sizeof(alcobject), /*tp_basicsize*/
589 0, /*tp_itemsize*/
590 /* methods */
591 (destructor)alc_dealloc, /*tp_dealloc*/
592 (printfunc)0, /*tp_print*/
593 (getattrfunc)alc_getattr, /*tp_getattr*/
594 (setattrfunc)0, /*tp_setattr*/
595 (cmpfunc)0, /*tp_compare*/
596 (reprfunc)0, /*tp_repr*/
597 0, /*tp_as_number*/
598 0, /*tp_as_sequence*/
599 0, /*tp_as_mapping*/
600 (hashfunc)0, /*tp_hash*/
601 (ternaryfunc)0, /*tp_call*/
602 (reprfunc)0, /*tp_str*/
Guido van Rossumd641d671997-04-03 17:06:32 +0000603
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000604 /* Space for future expansion */
605 0L,0L,0L,0L,
606 Alctype__doc__ /* Documentation string */
Guido van Rossume3db8621991-09-09 23:33:34 +0000607};
608
Guido van Rossumd641d671997-04-03 17:06:32 +0000609/* End of code for config objects */
610/* ---------------------------------------------------------------- */
Guido van Rossume3db8621991-09-09 23:33:34 +0000611
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000612#ifdef AL_NO_ELEM /* IRIX 6 */
Guido van Rossume3db8621991-09-09 23:33:34 +0000613
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000614PyDoc_STRVAR(alp_SetConfig__doc__,
615"alSetConfig: set the ALconfig of an audio ALport.");
Guido van Rossume3db8621991-09-09 23:33:34 +0000616
Roger E. Massea2a8b271997-01-03 22:40:34 +0000617static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000618alp_SetConfig(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000619{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000620 alcobject *config;
621 if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config))
622 return NULL;
623 if (alSetConfig(self->port, config->config) < 0)
624 return NULL;
625 Py_INCREF(Py_None);
626 return Py_None;
Guido van Rossume3db8621991-09-09 23:33:34 +0000627}
628
Guido van Rossumd641d671997-04-03 17:06:32 +0000629
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000630PyDoc_STRVAR(alp_GetConfig__doc__,
631"alGetConfig: get the ALconfig of an audio ALport.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000632
Roger E. Massea2a8b271997-01-03 22:40:34 +0000633static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000634alp_GetConfig(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000635{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000636 ALconfig config;
637 if (!PyArg_ParseTuple(args, ":GetConfig"))
638 return NULL;
639 if ((config = alGetConfig(self->port)) == NULL)
640 return NULL;
641 return newalcobject(config);
Guido van Rossumd641d671997-04-03 17:06:32 +0000642}
643
644
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000645PyDoc_STRVAR(alp_GetResource__doc__,
646"alGetResource: get the resource associated with an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000647
648static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000649alp_GetResource(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000650{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000651 int resource;
Guido van Rossumd641d671997-04-03 17:06:32 +0000652
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000653 if (!PyArg_ParseTuple(args, ":GetResource"))
654 return NULL;
655 if ((resource = alGetResource(self->port)) == 0)
656 return NULL;
657 return PyInt_FromLong((long) resource);
Guido van Rossumd641d671997-04-03 17:06:32 +0000658}
659
660
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000661PyDoc_STRVAR(alp_GetFD__doc__,
662"alGetFD: get the file descriptor for an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000663
664static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000665alp_GetFD(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +0000666{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000667 int fd;
Guido van Rossume3db8621991-09-09 23:33:34 +0000668
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000669 if (!PyArg_ParseTuple(args, ":GetFD"))
670 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +0000671
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000672 if ((fd = alGetFD(self->port)) < 0)
673 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +0000674
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000675 return PyInt_FromLong((long) fd);
Guido van Rossumd641d671997-04-03 17:06:32 +0000676}
677
678
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000679PyDoc_STRVAR(alp_GetFilled__doc__,
680"alGetFilled: return the number of filled sample frames in "
681"an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000682
683static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000684alp_GetFilled(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000685{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000686 int filled;
Guido van Rossumd641d671997-04-03 17:06:32 +0000687
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000688 if (!PyArg_ParseTuple(args, ":GetFilled"))
689 return NULL;
690 if ((filled = alGetFilled(self->port)) < 0)
691 return NULL;
692 return PyInt_FromLong((long) filled);
Guido van Rossumd641d671997-04-03 17:06:32 +0000693}
694
695
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000696PyDoc_STRVAR(alp_GetFillable__doc__,
697"alGetFillable: report the number of unfilled sample frames "
698"in an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000699
700static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000701alp_GetFillable(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000702{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000703 int fillable;
Guido van Rossumd641d671997-04-03 17:06:32 +0000704
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000705 if (!PyArg_ParseTuple(args, ":GetFillable"))
706 return NULL;
707 if ((fillable = alGetFillable(self->port)) < 0)
708 return NULL;
709 return PyInt_FromLong((long) fillable);
Guido van Rossumd641d671997-04-03 17:06:32 +0000710}
711
712
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000713PyDoc_STRVAR(alp_ReadFrames__doc__,
714"alReadFrames: read sample frames from an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000715
716static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000717alp_ReadFrames(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000718{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000719 int framecount;
720 PyObject *v;
721 int size;
722 int ch;
723 ALconfig c;
Guido van Rossumd641d671997-04-03 17:06:32 +0000724
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000725 if (!PyArg_ParseTuple(args, "i:ReadFrames", &framecount))
726 return NULL;
727 if (framecount < 0) {
728 PyErr_SetString(ErrorObject, "negative framecount");
729 return NULL;
730 }
731 c = alGetConfig(self->port);
732 switch (alGetSampFmt(c)) {
733 case AL_SAMPFMT_TWOSCOMP:
734 switch (alGetWidth(c)) {
735 case AL_SAMPLE_8:
736 size = 1;
737 break;
738 case AL_SAMPLE_16:
739 size = 2;
740 break;
741 case AL_SAMPLE_24:
742 size = 4;
743 break;
744 default:
745 PyErr_SetString(ErrorObject, "can't determine width");
746 alFreeConfig(c);
747 return NULL;
748 }
749 break;
750 case AL_SAMPFMT_FLOAT:
751 size = 4;
752 break;
753 case AL_SAMPFMT_DOUBLE:
754 size = 8;
755 break;
756 default:
757 PyErr_SetString(ErrorObject, "can't determine format");
758 alFreeConfig(c);
759 return NULL;
760 }
761 ch = alGetChannels(c);
762 alFreeConfig(c);
763 if (ch < 0) {
764 PyErr_SetString(ErrorObject, "can't determine # of channels");
765 return NULL;
766 }
767 size *= ch;
768 v = PyString_FromStringAndSize((char *) NULL, size * framecount);
769 if (v == NULL)
770 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000771
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000772 Py_BEGIN_ALLOW_THREADS
773 alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount);
774 Py_END_ALLOW_THREADS
Guido van Rossumd641d671997-04-03 17:06:32 +0000775
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000776 return v;
Guido van Rossumd641d671997-04-03 17:06:32 +0000777}
778
779
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000780PyDoc_STRVAR(alp_DiscardFrames__doc__,
781"alDiscardFrames: discard audio from an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000782
783static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000784alp_DiscardFrames(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000785{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000786 int framecount;
Guido van Rossumd641d671997-04-03 17:06:32 +0000787
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000788 if (!PyArg_ParseTuple(args, "i:DiscardFrames", &framecount))
789 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000790
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000791 Py_BEGIN_ALLOW_THREADS
792 framecount = alDiscardFrames(self->port, framecount);
793 Py_END_ALLOW_THREADS
Guido van Rossumd641d671997-04-03 17:06:32 +0000794
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000795 if (framecount < 0)
796 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000797
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000798 return PyInt_FromLong((long) framecount);
Guido van Rossumd641d671997-04-03 17:06:32 +0000799}
800
801
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000802PyDoc_STRVAR(alp_ZeroFrames__doc__,
803"alZeroFrames: write zero-valued sample frames to an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000804
805static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000806alp_ZeroFrames(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000807{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000808 int framecount;
Guido van Rossumd641d671997-04-03 17:06:32 +0000809
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000810 if (!PyArg_ParseTuple(args, "i:ZeroFrames", &framecount))
811 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000812
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000813 if (framecount < 0) {
814 PyErr_SetString(ErrorObject, "negative framecount");
815 return NULL;
816 }
Guido van Rossumd641d671997-04-03 17:06:32 +0000817
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000818 Py_BEGIN_ALLOW_THREADS
819 alZeroFrames(self->port, framecount);
820 Py_END_ALLOW_THREADS
Guido van Rossumd641d671997-04-03 17:06:32 +0000821
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000822 Py_INCREF(Py_None);
823 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +0000824}
825
826
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000827PyDoc_STRVAR(alp_SetFillPoint__doc__,
828"alSetFillPoint: set low- or high-water mark for an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000829
830static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000831alp_SetFillPoint(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000832{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000833 int fillpoint;
Guido van Rossumd641d671997-04-03 17:06:32 +0000834
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000835 if (!PyArg_ParseTuple(args, "i:SetFillPoint", &fillpoint))
836 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000837
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000838 if (alSetFillPoint(self->port, fillpoint) < 0)
839 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000840
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000841 Py_INCREF(Py_None);
842 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +0000843}
844
845
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000846PyDoc_STRVAR(alp_GetFillPoint__doc__,
847"alGetFillPoint: get low- or high-water mark for an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000848
849static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000850alp_GetFillPoint(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000851{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000852 int fillpoint;
Guido van Rossumd641d671997-04-03 17:06:32 +0000853
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000854 if (!PyArg_ParseTuple(args, ":GetFillPoint"))
855 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000856
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000857 if ((fillpoint = alGetFillPoint(self->port)) < 0)
858 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000859
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000860 return PyInt_FromLong((long) fillpoint);
Guido van Rossumd641d671997-04-03 17:06:32 +0000861}
862
863
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000864PyDoc_STRVAR(alp_GetFrameNumber__doc__,
865"alGetFrameNumber: get the absolute sample frame number "
866"associated with a port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000867
868static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000869alp_GetFrameNumber(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000870{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000871 stamp_t fnum;
Guido van Rossumd641d671997-04-03 17:06:32 +0000872
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000873 if (!PyArg_ParseTuple(args, ":GetFrameNumber"))
874 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000875
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000876 if (alGetFrameNumber(self->port, &fnum) < 0)
877 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +0000878
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000879 return PyLong_FromLongLong((long long) fnum);
Guido van Rossumd641d671997-04-03 17:06:32 +0000880}
881
882
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000883PyDoc_STRVAR(alp_GetFrameTime__doc__,
884"alGetFrameTime: get the time at which a sample frame came "
885"in or will go out.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000886
887static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000888alp_GetFrameTime(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000889{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000890 stamp_t fnum, time;
891 PyObject *ret, *v0, *v1;
Guido van Rossumd641d671997-04-03 17:06:32 +0000892
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000893 if (!PyArg_ParseTuple(args, ":GetFrameTime"))
894 return NULL;
895 if (alGetFrameTime(self->port, &fnum, &time) < 0)
896 return NULL;
897 v0 = PyLong_FromLongLong((long long) fnum);
898 v1 = PyLong_FromLongLong((long long) time);
899 if (PyErr_Occurred()) {
900 Py_XDECREF(v0);
901 Py_XDECREF(v1);
902 return NULL;
903 }
904 ret = PyTuple_Pack(2, v0, v1);
905 Py_DECREF(v0);
906 Py_DECREF(v1);
907 return ret;
Guido van Rossumd641d671997-04-03 17:06:32 +0000908}
909
910
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000911PyDoc_STRVAR(alp_WriteFrames__doc__,
912"alWriteFrames: write sample frames to an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000913
914static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000915alp_WriteFrames(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000916{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000917 char *samples;
918 int length;
919 int size, ch;
920 ALconfig c;
Guido van Rossumd641d671997-04-03 17:06:32 +0000921
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000922 if (!PyArg_ParseTuple(args, "s#:WriteFrames", &samples, &length))
923 return NULL;
924 c = alGetConfig(self->port);
925 switch (alGetSampFmt(c)) {
926 case AL_SAMPFMT_TWOSCOMP:
927 switch (alGetWidth(c)) {
928 case AL_SAMPLE_8:
929 size = 1;
930 break;
931 case AL_SAMPLE_16:
932 size = 2;
933 break;
934 case AL_SAMPLE_24:
935 size = 4;
936 break;
937 default:
938 PyErr_SetString(ErrorObject, "can't determine width");
939 alFreeConfig(c);
940 return NULL;
941 }
942 break;
943 case AL_SAMPFMT_FLOAT:
944 size = 4;
945 break;
946 case AL_SAMPFMT_DOUBLE:
947 size = 8;
948 break;
949 default:
950 PyErr_SetString(ErrorObject, "can't determine format");
951 alFreeConfig(c);
952 return NULL;
953 }
954 ch = alGetChannels(c);
955 alFreeConfig(c);
956 if (ch < 0) {
957 PyErr_SetString(ErrorObject, "can't determine # of channels");
958 return NULL;
959 }
960 size *= ch;
961 if (length % size != 0) {
962 PyErr_SetString(ErrorObject,
963 "buffer length not whole number of frames");
964 return NULL;
965 }
Guido van Rossumd641d671997-04-03 17:06:32 +0000966
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000967 Py_BEGIN_ALLOW_THREADS
968 alWriteFrames(self->port, (void *) samples, length / size);
969 Py_END_ALLOW_THREADS
Guido van Rossumd641d671997-04-03 17:06:32 +0000970
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000971 Py_INCREF(Py_None);
972 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +0000973}
974
975
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +0000976PyDoc_STRVAR(alp_ClosePort__doc__, "alClosePort: close an audio port.");
Guido van Rossumd641d671997-04-03 17:06:32 +0000977
978static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000979alp_ClosePort(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000980{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000981 if (!PyArg_ParseTuple(args, ":ClosePort"))
982 return NULL;
983 if (alClosePort(self->port) < 0)
984 return NULL;
985 self->port = NULL;
986 Py_INCREF(Py_None);
987 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +0000988}
989
990#endif /* AL_NO_ELEM */
991
992#ifdef OLD_INTERFACE
993static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +0000994alp_closeport(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +0000995{
Antoine Pitrouc83ea132010-05-09 14:46:46 +0000996 if (!PyArg_ParseTuple(args, ":ClosePort"))
997 return NULL;
998 if (ALcloseport(self->port) < 0)
999 return NULL;
1000 self->port = NULL;
1001 Py_INCREF(Py_None);
1002 return Py_None;
Guido van Rossume3db8621991-09-09 23:33:34 +00001003}
1004
Roger E. Massea2a8b271997-01-03 22:40:34 +00001005static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001006alp_getfd(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001007{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001008 int fd;
Guido van Rossumd641d671997-04-03 17:06:32 +00001009
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001010 if (!PyArg_ParseTuple(args, ":GetFD"))
1011 return NULL;
1012 if ((fd = ALgetfd(self-> port)) == -1)
1013 return NULL;
1014 return PyInt_FromLong(fd);
Guido van Rossumd641d671997-04-03 17:06:32 +00001015}
1016
1017static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001018alp_getfilled(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001019{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001020 long count;
Guido van Rossume3db8621991-09-09 23:33:34 +00001021
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001022 if (!PyArg_ParseTuple(args, ":GetFilled"))
1023 return NULL;
1024 if ((count = ALgetfilled(self-> port)) == -1)
1025 return NULL;
1026 return PyInt_FromLong(count);
Guido van Rossume3db8621991-09-09 23:33:34 +00001027}
1028
Roger E. Massea2a8b271997-01-03 22:40:34 +00001029static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001030alp_getfillable(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001031{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001032 long count;
Guido van Rossume3db8621991-09-09 23:33:34 +00001033
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001034 if (!PyArg_ParseTuple(args, ":GetFillable"))
1035 return NULL;
1036 if ((count = ALgetfillable(self-> port)) == -1)
1037 return NULL;
1038 return PyInt_FromLong (count);
Guido van Rossume3db8621991-09-09 23:33:34 +00001039}
1040
Roger E. Massea2a8b271997-01-03 22:40:34 +00001041static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001042alp_readsamps(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001043{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001044 long count;
1045 PyObject *v;
1046 ALconfig c;
1047 int width;
1048 int ret;
Guido van Rossume3db8621991-09-09 23:33:34 +00001049
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001050 if (!PyArg_ParseTuple(args, "l:readsamps", &count))
1051 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +00001052
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001053 if (count <= 0) {
1054 PyErr_SetString(ErrorObject, "al.readsamps : arg <= 0");
1055 return NULL;
1056 }
Guido van Rossume3db8621991-09-09 23:33:34 +00001057
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001058 c = ALgetconfig(self->port);
Jack Jansene8a3c281993-02-10 14:10:56 +00001059#ifdef AL_405
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001060 width = ALgetsampfmt(c);
1061 if (width == AL_SAMPFMT_FLOAT)
1062 width = sizeof(float);
1063 else if (width == AL_SAMPFMT_DOUBLE)
1064 width = sizeof(double);
1065 else
1066 width = ALgetwidth(c);
Jack Jansene8a3c281993-02-10 14:10:56 +00001067#else
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001068 width = ALgetwidth(c);
Jack Jansene8a3c281993-02-10 14:10:56 +00001069#endif /* AL_405 */
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001070 ALfreeconfig(c);
1071 v = PyString_FromStringAndSize((char *)NULL, width * count);
1072 if (v == NULL)
1073 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +00001074
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001075 Py_BEGIN_ALLOW_THREADS
1076 ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count);
1077 Py_END_ALLOW_THREADS
1078 if (ret == -1) {
1079 Py_DECREF(v);
1080 return NULL;
1081 }
Guido van Rossume3db8621991-09-09 23:33:34 +00001082
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001083 return (v);
Guido van Rossume3db8621991-09-09 23:33:34 +00001084}
1085
Roger E. Massea2a8b271997-01-03 22:40:34 +00001086static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001087alp_writesamps(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001088{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001089 char *buf;
1090 int size, width;
1091 ALconfig c;
1092 int ret;
Guido van Rossume3db8621991-09-09 23:33:34 +00001093
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001094 if (!PyArg_ParseTuple(args, "s#:writesamps", &buf, &size))
1095 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +00001096
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001097 c = ALgetconfig(self->port);
Jack Jansene8a3c281993-02-10 14:10:56 +00001098#ifdef AL_405
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001099 width = ALgetsampfmt(c);
1100 if (width == AL_SAMPFMT_FLOAT)
1101 width = sizeof(float);
1102 else if (width == AL_SAMPFMT_DOUBLE)
1103 width = sizeof(double);
1104 else
1105 width = ALgetwidth(c);
Jack Jansene8a3c281993-02-10 14:10:56 +00001106#else
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001107 width = ALgetwidth(c);
Jack Jansene8a3c281993-02-10 14:10:56 +00001108#endif /* AL_405 */
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001109 ALfreeconfig(c);
1110 Py_BEGIN_ALLOW_THREADS
1111 ret = ALwritesamps (self->port, (void *) buf, (long) size / width);
1112 Py_END_ALLOW_THREADS
1113 if (ret == -1)
1114 return NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +00001115
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001116 Py_INCREF(Py_None);
1117 return Py_None;
Guido van Rossume3db8621991-09-09 23:33:34 +00001118}
1119
Roger E. Massea2a8b271997-01-03 22:40:34 +00001120static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001121alp_getfillpoint(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001122{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001123 long count;
Guido van Rossume3db8621991-09-09 23:33:34 +00001124
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001125 if (!PyArg_ParseTuple(args, ":GetFillPoint"))
1126 return NULL;
1127 if ((count = ALgetfillpoint(self->port)) == -1)
1128 return NULL;
1129 return PyInt_FromLong(count);
Guido van Rossume3db8621991-09-09 23:33:34 +00001130}
1131
Roger E. Massea2a8b271997-01-03 22:40:34 +00001132static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001133alp_setfillpoint(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001134{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001135 long count;
Guido van Rossume3db8621991-09-09 23:33:34 +00001136
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001137 if (!PyArg_ParseTuple(args, "l:SetFillPoint", &count))
1138 return NULL;
1139 if (ALsetfillpoint(self->port, count) == -1)
1140 return NULL;
1141 Py_INCREF(Py_None);
1142 return Py_None;
Guido van Rossume3db8621991-09-09 23:33:34 +00001143}
1144
Roger E. Massea2a8b271997-01-03 22:40:34 +00001145static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001146alp_setconfig(alpobject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001147{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001148 alcobject *config;
Guido van Rossumd641d671997-04-03 17:06:32 +00001149
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001150 if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config))
1151 return NULL;
1152 if (ALsetconfig(self->port, config->config) == -1)
1153 return NULL;
1154 Py_INCREF(Py_None);
1155 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +00001156}
1157
1158static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001159alp_getconfig(alpobject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001160{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001161 ALconfig config;
Guido van Rossume3db8621991-09-09 23:33:34 +00001162
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001163 if (!PyArg_ParseTuple(args, ":GetConfig"))
1164 return NULL;
1165 config = ALgetconfig(self->port);
1166 if (config == NULL)
1167 return NULL;
1168 return newalcobject(config);
Guido van Rossume3db8621991-09-09 23:33:34 +00001169}
1170
Jack Jansene8a3c281993-02-10 14:10:56 +00001171#ifdef AL_405
Roger E. Massea2a8b271997-01-03 22:40:34 +00001172static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001173alp_getstatus(alpobject *self, PyObject *args)
Jack Jansene8a3c281993-02-10 14:10:56 +00001174{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001175 PyObject *list, *v;
1176 long *PVbuffer;
1177 long length;
1178 int i;
Jack Jansene8a3c281993-02-10 14:10:56 +00001179
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001180 if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &list))
1181 return NULL;
1182 length = PyList_Size(list);
1183 PVbuffer = PyMem_NEW(long, length);
1184 if (PVbuffer == NULL)
1185 return PyErr_NoMemory();
1186 for (i = 0; i < length; i++) {
1187 v = PyList_GetItem(list, i);
1188 if (!PyInt_Check(v)) {
1189 PyMem_DEL(PVbuffer);
1190 PyErr_BadArgument();
1191 return NULL;
1192 }
1193 PVbuffer[i] = PyInt_AsLong(v);
1194 }
Jack Jansene8a3c281993-02-10 14:10:56 +00001195
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001196 if (ALgetstatus(self->port, PVbuffer, length) == -1)
1197 return NULL;
Jack Jansene8a3c281993-02-10 14:10:56 +00001198
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001199 for (i = 0; i < length; i++)
1200 PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
Jack Jansene8a3c281993-02-10 14:10:56 +00001201
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001202 PyMem_DEL(PVbuffer);
1203
1204 Py_INCREF(Py_None);
1205 return Py_None;
Jack Jansene8a3c281993-02-10 14:10:56 +00001206}
1207#endif /* AL_405 */
1208
Guido van Rossumd641d671997-04-03 17:06:32 +00001209#endif /* OLD_INTERFACE */
1210
1211static struct PyMethodDef alp_methods[] = {
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001212#ifdef AL_NO_ELEM /* IRIX 6 */
1213 {"SetConfig", (PyCFunction)alp_SetConfig, METH_VARARGS, alp_SetConfig__doc__},
1214 {"GetConfig", (PyCFunction)alp_GetConfig, METH_VARARGS, alp_GetConfig__doc__},
1215 {"GetResource", (PyCFunction)alp_GetResource, METH_VARARGS, alp_GetResource__doc__},
1216 {"GetFD", (PyCFunction)alp_GetFD, METH_VARARGS, alp_GetFD__doc__},
1217 {"GetFilled", (PyCFunction)alp_GetFilled, METH_VARARGS, alp_GetFilled__doc__},
1218 {"GetFillable", (PyCFunction)alp_GetFillable, METH_VARARGS, alp_GetFillable__doc__},
1219 {"ReadFrames", (PyCFunction)alp_ReadFrames, METH_VARARGS, alp_ReadFrames__doc__},
1220 {"DiscardFrames", (PyCFunction)alp_DiscardFrames, METH_VARARGS, alp_DiscardFrames__doc__},
1221 {"ZeroFrames", (PyCFunction)alp_ZeroFrames, METH_VARARGS, alp_ZeroFrames__doc__},
1222 {"SetFillPoint", (PyCFunction)alp_SetFillPoint, METH_VARARGS, alp_SetFillPoint__doc__},
1223 {"GetFillPoint", (PyCFunction)alp_GetFillPoint, METH_VARARGS, alp_GetFillPoint__doc__},
1224 {"GetFrameNumber", (PyCFunction)alp_GetFrameNumber, METH_VARARGS, alp_GetFrameNumber__doc__},
1225 {"GetFrameTime", (PyCFunction)alp_GetFrameTime, METH_VARARGS, alp_GetFrameTime__doc__},
1226 {"WriteFrames", (PyCFunction)alp_WriteFrames, METH_VARARGS, alp_WriteFrames__doc__},
1227 {"ClosePort", (PyCFunction)alp_ClosePort, METH_VARARGS, alp_ClosePort__doc__},
Guido van Rossumd641d671997-04-03 17:06:32 +00001228#endif /* AL_NO_ELEM */
1229#ifdef OLD_INTERFACE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001230 {"closeport", (PyCFunction)alp_closeport, METH_VARARGS},
1231 {"getfd", (PyCFunction)alp_getfd, METH_VARARGS},
1232 {"fileno", (PyCFunction)alp_getfd, METH_VARARGS},
1233 {"getfilled", (PyCFunction)alp_getfilled, METH_VARARGS},
1234 {"getfillable", (PyCFunction)alp_getfillable, METH_VARARGS},
1235 {"readsamps", (PyCFunction)alp_readsamps, METH_VARARGS},
1236 {"writesamps", (PyCFunction)alp_writesamps, METH_VARARGS},
1237 {"setfillpoint", (PyCFunction)alp_setfillpoint, METH_VARARGS},
1238 {"getfillpoint", (PyCFunction)alp_getfillpoint, METH_VARARGS},
1239 {"setconfig", (PyCFunction)alp_setconfig, METH_VARARGS},
1240 {"getconfig", (PyCFunction)alp_getconfig, METH_VARARGS},
Jack Jansene8a3c281993-02-10 14:10:56 +00001241#ifdef AL_405
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001242 {"getstatus", (PyCFunction)alp_getstatus, METH_VARARGS},
1243#endif /* AL_405 */
Guido van Rossumd641d671997-04-03 17:06:32 +00001244#endif /* OLD_INTERFACE */
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001245
1246 {NULL, NULL} /* sentinel */
Guido van Rossume3db8621991-09-09 23:33:34 +00001247};
1248
Guido van Rossumd641d671997-04-03 17:06:32 +00001249/* ---------- */
1250
1251
1252static PyObject *
1253newalpobject(ALport port)
1254{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001255 alpobject *self;
1256
1257 self = PyObject_New(alpobject, &Alptype);
1258 if (self == NULL)
1259 return NULL;
1260 /* XXXX Add your own initializers here */
1261 self->port = port;
1262 return (PyObject *) self;
Guido van Rossumd641d671997-04-03 17:06:32 +00001263}
1264
1265
Guido van Rossume3db8621991-09-09 23:33:34 +00001266static void
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001267alp_dealloc(alpobject *self)
Guido van Rossume3db8621991-09-09 23:33:34 +00001268{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001269 /* XXXX Add your own cleanup code here */
1270 if (self->port) {
1271#ifdef AL_NO_ELEM /* IRIX 6 */
1272 alClosePort(self->port);
Guido van Rossumd641d671997-04-03 17:06:32 +00001273#else
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001274 ALcloseport(self->port);
Guido van Rossumd641d671997-04-03 17:06:32 +00001275#endif
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001276 }
1277 PyObject_Del(self);
Guido van Rossume3db8621991-09-09 23:33:34 +00001278}
1279
Roger E. Massea2a8b271997-01-03 22:40:34 +00001280static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001281alp_getattr(alpobject *self, char *name)
Guido van Rossume3db8621991-09-09 23:33:34 +00001282{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001283 /* XXXX Add your own getattr code here */
1284 if (self->port == NULL) {
1285 PyErr_SetString(ErrorObject, "port already closed");
1286 return NULL;
1287 }
1288 return Py_FindMethod(alp_methods, (PyObject *)self, name);
Guido van Rossume3db8621991-09-09 23:33:34 +00001289}
1290
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001291PyDoc_STRVAR(Alptype__doc__, "");
Guido van Rossumd641d671997-04-03 17:06:32 +00001292
1293static PyTypeObject Alptype = {
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001294 PyObject_HEAD_INIT(&PyType_Type)
1295 0, /*ob_size*/
1296 "al.port", /*tp_name*/
1297 sizeof(alpobject), /*tp_basicsize*/
1298 0, /*tp_itemsize*/
1299 /* methods */
1300 (destructor)alp_dealloc, /*tp_dealloc*/
1301 (printfunc)0, /*tp_print*/
1302 (getattrfunc)alp_getattr, /*tp_getattr*/
1303 (setattrfunc)0, /*tp_setattr*/
1304 (cmpfunc)0, /*tp_compare*/
1305 (reprfunc)0, /*tp_repr*/
1306 0, /*tp_as_number*/
1307 0, /*tp_as_sequence*/
1308 0, /*tp_as_mapping*/
1309 (hashfunc)0, /*tp_hash*/
1310 (ternaryfunc)0, /*tp_call*/
1311 (reprfunc)0, /*tp_str*/
Guido van Rossumd641d671997-04-03 17:06:32 +00001312
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001313 /* Space for future expansion */
1314 0L,0L,0L,0L,
1315 Alptype__doc__ /* Documentation string */
Guido van Rossume3db8621991-09-09 23:33:34 +00001316};
1317
Guido van Rossumd641d671997-04-03 17:06:32 +00001318/* End of code for port objects */
1319/* -------------------------------------------------------- */
1320
1321
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001322#ifdef AL_NO_ELEM /* IRIX 6 */
Guido van Rossumd641d671997-04-03 17:06:32 +00001323
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001324PyDoc_STRVAR(al_NewConfig__doc__,
1325"alNewConfig: create and initialize an audio ALconfig structure.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001326
Roger E. Massea2a8b271997-01-03 22:40:34 +00001327static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001328al_NewConfig(PyObject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001329{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001330 ALconfig config;
Guido van Rossumd641d671997-04-03 17:06:32 +00001331
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001332 if (!PyArg_ParseTuple(args, ":NewConfig"))
1333 return NULL;
1334 if ((config = alNewConfig()) == NULL)
1335 return NULL;
1336 return newalcobject(config);
Guido van Rossume3db8621991-09-09 23:33:34 +00001337}
1338
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001339PyDoc_STRVAR(al_OpenPort__doc__,
1340"alOpenPort: open an audio port.");
Guido van Rossume3db8621991-09-09 23:33:34 +00001341
Roger E. Massea2a8b271997-01-03 22:40:34 +00001342static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001343al_OpenPort(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001344{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001345 ALport port;
1346 char *name, *dir;
1347 alcobject *config = NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +00001348
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001349 if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config))
1350 return NULL;
1351 if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL)
1352 return NULL;
1353 return newalpobject(port);
Guido van Rossumd641d671997-04-03 17:06:32 +00001354}
1355
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001356PyDoc_STRVAR(al_Connect__doc__,
1357"alConnect: connect two audio I/O resources.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001358
1359static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001360al_Connect(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001361{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001362 int source, dest, nprops = 0, id, i;
1363 ALpv *props = NULL;
1364 ALparamInfo *propinfo = NULL;
1365 PyObject *propobj = NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +00001366
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001367 if (!PyArg_ParseTuple(args, "ii|O!:Connect", &source, &dest, &PyList_Type, &propobj))
1368 return NULL;
1369 if (propobj != NULL) {
1370 nprops = python2params(source, dest, propobj, &props, &propinfo);
1371 if (nprops < 0)
1372 return NULL;
1373 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001374
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001375 id = alConnect(source, dest, props, nprops);
Guido van Rossumd641d671997-04-03 17:06:32 +00001376
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001377 if (props) {
1378 for (i = 0; i < nprops; i++) {
1379 switch (propinfo[i].valueType) {
1380 case AL_SET_VAL:
1381 case AL_VECTOR_VAL:
1382 PyMem_DEL(props[i].value.ptr);
1383 break;
1384 }
1385 }
1386 PyMem_DEL(props);
1387 PyMem_DEL(propinfo);
1388 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001389
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001390 if (id < 0)
1391 return NULL;
1392 return PyInt_FromLong((long) id);
Guido van Rossumd641d671997-04-03 17:06:32 +00001393}
1394
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001395PyDoc_STRVAR(al_Disconnect__doc__,
1396"alDisconnect: delete a connection between two audio I/O resources.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001397
1398static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001399al_Disconnect(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001400{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001401 int res;
Guido van Rossumd641d671997-04-03 17:06:32 +00001402
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001403 if (!PyArg_ParseTuple(args, "i:Disconnect", &res))
1404 return NULL;
1405 if (alDisconnect(res) < 0)
1406 return NULL;
1407 Py_INCREF(Py_None);
1408 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +00001409}
1410
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001411PyDoc_STRVAR(al_GetParams__doc__,
1412"alGetParams: get the values of audio resource parameters.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001413
1414static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001415al_GetParams(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001416{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001417 int resource;
1418 PyObject *pvslist, *item = NULL, *v = NULL;
1419 ALpv *pvs;
1420 int i, j, npvs;
1421 ALparamInfo *pinfo;
Guido van Rossumd641d671997-04-03 17:06:32 +00001422
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001423 if (!PyArg_ParseTuple(args, "iO!:GetParams", &resource, &PyList_Type, &pvslist))
1424 return NULL;
1425 npvs = PyList_Size(pvslist);
1426 pvs = PyMem_NEW(ALpv, npvs);
1427 pinfo = PyMem_NEW(ALparamInfo, npvs);
1428 for (i = 0; i < npvs; i++) {
1429 item = PyList_GetItem(pvslist, i);
1430 if (!PyInt_Check(item)) {
1431 item = NULL;
1432 PyErr_SetString(ErrorObject, "list of integers expected");
1433 goto error;
1434 }
1435 pvs[i].param = (int) PyInt_AsLong(item);
1436 item = NULL; /* not needed anymore */
1437 if (alGetParamInfo(resource, pvs[i].param, &pinfo[i]) < 0)
1438 goto error;
1439 switch (pinfo[i].valueType) {
1440 case AL_NO_VAL:
1441 break;
1442 case AL_MATRIX_VAL:
1443 pinfo[i].maxElems *= pinfo[i].maxElems2;
1444 /* fall through */
1445 case AL_STRING_VAL:
1446 case AL_SET_VAL:
1447 case AL_VECTOR_VAL:
1448 switch (pinfo[i].elementType) {
1449 case AL_INT32_ELEM:
1450 case AL_RESOURCE_ELEM:
1451 case AL_ENUM_ELEM:
1452 pvs[i].value.ptr = PyMem_NEW(int, pinfo[i].maxElems);
1453 pvs[i].sizeIn = pinfo[i].maxElems;
1454 break;
1455 case AL_INT64_ELEM:
1456 case AL_FIXED_ELEM:
1457 pvs[i].value.ptr = PyMem_NEW(long long, pinfo[i].maxElems);
1458 pvs[i].sizeIn = pinfo[i].maxElems;
1459 break;
1460 case AL_CHAR_ELEM:
1461 pvs[i].value.ptr = PyMem_NEW(char, 32);
1462 pvs[i].sizeIn = 32;
1463 break;
1464 case AL_NO_ELEM:
1465 case AL_PTR_ELEM:
1466 default:
1467 PyErr_SetString(ErrorObject, "internal error");
1468 goto error;
1469 }
1470 break;
1471 case AL_SCALAR_VAL:
1472 break;
1473 default:
1474 PyErr_SetString(ErrorObject, "internal error");
1475 goto error;
1476 }
1477 if (pinfo[i].valueType == AL_MATRIX_VAL) {
1478 pinfo[i].maxElems /= pinfo[i].maxElems2;
1479 pvs[i].sizeIn /= pinfo[i].maxElems2;
1480 pvs[i].size2In = pinfo[i].maxElems2;
1481 }
1482 }
1483 if (alGetParams(resource, pvs, npvs) < 0)
1484 goto error;
1485 if (!(v = PyList_New(npvs)))
1486 goto error;
1487 for (i = 0; i < npvs; i++) {
1488 if (pvs[i].sizeOut < 0) {
1489 char buf[32];
1490 PyOS_snprintf(buf, sizeof(buf),
1491 "problem with param %d", i);
1492 PyErr_SetString(ErrorObject, buf);
1493 goto error;
1494 }
1495 switch (pinfo[i].valueType) {
1496 case AL_NO_VAL:
1497 item = Py_None;
1498 Py_INCREF(item);
1499 break;
1500 case AL_STRING_VAL:
1501 item = PyString_FromString(pvs[i].value.ptr);
1502 PyMem_DEL(pvs[i].value.ptr);
1503 break;
1504 case AL_MATRIX_VAL:
1505 /* XXXX this is not right */
1506 pvs[i].sizeOut *= pvs[i].size2Out;
1507 /* fall through */
1508 case AL_SET_VAL:
1509 case AL_VECTOR_VAL:
1510 item = PyList_New(pvs[i].sizeOut);
1511 for (j = 0; j < pvs[i].sizeOut; j++) {
1512 switch (pinfo[i].elementType) {
1513 case AL_INT32_ELEM:
1514 case AL_RESOURCE_ELEM:
1515 case AL_ENUM_ELEM:
1516 PyList_SetItem(item, j, PyInt_FromLong((long) ((int *) pvs[i].value.ptr)[j]));
1517 break;
1518 case AL_INT64_ELEM:
1519 PyList_SetItem(item, j, PyLong_FromLongLong(((long long *) pvs[i].value.ptr)[j]));
1520 break;
1521 case AL_FIXED_ELEM:
1522 PyList_SetItem(item, j, PyFloat_FromDouble(alFixedToDouble(((long long *) pvs[i].value.ptr)[j])));
1523 break;
1524 default:
1525 PyErr_SetString(ErrorObject, "internal error");
1526 goto error;
1527 }
1528 }
1529 PyMem_DEL(pvs[i].value.ptr);
1530 break;
1531 case AL_SCALAR_VAL:
1532 item = param2python(resource, pvs[i].param, pvs[i].value, &pinfo[i]);
1533 break;
1534 }
1535 if (PyErr_Occurred() ||
1536 PyList_SetItem(v, i, Py_BuildValue("(iO)", pvs[i].param,
1537 item)) < 0 ||
1538 PyErr_Occurred())
1539 goto error;
1540 Py_DECREF(item);
1541 }
1542 PyMem_DEL(pvs);
1543 PyMem_DEL(pinfo);
1544 return v;
Guido van Rossumd641d671997-04-03 17:06:32 +00001545
1546 error:
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001547 Py_XDECREF(v);
1548 Py_XDECREF(item);
1549 if (pvs)
1550 PyMem_DEL(pvs);
1551 if (pinfo)
1552 PyMem_DEL(pinfo);
1553 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +00001554}
1555
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001556PyDoc_STRVAR(al_SetParams__doc__,
1557"alSetParams: set the values of audio resource parameters.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001558
1559static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001560al_SetParams(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001561{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001562 int resource;
1563 PyObject *pvslist;
1564 ALpv *pvs;
1565 ALparamInfo *pinfo;
1566 int npvs, i;
Guido van Rossumd641d671997-04-03 17:06:32 +00001567
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001568 if (!PyArg_ParseTuple(args, "iO!:SetParams", &resource, &PyList_Type, &pvslist))
1569 return NULL;
1570 npvs = python2params(resource, -1, pvslist, &pvs, &pinfo);
1571 if (npvs < 0)
1572 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +00001573
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001574 if (alSetParams(resource, pvs, npvs) < 0)
1575 goto error;
Guido van Rossumd641d671997-04-03 17:06:32 +00001576
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001577 /* cleanup */
1578 for (i = 0; i < npvs; i++) {
1579 switch (pinfo[i].valueType) {
1580 case AL_SET_VAL:
1581 case AL_VECTOR_VAL:
1582 PyMem_DEL(pvs[i].value.ptr);
1583 break;
1584 }
1585 }
1586 PyMem_DEL(pvs);
1587 PyMem_DEL(pinfo);
Guido van Rossumd641d671997-04-03 17:06:32 +00001588
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001589 Py_INCREF(Py_None);
1590 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +00001591
1592 error:
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001593 /* XXXX we should clean up everything */
1594 if (pvs)
1595 PyMem_DEL(pvs);
1596 if (pinfo)
1597 PyMem_DEL(pinfo);
1598 return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +00001599}
1600
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001601PyDoc_STRVAR(al_QueryValues__doc__,
1602"alQueryValues: get the set of possible values for a parameter.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001603
1604static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001605al_QueryValues(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001606{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001607 int resource, param;
1608 ALvalue *return_set = NULL;
1609 int setsize = 32, qualsize = 0, nvals, i;
1610 ALpv *quals = NULL;
1611 ALparamInfo pinfo;
1612 ALparamInfo *qualinfo = NULL;
1613 PyObject *qualobj = NULL;
1614 PyObject *res = NULL, *item;
Guido van Rossumd641d671997-04-03 17:06:32 +00001615
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001616 if (!PyArg_ParseTuple(args, "ii|O!:QueryValues", &resource, &param,
1617 &PyList_Type, &qualobj))
1618 return NULL;
1619 if (qualobj != NULL) {
1620 qualsize = python2params(resource, param, qualobj, &quals, &qualinfo);
1621 if (qualsize < 0)
1622 return NULL;
1623 }
1624 setsize = 32;
1625 return_set = PyMem_NEW(ALvalue, setsize);
1626 if (return_set == NULL) {
1627 PyErr_NoMemory();
1628 goto cleanup;
1629 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001630
1631 retry:
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001632 nvals = alQueryValues(resource, param, return_set, setsize, quals, qualsize);
1633 if (nvals < 0)
1634 goto cleanup;
1635 if (nvals > setsize) {
1636 ALvalue *old_return_set = return_set;
1637 setsize = nvals;
1638 PyMem_RESIZE(return_set, ALvalue, setsize);
1639 if (return_set == NULL) {
1640 return_set = old_return_set;
1641 PyErr_NoMemory();
1642 goto cleanup;
1643 }
1644 goto retry;
1645 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001646
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001647 if (alGetParamInfo(resource, param, &pinfo) < 0)
1648 goto cleanup;
Guido van Rossumd641d671997-04-03 17:06:32 +00001649
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001650 res = PyList_New(nvals);
1651 if (res == NULL)
1652 goto cleanup;
1653 for (i = 0; i < nvals; i++) {
1654 item = param2python(resource, param, return_set[i], &pinfo);
1655 if (item == NULL ||
1656 PyList_SetItem(res, i, item) < 0) {
1657 Py_DECREF(res);
1658 res = NULL;
1659 goto cleanup;
1660 }
1661 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001662
1663 cleanup:
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001664 if (return_set)
1665 PyMem_DEL(return_set);
1666 if (quals) {
1667 for (i = 0; i < qualsize; i++) {
1668 switch (qualinfo[i].valueType) {
1669 case AL_SET_VAL:
1670 case AL_VECTOR_VAL:
1671 PyMem_DEL(quals[i].value.ptr);
1672 break;
1673 }
1674 }
1675 PyMem_DEL(quals);
1676 PyMem_DEL(qualinfo);
1677 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001678
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001679 return res;
Guido van Rossumd641d671997-04-03 17:06:32 +00001680}
1681
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001682PyDoc_STRVAR(al_GetParamInfo__doc__,
1683"alGetParamInfo: get information about a parameter on "
1684"a particular audio resource.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001685
1686static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001687al_GetParamInfo(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001688{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001689 int res, param;
1690 ALparamInfo pinfo;
1691 PyObject *v, *item;
Guido van Rossumd641d671997-04-03 17:06:32 +00001692
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001693 if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, &param))
1694 return NULL;
1695 if (alGetParamInfo(res, param, &pinfo) < 0)
1696 return NULL;
1697 v = PyDict_New();
1698 if (!v) return NULL;
Guido van Rossumd641d671997-04-03 17:06:32 +00001699
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001700 item = PyInt_FromLong((long) pinfo.resource);
1701 PyDict_SetItemString(v, "resource", item);
1702 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001703
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001704 item = PyInt_FromLong((long) pinfo.param);
1705 PyDict_SetItemString(v, "param", item);
1706 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001707
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001708 item = PyInt_FromLong((long) pinfo.valueType);
1709 PyDict_SetItemString(v, "valueType", item);
1710 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001711
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001712 if (pinfo.valueType != AL_NO_VAL && pinfo.valueType != AL_SCALAR_VAL) {
1713 /* multiple values */
1714 item = PyInt_FromLong((long) pinfo.maxElems);
1715 PyDict_SetItemString(v, "maxElems", item);
1716 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001717
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001718 if (pinfo.valueType == AL_MATRIX_VAL) {
1719 /* 2 dimensional */
1720 item = PyInt_FromLong((long) pinfo.maxElems2);
1721 PyDict_SetItemString(v, "maxElems2", item);
1722 Py_DECREF(item);
1723 }
1724 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001725
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001726 item = PyInt_FromLong((long) pinfo.elementType);
1727 PyDict_SetItemString(v, "elementType", item);
1728 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001729
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001730 item = PyString_FromString(pinfo.name);
1731 PyDict_SetItemString(v, "name", item);
1732 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001733
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001734 item = param2python(res, param, pinfo.initial, &pinfo);
1735 PyDict_SetItemString(v, "initial", item);
1736 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001737
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001738 if (pinfo.elementType != AL_ENUM_ELEM &&
1739 pinfo.elementType != AL_RESOURCE_ELEM &&
1740 pinfo.elementType != AL_CHAR_ELEM) {
1741 /* range param */
1742 item = param2python(res, param, pinfo.min, &pinfo);
1743 PyDict_SetItemString(v, "min", item);
1744 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001745
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001746 item = param2python(res, param, pinfo.max, &pinfo);
1747 PyDict_SetItemString(v, "max", item);
1748 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001749
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001750 item = param2python(res, param, pinfo.minDelta, &pinfo);
1751 PyDict_SetItemString(v, "minDelta", item);
1752 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001753
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001754 item = param2python(res, param, pinfo.maxDelta, &pinfo);
1755 PyDict_SetItemString(v, "maxDelta", item);
1756 Py_DECREF(item);
Guido van Rossumd641d671997-04-03 17:06:32 +00001757
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001758 item = PyInt_FromLong((long) pinfo.specialVals);
1759 PyDict_SetItemString(v, "specialVals", item);
1760 Py_DECREF(item);
1761 }
Guido van Rossumd641d671997-04-03 17:06:32 +00001762
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001763 return v;
Guido van Rossumd641d671997-04-03 17:06:32 +00001764}
1765
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001766PyDoc_STRVAR(al_GetResourceByName__doc__,
1767"alGetResourceByName: find an audio resource by name.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001768
1769static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001770al_GetResourceByName(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001771{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001772 int res, start_res, type;
1773 char *name;
Guido van Rossumd641d671997-04-03 17:06:32 +00001774
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001775 if (!PyArg_ParseTuple(args, "isi:GetResourceByName", &start_res, &name, &type))
1776 return NULL;
1777 if ((res = alGetResourceByName(start_res, name, type)) == 0)
1778 return NULL;
1779 return PyInt_FromLong((long) res);
Guido van Rossumd641d671997-04-03 17:06:32 +00001780}
1781
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001782PyDoc_STRVAR(al_IsSubtype__doc__,
1783"alIsSubtype: indicate if one resource type is a subtype of another.");
Guido van Rossumd641d671997-04-03 17:06:32 +00001784
1785static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001786al_IsSubtype(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001787{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001788 int type, subtype;
Guido van Rossumd641d671997-04-03 17:06:32 +00001789
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001790 if (!PyArg_ParseTuple(args, "ii:IsSubtype", &type, &subtype))
1791 return NULL;
1792 return PyInt_FromLong((long) alIsSubtype(type, subtype));
Guido van Rossumd641d671997-04-03 17:06:32 +00001793}
1794
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001795PyDoc_STRVAR(al_SetErrorHandler__doc__, "");
Guido van Rossumd641d671997-04-03 17:06:32 +00001796
1797static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001798al_SetErrorHandler(PyObject *self, PyObject *args)
Guido van Rossumd641d671997-04-03 17:06:32 +00001799{
1800
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001801 if (!PyArg_ParseTuple(args, ":SetErrorHandler"))
1802 return NULL;
1803 Py_INCREF(Py_None);
1804 return Py_None;
Guido van Rossumd641d671997-04-03 17:06:32 +00001805}
1806
1807#endif /* AL_NO_ELEM */
1808
1809#ifdef OLD_INTERFACE
1810
1811static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001812al_openport(PyObject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001813{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001814 char *name, *dir;
1815 ALport port;
1816 alcobject *config = NULL;
Guido van Rossume3db8621991-09-09 23:33:34 +00001817
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001818 if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config))
1819 return NULL;
1820 if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL)
1821 return NULL;
1822 return newalpobject(port);
Guido van Rossume3db8621991-09-09 23:33:34 +00001823}
1824
Roger E. Massea2a8b271997-01-03 22:40:34 +00001825static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001826al_newconfig(PyObject *self, PyObject *args)
Guido van Rossume3db8621991-09-09 23:33:34 +00001827{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001828 ALconfig config;
Guido van Rossume3db8621991-09-09 23:33:34 +00001829
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001830 if (!PyArg_ParseTuple(args, ":NewConfig"))
1831 return NULL;
1832 if ((config = ALnewconfig ()) == NULL)
1833 return NULL;
1834 return newalcobject(config);
Guido van Rossume3db8621991-09-09 23:33:34 +00001835}
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001836
Roger E. Massea2a8b271997-01-03 22:40:34 +00001837static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001838al_queryparams(PyObject *self, PyObject *args)
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001839{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001840 long device;
1841 long length;
1842 long *PVbuffer;
1843 long PVdummy[2];
1844 PyObject *v = NULL;
1845 int i;
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001846
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001847 if (!PyArg_ParseTuple(args, "l:queryparams", &device))
1848 return NULL;
1849 if ((length = ALqueryparams(device, PVdummy, 2L)) == -1)
1850 return NULL;
1851 if ((PVbuffer = PyMem_NEW(long, length)) == NULL)
1852 return PyErr_NoMemory();
1853 if (ALqueryparams(device, PVbuffer, length) >= 0 &&
1854 (v = PyList_New((int)length)) != NULL) {
1855 for (i = 0; i < length; i++)
1856 PyList_SetItem(v, i, PyInt_FromLong(PVbuffer[i]));
1857 }
1858 PyMem_DEL(PVbuffer);
1859 return v;
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001860}
1861
Roger E. Massea2a8b271997-01-03 22:40:34 +00001862static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001863doParams(PyObject *args, int (*func)(long, long *, long), int modified)
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001864{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001865 long device;
1866 PyObject *list, *v;
1867 long *PVbuffer;
1868 long length;
1869 int i;
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001870
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001871 if (!PyArg_ParseTuple(args, "lO!", &device, &PyList_Type, &list))
1872 return NULL;
1873 length = PyList_Size(list);
1874 PVbuffer = PyMem_NEW(long, length);
1875 if (PVbuffer == NULL)
1876 return PyErr_NoMemory();
1877 for (i = 0; i < length; i++) {
1878 v = PyList_GetItem(list, i);
1879 if (!PyInt_Check(v)) {
1880 PyMem_DEL(PVbuffer);
1881 PyErr_BadArgument();
1882 return NULL;
1883 }
1884 PVbuffer[i] = PyInt_AsLong(v);
1885 }
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001886
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001887 if ((*func)(device, PVbuffer, length) == -1) {
1888 PyMem_DEL(PVbuffer);
1889 return NULL;
1890 }
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001891
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001892 if (modified) {
1893 for (i = 0; i < length; i++)
1894 PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
1895 }
Guido van Rossumc0aab891991-10-20 20:10:46 +00001896
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001897 PyMem_DEL(PVbuffer);
1898
1899 Py_INCREF(Py_None);
1900 return Py_None;
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001901}
1902
Roger E. Massea2a8b271997-01-03 22:40:34 +00001903static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001904al_getparams(PyObject *self, PyObject *args)
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001905{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001906 return doParams(args, ALgetparams, 1);
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001907}
1908
Roger E. Massea2a8b271997-01-03 22:40:34 +00001909static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001910al_setparams(PyObject *self, PyObject *args)
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001911{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001912 return doParams(args, ALsetparams, 0);
Guido van Rossumb3a5b9b1991-09-10 14:54:05 +00001913}
1914
Roger E. Massea2a8b271997-01-03 22:40:34 +00001915static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001916al_getname(PyObject *self, PyObject *args)
Guido van Rossum448f4bf1992-08-19 16:41:15 +00001917{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001918 long device, descriptor;
1919 char *name;
Guido van Rossumd641d671997-04-03 17:06:32 +00001920
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001921 if (!PyArg_ParseTuple(args, "ll:getname", &device, &descriptor))
1922 return NULL;
1923 if ((name = ALgetname(device, descriptor)) == NULL)
1924 return NULL;
1925 return PyString_FromString(name);
Guido van Rossum448f4bf1992-08-19 16:41:15 +00001926}
1927
Roger E. Massea2a8b271997-01-03 22:40:34 +00001928static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001929al_getdefault(PyObject *self, PyObject *args)
Guido van Rossum448f4bf1992-08-19 16:41:15 +00001930{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001931 long device, descriptor, value;
Guido van Rossumd641d671997-04-03 17:06:32 +00001932
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001933 if (!PyArg_ParseTuple(args, "ll:getdefault", &device, &descriptor))
1934 return NULL;
1935 if ((value = ALgetdefault(device, descriptor)) == -1)
1936 return NULL;
1937 return PyLong_FromLong(value);
Guido van Rossum448f4bf1992-08-19 16:41:15 +00001938}
1939
Roger E. Massea2a8b271997-01-03 22:40:34 +00001940static PyObject *
Peter Schneider-Kamp6a850272000-07-10 17:04:33 +00001941al_getminmax(PyObject *self, PyObject *args)
Guido van Rossum448f4bf1992-08-19 16:41:15 +00001942{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001943 long device, descriptor, min, max;
Guido van Rossumd641d671997-04-03 17:06:32 +00001944
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001945 if (!PyArg_ParseTuple(args, "ll:getminmax", &device, &descriptor))
1946 return NULL;
1947 min = -1;
1948 max = -1;
1949 if (ALgetminmax(device, descriptor, &min, &max) == -1)
1950 return NULL;
1951 return Py_BuildValue("ll", min, max);
Guido van Rossum448f4bf1992-08-19 16:41:15 +00001952}
1953
Guido van Rossumd641d671997-04-03 17:06:32 +00001954#endif /* OLD_INTERFACE */
1955
1956/* List of methods defined in the module */
1957
1958static struct PyMethodDef al_methods[] = {
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001959#ifdef AL_NO_ELEM /* IRIX 6 */
1960 {"NewConfig", (PyCFunction)al_NewConfig, METH_VARARGS, al_NewConfig__doc__},
1961 {"OpenPort", (PyCFunction)al_OpenPort, METH_VARARGS, al_OpenPort__doc__},
1962 {"Connect", (PyCFunction)al_Connect, METH_VARARGS, al_Connect__doc__},
1963 {"Disconnect", (PyCFunction)al_Disconnect, METH_VARARGS, al_Disconnect__doc__},
1964 {"GetParams", (PyCFunction)al_GetParams, METH_VARARGS, al_GetParams__doc__},
1965 {"SetParams", (PyCFunction)al_SetParams, METH_VARARGS, al_SetParams__doc__},
1966 {"QueryValues", (PyCFunction)al_QueryValues, METH_VARARGS, al_QueryValues__doc__},
1967 {"GetParamInfo", (PyCFunction)al_GetParamInfo, METH_VARARGS, al_GetParamInfo__doc__},
1968 {"GetResourceByName", (PyCFunction)al_GetResourceByName, METH_VARARGS, al_GetResourceByName__doc__},
1969 {"IsSubtype", (PyCFunction)al_IsSubtype, METH_VARARGS, al_IsSubtype__doc__},
Guido van Rossumd641d671997-04-03 17:06:32 +00001970#if 0
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001971 /* this one not supported */
1972 {"SetErrorHandler", (PyCFunction)al_SetErrorHandler, METH_VARARGS, al_SetErrorHandler__doc__},
Guido van Rossumd641d671997-04-03 17:06:32 +00001973#endif
1974#endif /* AL_NO_ELEM */
1975#ifdef OLD_INTERFACE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001976 {"openport", (PyCFunction)al_openport, METH_VARARGS},
1977 {"newconfig", (PyCFunction)al_newconfig, METH_VARARGS},
1978 {"queryparams", (PyCFunction)al_queryparams, METH_VARARGS},
1979 {"getparams", (PyCFunction)al_getparams, METH_VARARGS},
1980 {"setparams", (PyCFunction)al_setparams, METH_VARARGS},
1981 {"getname", (PyCFunction)al_getname, METH_VARARGS},
1982 {"getdefault", (PyCFunction)al_getdefault, METH_VARARGS},
1983 {"getminmax", (PyCFunction)al_getminmax, METH_VARARGS},
Guido van Rossumd641d671997-04-03 17:06:32 +00001984#endif /* OLD_INTERFACE */
1985
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001986 {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
Guido van Rossume3db8621991-09-09 23:33:34 +00001987};
1988
Guido van Rossumd641d671997-04-03 17:06:32 +00001989
1990/* Initialization function for the module (*must* be called inital) */
1991
Martin v. Löwis14f8b4c2002-06-13 20:33:02 +00001992PyDoc_STRVAR(al_module_documentation, "");
Guido van Rossumd641d671997-04-03 17:06:32 +00001993
Guido van Rossume3db8621991-09-09 23:33:34 +00001994void
Thomas Woutersf3f33dc2000-07-21 06:00:07 +00001995inital(void)
Guido van Rossume3db8621991-09-09 23:33:34 +00001996{
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001997 PyObject *m, *d, *x;
Guido van Rossume3db8621991-09-09 23:33:34 +00001998
Antoine Pitrouc83ea132010-05-09 14:46:46 +00001999 if (PyErr_WarnPy3k("the al module has been removed in "
2000 "Python 3.0", 2) < 0)
2001 return;
Brett Cannon34721d52008-05-14 01:08:21 +00002002
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002003 /* Create the module and add the functions */
2004 m = Py_InitModule4("al", al_methods,
2005 al_module_documentation,
2006 (PyObject*)NULL,PYTHON_API_VERSION);
2007 if (m == NULL)
2008 return;
Guido van Rossumd641d671997-04-03 17:06:32 +00002009
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002010 /* Add some symbolic constants to the module */
2011 d = PyModule_GetDict(m);
2012 ErrorObject = PyErr_NewException("al.error", NULL, NULL);
2013 PyDict_SetItemString(d, "error", ErrorObject);
Guido van Rossumd641d671997-04-03 17:06:32 +00002014
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002015 /* XXXX Add constants here */
Guido van Rossumd641d671997-04-03 17:06:32 +00002016#ifdef AL_4CHANNEL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002017 x = PyInt_FromLong((long) AL_4CHANNEL);
2018 if (x == NULL || PyDict_SetItemString(d, "FOURCHANNEL", x) < 0)
2019 goto error;
2020 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002021#endif
2022#ifdef AL_ADAT_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002023 x = PyInt_FromLong((long) AL_ADAT_IF_TYPE);
2024 if (x == NULL || PyDict_SetItemString(d, "ADAT_IF_TYPE", x) < 0)
2025 goto error;
2026 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002027#endif
2028#ifdef AL_ADAT_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002029 x = PyInt_FromLong((long) AL_ADAT_MCLK_TYPE);
2030 if (x == NULL || PyDict_SetItemString(d, "ADAT_MCLK_TYPE", x) < 0)
2031 goto error;
2032 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002033#endif
2034#ifdef AL_AES_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002035 x = PyInt_FromLong((long) AL_AES_IF_TYPE);
2036 if (x == NULL || PyDict_SetItemString(d, "AES_IF_TYPE", x) < 0)
2037 goto error;
2038 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002039#endif
2040#ifdef AL_AES_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002041 x = PyInt_FromLong((long) AL_AES_MCLK_TYPE);
2042 if (x == NULL || PyDict_SetItemString(d, "AES_MCLK_TYPE", x) < 0)
2043 goto error;
2044 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002045#endif
2046#ifdef AL_ANALOG_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002047 x = PyInt_FromLong((long) AL_ANALOG_IF_TYPE);
2048 if (x == NULL || PyDict_SetItemString(d, "ANALOG_IF_TYPE", x) < 0)
2049 goto error;
2050 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002051#endif
2052#ifdef AL_ASSOCIATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002053 x = PyInt_FromLong((long) AL_ASSOCIATE);
2054 if (x == NULL || PyDict_SetItemString(d, "ASSOCIATE", x) < 0)
2055 goto error;
2056 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002057#endif
2058#ifdef AL_BAD_BUFFER_NULL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002059 x = PyInt_FromLong((long) AL_BAD_BUFFER_NULL);
2060 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_NULL", x) < 0)
2061 goto error;
2062 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002063#endif
2064#ifdef AL_BAD_BUFFERLENGTH
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002065 x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH);
2066 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH", x) < 0)
2067 goto error;
2068 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002069#endif
2070#ifdef AL_BAD_BUFFERLENGTH_NEG
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002071 x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_NEG);
2072 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0)
2073 goto error;
2074 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002075#endif
2076#ifdef AL_BAD_BUFFERLENGTH_ODD
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002077 x = PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_ODD);
2078 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0)
2079 goto error;
2080 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002081#endif
2082#ifdef AL_BAD_CHANNELS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002083 x = PyInt_FromLong((long) AL_BAD_CHANNELS);
2084 if (x == NULL || PyDict_SetItemString(d, "BAD_CHANNELS", x) < 0)
2085 goto error;
2086 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002087#endif
2088#ifdef AL_BAD_CONFIG
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002089 x = PyInt_FromLong((long) AL_BAD_CONFIG);
2090 if (x == NULL || PyDict_SetItemString(d, "BAD_CONFIG", x) < 0)
2091 goto error;
2092 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002093#endif
2094#ifdef AL_BAD_COUNT_NEG
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002095 x = PyInt_FromLong((long) AL_BAD_COUNT_NEG);
2096 if (x == NULL || PyDict_SetItemString(d, "BAD_COUNT_NEG", x) < 0)
2097 goto error;
2098 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002099#endif
2100#ifdef AL_BAD_DEVICE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002101 x = PyInt_FromLong((long) AL_BAD_DEVICE);
2102 if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE", x) < 0)
2103 goto error;
2104 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002105#endif
2106#ifdef AL_BAD_DEVICE_ACCESS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002107 x = PyInt_FromLong((long) AL_BAD_DEVICE_ACCESS);
2108 if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE_ACCESS", x) < 0)
2109 goto error;
2110 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002111#endif
2112#ifdef AL_BAD_DIRECTION
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002113 x = PyInt_FromLong((long) AL_BAD_DIRECTION);
2114 if (x == NULL || PyDict_SetItemString(d, "BAD_DIRECTION", x) < 0)
2115 goto error;
2116 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002117#endif
2118#ifdef AL_BAD_FILLPOINT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002119 x = PyInt_FromLong((long) AL_BAD_FILLPOINT);
2120 if (x == NULL || PyDict_SetItemString(d, "BAD_FILLPOINT", x) < 0)
2121 goto error;
2122 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002123#endif
2124#ifdef AL_BAD_FLOATMAX
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002125 x = PyInt_FromLong((long) AL_BAD_FLOATMAX);
2126 if (x == NULL || PyDict_SetItemString(d, "BAD_FLOATMAX", x) < 0)
2127 goto error;
2128 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002129#endif
2130#ifdef AL_BAD_ILLEGAL_STATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002131 x = PyInt_FromLong((long) AL_BAD_ILLEGAL_STATE);
2132 if (x == NULL || PyDict_SetItemString(d, "BAD_ILLEGAL_STATE", x) < 0)
2133 goto error;
2134 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002135#endif
2136#ifdef AL_BAD_NO_PORTS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002137 x = PyInt_FromLong((long) AL_BAD_NO_PORTS);
2138 if (x == NULL || PyDict_SetItemString(d, "BAD_NO_PORTS", x) < 0)
2139 goto error;
2140 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002141#endif
2142#ifdef AL_BAD_NOT_FOUND
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002143 x = PyInt_FromLong((long) AL_BAD_NOT_FOUND);
2144 if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_FOUND", x) < 0)
2145 goto error;
2146 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002147#endif
2148#ifdef AL_BAD_NOT_IMPLEMENTED
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002149 x = PyInt_FromLong((long) AL_BAD_NOT_IMPLEMENTED);
2150 if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_IMPLEMENTED", x) < 0)
2151 goto error;
2152 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002153#endif
2154#ifdef AL_BAD_OUT_OF_MEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002155 x = PyInt_FromLong((long) AL_BAD_OUT_OF_MEM);
2156 if (x == NULL || PyDict_SetItemString(d, "BAD_OUT_OF_MEM", x) < 0)
2157 goto error;
2158 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002159#endif
2160#ifdef AL_BAD_PARAM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002161 x = PyInt_FromLong((long) AL_BAD_PARAM);
2162 if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0)
2163 goto error;
2164 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002165#endif
2166#ifdef AL_BAD_PERMISSIONS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002167 x = PyInt_FromLong((long) AL_BAD_PERMISSIONS);
2168 if (x == NULL || PyDict_SetItemString(d, "BAD_PERMISSIONS", x) < 0)
2169 goto error;
2170 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002171#endif
2172#ifdef AL_BAD_PORT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002173 x = PyInt_FromLong((long) AL_BAD_PORT);
2174 if (x == NULL || PyDict_SetItemString(d, "BAD_PORT", x) < 0)
2175 goto error;
2176 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002177#endif
2178#ifdef AL_BAD_PORTSTYLE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002179 x = PyInt_FromLong((long) AL_BAD_PORTSTYLE);
2180 if (x == NULL || PyDict_SetItemString(d, "BAD_PORTSTYLE", x) < 0)
2181 goto error;
2182 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002183#endif
2184#ifdef AL_BAD_PVBUFFER
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002185 x = PyInt_FromLong((long) AL_BAD_PVBUFFER);
2186 if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0)
2187 goto error;
2188 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002189#endif
2190#ifdef AL_BAD_QSIZE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002191 x = PyInt_FromLong((long) AL_BAD_QSIZE);
2192 if (x == NULL || PyDict_SetItemString(d, "BAD_QSIZE", x) < 0)
2193 goto error;
2194 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002195#endif
2196#ifdef AL_BAD_RATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002197 x = PyInt_FromLong((long) AL_BAD_RATE);
2198 if (x == NULL || PyDict_SetItemString(d, "BAD_RATE", x) < 0)
2199 goto error;
2200 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002201#endif
2202#ifdef AL_BAD_RESOURCE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002203 x = PyInt_FromLong((long) AL_BAD_RESOURCE);
2204 if (x == NULL || PyDict_SetItemString(d, "BAD_RESOURCE", x) < 0)
2205 goto error;
2206 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002207#endif
2208#ifdef AL_BAD_SAMPFMT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002209 x = PyInt_FromLong((long) AL_BAD_SAMPFMT);
2210 if (x == NULL || PyDict_SetItemString(d, "BAD_SAMPFMT", x) < 0)
2211 goto error;
2212 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002213#endif
2214#ifdef AL_BAD_TRANSFER_SIZE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002215 x = PyInt_FromLong((long) AL_BAD_TRANSFER_SIZE);
2216 if (x == NULL || PyDict_SetItemString(d, "BAD_TRANSFER_SIZE", x) < 0)
2217 goto error;
2218 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002219#endif
2220#ifdef AL_BAD_WIDTH
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002221 x = PyInt_FromLong((long) AL_BAD_WIDTH);
2222 if (x == NULL || PyDict_SetItemString(d, "BAD_WIDTH", x) < 0)
2223 goto error;
2224 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002225#endif
2226#ifdef AL_CHANNEL_MODE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002227 x = PyInt_FromLong((long) AL_CHANNEL_MODE);
2228 if (x == NULL || PyDict_SetItemString(d, "CHANNEL_MODE", x) < 0)
2229 goto error;
2230 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002231#endif
2232#ifdef AL_CHANNELS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002233 x = PyInt_FromLong((long) AL_CHANNELS);
2234 if (x == NULL || PyDict_SetItemString(d, "CHANNELS", x) < 0)
2235 goto error;
2236 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002237#endif
2238#ifdef AL_CHAR_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002239 x = PyInt_FromLong((long) AL_CHAR_ELEM);
2240 if (x == NULL || PyDict_SetItemString(d, "CHAR_ELEM", x) < 0)
2241 goto error;
2242 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002243#endif
2244#ifdef AL_CLOCK_GEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002245 x = PyInt_FromLong((long) AL_CLOCK_GEN);
2246 if (x == NULL || PyDict_SetItemString(d, "CLOCK_GEN", x) < 0)
2247 goto error;
2248 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002249#endif
2250#ifdef AL_CLOCKGEN_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002251 x = PyInt_FromLong((long) AL_CLOCKGEN_TYPE);
2252 if (x == NULL || PyDict_SetItemString(d, "CLOCKGEN_TYPE", x) < 0)
2253 goto error;
2254 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002255#endif
2256#ifdef AL_CONNECT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002257 x = PyInt_FromLong((long) AL_CONNECT);
2258 if (x == NULL || PyDict_SetItemString(d, "CONNECT", x) < 0)
2259 goto error;
2260 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002261#endif
2262#ifdef AL_CONNECTION_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002263 x = PyInt_FromLong((long) AL_CONNECTION_TYPE);
2264 if (x == NULL || PyDict_SetItemString(d, "CONNECTION_TYPE", x) < 0)
2265 goto error;
2266 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002267#endif
2268#ifdef AL_CONNECTIONS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002269 x = PyInt_FromLong((long) AL_CONNECTIONS);
2270 if (x == NULL || PyDict_SetItemString(d, "CONNECTIONS", x) < 0)
2271 goto error;
2272 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002273#endif
2274#ifdef AL_CRYSTAL_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002275 x = PyInt_FromLong((long) AL_CRYSTAL_MCLK_TYPE);
2276 if (x == NULL || PyDict_SetItemString(d, "CRYSTAL_MCLK_TYPE", x) < 0)
2277 goto error;
2278 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002279#endif
2280#ifdef AL_DEFAULT_DEVICE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002281 x = PyInt_FromLong((long) AL_DEFAULT_DEVICE);
2282 if (x == NULL || PyDict_SetItemString(d, "DEFAULT_DEVICE", x) < 0)
2283 goto error;
2284 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002285#endif
2286#ifdef AL_DEFAULT_INPUT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002287 x = PyInt_FromLong((long) AL_DEFAULT_INPUT);
2288 if (x == NULL || PyDict_SetItemString(d, "DEFAULT_INPUT", x) < 0)
2289 goto error;
2290 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002291#endif
2292#ifdef AL_DEFAULT_OUTPUT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002293 x = PyInt_FromLong((long) AL_DEFAULT_OUTPUT);
2294 if (x == NULL || PyDict_SetItemString(d, "DEFAULT_OUTPUT", x) < 0)
2295 goto error;
2296 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002297#endif
2298#ifdef AL_DEST
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002299 x = PyInt_FromLong((long) AL_DEST);
2300 if (x == NULL || PyDict_SetItemString(d, "DEST", x) < 0)
2301 goto error;
2302 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002303#endif
2304#ifdef AL_DEVICE_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002305 x = PyInt_FromLong((long) AL_DEVICE_TYPE);
2306 if (x == NULL || PyDict_SetItemString(d, "DEVICE_TYPE", x) < 0)
2307 goto error;
2308 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002309#endif
2310#ifdef AL_DEVICES
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002311 x = PyInt_FromLong((long) AL_DEVICES);
2312 if (x == NULL || PyDict_SetItemString(d, "DEVICES", x) < 0)
2313 goto error;
2314 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002315#endif
2316#ifdef AL_DIGITAL_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002317 x = PyInt_FromLong((long) AL_DIGITAL_IF_TYPE);
2318 if (x == NULL || PyDict_SetItemString(d, "DIGITAL_IF_TYPE", x) < 0)
2319 goto error;
2320 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002321#endif
2322#ifdef AL_DIGITAL_INPUT_RATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002323 x = PyInt_FromLong((long) AL_DIGITAL_INPUT_RATE);
2324 if (x == NULL || PyDict_SetItemString(d, "DIGITAL_INPUT_RATE", x) < 0)
2325 goto error;
2326 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002327#endif
2328#ifdef AL_DISCONNECT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002329 x = PyInt_FromLong((long) AL_DISCONNECT);
2330 if (x == NULL || PyDict_SetItemString(d, "DISCONNECT", x) < 0)
2331 goto error;
2332 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002333#endif
2334#ifdef AL_ENUM_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002335 x = PyInt_FromLong((long) AL_ENUM_ELEM);
2336 if (x == NULL || PyDict_SetItemString(d, "ENUM_ELEM", x) < 0)
2337 goto error;
2338 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002339#endif
2340#ifdef AL_ENUM_VALUE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002341 x = PyInt_FromLong((long) AL_ENUM_VALUE);
2342 if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0)
2343 goto error;
2344 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002345#endif
2346#ifdef AL_ERROR_INPUT_OVERFLOW
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002347 x = PyInt_FromLong((long) AL_ERROR_INPUT_OVERFLOW);
2348 if (x == NULL || PyDict_SetItemString(d, "ERROR_INPUT_OVERFLOW", x) < 0)
2349 goto error;
2350 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002351#endif
2352#ifdef AL_ERROR_LENGTH
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002353 x = PyInt_FromLong((long) AL_ERROR_LENGTH);
2354 if (x == NULL || PyDict_SetItemString(d, "ERROR_LENGTH", x) < 0)
2355 goto error;
2356 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002357#endif
2358#ifdef AL_ERROR_LOCATION_LSP
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002359 x = PyInt_FromLong((long) AL_ERROR_LOCATION_LSP);
2360 if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_LSP", x) < 0)
2361 goto error;
2362 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002363#endif
2364#ifdef AL_ERROR_LOCATION_MSP
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002365 x = PyInt_FromLong((long) AL_ERROR_LOCATION_MSP);
2366 if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_MSP", x) < 0)
2367 goto error;
2368 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002369#endif
2370#ifdef AL_ERROR_NUMBER
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002371 x = PyInt_FromLong((long) AL_ERROR_NUMBER);
2372 if (x == NULL || PyDict_SetItemString(d, "ERROR_NUMBER", x) < 0)
2373 goto error;
2374 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002375#endif
2376#ifdef AL_ERROR_OUTPUT_UNDERFLOW
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002377 x = PyInt_FromLong((long) AL_ERROR_OUTPUT_UNDERFLOW);
2378 if (x == NULL || PyDict_SetItemString(d, "ERROR_OUTPUT_UNDERFLOW", x) < 0)
2379 goto error;
2380 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002381#endif
2382#ifdef AL_ERROR_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002383 x = PyInt_FromLong((long) AL_ERROR_TYPE);
2384 if (x == NULL || PyDict_SetItemString(d, "ERROR_TYPE", x) < 0)
2385 goto error;
2386 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002387#endif
2388#ifdef AL_FIXED_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002389 x = PyInt_FromLong((long) AL_FIXED_ELEM);
2390 if (x == NULL || PyDict_SetItemString(d, "FIXED_ELEM", x) < 0)
2391 goto error;
2392 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002393#endif
2394#ifdef AL_FIXED_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002395 x = PyInt_FromLong((long) AL_FIXED_MCLK_TYPE);
2396 if (x == NULL || PyDict_SetItemString(d, "FIXED_MCLK_TYPE", x) < 0)
2397 goto error;
2398 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002399#endif
2400#ifdef AL_GAIN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002401 x = PyInt_FromLong((long) AL_GAIN);
2402 if (x == NULL || PyDict_SetItemString(d, "GAIN", x) < 0)
2403 goto error;
2404 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002405#endif
2406#ifdef AL_GAIN_REF
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002407 x = PyInt_FromLong((long) AL_GAIN_REF);
2408 if (x == NULL || PyDict_SetItemString(d, "GAIN_REF", x) < 0)
2409 goto error;
2410 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002411#endif
2412#ifdef AL_HRB_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002413 x = PyInt_FromLong((long) AL_HRB_TYPE);
2414 if (x == NULL || PyDict_SetItemString(d, "HRB_TYPE", x) < 0)
2415 goto error;
2416 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002417#endif
2418#ifdef AL_INPUT_COUNT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002419 x = PyInt_FromLong((long) AL_INPUT_COUNT);
2420 if (x == NULL || PyDict_SetItemString(d, "INPUT_COUNT", x) < 0)
2421 goto error;
2422 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002423#endif
2424#ifdef AL_INPUT_DEVICE_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002425 x = PyInt_FromLong((long) AL_INPUT_DEVICE_TYPE);
2426 if (x == NULL || PyDict_SetItemString(d, "INPUT_DEVICE_TYPE", x) < 0)
2427 goto error;
2428 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002429#endif
2430#ifdef AL_INPUT_DIGITAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002431 x = PyInt_FromLong((long) AL_INPUT_DIGITAL);
2432 if (x == NULL || PyDict_SetItemString(d, "INPUT_DIGITAL", x) < 0)
2433 goto error;
2434 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002435#endif
2436#ifdef AL_INPUT_HRB_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002437 x = PyInt_FromLong((long) AL_INPUT_HRB_TYPE);
2438 if (x == NULL || PyDict_SetItemString(d, "INPUT_HRB_TYPE", x) < 0)
2439 goto error;
2440 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002441#endif
2442#ifdef AL_INPUT_LINE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002443 x = PyInt_FromLong((long) AL_INPUT_LINE);
2444 if (x == NULL || PyDict_SetItemString(d, "INPUT_LINE", x) < 0)
2445 goto error;
2446 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002447#endif
2448#ifdef AL_INPUT_MIC
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002449 x = PyInt_FromLong((long) AL_INPUT_MIC);
2450 if (x == NULL || PyDict_SetItemString(d, "INPUT_MIC", x) < 0)
2451 goto error;
2452 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002453#endif
2454#ifdef AL_INPUT_PORT_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002455 x = PyInt_FromLong((long) AL_INPUT_PORT_TYPE);
2456 if (x == NULL || PyDict_SetItemString(d, "INPUT_PORT_TYPE", x) < 0)
2457 goto error;
2458 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002459#endif
2460#ifdef AL_INPUT_RATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002461 x = PyInt_FromLong((long) AL_INPUT_RATE);
2462 if (x == NULL || PyDict_SetItemString(d, "INPUT_RATE", x) < 0)
2463 goto error;
2464 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002465#endif
2466#ifdef AL_INPUT_SOURCE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002467 x = PyInt_FromLong((long) AL_INPUT_SOURCE);
2468 if (x == NULL || PyDict_SetItemString(d, "INPUT_SOURCE", x) < 0)
2469 goto error;
2470 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002471#endif
2472#ifdef AL_INT32_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002473 x = PyInt_FromLong((long) AL_INT32_ELEM);
2474 if (x == NULL || PyDict_SetItemString(d, "INT32_ELEM", x) < 0)
2475 goto error;
2476 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002477#endif
2478#ifdef AL_INT64_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002479 x = PyInt_FromLong((long) AL_INT64_ELEM);
2480 if (x == NULL || PyDict_SetItemString(d, "INT64_ELEM", x) < 0)
2481 goto error;
2482 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002483#endif
2484#ifdef AL_INTERFACE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002485 x = PyInt_FromLong((long) AL_INTERFACE);
2486 if (x == NULL || PyDict_SetItemString(d, "INTERFACE", x) < 0)
2487 goto error;
2488 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002489#endif
2490#ifdef AL_INTERFACE_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002491 x = PyInt_FromLong((long) AL_INTERFACE_TYPE);
2492 if (x == NULL || PyDict_SetItemString(d, "INTERFACE_TYPE", x) < 0)
2493 goto error;
2494 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002495#endif
2496#ifdef AL_INVALID_PARAM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002497 x = PyInt_FromLong((long) AL_INVALID_PARAM);
2498 if (x == NULL || PyDict_SetItemString(d, "INVALID_PARAM", x) < 0)
2499 goto error;
2500 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002501#endif
2502#ifdef AL_INVALID_VALUE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002503 x = PyInt_FromLong((long) AL_INVALID_VALUE);
2504 if (x == NULL || PyDict_SetItemString(d, "INVALID_VALUE", x) < 0)
2505 goto error;
2506 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002507#endif
2508#ifdef AL_JITTER
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002509 x = PyInt_FromLong((long) AL_JITTER);
2510 if (x == NULL || PyDict_SetItemString(d, "JITTER", x) < 0)
2511 goto error;
2512 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002513#endif
2514#ifdef AL_LABEL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002515 x = PyInt_FromLong((long) AL_LABEL);
2516 if (x == NULL || PyDict_SetItemString(d, "LABEL", x) < 0)
2517 goto error;
2518 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002519#endif
2520#ifdef AL_LEFT_INPUT_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002521 x = PyInt_FromLong((long) AL_LEFT_INPUT_ATTEN);
2522 if (x == NULL || PyDict_SetItemString(d, "LEFT_INPUT_ATTEN", x) < 0)
2523 goto error;
2524 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002525#endif
2526#ifdef AL_LEFT_MONITOR_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002527 x = PyInt_FromLong((long) AL_LEFT_MONITOR_ATTEN);
2528 if (x == NULL || PyDict_SetItemString(d, "LEFT_MONITOR_ATTEN", x) < 0)
2529 goto error;
2530 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002531#endif
2532#ifdef AL_LEFT_SPEAKER_GAIN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002533 x = PyInt_FromLong((long) AL_LEFT_SPEAKER_GAIN);
2534 if (x == NULL || PyDict_SetItemString(d, "LEFT_SPEAKER_GAIN", x) < 0)
2535 goto error;
2536 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002537#endif
2538#ifdef AL_LEFT1_INPUT_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002539 x = PyInt_FromLong((long) AL_LEFT1_INPUT_ATTEN);
2540 if (x == NULL || PyDict_SetItemString(d, "LEFT1_INPUT_ATTEN", x) < 0)
2541 goto error;
2542 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002543#endif
2544#ifdef AL_LEFT2_INPUT_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002545 x = PyInt_FromLong((long) AL_LEFT2_INPUT_ATTEN);
2546 if (x == NULL || PyDict_SetItemString(d, "LEFT2_INPUT_ATTEN", x) < 0)
2547 goto error;
2548 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002549#endif
2550#ifdef AL_LINE_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002551 x = PyInt_FromLong((long) AL_LINE_IF_TYPE);
2552 if (x == NULL || PyDict_SetItemString(d, "LINE_IF_TYPE", x) < 0)
2553 goto error;
2554 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002555#endif
Neal Norwitzddb4f622003-03-30 21:49:18 +00002556#ifdef AL_LOCKED
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002557 x = PyInt_FromLong((long) AL_LOCKED);
2558 if (x == NULL || PyDict_SetItemString(d, "LOCKED", x) < 0)
2559 goto error;
2560 Py_DECREF(x);
Neal Norwitzddb4f622003-03-30 21:49:18 +00002561#endif
Guido van Rossumd641d671997-04-03 17:06:32 +00002562#ifdef AL_MASTER_CLOCK
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002563 x = PyInt_FromLong((long) AL_MASTER_CLOCK);
2564 if (x == NULL || PyDict_SetItemString(d, "MASTER_CLOCK", x) < 0)
2565 goto error;
2566 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002567#endif
2568#ifdef AL_MATRIX_VAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002569 x = PyInt_FromLong((long) AL_MATRIX_VAL);
2570 if (x == NULL || PyDict_SetItemString(d, "MATRIX_VAL", x) < 0)
2571 goto error;
2572 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002573#endif
2574#ifdef AL_MAX_ERROR
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002575 x = PyInt_FromLong((long) AL_MAX_ERROR);
2576 if (x == NULL || PyDict_SetItemString(d, "MAX_ERROR", x) < 0)
2577 goto error;
2578 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002579#endif
2580#ifdef AL_MAX_EVENT_PARAM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002581 x = PyInt_FromLong((long) AL_MAX_EVENT_PARAM);
2582 if (x == NULL || PyDict_SetItemString(d, "MAX_EVENT_PARAM", x) < 0)
2583 goto error;
2584 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002585#endif
2586#ifdef AL_MAX_PBUFSIZE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002587 x = PyInt_FromLong((long) AL_MAX_PBUFSIZE);
2588 if (x == NULL || PyDict_SetItemString(d, "MAX_PBUFSIZE", x) < 0)
2589 goto error;
2590 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002591#endif
2592#ifdef AL_MAX_PORTS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002593 x = PyInt_FromLong((long) AL_MAX_PORTS);
2594 if (x == NULL || PyDict_SetItemString(d, "MAX_PORTS", x) < 0)
2595 goto error;
2596 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002597#endif
2598#ifdef AL_MAX_RESOURCE_ID
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002599 x = PyInt_FromLong((long) AL_MAX_RESOURCE_ID);
2600 if (x == NULL || PyDict_SetItemString(d, "MAX_RESOURCE_ID", x) < 0)
2601 goto error;
2602 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002603#endif
2604#ifdef AL_MAX_SETSIZE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002605 x = PyInt_FromLong((long) AL_MAX_SETSIZE);
2606 if (x == NULL || PyDict_SetItemString(d, "MAX_SETSIZE", x) < 0)
2607 goto error;
2608 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002609#endif
2610#ifdef AL_MAX_STRLEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002611 x = PyInt_FromLong((long) AL_MAX_STRLEN);
2612 if (x == NULL || PyDict_SetItemString(d, "MAX_STRLEN", x) < 0)
2613 goto error;
2614 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002615#endif
2616#ifdef AL_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002617 x = PyInt_FromLong((long) AL_MCLK_TYPE);
2618 if (x == NULL || PyDict_SetItemString(d, "MCLK_TYPE", x) < 0)
2619 goto error;
2620 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002621#endif
2622#ifdef AL_MIC_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002623 x = PyInt_FromLong((long) AL_MIC_IF_TYPE);
2624 if (x == NULL || PyDict_SetItemString(d, "MIC_IF_TYPE", x) < 0)
2625 goto error;
2626 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002627#endif
2628#ifdef AL_MONITOR_CTL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002629 x = PyInt_FromLong((long) AL_MONITOR_CTL);
2630 if (x == NULL || PyDict_SetItemString(d, "MONITOR_CTL", x) < 0)
2631 goto error;
2632 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002633#endif
2634#ifdef AL_MONITOR_OFF
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002635 x = PyInt_FromLong((long) AL_MONITOR_OFF);
2636 if (x == NULL || PyDict_SetItemString(d, "MONITOR_OFF", x) < 0)
2637 goto error;
2638 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002639#endif
2640#ifdef AL_MONITOR_ON
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002641 x = PyInt_FromLong((long) AL_MONITOR_ON);
2642 if (x == NULL || PyDict_SetItemString(d, "MONITOR_ON", x) < 0)
2643 goto error;
2644 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002645#endif
2646#ifdef AL_MONO
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002647 x = PyInt_FromLong((long) AL_MONO);
2648 if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0)
2649 goto error;
2650 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002651#endif
2652#ifdef AL_MUTE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002653 x = PyInt_FromLong((long) AL_MUTE);
2654 if (x == NULL || PyDict_SetItemString(d, "MUTE", x) < 0)
2655 goto error;
2656 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002657#endif
2658#ifdef AL_NAME
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002659 x = PyInt_FromLong((long) AL_NAME);
2660 if (x == NULL || PyDict_SetItemString(d, "NAME", x) < 0)
2661 goto error;
2662 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002663#endif
2664#ifdef AL_NEG_INFINITY
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002665 x = PyInt_FromLong((long) AL_NEG_INFINITY);
2666 if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY", x) < 0)
2667 goto error;
2668 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002669#endif
2670#ifdef AL_NEG_INFINITY_BIT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002671 x = PyInt_FromLong((long) AL_NEG_INFINITY_BIT);
2672 if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY_BIT", x) < 0)
2673 goto error;
2674 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002675#endif
2676#ifdef AL_NO_CHANGE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002677 x = PyInt_FromLong((long) AL_NO_CHANGE);
2678 if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE", x) < 0)
2679 goto error;
2680 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002681#endif
2682#ifdef AL_NO_CHANGE_BIT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002683 x = PyInt_FromLong((long) AL_NO_CHANGE_BIT);
2684 if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE_BIT", x) < 0)
2685 goto error;
2686 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002687#endif
2688#ifdef AL_NO_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002689 x = PyInt_FromLong((long) AL_NO_ELEM);
2690 if (x == NULL || PyDict_SetItemString(d, "NO_ELEM", x) < 0)
2691 goto error;
2692 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002693#endif
2694#ifdef AL_NO_ERRORS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002695 x = PyInt_FromLong((long) AL_NO_ERRORS);
2696 if (x == NULL || PyDict_SetItemString(d, "NO_ERRORS", x) < 0)
2697 goto error;
2698 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002699#endif
2700#ifdef AL_NO_OP
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002701 x = PyInt_FromLong((long) AL_NO_OP);
2702 if (x == NULL || PyDict_SetItemString(d, "NO_OP", x) < 0)
2703 goto error;
2704 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002705#endif
2706#ifdef AL_NO_VAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002707 x = PyInt_FromLong((long) AL_NO_VAL);
2708 if (x == NULL || PyDict_SetItemString(d, "NO_VAL", x) < 0)
2709 goto error;
2710 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002711#endif
Neal Norwitzddb4f622003-03-30 21:49:18 +00002712#ifdef AL_NULL_INTERFACE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002713 x = PyInt_FromLong((long) AL_NULL_INTERFACE);
2714 if (x == NULL || PyDict_SetItemString(d, "NULL_INTERFACE", x) < 0)
2715 goto error;
2716 Py_DECREF(x);
Neal Norwitzddb4f622003-03-30 21:49:18 +00002717#endif
Guido van Rossumd641d671997-04-03 17:06:32 +00002718#ifdef AL_NULL_RESOURCE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002719 x = PyInt_FromLong((long) AL_NULL_RESOURCE);
2720 if (x == NULL || PyDict_SetItemString(d, "NULL_RESOURCE", x) < 0)
2721 goto error;
2722 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002723#endif
Neal Norwitzddb4f622003-03-30 21:49:18 +00002724#ifdef AL_OPTICAL_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002725 x = PyInt_FromLong((long) AL_OPTICAL_IF_TYPE);
2726 if (x == NULL || PyDict_SetItemString(d, "OPTICAL_IF_TYPE", x) < 0)
2727 goto error;
2728 Py_DECREF(x);
Neal Norwitzddb4f622003-03-30 21:49:18 +00002729#endif
Guido van Rossumd641d671997-04-03 17:06:32 +00002730#ifdef AL_OUTPUT_COUNT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002731 x = PyInt_FromLong((long) AL_OUTPUT_COUNT);
2732 if (x == NULL || PyDict_SetItemString(d, "OUTPUT_COUNT", x) < 0)
2733 goto error;
2734 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002735#endif
2736#ifdef AL_OUTPUT_DEVICE_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002737 x = PyInt_FromLong((long) AL_OUTPUT_DEVICE_TYPE);
2738 if (x == NULL || PyDict_SetItemString(d, "OUTPUT_DEVICE_TYPE", x) < 0)
2739 goto error;
2740 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002741#endif
2742#ifdef AL_OUTPUT_HRB_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002743 x = PyInt_FromLong((long) AL_OUTPUT_HRB_TYPE);
2744 if (x == NULL || PyDict_SetItemString(d, "OUTPUT_HRB_TYPE", x) < 0)
2745 goto error;
2746 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002747#endif
2748#ifdef AL_OUTPUT_PORT_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002749 x = PyInt_FromLong((long) AL_OUTPUT_PORT_TYPE);
2750 if (x == NULL || PyDict_SetItemString(d, "OUTPUT_PORT_TYPE", x) < 0)
2751 goto error;
2752 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002753#endif
2754#ifdef AL_OUTPUT_RATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002755 x = PyInt_FromLong((long) AL_OUTPUT_RATE);
2756 if (x == NULL || PyDict_SetItemString(d, "OUTPUT_RATE", x) < 0)
2757 goto error;
2758 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002759#endif
2760#ifdef AL_PARAM_BIT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002761 x = PyInt_FromLong((long) AL_PARAM_BIT);
2762 if (x == NULL || PyDict_SetItemString(d, "PARAM_BIT", x) < 0)
2763 goto error;
2764 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002765#endif
2766#ifdef AL_PARAMS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002767 x = PyInt_FromLong((long) AL_PARAMS);
2768 if (x == NULL || PyDict_SetItemString(d, "PARAMS", x) < 0)
2769 goto error;
2770 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002771#endif
2772#ifdef AL_PORT_COUNT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002773 x = PyInt_FromLong((long) AL_PORT_COUNT);
2774 if (x == NULL || PyDict_SetItemString(d, "PORT_COUNT", x) < 0)
2775 goto error;
2776 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002777#endif
2778#ifdef AL_PORT_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002779 x = PyInt_FromLong((long) AL_PORT_TYPE);
2780 if (x == NULL || PyDict_SetItemString(d, "PORT_TYPE", x) < 0)
2781 goto error;
2782 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002783#endif
2784#ifdef AL_PORTS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002785 x = PyInt_FromLong((long) AL_PORTS);
2786 if (x == NULL || PyDict_SetItemString(d, "PORTS", x) < 0)
2787 goto error;
2788 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002789#endif
2790#ifdef AL_PORTSTYLE_DIRECT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002791 x = PyInt_FromLong((long) AL_PORTSTYLE_DIRECT);
2792 if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_DIRECT", x) < 0)
2793 goto error;
2794 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002795#endif
2796#ifdef AL_PORTSTYLE_SERIAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002797 x = PyInt_FromLong((long) AL_PORTSTYLE_SERIAL);
2798 if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_SERIAL", x) < 0)
2799 goto error;
2800 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002801#endif
2802#ifdef AL_PRINT_ERRORS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002803 x = PyInt_FromLong((long) AL_PRINT_ERRORS);
2804 if (x == NULL || PyDict_SetItemString(d, "PRINT_ERRORS", x) < 0)
2805 goto error;
2806 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002807#endif
2808#ifdef AL_PTR_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002809 x = PyInt_FromLong((long) AL_PTR_ELEM);
2810 if (x == NULL || PyDict_SetItemString(d, "PTR_ELEM", x) < 0)
2811 goto error;
2812 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002813#endif
2814#ifdef AL_RANGE_VALUE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002815 x = PyInt_FromLong((long) AL_RANGE_VALUE);
2816 if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0)
2817 goto error;
2818 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002819#endif
2820#ifdef AL_RATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002821 x = PyInt_FromLong((long) AL_RATE);
2822 if (x == NULL || PyDict_SetItemString(d, "RATE", x) < 0)
2823 goto error;
2824 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002825#endif
2826#ifdef AL_RATE_11025
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002827 x = PyInt_FromLong((long) AL_RATE_11025);
2828 if (x == NULL || PyDict_SetItemString(d, "RATE_11025", x) < 0)
2829 goto error;
2830 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002831#endif
2832#ifdef AL_RATE_16000
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002833 x = PyInt_FromLong((long) AL_RATE_16000);
2834 if (x == NULL || PyDict_SetItemString(d, "RATE_16000", x) < 0)
2835 goto error;
2836 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002837#endif
2838#ifdef AL_RATE_22050
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002839 x = PyInt_FromLong((long) AL_RATE_22050);
2840 if (x == NULL || PyDict_SetItemString(d, "RATE_22050", x) < 0)
2841 goto error;
2842 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002843#endif
2844#ifdef AL_RATE_32000
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002845 x = PyInt_FromLong((long) AL_RATE_32000);
2846 if (x == NULL || PyDict_SetItemString(d, "RATE_32000", x) < 0)
2847 goto error;
2848 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002849#endif
2850#ifdef AL_RATE_44100
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002851 x = PyInt_FromLong((long) AL_RATE_44100);
2852 if (x == NULL || PyDict_SetItemString(d, "RATE_44100", x) < 0)
2853 goto error;
2854 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002855#endif
2856#ifdef AL_RATE_48000
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002857 x = PyInt_FromLong((long) AL_RATE_48000);
2858 if (x == NULL || PyDict_SetItemString(d, "RATE_48000", x) < 0)
2859 goto error;
2860 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002861#endif
2862#ifdef AL_RATE_8000
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002863 x = PyInt_FromLong((long) AL_RATE_8000);
2864 if (x == NULL || PyDict_SetItemString(d, "RATE_8000", x) < 0)
2865 goto error;
2866 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002867#endif
2868#ifdef AL_RATE_AES_1
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002869 x = PyInt_FromLong((long) AL_RATE_AES_1);
2870 if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1", x) < 0)
2871 goto error;
2872 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002873#endif
2874#ifdef AL_RATE_AES_1s
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002875 x = PyInt_FromLong((long) AL_RATE_AES_1s);
2876 if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1s", x) < 0)
2877 goto error;
2878 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002879#endif
2880#ifdef AL_RATE_AES_2
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002881 x = PyInt_FromLong((long) AL_RATE_AES_2);
2882 if (x == NULL || PyDict_SetItemString(d, "RATE_AES_2", x) < 0)
2883 goto error;
2884 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002885#endif
2886#ifdef AL_RATE_AES_3
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002887 x = PyInt_FromLong((long) AL_RATE_AES_3);
2888 if (x == NULL || PyDict_SetItemString(d, "RATE_AES_3", x) < 0)
2889 goto error;
2890 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002891#endif
2892#ifdef AL_RATE_AES_4
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002893 x = PyInt_FromLong((long) AL_RATE_AES_4);
2894 if (x == NULL || PyDict_SetItemString(d, "RATE_AES_4", x) < 0)
2895 goto error;
2896 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002897#endif
2898#ifdef AL_RATE_AES_6
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002899 x = PyInt_FromLong((long) AL_RATE_AES_6);
2900 if (x == NULL || PyDict_SetItemString(d, "RATE_AES_6", x) < 0)
2901 goto error;
2902 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002903#endif
2904#ifdef AL_RATE_FRACTION_D
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002905 x = PyInt_FromLong((long) AL_RATE_FRACTION_D);
2906 if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_D", x) < 0)
2907 goto error;
2908 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002909#endif
2910#ifdef AL_RATE_FRACTION_N
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002911 x = PyInt_FromLong((long) AL_RATE_FRACTION_N);
2912 if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_N", x) < 0)
2913 goto error;
2914 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002915#endif
2916#ifdef AL_RATE_INPUTRATE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002917 x = PyInt_FromLong((long) AL_RATE_INPUTRATE);
2918 if (x == NULL || PyDict_SetItemString(d, "RATE_INPUTRATE", x) < 0)
2919 goto error;
2920 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002921#endif
2922#ifdef AL_RATE_NO_DIGITAL_INPUT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002923 x = PyInt_FromLong((long) AL_RATE_NO_DIGITAL_INPUT);
2924 if (x == NULL || PyDict_SetItemString(d, "RATE_NO_DIGITAL_INPUT", x) < 0)
2925 goto error;
2926 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002927#endif
2928#ifdef AL_RATE_UNACQUIRED
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002929 x = PyInt_FromLong((long) AL_RATE_UNACQUIRED);
2930 if (x == NULL || PyDict_SetItemString(d, "RATE_UNACQUIRED", x) < 0)
2931 goto error;
2932 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002933#endif
2934#ifdef AL_RATE_UNDEFINED
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002935 x = PyInt_FromLong((long) AL_RATE_UNDEFINED);
2936 if (x == NULL || PyDict_SetItemString(d, "RATE_UNDEFINED", x) < 0)
2937 goto error;
2938 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002939#endif
2940#ifdef AL_REF_0DBV
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002941 x = PyInt_FromLong((long) AL_REF_0DBV);
2942 if (x == NULL || PyDict_SetItemString(d, "REF_0DBV", x) < 0)
2943 goto error;
2944 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002945#endif
2946#ifdef AL_REF_NONE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002947 x = PyInt_FromLong((long) AL_REF_NONE);
2948 if (x == NULL || PyDict_SetItemString(d, "REF_NONE", x) < 0)
2949 goto error;
2950 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002951#endif
2952#ifdef AL_RESERVED1_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002953 x = PyInt_FromLong((long) AL_RESERVED1_TYPE);
2954 if (x == NULL || PyDict_SetItemString(d, "RESERVED1_TYPE", x) < 0)
2955 goto error;
2956 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002957#endif
2958#ifdef AL_RESERVED2_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002959 x = PyInt_FromLong((long) AL_RESERVED2_TYPE);
2960 if (x == NULL || PyDict_SetItemString(d, "RESERVED2_TYPE", x) < 0)
2961 goto error;
2962 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002963#endif
2964#ifdef AL_RESERVED3_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002965 x = PyInt_FromLong((long) AL_RESERVED3_TYPE);
2966 if (x == NULL || PyDict_SetItemString(d, "RESERVED3_TYPE", x) < 0)
2967 goto error;
2968 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002969#endif
2970#ifdef AL_RESERVED4_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002971 x = PyInt_FromLong((long) AL_RESERVED4_TYPE);
2972 if (x == NULL || PyDict_SetItemString(d, "RESERVED4_TYPE", x) < 0)
2973 goto error;
2974 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002975#endif
2976#ifdef AL_RESOURCE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002977 x = PyInt_FromLong((long) AL_RESOURCE);
2978 if (x == NULL || PyDict_SetItemString(d, "RESOURCE", x) < 0)
2979 goto error;
2980 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002981#endif
2982#ifdef AL_RESOURCE_ELEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002983 x = PyInt_FromLong((long) AL_RESOURCE_ELEM);
2984 if (x == NULL || PyDict_SetItemString(d, "RESOURCE_ELEM", x) < 0)
2985 goto error;
2986 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002987#endif
2988#ifdef AL_RESOURCE_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002989 x = PyInt_FromLong((long) AL_RESOURCE_TYPE);
2990 if (x == NULL || PyDict_SetItemString(d, "RESOURCE_TYPE", x) < 0)
2991 goto error;
2992 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002993#endif
2994#ifdef AL_RIGHT_INPUT_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00002995 x = PyInt_FromLong((long) AL_RIGHT_INPUT_ATTEN);
2996 if (x == NULL || PyDict_SetItemString(d, "RIGHT_INPUT_ATTEN", x) < 0)
2997 goto error;
2998 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00002999#endif
3000#ifdef AL_RIGHT_MONITOR_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003001 x = PyInt_FromLong((long) AL_RIGHT_MONITOR_ATTEN);
3002 if (x == NULL || PyDict_SetItemString(d, "RIGHT_MONITOR_ATTEN", x) < 0)
3003 goto error;
3004 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003005#endif
3006#ifdef AL_RIGHT_SPEAKER_GAIN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003007 x = PyInt_FromLong((long) AL_RIGHT_SPEAKER_GAIN);
3008 if (x == NULL || PyDict_SetItemString(d, "RIGHT_SPEAKER_GAIN", x) < 0)
3009 goto error;
3010 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003011#endif
3012#ifdef AL_RIGHT1_INPUT_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003013 x = PyInt_FromLong((long) AL_RIGHT1_INPUT_ATTEN);
3014 if (x == NULL || PyDict_SetItemString(d, "RIGHT1_INPUT_ATTEN", x) < 0)
3015 goto error;
3016 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003017#endif
3018#ifdef AL_RIGHT2_INPUT_ATTEN
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003019 x = PyInt_FromLong((long) AL_RIGHT2_INPUT_ATTEN);
3020 if (x == NULL || PyDict_SetItemString(d, "RIGHT2_INPUT_ATTEN", x) < 0)
3021 goto error;
3022 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003023#endif
3024#ifdef AL_SAMPFMT_DOUBLE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003025 x = PyInt_FromLong((long) AL_SAMPFMT_DOUBLE);
3026 if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_DOUBLE", x) < 0)
3027 goto error;
3028 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003029#endif
3030#ifdef AL_SAMPFMT_FLOAT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003031 x = PyInt_FromLong((long) AL_SAMPFMT_FLOAT);
3032 if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_FLOAT", x) < 0)
3033 goto error;
3034 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003035#endif
3036#ifdef AL_SAMPFMT_TWOSCOMP
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003037 x = PyInt_FromLong((long) AL_SAMPFMT_TWOSCOMP);
3038 if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_TWOSCOMP", x) < 0)
3039 goto error;
3040 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003041#endif
3042#ifdef AL_SAMPLE_16
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003043 x = PyInt_FromLong((long) AL_SAMPLE_16);
3044 if (x == NULL || PyDict_SetItemString(d, "SAMPLE_16", x) < 0)
3045 goto error;
3046 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003047#endif
3048#ifdef AL_SAMPLE_24
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003049 x = PyInt_FromLong((long) AL_SAMPLE_24);
3050 if (x == NULL || PyDict_SetItemString(d, "SAMPLE_24", x) < 0)
3051 goto error;
3052 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003053#endif
3054#ifdef AL_SAMPLE_8
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003055 x = PyInt_FromLong((long) AL_SAMPLE_8);
3056 if (x == NULL || PyDict_SetItemString(d, "SAMPLE_8", x) < 0)
3057 goto error;
3058 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003059#endif
3060#ifdef AL_SCALAR_VAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003061 x = PyInt_FromLong((long) AL_SCALAR_VAL);
3062 if (x == NULL || PyDict_SetItemString(d, "SCALAR_VAL", x) < 0)
3063 goto error;
3064 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003065#endif
3066#ifdef AL_SET_VAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003067 x = PyInt_FromLong((long) AL_SET_VAL);
3068 if (x == NULL || PyDict_SetItemString(d, "SET_VAL", x) < 0)
3069 goto error;
3070 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003071#endif
3072#ifdef AL_SHORT_NAME
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003073 x = PyInt_FromLong((long) AL_SHORT_NAME);
3074 if (x == NULL || PyDict_SetItemString(d, "SHORT_NAME", x) < 0)
3075 goto error;
3076 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003077#endif
Neal Norwitzddb4f622003-03-30 21:49:18 +00003078#ifdef AL_SMPTE272M_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003079 x = PyInt_FromLong((long) AL_SMPTE272M_IF_TYPE);
3080 if (x == NULL || PyDict_SetItemString(d, "SMPTE272M_IF_TYPE", x) < 0)
3081 goto error;
3082 Py_DECREF(x);
Neal Norwitzddb4f622003-03-30 21:49:18 +00003083#endif
Guido van Rossumd641d671997-04-03 17:06:32 +00003084#ifdef AL_SOURCE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003085 x = PyInt_FromLong((long) AL_SOURCE);
3086 if (x == NULL || PyDict_SetItemString(d, "SOURCE", x) < 0)
3087 goto error;
3088 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003089#endif
3090#ifdef AL_SPEAKER_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003091 x = PyInt_FromLong((long) AL_SPEAKER_IF_TYPE);
3092 if (x == NULL || PyDict_SetItemString(d, "SPEAKER_IF_TYPE", x) < 0)
3093 goto error;
3094 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003095#endif
3096#ifdef AL_SPEAKER_MUTE_CTL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003097 x = PyInt_FromLong((long) AL_SPEAKER_MUTE_CTL);
3098 if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_CTL", x) < 0)
3099 goto error;
3100 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003101#endif
3102#ifdef AL_SPEAKER_MUTE_OFF
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003103 x = PyInt_FromLong((long) AL_SPEAKER_MUTE_OFF);
3104 if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_OFF", x) < 0)
3105 goto error;
3106 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003107#endif
3108#ifdef AL_SPEAKER_MUTE_ON
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003109 x = PyInt_FromLong((long) AL_SPEAKER_MUTE_ON);
3110 if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_ON", x) < 0)
3111 goto error;
3112 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003113#endif
3114#ifdef AL_SPEAKER_PLUS_LINE_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003115 x = PyInt_FromLong((long) AL_SPEAKER_PLUS_LINE_IF_TYPE);
3116 if (x == NULL || PyDict_SetItemString(d, "SPEAKER_PLUS_LINE_IF_TYPE", x) < 0)
3117 goto error;
3118 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003119#endif
3120#ifdef AL_STEREO
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003121 x = PyInt_FromLong((long) AL_STEREO);
3122 if (x == NULL || PyDict_SetItemString(d, "STEREO", x) < 0)
3123 goto error;
3124 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003125#endif
3126#ifdef AL_STRING_VAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003127 x = PyInt_FromLong((long) AL_STRING_VAL);
3128 if (x == NULL || PyDict_SetItemString(d, "STRING_VAL", x) < 0)
3129 goto error;
3130 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003131#endif
3132#ifdef AL_SUBSYSTEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003133 x = PyInt_FromLong((long) AL_SUBSYSTEM);
3134 if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM", x) < 0)
3135 goto error;
3136 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003137#endif
3138#ifdef AL_SUBSYSTEM_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003139 x = PyInt_FromLong((long) AL_SUBSYSTEM_TYPE);
3140 if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM_TYPE", x) < 0)
3141 goto error;
3142 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003143#endif
3144#ifdef AL_SYNC_INPUT_TO_AES
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003145 x = PyInt_FromLong((long) AL_SYNC_INPUT_TO_AES);
3146 if (x == NULL || PyDict_SetItemString(d, "SYNC_INPUT_TO_AES", x) < 0)
3147 goto error;
3148 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003149#endif
3150#ifdef AL_SYNC_OUTPUT_TO_AES
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003151 x = PyInt_FromLong((long) AL_SYNC_OUTPUT_TO_AES);
3152 if (x == NULL || PyDict_SetItemString(d, "SYNC_OUTPUT_TO_AES", x) < 0)
3153 goto error;
3154 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003155#endif
3156#ifdef AL_SYSTEM
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003157 x = PyInt_FromLong((long) AL_SYSTEM);
3158 if (x == NULL || PyDict_SetItemString(d, "SYSTEM", x) < 0)
3159 goto error;
3160 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003161#endif
3162#ifdef AL_SYSTEM_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003163 x = PyInt_FromLong((long) AL_SYSTEM_TYPE);
3164 if (x == NULL || PyDict_SetItemString(d, "SYSTEM_TYPE", x) < 0)
3165 goto error;
3166 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003167#endif
3168#ifdef AL_TEST_IF_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003169 x = PyInt_FromLong((long) AL_TEST_IF_TYPE);
3170 if (x == NULL || PyDict_SetItemString(d, "TEST_IF_TYPE", x) < 0)
3171 goto error;
3172 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003173#endif
3174#ifdef AL_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003175 x = PyInt_FromLong((long) AL_TYPE);
3176 if (x == NULL || PyDict_SetItemString(d, "TYPE", x) < 0)
3177 goto error;
3178 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003179#endif
3180#ifdef AL_TYPE_BIT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003181 x = PyInt_FromLong((long) AL_TYPE_BIT);
3182 if (x == NULL || PyDict_SetItemString(d, "TYPE_BIT", x) < 0)
3183 goto error;
3184 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003185#endif
3186#ifdef AL_UNUSED_COUNT
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003187 x = PyInt_FromLong((long) AL_UNUSED_COUNT);
3188 if (x == NULL || PyDict_SetItemString(d, "UNUSED_COUNT", x) < 0)
3189 goto error;
3190 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003191#endif
3192#ifdef AL_UNUSED_PORTS
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003193 x = PyInt_FromLong((long) AL_UNUSED_PORTS);
3194 if (x == NULL || PyDict_SetItemString(d, "UNUSED_PORTS", x) < 0)
3195 goto error;
3196 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003197#endif
3198#ifdef AL_VARIABLE_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003199 x = PyInt_FromLong((long) AL_VARIABLE_MCLK_TYPE);
3200 if (x == NULL || PyDict_SetItemString(d, "VARIABLE_MCLK_TYPE", x) < 0)
3201 goto error;
3202 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003203#endif
3204#ifdef AL_VECTOR_VAL
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003205 x = PyInt_FromLong((long) AL_VECTOR_VAL);
3206 if (x == NULL || PyDict_SetItemString(d, "VECTOR_VAL", x) < 0)
3207 goto error;
3208 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003209#endif
3210#ifdef AL_VIDEO_MCLK_TYPE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003211 x = PyInt_FromLong((long) AL_VIDEO_MCLK_TYPE);
3212 if (x == NULL || PyDict_SetItemString(d, "VIDEO_MCLK_TYPE", x) < 0)
3213 goto error;
3214 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003215#endif
3216#ifdef AL_WORDSIZE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003217 x = PyInt_FromLong((long) AL_WORDSIZE);
3218 if (x == NULL || PyDict_SetItemString(d, "WORDSIZE", x) < 0)
3219 goto error;
3220 Py_DECREF(x);
Guido van Rossumd641d671997-04-03 17:06:32 +00003221#endif
3222
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003223#ifdef AL_NO_ELEM /* IRIX 6 */
3224 (void) alSetErrorHandler(ErrorHandler);
Guido van Rossumd641d671997-04-03 17:06:32 +00003225#endif /* AL_NO_ELEM */
3226#ifdef OLD_INTERFACE
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003227 (void) ALseterrorhandler(ErrorHandler);
Guido van Rossumd641d671997-04-03 17:06:32 +00003228#endif /* OLD_INTERFACE */
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003229
Barry Warsaw9bfd2bf2000-09-01 09:01:32 +00003230 error:
Antoine Pitrouc83ea132010-05-09 14:46:46 +00003231 return;
Guido van Rossume3db8621991-09-09 23:33:34 +00003232}