| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 2 | #define OLD_INTERFACE		/* define for pre-Irix 6 interface */ | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 3 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 4 | #include "Python.h" | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 5 | #include "stringobject.h" | 
 | 6 | #include <audio.h> | 
 | 7 | #include <stdarg.h> | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 8 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 9 | #ifndef AL_NO_ELEM | 
 | 10 | #ifndef OLD_INTERFACE | 
 | 11 | #define OLD_INTERFACE | 
 | 12 | #endif /* OLD_INTERFACE */ | 
 | 13 | #endif /* AL_NO_ELEM */ | 
 | 14 |  | 
 | 15 | static PyObject *ErrorObject; | 
 | 16 |  | 
 | 17 | /* ----------------------------------------------------- */ | 
 | 18 |  | 
 | 19 | /* Declarations for objects of type port */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 20 |  | 
 | 21 | typedef struct { | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 22 | 	PyObject_HEAD | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 23 | 	/* XXXX Add your own stuff here */ | 
 | 24 | 	ALport port; | 
 | 25 | } alpobject; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 26 |  | 
| Jeremy Hylton | 938ace6 | 2002-07-17 16:30:39 +0000 | [diff] [blame] | 27 | static PyTypeObject Alptype; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 28 |  | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 29 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 30 |  | 
 | 31 | /* ---------------------------------------------------------------- */ | 
 | 32 |  | 
 | 33 | /* Declarations for objects of type config */ | 
 | 34 |  | 
 | 35 | typedef struct { | 
 | 36 | 	PyObject_HEAD | 
 | 37 | 	/* XXXX Add your own stuff here */ | 
 | 38 | 	ALconfig config; | 
 | 39 | } alcobject; | 
 | 40 |  | 
| Jeremy Hylton | 938ace6 | 2002-07-17 16:30:39 +0000 | [diff] [blame] | 41 | static PyTypeObject Alctype; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 42 |  | 
 | 43 |  | 
 | 44 | static void | 
 | 45 | ErrorHandler(long code, const char *fmt, ...) | 
 | 46 | { | 
 | 47 | 	va_list args; | 
 | 48 | 	char buf[128]; | 
 | 49 |  | 
 | 50 | 	va_start(args, fmt); | 
 | 51 | 	vsprintf(buf, fmt, args); | 
 | 52 | 	va_end(args); | 
 | 53 | 	PyErr_SetString(ErrorObject, buf); | 
 | 54 | } | 
 | 55 |  | 
 | 56 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
| Guido van Rossum | fc58e58 | 1992-01-27 16:45:55 +0000 | [diff] [blame] | 57 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 58 | static PyObject * | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 59 | param2python(int resource, int param, ALvalue value, ALparamInfo *pinfo) | 
 | 60 | { | 
 | 61 | 	ALparamInfo info; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 62 |  | 
 | 63 | 	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 | 	} | 
 | 92 | } | 
 | 93 |  | 
 | 94 | static int | 
 | 95 | python2elem(PyObject *item, void *ptr, int elementType) | 
 | 96 | { | 
 | 97 | 	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; | 
 | 132 | } | 
 | 133 |  | 
 | 134 | static int | 
 | 135 | python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo) | 
 | 136 | { | 
 | 137 | 	ALparamInfo info; | 
 | 138 | 	int i, stepsize; | 
 | 139 | 	PyObject *item; | 
 | 140 |  | 
 | 141 | 	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: | 
| Jeremy Hylton | 03657cf | 2000-07-12 13:05:33 +0000 | [diff] [blame] | 169 | 			param->sizeIn = PySequence_Size(value); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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: | 
| Jeremy Hylton | 03657cf | 2000-07-12 13:05:33 +0000 | [diff] [blame] | 175 | 			param->sizeIn = PySequence_Size(value); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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 *) ¶m->value.i, | 
 | 194 | 					   pinfo->elementType); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 195 | 		case AL_INT64_ELEM: | 
 | 196 | 		case AL_FIXED_ELEM: | 
 | 197 | 			return python2elem(value, (void *) ¶m->value.ll, | 
 | 198 | 					   pinfo->elementType); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 199 | 		default: | 
 | 200 | 			PyErr_SetString(ErrorObject, "unknown element type"); | 
 | 201 | 			return -1; | 
 | 202 | 		} | 
 | 203 | 	} | 
 | 204 | 	return 0; | 
 | 205 | } | 
 | 206 |  | 
 | 207 | static int | 
 | 208 | python2params(int resource1, int resource2, PyObject *list, ALpv **pvsp, ALparamInfo **pinfop) | 
 | 209 | { | 
 | 210 | 	PyObject *item; | 
 | 211 | 	ALpv *pvs; | 
 | 212 | 	ALparamInfo *pinfo; | 
 | 213 | 	int npvs, i; | 
 | 214 |  | 
 | 215 | 	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 | 	} | 
 | 228 |  | 
 | 229 | 	*pvsp = pvs; | 
 | 230 | 	*pinfop = pinfo; | 
 | 231 | 	return npvs; | 
 | 232 |  | 
 | 233 |   error: | 
 | 234 | 	/* XXXX we should clean up everything */ | 
 | 235 | 	if (pvs) | 
 | 236 | 		PyMem_DEL(pvs); | 
 | 237 | 	if (pinfo) | 
 | 238 | 		PyMem_DEL(pinfo); | 
 | 239 | 	return -1; | 
 | 240 | } | 
 | 241 |  | 
 | 242 | /* -------------------------------------------------------- */ | 
 | 243 |  | 
 | 244 |  | 
 | 245 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 246 | SetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig, int)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 247 | { | 
 | 248 | 	int par; | 
 | 249 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 250 | 	if (!PyArg_ParseTuple(args, "i:SetConfig", &par)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 251 | 		return NULL; | 
 | 252 |  | 
 | 253 | 	if ((*func)(self->config, par) == -1) | 
 | 254 | 		return NULL; | 
 | 255 |  | 
 | 256 | 	Py_INCREF(Py_None); | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 257 | 	return Py_None; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 258 | } | 
 | 259 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 260 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 261 | GetConfig(alcobject *self, PyObject *args, int (*func)(ALconfig)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 262 | {	 | 
 | 263 | 	int par; | 
 | 264 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 265 | 	if (!PyArg_ParseTuple(args, ":GetConfig")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 266 | 		return NULL; | 
 | 267 | 	 | 
 | 268 | 	if ((par = (*func)(self->config)) == -1) | 
 | 269 | 		return NULL; | 
 | 270 |  | 
 | 271 | 	return PyInt_FromLong((long) par); | 
 | 272 | } | 
 | 273 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 274 | PyDoc_STRVAR(alc_SetWidth__doc__, | 
 | 275 | "alSetWidth: set the wordsize for integer audio data."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 276 |  | 
 | 277 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 278 | alc_SetWidth(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 279 | { | 
 | 280 | 	return SetConfig(self, args, alSetWidth); | 
 | 281 | } | 
 | 282 |  | 
 | 283 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 284 | PyDoc_STRVAR(alc_GetWidth__doc__, | 
 | 285 | "alGetWidth: get the wordsize for integer audio data."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 286 |  | 
 | 287 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 288 | alc_GetWidth(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 289 | { | 
 | 290 | 	return GetConfig(self, args, alGetWidth); | 
 | 291 | } | 
 | 292 |  | 
 | 293 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 294 | PyDoc_STRVAR(alc_SetSampFmt__doc__, | 
 | 295 | "alSetSampFmt: set the sample format setting in an audio ALconfig " | 
 | 296 | "structure."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 297 |  | 
 | 298 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 299 | alc_SetSampFmt(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 300 | { | 
 | 301 | 	return SetConfig(self, args, alSetSampFmt); | 
 | 302 | } | 
 | 303 |  | 
 | 304 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 305 | PyDoc_STRVAR(alc_GetSampFmt__doc__, | 
 | 306 | "alGetSampFmt: get the sample format setting in an audio ALconfig " | 
 | 307 | "structure."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 308 |  | 
 | 309 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 310 | alc_GetSampFmt(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 311 | { | 
 | 312 | 	return GetConfig(self, args, alGetSampFmt); | 
 | 313 | } | 
 | 314 |  | 
 | 315 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 316 | PyDoc_STRVAR(alc_SetChannels__doc__, | 
 | 317 | "alSetChannels: set the channel settings in an audio ALconfig."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 318 |  | 
 | 319 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 320 | alc_SetChannels(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 321 | { | 
 | 322 | 	return SetConfig(self, args, alSetChannels); | 
 | 323 | } | 
 | 324 |  | 
 | 325 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 326 | PyDoc_STRVAR(alc_GetChannels__doc__, | 
 | 327 | "alGetChannels: get the channel settings in an audio ALconfig."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 328 |  | 
 | 329 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 330 | alc_GetChannels(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 331 | { | 
 | 332 | 	return GetConfig(self, args, alGetChannels); | 
 | 333 | } | 
 | 334 |  | 
 | 335 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 336 | PyDoc_STRVAR(alc_SetFloatMax__doc__, | 
 | 337 | "alSetFloatMax: set the maximum value of floating point sample data."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 338 |  | 
 | 339 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 340 | alc_SetFloatMax(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 341 | { | 
 | 342 | 	double maximum_value; | 
 | 343 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 344 | 	if (!PyArg_ParseTuple(args, "d:SetFloatMax", &maximum_value)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 345 | 		return NULL; | 
 | 346 | 	if (alSetFloatMax(self->config, maximum_value) < 0) | 
 | 347 | 		return NULL; | 
 | 348 | 	Py_INCREF(Py_None); | 
 | 349 | 	return Py_None; | 
 | 350 | } | 
 | 351 |  | 
 | 352 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 353 | PyDoc_STRVAR(alc_GetFloatMax__doc__, | 
 | 354 | "alGetFloatMax: get the maximum value of floating point sample data."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 355 |  | 
 | 356 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 357 | alc_GetFloatMax(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 358 | { | 
 | 359 | 	double maximum_value; | 
 | 360 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 361 | 	if (!PyArg_ParseTuple(args, ":GetFloatMax")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 362 | 		return NULL; | 
 | 363 | 	if ((maximum_value = alGetFloatMax(self->config)) == 0) | 
 | 364 | 		return NULL; | 
 | 365 | 	return PyFloat_FromDouble(maximum_value); | 
 | 366 | } | 
 | 367 |  | 
 | 368 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 369 | PyDoc_STRVAR(alc_SetDevice__doc__, | 
 | 370 | "alSetDevice: set the device setting in an audio ALconfig structure."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 371 |  | 
 | 372 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 373 | alc_SetDevice(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 374 | { | 
 | 375 | 	return SetConfig(self, args, alSetDevice); | 
 | 376 | } | 
 | 377 |  | 
 | 378 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 379 | PyDoc_STRVAR(alc_GetDevice__doc__, | 
 | 380 | "alGetDevice: get the device setting in an audio ALconfig structure."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 381 |  | 
 | 382 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 383 | alc_GetDevice(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 384 | { | 
 | 385 | 	return GetConfig(self, args, alGetDevice); | 
 | 386 | } | 
 | 387 |  | 
 | 388 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 389 | PyDoc_STRVAR(alc_SetQueueSize__doc__, | 
 | 390 | "alSetQueueSize: set audio port buffer size."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 391 |  | 
 | 392 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 393 | alc_SetQueueSize(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 394 | { | 
 | 395 | 	return SetConfig(self, args, alSetQueueSize); | 
 | 396 | } | 
 | 397 |  | 
 | 398 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 399 | PyDoc_STRVAR(alc_GetQueueSize__doc__, | 
 | 400 | "alGetQueueSize: get audio port buffer size."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 401 |  | 
 | 402 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 403 | alc_GetQueueSize(alcobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 404 | { | 
 | 405 | 	return GetConfig(self, args, alGetQueueSize); | 
 | 406 | } | 
 | 407 |  | 
 | 408 | #endif /* AL_NO_ELEM */ | 
 | 409 |  | 
 | 410 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 411 | setconfig(alcobject *self, PyObject *args, int (*func)(ALconfig, long)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 412 | { | 
 | 413 | 	long par; | 
 | 414 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 415 | 	if (!PyArg_ParseTuple(args, "l:SetConfig", &par)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 416 | 		return NULL; | 
 | 417 |  | 
 | 418 | 	if ((*func)(self->config, par) == -1) | 
 | 419 | 		return NULL; | 
 | 420 |  | 
 | 421 | 	Py_INCREF(Py_None); | 
 | 422 | 	return Py_None; | 
 | 423 | } | 
 | 424 |  | 
 | 425 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 426 | getconfig(alcobject *self, PyObject *args, long (*func)(ALconfig)) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 427 | {	 | 
 | 428 | 	long par; | 
 | 429 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 430 | 	if (!PyArg_ParseTuple(args, ":GetConfig")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 431 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 432 | 	 | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 433 | 	if ((par = (*func)(self->config)) == -1) | 
 | 434 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 435 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 436 | 	return PyInt_FromLong((long) par); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 437 | } | 
 | 438 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 439 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 440 | alc_setqueuesize (alcobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 441 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 442 | 	return setconfig(self, args, ALsetqueuesize); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 443 | } | 
 | 444 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 445 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 446 | alc_getqueuesize (alcobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 447 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 448 | 	return getconfig(self, args, ALgetqueuesize); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 449 | } | 
 | 450 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 451 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 452 | alc_setwidth (alcobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 453 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 454 | 	return setconfig(self, args, ALsetwidth); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 455 | } | 
 | 456 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 457 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 458 | alc_getwidth (alcobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 459 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 460 | 	return getconfig(self, args, ALgetwidth);	 | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 461 | } | 
 | 462 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 463 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 464 | alc_getchannels (alcobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 465 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 466 | 	return getconfig(self, args, ALgetchannels);	 | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 467 | } | 
 | 468 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 469 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 470 | alc_setchannels (alcobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 471 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 472 | 	return setconfig(self, args, ALsetchannels); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 473 | } | 
 | 474 |  | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 475 | #ifdef AL_405 | 
 | 476 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 477 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 478 | alc_getsampfmt (alcobject *self, PyObject *args) | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 479 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 480 | 	return getconfig(self, args, ALgetsampfmt);	 | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 481 | } | 
 | 482 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 483 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 484 | alc_setsampfmt (alcobject *self, PyObject *args) | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 485 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 486 | 	return setconfig(self, args, ALsetsampfmt); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 487 | } | 
 | 488 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 489 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 490 | alc_getfloatmax(alcobject *self, PyObject *args) | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 491 | { | 
 | 492 | 	double arg; | 
 | 493 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 494 | 	if (!PyArg_ParseTuple(args, ":GetFloatMax")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 495 | 		return 0; | 
 | 496 | 	if ((arg = ALgetfloatmax(self->config)) == 0) | 
 | 497 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 498 | 	return PyFloat_FromDouble(arg); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 499 | } | 
 | 500 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 501 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 502 | alc_setfloatmax(alcobject *self, PyObject *args) | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 503 | { | 
 | 504 | 	double arg; | 
 | 505 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 506 | 	if (!PyArg_ParseTuple(args, "d:SetFloatMax", &arg)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 507 | 		return 0; | 
 | 508 | 	if (ALsetfloatmax(self->config, arg) == -1) | 
 | 509 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 510 | 	Py_INCREF(Py_None); | 
 | 511 | 	return Py_None; | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 512 | } | 
 | 513 | #endif /* AL_405 */ | 
 | 514 | 	 | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 515 | static struct PyMethodDef alc_methods[] = { | 
 | 516 | #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__}, | 
 | 529 | #endif /* AL_NO_ELEM */ | 
 | 530 | 	{"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 Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 536 | #ifdef AL_405 | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 537 | 	{"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 Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 541 | #endif /* AL_405 */ | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 542 |  | 
 | 543 | 	{NULL,		NULL}		/* sentinel */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 544 | }; | 
 | 545 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 546 | /* ---------- */ | 
 | 547 |  | 
 | 548 |  | 
 | 549 | static PyObject * | 
 | 550 | newalcobject(ALconfig config) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 551 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 552 | 	alcobject *self; | 
 | 553 | 	 | 
| Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 554 | 	self = PyObject_New(alcobject, &Alctype); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 555 | 	if (self == NULL) | 
 | 556 | 		return NULL; | 
 | 557 | 	/* XXXX Add your own initializers here */ | 
 | 558 | 	self->config = config; | 
 | 559 | 	return (PyObject *) self; | 
 | 560 | } | 
 | 561 |  | 
 | 562 |  | 
 | 563 | static void | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 564 | alc_dealloc(alcobject *self) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 565 | { | 
 | 566 | 	/* XXXX Add your own cleanup code here */ | 
 | 567 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
 | 568 | 	(void) alFreeConfig(self->config);	/* ignore errors */ | 
 | 569 | #else | 
 | 570 | 	(void) ALfreeconfig(self->config);	/* ignore errors */ | 
 | 571 | #endif | 
| Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 572 | 	PyObject_Del(self); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 573 | } | 
 | 574 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 575 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 576 | alc_getattr(alcobject *self, char *name) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 577 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 578 | 	/* XXXX Add your own getattr code here */ | 
 | 579 | 	return Py_FindMethod(alc_methods, (PyObject *)self, name); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 580 | } | 
 | 581 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 582 | PyDoc_STRVAR(Alctype__doc__, ""); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 583 |  | 
 | 584 | static PyTypeObject Alctype = { | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 585 | 	PyObject_HEAD_INIT(&PyType_Type) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 586 | 	0,				/*ob_size*/ | 
| Guido van Rossum | 1464839 | 2001-12-08 18:02:58 +0000 | [diff] [blame] | 587 | 	"al.config",			/*tp_name*/ | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 588 | 	sizeof(alcobject),		/*tp_basicsize*/ | 
 | 589 | 	0,				/*tp_itemsize*/ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 590 | 	/* methods */ | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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*/ | 
 | 603 |  | 
 | 604 | 	/* Space for future expansion */ | 
 | 605 | 	0L,0L,0L,0L, | 
 | 606 | 	Alctype__doc__ /* Documentation string */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 607 | }; | 
 | 608 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 609 | /* End of code for config objects */ | 
 | 610 | /* ---------------------------------------------------------------- */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 611 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 612 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 613 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 614 | PyDoc_STRVAR(alp_SetConfig__doc__, | 
 | 615 | "alSetConfig: set the ALconfig of an audio ALport."); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 616 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 617 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 618 | alp_SetConfig(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 619 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 620 | 	alcobject *config; | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 621 | 	if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 622 | 		return NULL; | 
 | 623 | 	if (alSetConfig(self->port, config->config) < 0) | 
 | 624 | 		return NULL; | 
 | 625 | 	Py_INCREF(Py_None); | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 626 | 	return Py_None; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 627 | } | 
 | 628 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 629 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 630 | PyDoc_STRVAR(alp_GetConfig__doc__, | 
 | 631 | "alGetConfig: get the ALconfig of an audio ALport."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 632 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 633 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 634 | alp_GetConfig(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 635 | { | 
 | 636 | 	ALconfig config; | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 637 | 	if (!PyArg_ParseTuple(args, ":GetConfig")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 638 | 		return NULL; | 
 | 639 | 	if ((config = alGetConfig(self->port)) == NULL) | 
 | 640 | 		return NULL; | 
 | 641 | 	return newalcobject(config); | 
 | 642 | } | 
 | 643 |  | 
 | 644 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 645 | PyDoc_STRVAR(alp_GetResource__doc__, | 
 | 646 | "alGetResource: get the resource associated with an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 647 |  | 
 | 648 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 649 | alp_GetResource(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 650 | { | 
 | 651 | 	int resource; | 
 | 652 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 653 | 	if (!PyArg_ParseTuple(args, ":GetResource")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 654 | 		return NULL; | 
 | 655 | 	if ((resource = alGetResource(self->port)) == 0) | 
 | 656 | 		return NULL; | 
 | 657 | 	return PyInt_FromLong((long) resource); | 
 | 658 | } | 
 | 659 |  | 
 | 660 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 661 | PyDoc_STRVAR(alp_GetFD__doc__, | 
 | 662 | "alGetFD: get the file descriptor for an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 663 |  | 
 | 664 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 665 | alp_GetFD(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 666 | { | 
 | 667 | 	int fd; | 
 | 668 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 669 | 	if (!PyArg_ParseTuple(args, ":GetFD")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 670 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 671 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 672 | 	if ((fd = alGetFD(self->port)) < 0) | 
 | 673 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 674 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 675 | 	return PyInt_FromLong((long) fd); | 
 | 676 | } | 
 | 677 |  | 
 | 678 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 679 | PyDoc_STRVAR(alp_GetFilled__doc__, | 
 | 680 | "alGetFilled: return the number of filled sample frames in " | 
 | 681 | "an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 682 |  | 
 | 683 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 684 | alp_GetFilled(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 685 | { | 
 | 686 | 	int filled; | 
 | 687 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 688 | 	if (!PyArg_ParseTuple(args, ":GetFilled")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 689 | 		return NULL; | 
 | 690 | 	if ((filled = alGetFilled(self->port)) < 0) | 
 | 691 | 		return NULL; | 
 | 692 | 	return PyInt_FromLong((long) filled); | 
 | 693 | } | 
 | 694 |  | 
 | 695 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 696 | PyDoc_STRVAR(alp_GetFillable__doc__, | 
 | 697 | "alGetFillable: report the number of unfilled sample frames " | 
 | 698 | "in an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 699 |  | 
 | 700 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 701 | alp_GetFillable(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 702 | { | 
 | 703 | 	int fillable; | 
 | 704 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 705 | 	if (!PyArg_ParseTuple(args, ":GetFillable")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 706 | 		return NULL; | 
 | 707 | 	if ((fillable = alGetFillable(self->port)) < 0) | 
 | 708 | 		return NULL; | 
 | 709 | 	return PyInt_FromLong((long) fillable); | 
 | 710 | } | 
 | 711 |  | 
 | 712 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 713 | PyDoc_STRVAR(alp_ReadFrames__doc__, | 
 | 714 | "alReadFrames: read sample frames from an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 715 |  | 
 | 716 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 717 | alp_ReadFrames(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 718 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 719 | 	int framecount; | 
 | 720 | 	PyObject *v; | 
 | 721 | 	int size; | 
 | 722 | 	int ch; | 
 | 723 | 	ALconfig c; | 
 | 724 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 725 | 	if (!PyArg_ParseTuple(args, "i:ReadFrames", &framecount)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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; | 
 | 771 |  | 
 | 772 | 	Py_BEGIN_ALLOW_THREADS | 
 | 773 | 	alReadFrames(self->port, (void *) PyString_AS_STRING(v), framecount); | 
 | 774 | 	Py_END_ALLOW_THREADS | 
 | 775 |  | 
 | 776 | 	return v; | 
 | 777 | } | 
 | 778 |  | 
 | 779 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 780 | PyDoc_STRVAR(alp_DiscardFrames__doc__, | 
 | 781 | "alDiscardFrames: discard audio from an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 782 |  | 
 | 783 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 784 | alp_DiscardFrames(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 785 | { | 
 | 786 | 	int framecount; | 
 | 787 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 788 | 	if (!PyArg_ParseTuple(args, "i:DiscardFrames", &framecount)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 789 | 		return NULL; | 
 | 790 |  | 
 | 791 | 	Py_BEGIN_ALLOW_THREADS | 
 | 792 | 	framecount = alDiscardFrames(self->port, framecount); | 
 | 793 | 	Py_END_ALLOW_THREADS | 
 | 794 |  | 
 | 795 | 	if (framecount < 0) | 
 | 796 | 		return NULL; | 
 | 797 |  | 
 | 798 | 	return PyInt_FromLong((long) framecount); | 
 | 799 | } | 
 | 800 |  | 
 | 801 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 802 | PyDoc_STRVAR(alp_ZeroFrames__doc__, | 
 | 803 | "alZeroFrames: write zero-valued sample frames to an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 804 |  | 
 | 805 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 806 | alp_ZeroFrames(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 807 | { | 
 | 808 | 	int framecount; | 
 | 809 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 810 | 	if (!PyArg_ParseTuple(args, "i:ZeroFrames", &framecount)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 811 | 		return NULL; | 
 | 812 |  | 
 | 813 | 	if (framecount < 0) { | 
 | 814 | 		PyErr_SetString(ErrorObject, "negative framecount"); | 
 | 815 | 		return NULL; | 
 | 816 | 	} | 
 | 817 |  | 
 | 818 | 	Py_BEGIN_ALLOW_THREADS | 
 | 819 | 	alZeroFrames(self->port, framecount); | 
 | 820 | 	Py_END_ALLOW_THREADS | 
 | 821 |  | 
 | 822 | 	Py_INCREF(Py_None); | 
 | 823 | 	return Py_None; | 
 | 824 | } | 
 | 825 |  | 
 | 826 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 827 | PyDoc_STRVAR(alp_SetFillPoint__doc__, | 
 | 828 | "alSetFillPoint: set low- or high-water mark for an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 829 |  | 
 | 830 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 831 | alp_SetFillPoint(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 832 | { | 
 | 833 | 	int fillpoint; | 
 | 834 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 835 | 	if (!PyArg_ParseTuple(args, "i:SetFillPoint", &fillpoint)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 836 | 		return NULL; | 
 | 837 |  | 
 | 838 | 	if (alSetFillPoint(self->port, fillpoint) < 0) | 
 | 839 | 		return NULL; | 
 | 840 |  | 
 | 841 | 	Py_INCREF(Py_None); | 
 | 842 | 	return Py_None; | 
 | 843 | } | 
 | 844 |  | 
 | 845 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 846 | PyDoc_STRVAR(alp_GetFillPoint__doc__, | 
 | 847 | "alGetFillPoint: get low- or high-water mark for an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 848 |  | 
 | 849 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 850 | alp_GetFillPoint(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 851 | { | 
 | 852 | 	int fillpoint; | 
 | 853 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 854 | 	if (!PyArg_ParseTuple(args, ":GetFillPoint")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 855 | 		return NULL; | 
 | 856 |  | 
 | 857 | 	if ((fillpoint = alGetFillPoint(self->port)) < 0) | 
 | 858 | 		return NULL; | 
 | 859 |  | 
 | 860 | 	return PyInt_FromLong((long) fillpoint); | 
 | 861 | } | 
 | 862 |  | 
 | 863 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 864 | PyDoc_STRVAR(alp_GetFrameNumber__doc__, | 
 | 865 | "alGetFrameNumber: get the absolute sample frame number " | 
 | 866 | "associated with a port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 867 |  | 
 | 868 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 869 | alp_GetFrameNumber(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 870 | { | 
 | 871 | 	stamp_t fnum; | 
 | 872 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 873 | 	if (!PyArg_ParseTuple(args, ":GetFrameNumber")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 874 | 		return NULL; | 
 | 875 |  | 
 | 876 | 	if (alGetFrameNumber(self->port, &fnum) < 0) | 
 | 877 | 		return NULL; | 
 | 878 |  | 
 | 879 | 	return PyLong_FromLongLong((long long) fnum); | 
 | 880 | } | 
 | 881 |  | 
 | 882 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 883 | PyDoc_STRVAR(alp_GetFrameTime__doc__, | 
 | 884 | "alGetFrameTime: get the time at which a sample frame came " | 
 | 885 | "in or will go out."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 886 |  | 
 | 887 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 888 | alp_GetFrameTime(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 889 | { | 
 | 890 | 	stamp_t fnum, time; | 
 | 891 | 	PyObject *ret, *v0, *v1; | 
 | 892 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 893 | 	if (!PyArg_ParseTuple(args, ":GetFrameTime")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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 | 	} | 
| Raymond Hettinger | 8ae4689 | 2003-10-12 19:09:37 +0000 | [diff] [blame] | 904 | 	ret = PyTuple_Pack(2, v0, v1); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 905 | 	Py_DECREF(v0); | 
 | 906 | 	Py_DECREF(v1); | 
 | 907 | 	return ret; | 
 | 908 | } | 
 | 909 |  | 
 | 910 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 911 | PyDoc_STRVAR(alp_WriteFrames__doc__, | 
 | 912 | "alWriteFrames: write sample frames to an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 913 |  | 
 | 914 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 915 | alp_WriteFrames(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 916 | { | 
 | 917 | 	char *samples; | 
 | 918 | 	int length; | 
 | 919 | 	int size, ch; | 
 | 920 | 	ALconfig c; | 
 | 921 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 922 | 	if (!PyArg_ParseTuple(args, "s#:WriteFrames", &samples, &length)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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 | 	} | 
 | 966 |  | 
 | 967 | 	Py_BEGIN_ALLOW_THREADS | 
 | 968 | 	alWriteFrames(self->port, (void *) samples, length / size); | 
 | 969 | 	Py_END_ALLOW_THREADS | 
 | 970 |  | 
 | 971 | 	Py_INCREF(Py_None); | 
 | 972 | 	return Py_None; | 
 | 973 | } | 
 | 974 |  | 
 | 975 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 976 | PyDoc_STRVAR(alp_ClosePort__doc__, "alClosePort: close an audio port."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 977 |  | 
 | 978 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 979 | alp_ClosePort(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 980 | { | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 981 | 	if (!PyArg_ParseTuple(args, ":ClosePort")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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; | 
 | 988 | } | 
 | 989 |  | 
 | 990 | #endif /* AL_NO_ELEM */ | 
 | 991 |  | 
 | 992 | #ifdef OLD_INTERFACE | 
 | 993 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 994 | alp_closeport(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 995 | { | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 996 | 	if (!PyArg_ParseTuple(args, ":ClosePort")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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 Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1003 | } | 
 | 1004 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1005 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1006 | alp_getfd(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1007 | { | 
 | 1008 | 	int fd; | 
 | 1009 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1010 | 	if (!PyArg_ParseTuple(args, ":GetFD")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1011 | 		return NULL; | 
 | 1012 | 	if ((fd = ALgetfd(self-> port)) == -1) | 
 | 1013 | 		return NULL; | 
 | 1014 | 	return PyInt_FromLong(fd); | 
 | 1015 | } | 
 | 1016 |  | 
 | 1017 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1018 | alp_getfilled(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1019 | { | 
 | 1020 | 	long count; | 
 | 1021 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1022 | 	if (!PyArg_ParseTuple(args, ":GetFilled")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1023 | 		return NULL; | 
 | 1024 | 	if ((count = ALgetfilled(self-> port)) == -1) | 
 | 1025 | 		return NULL; | 
 | 1026 | 	return PyInt_FromLong(count); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1027 | } | 
 | 1028 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1029 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1030 | alp_getfillable(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1031 | { | 
 | 1032 | 	long count; | 
 | 1033 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1034 | 	if (!PyArg_ParseTuple(args, ":GetFillable")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1035 | 		return NULL; | 
 | 1036 | 	if ((count = ALgetfillable(self-> port)) == -1) | 
 | 1037 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1038 | 	return PyInt_FromLong (count); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1039 | } | 
 | 1040 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1041 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1042 | alp_readsamps(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1043 | { | 
 | 1044 | 	long count; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1045 | 	PyObject *v; | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1046 | 	ALconfig c; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1047 | 	int width; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1048 | 	int ret; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1049 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1050 | 	if (!PyArg_ParseTuple(args, "l:readsamps", &count)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1051 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1052 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1053 | 	if (count <= 0) { | 
 | 1054 | 		PyErr_SetString(ErrorObject, "al.readsamps : arg <= 0"); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1055 | 		return NULL; | 
 | 1056 | 	} | 
 | 1057 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1058 | 	c = ALgetconfig(self->port); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1059 | #ifdef AL_405 | 
 | 1060 | 	width = ALgetsampfmt(c); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1061 | 	if (width == AL_SAMPFMT_FLOAT) | 
 | 1062 | 		width = sizeof(float); | 
 | 1063 | 	else if (width == AL_SAMPFMT_DOUBLE) | 
 | 1064 | 		width = sizeof(double); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1065 | 	else | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1066 | 		width = ALgetwidth(c); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1067 | #else | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1068 | 	width = ALgetwidth(c); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1069 | #endif /* AL_405 */ | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1070 | 	ALfreeconfig(c); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1071 | 	v = PyString_FromStringAndSize((char *)NULL, width * count); | 
 | 1072 | 	if (v == NULL) | 
 | 1073 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1074 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1075 | 	Py_BEGIN_ALLOW_THREADS | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1076 | 	ret = ALreadsamps(self->port, (void *) PyString_AsString(v), count); | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1077 | 	Py_END_ALLOW_THREADS | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1078 | 	if (ret == -1) { | 
 | 1079 | 		Py_DECREF(v); | 
 | 1080 | 		return NULL; | 
 | 1081 | 	} | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1082 |  | 
 | 1083 | 	return (v); | 
 | 1084 | } | 
 | 1085 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1086 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1087 | alp_writesamps(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1088 | { | 
| Guido van Rossum | fc58e58 | 1992-01-27 16:45:55 +0000 | [diff] [blame] | 1089 | 	char *buf; | 
 | 1090 | 	int size, width; | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1091 | 	ALconfig c; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1092 | 	int ret; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1093 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1094 | 	if (!PyArg_ParseTuple(args, "s#:writesamps", &buf, &size)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1095 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1096 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1097 | 	c = ALgetconfig(self->port); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1098 | #ifdef AL_405 | 
 | 1099 | 	width = ALgetsampfmt(c); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1100 | 	if (width == AL_SAMPFMT_FLOAT) | 
 | 1101 | 		width = sizeof(float); | 
 | 1102 | 	else if (width == AL_SAMPFMT_DOUBLE) | 
 | 1103 | 		width = sizeof(double); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1104 | 	else | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1105 | 		width = ALgetwidth(c); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1106 | #else | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1107 | 	width = ALgetwidth(c); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1108 | #endif /* AL_405 */ | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1109 | 	ALfreeconfig(c); | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1110 | 	Py_BEGIN_ALLOW_THREADS | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1111 | 	ret = ALwritesamps (self->port, (void *) buf, (long) size / width); | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1112 | 	Py_END_ALLOW_THREADS | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1113 | 	if (ret == -1) | 
 | 1114 | 		return NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1115 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1116 | 	Py_INCREF(Py_None); | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1117 | 	return Py_None; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1118 | } | 
 | 1119 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1120 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1121 | alp_getfillpoint(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1122 | { | 
 | 1123 | 	long count; | 
 | 1124 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1125 | 	if (!PyArg_ParseTuple(args, ":GetFillPoint")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1126 | 		return NULL; | 
 | 1127 | 	if ((count = ALgetfillpoint(self->port)) == -1) | 
 | 1128 | 		return NULL; | 
 | 1129 | 	return PyInt_FromLong(count); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1130 | } | 
 | 1131 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1132 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1133 | alp_setfillpoint(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1134 | { | 
 | 1135 | 	long count; | 
 | 1136 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1137 | 	if (!PyArg_ParseTuple(args, "l:SetFillPoint", &count)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1138 | 		return NULL; | 
 | 1139 | 	if (ALsetfillpoint(self->port, count) == -1) | 
 | 1140 | 		return NULL; | 
 | 1141 | 	Py_INCREF(Py_None); | 
 | 1142 | 	return Py_None; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1143 | } | 
 | 1144 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1145 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1146 | alp_setconfig(alpobject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1147 | { | 
 | 1148 | 	alcobject *config; | 
 | 1149 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1150 | 	if (!PyArg_ParseTuple(args, "O!:SetConfig", &Alctype, &config)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1151 | 		return NULL; | 
 | 1152 | 	if (ALsetconfig(self->port, config->config) == -1) | 
 | 1153 | 		return NULL; | 
 | 1154 | 	Py_INCREF(Py_None); | 
 | 1155 | 	return Py_None; | 
 | 1156 | } | 
 | 1157 |  | 
 | 1158 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1159 | alp_getconfig(alpobject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1160 | { | 
 | 1161 | 	ALconfig config; | 
 | 1162 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1163 | 	if (!PyArg_ParseTuple(args, ":GetConfig")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1164 | 		return NULL; | 
 | 1165 | 	config = ALgetconfig(self->port); | 
 | 1166 | 	if (config == NULL) | 
 | 1167 | 		return NULL; | 
 | 1168 | 	return newalcobject(config); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1169 | } | 
 | 1170 |  | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1171 | #ifdef AL_405 | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1172 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1173 | alp_getstatus(alpobject *self, PyObject *args) | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1174 | { | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1175 | 	PyObject *list, *v; | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1176 | 	long *PVbuffer; | 
 | 1177 | 	long length; | 
 | 1178 | 	int i; | 
 | 1179 | 	 | 
| Martin v. Löwis | 0bd292f | 2001-11-03 10:48:43 +0000 | [diff] [blame] | 1180 | 	if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &list)) | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1181 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1182 | 	length = PyList_Size(list); | 
 | 1183 | 	PVbuffer = PyMem_NEW(long, length); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1184 | 	if (PVbuffer == NULL) | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1185 | 		return PyErr_NoMemory(); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1186 | 	for (i = 0; i < length; i++) { | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1187 | 		v = PyList_GetItem(list, i); | 
 | 1188 | 		if (!PyInt_Check(v)) { | 
 | 1189 | 			PyMem_DEL(PVbuffer); | 
 | 1190 | 			PyErr_BadArgument(); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1191 | 			return NULL; | 
 | 1192 | 		} | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1193 | 		PVbuffer[i] = PyInt_AsLong(v); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1194 | 	} | 
 | 1195 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1196 | 	if (ALgetstatus(self->port, PVbuffer, length) == -1) | 
 | 1197 | 		return NULL; | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1198 |  | 
 | 1199 | 	for (i = 0; i < length; i++) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1200 | 		PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1201 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1202 | 	PyMem_DEL(PVbuffer); | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1203 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1204 | 	Py_INCREF(Py_None); | 
 | 1205 | 	return Py_None; | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1206 | } | 
 | 1207 | #endif /* AL_405 */ | 
 | 1208 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1209 | #endif /* OLD_INTERFACE */ | 
 | 1210 |  | 
 | 1211 | static struct PyMethodDef alp_methods[] = { | 
 | 1212 | #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__}, | 
 | 1228 | #endif /* AL_NO_ELEM */ | 
 | 1229 | #ifdef OLD_INTERFACE | 
 | 1230 | 	{"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 Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1241 | #ifdef AL_405 | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1242 | 	{"getstatus",		(PyCFunction)alp_getstatus,	METH_VARARGS}, | 
| Jack Jansen | e8a3c28 | 1993-02-10 14:10:56 +0000 | [diff] [blame] | 1243 | #endif /* AL_405 */	     | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1244 | #endif /* OLD_INTERFACE */ | 
 | 1245 |   | 
 | 1246 | 	{NULL,		NULL}		/* sentinel */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1247 | }; | 
 | 1248 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1249 | /* ---------- */ | 
 | 1250 |  | 
 | 1251 |  | 
 | 1252 | static PyObject * | 
 | 1253 | newalpobject(ALport port) | 
 | 1254 | { | 
 | 1255 | 	alpobject *self; | 
 | 1256 | 	 | 
| Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 1257 | 	self = PyObject_New(alpobject, &Alptype); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1258 | 	if (self == NULL) | 
 | 1259 | 		return NULL; | 
 | 1260 | 	/* XXXX Add your own initializers here */ | 
 | 1261 | 	self->port = port; | 
 | 1262 | 	return (PyObject *) self; | 
 | 1263 | } | 
 | 1264 |  | 
 | 1265 |  | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1266 | static void | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1267 | alp_dealloc(alpobject *self) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1268 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1269 | 	/* XXXX Add your own cleanup code here */ | 
 | 1270 | 	if (self->port) { | 
 | 1271 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
 | 1272 | 		alClosePort(self->port); | 
 | 1273 | #else | 
 | 1274 | 		ALcloseport(self->port); | 
 | 1275 | #endif | 
 | 1276 | 	} | 
| Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 1277 | 	PyObject_Del(self); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1278 | } | 
 | 1279 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1280 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1281 | alp_getattr(alpobject *self, char *name) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1282 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1283 | 	/* 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 Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1289 | } | 
 | 1290 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1291 | PyDoc_STRVAR(Alptype__doc__, ""); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1292 |  | 
 | 1293 | static PyTypeObject Alptype = { | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1294 | 	PyObject_HEAD_INIT(&PyType_Type) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1295 | 	0,				/*ob_size*/ | 
| Guido van Rossum | 1464839 | 2001-12-08 18:02:58 +0000 | [diff] [blame] | 1296 | 	"al.port",			/*tp_name*/ | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1297 | 	sizeof(alpobject),		/*tp_basicsize*/ | 
 | 1298 | 	0,				/*tp_itemsize*/ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1299 | 	/* methods */ | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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*/ | 
 | 1312 |  | 
 | 1313 | 	/* Space for future expansion */ | 
 | 1314 | 	0L,0L,0L,0L, | 
 | 1315 | 	Alptype__doc__ /* Documentation string */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1316 | }; | 
 | 1317 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1318 | /* End of code for port objects */ | 
 | 1319 | /* -------------------------------------------------------- */ | 
 | 1320 |  | 
 | 1321 |  | 
 | 1322 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
 | 1323 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1324 | PyDoc_STRVAR(al_NewConfig__doc__, | 
 | 1325 | "alNewConfig: create and initialize an audio ALconfig structure."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1326 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1327 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1328 | al_NewConfig(PyObject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1329 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1330 | 	ALconfig config; | 
 | 1331 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1332 | 	if (!PyArg_ParseTuple(args, ":NewConfig")) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1333 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1334 | 	if ((config = alNewConfig()) == NULL) | 
 | 1335 | 		return NULL; | 
 | 1336 | 	return newalcobject(config); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1337 | } | 
 | 1338 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1339 | PyDoc_STRVAR(al_OpenPort__doc__, | 
 | 1340 | "alOpenPort: open an audio port."); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1341 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1342 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1343 | al_OpenPort(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1344 | { | 
 | 1345 | 	ALport port; | 
 | 1346 | 	char *name, *dir; | 
 | 1347 | 	alcobject *config = NULL; | 
 | 1348 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1349 | 	if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1350 | 		return NULL; | 
 | 1351 | 	if ((port = alOpenPort(name, dir, config ? config->config : NULL)) == NULL) | 
 | 1352 | 		return NULL; | 
 | 1353 | 	return newalpobject(port); | 
 | 1354 | } | 
 | 1355 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1356 | PyDoc_STRVAR(al_Connect__doc__, | 
 | 1357 | "alConnect: connect two audio I/O resources."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1358 |  | 
 | 1359 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1360 | al_Connect(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1361 | { | 
 | 1362 | 	int source, dest, nprops = 0, id, i; | 
 | 1363 | 	ALpv *props = NULL; | 
 | 1364 | 	ALparamInfo *propinfo = NULL; | 
 | 1365 | 	PyObject *propobj = NULL; | 
 | 1366 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1367 | 	if (!PyArg_ParseTuple(args, "ii|O!:Connect", &source, &dest, &PyList_Type, &propobj)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1368 | 		return NULL; | 
 | 1369 | 	if (propobj != NULL) { | 
 | 1370 | 		nprops = python2params(source, dest, propobj, &props, &propinfo); | 
 | 1371 | 		if (nprops < 0) | 
 | 1372 | 			return NULL; | 
 | 1373 | 	} | 
 | 1374 |  | 
 | 1375 | 	id = alConnect(source, dest, props, nprops); | 
 | 1376 |  | 
 | 1377 | 	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 | 	} | 
 | 1389 |  | 
 | 1390 | 	if (id < 0) | 
 | 1391 | 		return NULL; | 
 | 1392 | 	return PyInt_FromLong((long) id); | 
 | 1393 | } | 
 | 1394 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1395 | PyDoc_STRVAR(al_Disconnect__doc__, | 
 | 1396 | "alDisconnect: delete a connection between two audio I/O resources."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1397 |  | 
 | 1398 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1399 | al_Disconnect(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1400 | { | 
 | 1401 | 	int res; | 
 | 1402 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1403 | 	if (!PyArg_ParseTuple(args, "i:Disconnect", &res)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1404 | 		return NULL; | 
 | 1405 | 	if (alDisconnect(res) < 0) | 
 | 1406 | 		return NULL; | 
 | 1407 | 	Py_INCREF(Py_None); | 
 | 1408 | 	return Py_None; | 
 | 1409 | } | 
 | 1410 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1411 | PyDoc_STRVAR(al_GetParams__doc__, | 
 | 1412 | "alGetParams: get the values of audio resource parameters."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1413 |  | 
 | 1414 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1415 | al_GetParams(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1416 | { | 
 | 1417 | 	int resource; | 
 | 1418 | 	PyObject *pvslist, *item = NULL, *v = NULL; | 
 | 1419 | 	ALpv *pvs; | 
 | 1420 | 	int i, j, npvs; | 
 | 1421 | 	ALparamInfo *pinfo; | 
 | 1422 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1423 | 	if (!PyArg_ParseTuple(args, "iO!:GetParams", &resource, &PyList_Type, &pvslist)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 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 | 	v = PyList_New(npvs); | 
 | 1486 | 	for (i = 0; i < npvs; i++) { | 
 | 1487 | 		if (pvs[i].sizeOut < 0) { | 
 | 1488 | 			char buf[32]; | 
| Tim Peters | 75cdad5 | 2001-11-28 22:07:30 +0000 | [diff] [blame] | 1489 | 			PyOS_snprintf(buf, sizeof(buf), | 
 | 1490 | 				      "problem with param %d", i); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1491 | 			PyErr_SetString(ErrorObject, buf); | 
 | 1492 | 			goto error; | 
 | 1493 | 		} | 
 | 1494 | 		switch (pinfo[i].valueType) { | 
 | 1495 | 		case AL_NO_VAL: | 
 | 1496 | 			item = Py_None; | 
 | 1497 | 			Py_INCREF(item); | 
 | 1498 | 			break; | 
 | 1499 | 		case AL_STRING_VAL: | 
 | 1500 | 			item = PyString_FromString(pvs[i].value.ptr); | 
 | 1501 | 			PyMem_DEL(pvs[i].value.ptr); | 
 | 1502 | 			break; | 
 | 1503 | 		case AL_MATRIX_VAL: | 
 | 1504 | 			/* XXXX this is not right */ | 
 | 1505 | 			pvs[i].sizeOut *= pvs[i].size2Out; | 
 | 1506 | 			/* fall through */ | 
 | 1507 | 		case AL_SET_VAL: | 
 | 1508 | 		case AL_VECTOR_VAL: | 
 | 1509 | 			item = PyList_New(pvs[i].sizeOut); | 
 | 1510 | 			for (j = 0; j < pvs[i].sizeOut; j++) { | 
 | 1511 | 				switch (pinfo[i].elementType) { | 
 | 1512 | 				case AL_INT32_ELEM: | 
 | 1513 | 				case AL_RESOURCE_ELEM: | 
 | 1514 | 				case AL_ENUM_ELEM: | 
 | 1515 | 					PyList_SetItem(item, j, PyInt_FromLong((long) ((int *) pvs[i].value.ptr)[j])); | 
 | 1516 | 					break; | 
 | 1517 | 				case AL_INT64_ELEM: | 
 | 1518 | 					PyList_SetItem(item, j, PyLong_FromLongLong(((long long *) pvs[i].value.ptr)[j])); | 
 | 1519 | 					break; | 
 | 1520 | 				case AL_FIXED_ELEM: | 
 | 1521 | 					PyList_SetItem(item, j, PyFloat_FromDouble(alFixedToDouble(((long long *) pvs[i].value.ptr)[j]))); | 
 | 1522 | 					break; | 
 | 1523 | 				default: | 
 | 1524 | 					PyErr_SetString(ErrorObject, "internal error"); | 
 | 1525 | 					goto error; | 
 | 1526 | 				} | 
 | 1527 | 			} | 
 | 1528 | 			PyMem_DEL(pvs[i].value.ptr); | 
 | 1529 | 			break; | 
 | 1530 | 		case AL_SCALAR_VAL: | 
 | 1531 | 			item = param2python(resource, pvs[i].param, pvs[i].value, &pinfo[i]); | 
 | 1532 | 			break; | 
 | 1533 | 		} | 
 | 1534 | 		if (PyErr_Occurred() || | 
 | 1535 | 		    PyList_SetItem(v, i, Py_BuildValue("(iO)", pvs[i].param, | 
 | 1536 | 						       item)) < 0 || | 
 | 1537 | 		    PyErr_Occurred()) | 
 | 1538 | 			goto error; | 
 | 1539 | 		Py_DECREF(item); | 
 | 1540 | 	} | 
 | 1541 | 	PyMem_DEL(pvs); | 
 | 1542 | 	PyMem_DEL(pinfo); | 
 | 1543 | 	return v; | 
 | 1544 |  | 
 | 1545 |   error: | 
 | 1546 | 	Py_XDECREF(v); | 
 | 1547 | 	Py_XDECREF(item); | 
 | 1548 | 	if (pvs) | 
 | 1549 | 		PyMem_DEL(pvs); | 
 | 1550 | 	if (pinfo) | 
 | 1551 | 		PyMem_DEL(pinfo); | 
 | 1552 | 	return NULL; | 
 | 1553 | } | 
 | 1554 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1555 | PyDoc_STRVAR(al_SetParams__doc__, | 
 | 1556 | "alSetParams: set the values of audio resource parameters."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1557 |  | 
 | 1558 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1559 | al_SetParams(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1560 | { | 
 | 1561 | 	int resource; | 
| Neal Norwitz | ddb4f62 | 2003-03-30 21:49:18 +0000 | [diff] [blame] | 1562 | 	PyObject *pvslist; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1563 | 	ALpv *pvs; | 
 | 1564 | 	ALparamInfo *pinfo; | 
 | 1565 | 	int npvs, i; | 
 | 1566 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1567 | 	if (!PyArg_ParseTuple(args, "iO!:SetParams", &resource, &PyList_Type, &pvslist)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1568 | 		return NULL; | 
 | 1569 | 	npvs = python2params(resource, -1, pvslist, &pvs, &pinfo); | 
 | 1570 | 	if (npvs < 0) | 
 | 1571 | 		return NULL; | 
 | 1572 |  | 
 | 1573 | 	if (alSetParams(resource, pvs, npvs) < 0) | 
 | 1574 | 		goto error; | 
 | 1575 |  | 
 | 1576 | 	/* cleanup */ | 
 | 1577 | 	for (i = 0; i < npvs; i++) { | 
 | 1578 | 		switch (pinfo[i].valueType) { | 
 | 1579 | 		case AL_SET_VAL: | 
 | 1580 | 		case AL_VECTOR_VAL: | 
 | 1581 | 			PyMem_DEL(pvs[i].value.ptr); | 
 | 1582 | 			break; | 
 | 1583 | 		} | 
 | 1584 | 	} | 
 | 1585 | 	PyMem_DEL(pvs); | 
 | 1586 | 	PyMem_DEL(pinfo); | 
 | 1587 |  | 
 | 1588 | 	Py_INCREF(Py_None); | 
 | 1589 | 	return Py_None; | 
 | 1590 |  | 
 | 1591 |   error: | 
 | 1592 | 	/* XXXX we should clean up everything */ | 
 | 1593 | 	if (pvs) | 
 | 1594 | 		PyMem_DEL(pvs); | 
 | 1595 | 	if (pinfo) | 
 | 1596 | 		PyMem_DEL(pinfo); | 
 | 1597 | 	return NULL; | 
 | 1598 | } | 
 | 1599 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1600 | PyDoc_STRVAR(al_QueryValues__doc__, | 
 | 1601 | "alQueryValues: get the set of possible values for a parameter."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1602 |  | 
 | 1603 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1604 | al_QueryValues(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1605 | { | 
 | 1606 | 	int resource, param; | 
 | 1607 | 	ALvalue *return_set = NULL; | 
 | 1608 | 	int setsize = 32, qualsize = 0, nvals, i; | 
 | 1609 | 	ALpv *quals = NULL; | 
 | 1610 | 	ALparamInfo pinfo; | 
 | 1611 | 	ALparamInfo *qualinfo = NULL; | 
 | 1612 | 	PyObject *qualobj = NULL; | 
 | 1613 | 	PyObject *res = NULL, *item; | 
 | 1614 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1615 | 	if (!PyArg_ParseTuple(args, "ii|O!:QueryValues", &resource, ¶m, | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1616 | 			      &PyList_Type, &qualobj)) | 
 | 1617 | 		return NULL; | 
 | 1618 | 	if (qualobj != NULL) { | 
 | 1619 | 		qualsize = python2params(resource, param, qualobj, &quals, &qualinfo); | 
 | 1620 | 		if (qualsize < 0) | 
 | 1621 | 			return NULL; | 
 | 1622 | 	} | 
 | 1623 | 	setsize = 32; | 
 | 1624 | 	return_set = PyMem_NEW(ALvalue, setsize); | 
 | 1625 | 	if (return_set == NULL) { | 
 | 1626 | 		PyErr_NoMemory(); | 
 | 1627 | 		goto cleanup; | 
 | 1628 | 	} | 
 | 1629 |  | 
 | 1630 |   retry: | 
 | 1631 | 	nvals = alQueryValues(resource, param, return_set, setsize, quals, qualsize); | 
 | 1632 | 	if (nvals < 0) | 
 | 1633 | 		goto cleanup; | 
 | 1634 | 	if (nvals > setsize) { | 
 | 1635 | 		setsize = nvals; | 
 | 1636 | 		PyMem_RESIZE(return_set, ALvalue, setsize); | 
 | 1637 | 		if (return_set == NULL) { | 
 | 1638 | 			PyErr_NoMemory(); | 
 | 1639 | 			goto cleanup; | 
 | 1640 | 		} | 
 | 1641 | 		goto retry; | 
 | 1642 | 	} | 
 | 1643 |  | 
 | 1644 | 	if (alGetParamInfo(resource, param, &pinfo) < 0) | 
 | 1645 | 		goto cleanup; | 
 | 1646 |  | 
 | 1647 | 	res = PyList_New(nvals); | 
 | 1648 | 	if (res == NULL) | 
 | 1649 | 		goto cleanup; | 
 | 1650 | 	for (i = 0; i < nvals; i++) { | 
 | 1651 | 		item = param2python(resource, param, return_set[i], &pinfo); | 
 | 1652 | 		if (item == NULL || | 
 | 1653 | 		    PyList_SetItem(res, i, item) < 0) { | 
 | 1654 | 			Py_DECREF(res); | 
 | 1655 | 			res = NULL; | 
 | 1656 | 			goto cleanup; | 
 | 1657 | 		} | 
 | 1658 | 	} | 
 | 1659 |  | 
 | 1660 |   cleanup: | 
 | 1661 | 	if (return_set) | 
 | 1662 | 		PyMem_DEL(return_set); | 
 | 1663 | 	if (quals) { | 
 | 1664 | 		for (i = 0; i < qualsize; i++) { | 
 | 1665 | 			switch (qualinfo[i].valueType) { | 
 | 1666 | 			case AL_SET_VAL: | 
 | 1667 | 			case AL_VECTOR_VAL: | 
 | 1668 | 				PyMem_DEL(quals[i].value.ptr); | 
 | 1669 | 				break; | 
 | 1670 | 			} | 
 | 1671 | 		} | 
 | 1672 | 		PyMem_DEL(quals); | 
 | 1673 | 		PyMem_DEL(qualinfo); | 
 | 1674 | 	} | 
 | 1675 |  | 
 | 1676 | 	return res; | 
 | 1677 | } | 
 | 1678 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1679 | PyDoc_STRVAR(al_GetParamInfo__doc__, | 
 | 1680 | "alGetParamInfo: get information about a parameter on " | 
 | 1681 | "a particular audio resource."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1682 |  | 
 | 1683 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1684 | al_GetParamInfo(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1685 | { | 
 | 1686 | 	int res, param; | 
 | 1687 | 	ALparamInfo pinfo; | 
 | 1688 | 	PyObject *v, *item;; | 
 | 1689 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1690 | 	if (!PyArg_ParseTuple(args, "ii:GetParamInfo", &res, ¶m)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1691 | 		return NULL; | 
 | 1692 | 	if (alGetParamInfo(res, param, &pinfo) < 0) | 
 | 1693 | 		return NULL; | 
 | 1694 | 	v = PyDict_New(); | 
 | 1695 |  | 
 | 1696 | 	item = PyInt_FromLong((long) pinfo.resource); | 
 | 1697 | 	PyDict_SetItemString(v, "resource", item); | 
 | 1698 | 	Py_DECREF(item); | 
 | 1699 |  | 
 | 1700 | 	item = PyInt_FromLong((long) pinfo.param); | 
 | 1701 | 	PyDict_SetItemString(v, "param", item); | 
 | 1702 | 	Py_DECREF(item); | 
 | 1703 |  | 
 | 1704 | 	item = PyInt_FromLong((long) pinfo.valueType); | 
 | 1705 | 	PyDict_SetItemString(v, "valueType", item); | 
 | 1706 | 	Py_DECREF(item); | 
 | 1707 |  | 
 | 1708 | 	if (pinfo.valueType != AL_NO_VAL && pinfo.valueType != AL_SCALAR_VAL) { | 
 | 1709 | 		/* multiple values */ | 
 | 1710 | 		item = PyInt_FromLong((long) pinfo.maxElems); | 
 | 1711 | 		PyDict_SetItemString(v, "maxElems", item); | 
 | 1712 | 		Py_DECREF(item); | 
 | 1713 |  | 
 | 1714 | 		if (pinfo.valueType == AL_MATRIX_VAL) { | 
 | 1715 | 			/* 2 dimensional */ | 
 | 1716 | 			item = PyInt_FromLong((long) pinfo.maxElems2); | 
 | 1717 | 			PyDict_SetItemString(v, "maxElems2", item); | 
 | 1718 | 			Py_DECREF(item); | 
 | 1719 | 		} | 
 | 1720 | 	} | 
 | 1721 |  | 
 | 1722 | 	item = PyInt_FromLong((long) pinfo.elementType); | 
 | 1723 | 	PyDict_SetItemString(v, "elementType", item); | 
 | 1724 | 	Py_DECREF(item); | 
 | 1725 |  | 
 | 1726 | 	item = PyString_FromString(pinfo.name); | 
 | 1727 | 	PyDict_SetItemString(v, "name", item); | 
 | 1728 | 	Py_DECREF(item); | 
 | 1729 |  | 
 | 1730 | 	item = param2python(res, param, pinfo.initial, &pinfo); | 
 | 1731 | 	PyDict_SetItemString(v, "initial", item); | 
 | 1732 | 	Py_DECREF(item); | 
 | 1733 |  | 
 | 1734 | 	if (pinfo.elementType != AL_ENUM_ELEM && | 
 | 1735 | 	    pinfo.elementType != AL_RESOURCE_ELEM && | 
 | 1736 | 	    pinfo.elementType != AL_CHAR_ELEM) { | 
 | 1737 | 		/* range param */ | 
 | 1738 | 		item = param2python(res, param, pinfo.min, &pinfo); | 
 | 1739 | 		PyDict_SetItemString(v, "min", item); | 
 | 1740 | 		Py_DECREF(item); | 
 | 1741 |  | 
 | 1742 | 		item = param2python(res, param, pinfo.max, &pinfo); | 
 | 1743 | 		PyDict_SetItemString(v, "max", item); | 
 | 1744 | 		Py_DECREF(item); | 
 | 1745 |  | 
 | 1746 | 		item = param2python(res, param, pinfo.minDelta, &pinfo); | 
 | 1747 | 		PyDict_SetItemString(v, "minDelta", item); | 
 | 1748 | 		Py_DECREF(item); | 
 | 1749 |  | 
 | 1750 | 		item = param2python(res, param, pinfo.maxDelta, &pinfo); | 
 | 1751 | 		PyDict_SetItemString(v, "maxDelta", item); | 
 | 1752 | 		Py_DECREF(item); | 
 | 1753 |  | 
 | 1754 | 		item = PyInt_FromLong((long) pinfo.specialVals); | 
 | 1755 | 		PyDict_SetItemString(v, "specialVals", item); | 
 | 1756 | 		Py_DECREF(item); | 
 | 1757 | 	} | 
 | 1758 |  | 
 | 1759 | 	return v; | 
 | 1760 | } | 
 | 1761 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1762 | PyDoc_STRVAR(al_GetResourceByName__doc__, | 
 | 1763 | "alGetResourceByName: find an audio resource by name."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1764 |  | 
 | 1765 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1766 | al_GetResourceByName(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1767 | { | 
 | 1768 | 	int res, start_res, type; | 
 | 1769 | 	char *name; | 
 | 1770 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1771 | 	if (!PyArg_ParseTuple(args, "isi:GetResourceByName", &start_res, &name, &type)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1772 | 		return NULL; | 
 | 1773 | 	if ((res = alGetResourceByName(start_res, name, type)) == 0) | 
 | 1774 | 		return NULL; | 
 | 1775 | 	return PyInt_FromLong((long) res); | 
 | 1776 | } | 
 | 1777 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1778 | PyDoc_STRVAR(al_IsSubtype__doc__, | 
 | 1779 | "alIsSubtype: indicate if one resource type is a subtype of another."); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1780 |  | 
 | 1781 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1782 | al_IsSubtype(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1783 | { | 
 | 1784 | 	int type, subtype; | 
 | 1785 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1786 | 	if (!PyArg_ParseTuple(args, "ii:IsSubtype", &type, &subtype)) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1787 | 		return NULL; | 
 | 1788 | 	return PyInt_FromLong((long) alIsSubtype(type, subtype)); | 
 | 1789 | } | 
 | 1790 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1791 | PyDoc_STRVAR(al_SetErrorHandler__doc__, ""); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1792 |  | 
 | 1793 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1794 | al_SetErrorHandler(PyObject *self, PyObject *args) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1795 | { | 
 | 1796 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1797 | 	if (!PyArg_ParseTuple(args, ":SetErrorHandler")) | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1798 | 		return NULL; | 
 | 1799 | 	Py_INCREF(Py_None); | 
 | 1800 | 	return Py_None; | 
 | 1801 | } | 
 | 1802 |  | 
 | 1803 | #endif /* AL_NO_ELEM */ | 
 | 1804 |  | 
 | 1805 | #ifdef OLD_INTERFACE | 
 | 1806 |  | 
 | 1807 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1808 | al_openport(PyObject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1809 | { | 
| Guido van Rossum | fc58e58 | 1992-01-27 16:45:55 +0000 | [diff] [blame] | 1810 | 	char *name, *dir; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1811 | 	ALport port; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1812 | 	alcobject *config = NULL; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1813 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1814 | 	if (!PyArg_ParseTuple(args, "ss|O!:OpenPort", &name, &dir, &Alctype, &config)) | 
| Guido van Rossum | c0aab89 | 1991-10-20 20:10:46 +0000 | [diff] [blame] | 1815 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1816 | 	if ((port = ALopenport(name, dir, config ? config->config : NULL)) == NULL) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1817 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1818 | 	return newalpobject(port); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1819 | } | 
 | 1820 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1821 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1822 | al_newconfig(PyObject *self, PyObject *args) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1823 | { | 
 | 1824 | 	ALconfig config; | 
 | 1825 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1826 | 	if (!PyArg_ParseTuple(args, ":NewConfig")) | 
| Guido van Rossum | c0aab89 | 1991-10-20 20:10:46 +0000 | [diff] [blame] | 1827 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1828 | 	if ((config = ALnewconfig ()) == NULL) | 
 | 1829 | 		return NULL; | 
 | 1830 | 	return newalcobject(config); | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1831 | } | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1832 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1833 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1834 | al_queryparams(PyObject *self, PyObject *args) | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1835 | { | 
 | 1836 | 	long device; | 
 | 1837 | 	long length; | 
 | 1838 | 	long *PVbuffer; | 
 | 1839 | 	long PVdummy[2]; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1840 | 	PyObject *v = NULL; | 
 | 1841 | 	int i; | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1842 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1843 | 	if (!PyArg_ParseTuple(args, "l:queryparams", &device)) | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1844 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1845 | 	if ((length = ALqueryparams(device, PVdummy, 2L)) == -1) | 
 | 1846 | 		return NULL; | 
 | 1847 | 	if ((PVbuffer = PyMem_NEW(long, length)) == NULL) | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1848 | 		return PyErr_NoMemory(); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1849 | 	if (ALqueryparams(device, PVbuffer, length) >= 0 && | 
 | 1850 | 	    (v = PyList_New((int)length)) != NULL) { | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1851 | 		for (i = 0; i < length; i++) | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1852 | 			PyList_SetItem(v, i, PyInt_FromLong(PVbuffer[i])); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1853 | 	} | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1854 | 	PyMem_DEL(PVbuffer); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1855 | 	return v; | 
 | 1856 | } | 
 | 1857 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1858 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1859 | doParams(PyObject *args, int (*func)(long, long *, long), int modified) | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1860 | { | 
 | 1861 | 	long device; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1862 | 	PyObject *list, *v; | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1863 | 	long *PVbuffer; | 
 | 1864 | 	long length; | 
 | 1865 | 	int i; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1866 | 	 | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1867 | 	if (!PyArg_ParseTuple(args, "lO!", &device, &PyList_Type, &list)) | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1868 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1869 | 	length = PyList_Size(list); | 
 | 1870 | 	PVbuffer = PyMem_NEW(long, length); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1871 | 	if (PVbuffer == NULL) | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1872 | 		return PyErr_NoMemory(); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1873 | 	for (i = 0; i < length; i++) { | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1874 | 		v = PyList_GetItem(list, i); | 
 | 1875 | 		if (!PyInt_Check(v)) { | 
 | 1876 | 			PyMem_DEL(PVbuffer); | 
 | 1877 | 			PyErr_BadArgument(); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1878 | 			return NULL; | 
 | 1879 | 		} | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1880 | 		PVbuffer[i] = PyInt_AsLong(v); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1881 | 	} | 
 | 1882 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1883 | 	if ((*func)(device, PVbuffer, length) == -1) { | 
 | 1884 | 		PyMem_DEL(PVbuffer); | 
 | 1885 | 		return NULL; | 
 | 1886 | 	} | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1887 |  | 
 | 1888 | 	if (modified) { | 
 | 1889 | 		for (i = 0; i < length; i++) | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1890 | 			PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i])); | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1891 | 	} | 
 | 1892 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1893 | 	PyMem_DEL(PVbuffer); | 
| Guido van Rossum | c0aab89 | 1991-10-20 20:10:46 +0000 | [diff] [blame] | 1894 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1895 | 	Py_INCREF(Py_None); | 
 | 1896 | 	return Py_None; | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1897 | } | 
 | 1898 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1899 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1900 | al_getparams(PyObject *self, PyObject *args) | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1901 | { | 
 | 1902 | 	return doParams(args, ALgetparams, 1); | 
 | 1903 | } | 
 | 1904 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1905 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1906 | al_setparams(PyObject *self, PyObject *args) | 
| Guido van Rossum | b3a5b9b | 1991-09-10 14:54:05 +0000 | [diff] [blame] | 1907 | { | 
 | 1908 | 	return doParams(args, ALsetparams, 0); | 
 | 1909 | } | 
 | 1910 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1911 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1912 | al_getname(PyObject *self, PyObject *args) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1913 | { | 
 | 1914 | 	long device, descriptor; | 
 | 1915 | 	char *name; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1916 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1917 | 	if (!PyArg_ParseTuple(args, "ll:getname", &device, &descriptor)) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1918 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1919 | 	if ((name = ALgetname(device, descriptor)) == NULL) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1920 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1921 | 	return PyString_FromString(name); | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1922 | } | 
 | 1923 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1924 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1925 | al_getdefault(PyObject *self, PyObject *args) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1926 | { | 
 | 1927 | 	long device, descriptor, value; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1928 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1929 | 	if (!PyArg_ParseTuple(args, "ll:getdefault", &device, &descriptor)) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1930 | 		return NULL; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1931 | 	if ((value = ALgetdefault(device, descriptor)) == -1) | 
 | 1932 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1933 | 	return PyLong_FromLong(value); | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1934 | } | 
 | 1935 |  | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1936 | static PyObject * | 
| Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 1937 | al_getminmax(PyObject *self, PyObject *args) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1938 | { | 
 | 1939 | 	long device, descriptor, min, max; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1940 |  | 
| Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 1941 | 	if (!PyArg_ParseTuple(args, "ll:getminmax", &device, &descriptor)) | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1942 | 		return NULL; | 
 | 1943 | 	min = -1; | 
 | 1944 | 	max = -1; | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1945 | 	if (ALgetminmax(device, descriptor, &min, &max) == -1) | 
 | 1946 | 		return NULL; | 
| Roger E. Masse | a2a8b27 | 1997-01-03 22:40:34 +0000 | [diff] [blame] | 1947 | 	return Py_BuildValue("ll", min, max); | 
| Guido van Rossum | 448f4bf | 1992-08-19 16:41:15 +0000 | [diff] [blame] | 1948 | } | 
 | 1949 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1950 | #endif /* OLD_INTERFACE */ | 
 | 1951 |  | 
 | 1952 | /* List of methods defined in the module */ | 
 | 1953 |  | 
 | 1954 | static struct PyMethodDef al_methods[] = { | 
 | 1955 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
 | 1956 | 	{"NewConfig",	(PyCFunction)al_NewConfig,	METH_VARARGS,	al_NewConfig__doc__}, | 
 | 1957 | 	{"OpenPort",	(PyCFunction)al_OpenPort,	METH_VARARGS,	al_OpenPort__doc__}, | 
 | 1958 | 	{"Connect",	(PyCFunction)al_Connect,	METH_VARARGS,	al_Connect__doc__}, | 
 | 1959 | 	{"Disconnect",	(PyCFunction)al_Disconnect,	METH_VARARGS,	al_Disconnect__doc__}, | 
 | 1960 | 	{"GetParams",	(PyCFunction)al_GetParams,	METH_VARARGS,	al_GetParams__doc__}, | 
 | 1961 | 	{"SetParams",	(PyCFunction)al_SetParams,	METH_VARARGS,	al_SetParams__doc__}, | 
 | 1962 | 	{"QueryValues",	(PyCFunction)al_QueryValues,	METH_VARARGS,	al_QueryValues__doc__}, | 
 | 1963 | 	{"GetParamInfo",	(PyCFunction)al_GetParamInfo,	METH_VARARGS,	al_GetParamInfo__doc__}, | 
 | 1964 | 	{"GetResourceByName",	(PyCFunction)al_GetResourceByName,	METH_VARARGS,	al_GetResourceByName__doc__}, | 
 | 1965 | 	{"IsSubtype",	(PyCFunction)al_IsSubtype,	METH_VARARGS,	al_IsSubtype__doc__}, | 
 | 1966 | #if 0 | 
 | 1967 | 	/* this one not supported */ | 
 | 1968 | 	{"SetErrorHandler",	(PyCFunction)al_SetErrorHandler,	METH_VARARGS,	al_SetErrorHandler__doc__}, | 
 | 1969 | #endif | 
 | 1970 | #endif /* AL_NO_ELEM */ | 
 | 1971 | #ifdef OLD_INTERFACE | 
 | 1972 | 	{"openport",		(PyCFunction)al_openport,	METH_VARARGS}, | 
 | 1973 | 	{"newconfig",		(PyCFunction)al_newconfig,	METH_VARARGS}, | 
 | 1974 | 	{"queryparams",		(PyCFunction)al_queryparams,	METH_VARARGS}, | 
 | 1975 | 	{"getparams",		(PyCFunction)al_getparams,	METH_VARARGS}, | 
 | 1976 | 	{"setparams",		(PyCFunction)al_setparams,	METH_VARARGS}, | 
 | 1977 | 	{"getname",		(PyCFunction)al_getname,	METH_VARARGS}, | 
 | 1978 | 	{"getdefault",		(PyCFunction)al_getdefault,	METH_VARARGS}, | 
 | 1979 | 	{"getminmax",		(PyCFunction)al_getminmax,	METH_VARARGS}, | 
 | 1980 | #endif /* OLD_INTERFACE */ | 
 | 1981 |  | 
 | 1982 | 	{NULL,	 (PyCFunction)NULL, 0, NULL}		/* sentinel */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1983 | }; | 
 | 1984 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1985 |  | 
 | 1986 | /* Initialization function for the module (*must* be called inital) */ | 
 | 1987 |  | 
| Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 1988 | PyDoc_STRVAR(al_module_documentation, ""); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1989 |  | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1990 | void | 
| Thomas Wouters | f3f33dc | 2000-07-21 06:00:07 +0000 | [diff] [blame] | 1991 | inital(void) | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1992 | { | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1993 | 	PyObject *m, *d, *x; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 1994 |  | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 1995 | 	/* Create the module and add the functions */ | 
 | 1996 | 	m = Py_InitModule4("al", al_methods, | 
 | 1997 | 		al_module_documentation, | 
 | 1998 | 		(PyObject*)NULL,PYTHON_API_VERSION); | 
 | 1999 |  | 
 | 2000 | 	/* Add some symbolic constants to the module */ | 
 | 2001 | 	d = PyModule_GetDict(m); | 
| Fred Drake | 589c35b | 2000-07-06 19:38:49 +0000 | [diff] [blame] | 2002 | 	ErrorObject = PyErr_NewException("al.error", NULL, NULL); | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 2003 | 	PyDict_SetItemString(d, "error", ErrorObject); | 
 | 2004 |  | 
 | 2005 | 	/* XXXX Add constants here */ | 
 | 2006 | #ifdef AL_4CHANNEL | 
 | 2007 | 	x =  PyInt_FromLong((long) AL_4CHANNEL); | 
 | 2008 | 	if (x == NULL || PyDict_SetItemString(d, "FOURCHANNEL", x) < 0) | 
 | 2009 | 		goto error; | 
 | 2010 | 	Py_DECREF(x); | 
 | 2011 | #endif | 
 | 2012 | #ifdef AL_ADAT_IF_TYPE | 
 | 2013 | 	x =  PyInt_FromLong((long) AL_ADAT_IF_TYPE); | 
 | 2014 | 	if (x == NULL || PyDict_SetItemString(d, "ADAT_IF_TYPE", x) < 0) | 
 | 2015 | 		goto error; | 
 | 2016 | 	Py_DECREF(x); | 
 | 2017 | #endif | 
 | 2018 | #ifdef AL_ADAT_MCLK_TYPE | 
 | 2019 | 	x =  PyInt_FromLong((long) AL_ADAT_MCLK_TYPE); | 
 | 2020 | 	if (x == NULL || PyDict_SetItemString(d, "ADAT_MCLK_TYPE", x) < 0) | 
 | 2021 | 		goto error; | 
 | 2022 | 	Py_DECREF(x); | 
 | 2023 | #endif | 
 | 2024 | #ifdef AL_AES_IF_TYPE | 
 | 2025 | 	x =  PyInt_FromLong((long) AL_AES_IF_TYPE); | 
 | 2026 | 	if (x == NULL || PyDict_SetItemString(d, "AES_IF_TYPE", x) < 0) | 
 | 2027 | 		goto error; | 
 | 2028 | 	Py_DECREF(x); | 
 | 2029 | #endif | 
 | 2030 | #ifdef AL_AES_MCLK_TYPE | 
 | 2031 | 	x =  PyInt_FromLong((long) AL_AES_MCLK_TYPE); | 
 | 2032 | 	if (x == NULL || PyDict_SetItemString(d, "AES_MCLK_TYPE", x) < 0) | 
 | 2033 | 		goto error; | 
 | 2034 | 	Py_DECREF(x); | 
 | 2035 | #endif | 
 | 2036 | #ifdef AL_ANALOG_IF_TYPE | 
 | 2037 | 	x =  PyInt_FromLong((long) AL_ANALOG_IF_TYPE); | 
 | 2038 | 	if (x == NULL || PyDict_SetItemString(d, "ANALOG_IF_TYPE", x) < 0) | 
 | 2039 | 		goto error; | 
 | 2040 | 	Py_DECREF(x); | 
 | 2041 | #endif | 
 | 2042 | #ifdef AL_ASSOCIATE | 
 | 2043 | 	x =  PyInt_FromLong((long) AL_ASSOCIATE); | 
 | 2044 | 	if (x == NULL || PyDict_SetItemString(d, "ASSOCIATE", x) < 0) | 
 | 2045 | 		goto error; | 
 | 2046 | 	Py_DECREF(x); | 
 | 2047 | #endif | 
 | 2048 | #ifdef AL_BAD_BUFFER_NULL | 
 | 2049 | 	x =  PyInt_FromLong((long) AL_BAD_BUFFER_NULL); | 
 | 2050 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_NULL", x) < 0) | 
 | 2051 | 		goto error; | 
 | 2052 | 	Py_DECREF(x); | 
 | 2053 | #endif | 
 | 2054 | #ifdef AL_BAD_BUFFERLENGTH | 
 | 2055 | 	x =  PyInt_FromLong((long) AL_BAD_BUFFERLENGTH); | 
 | 2056 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH", x) < 0) | 
 | 2057 | 		goto error; | 
 | 2058 | 	Py_DECREF(x); | 
 | 2059 | #endif | 
 | 2060 | #ifdef AL_BAD_BUFFERLENGTH_NEG | 
 | 2061 | 	x =  PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_NEG); | 
 | 2062 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0) | 
 | 2063 | 		goto error; | 
 | 2064 | 	Py_DECREF(x); | 
 | 2065 | #endif | 
 | 2066 | #ifdef AL_BAD_BUFFERLENGTH_ODD | 
 | 2067 | 	x =  PyInt_FromLong((long) AL_BAD_BUFFERLENGTH_ODD); | 
 | 2068 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0) | 
 | 2069 | 		goto error; | 
 | 2070 | 	Py_DECREF(x); | 
 | 2071 | #endif | 
 | 2072 | #ifdef AL_BAD_CHANNELS | 
 | 2073 | 	x =  PyInt_FromLong((long) AL_BAD_CHANNELS); | 
 | 2074 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_CHANNELS", x) < 0) | 
 | 2075 | 		goto error; | 
 | 2076 | 	Py_DECREF(x); | 
 | 2077 | #endif | 
 | 2078 | #ifdef AL_BAD_CONFIG | 
 | 2079 | 	x =  PyInt_FromLong((long) AL_BAD_CONFIG); | 
 | 2080 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_CONFIG", x) < 0) | 
 | 2081 | 		goto error; | 
 | 2082 | 	Py_DECREF(x); | 
 | 2083 | #endif | 
 | 2084 | #ifdef AL_BAD_COUNT_NEG | 
 | 2085 | 	x =  PyInt_FromLong((long) AL_BAD_COUNT_NEG); | 
 | 2086 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_COUNT_NEG", x) < 0) | 
 | 2087 | 		goto error; | 
 | 2088 | 	Py_DECREF(x); | 
 | 2089 | #endif | 
 | 2090 | #ifdef AL_BAD_DEVICE | 
 | 2091 | 	x =  PyInt_FromLong((long) AL_BAD_DEVICE); | 
 | 2092 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE", x) < 0) | 
 | 2093 | 		goto error; | 
 | 2094 | 	Py_DECREF(x); | 
 | 2095 | #endif | 
 | 2096 | #ifdef AL_BAD_DEVICE_ACCESS | 
 | 2097 | 	x =  PyInt_FromLong((long) AL_BAD_DEVICE_ACCESS); | 
 | 2098 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_DEVICE_ACCESS", x) < 0) | 
 | 2099 | 		goto error; | 
 | 2100 | 	Py_DECREF(x); | 
 | 2101 | #endif | 
 | 2102 | #ifdef AL_BAD_DIRECTION | 
 | 2103 | 	x =  PyInt_FromLong((long) AL_BAD_DIRECTION); | 
 | 2104 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_DIRECTION", x) < 0) | 
 | 2105 | 		goto error; | 
 | 2106 | 	Py_DECREF(x); | 
 | 2107 | #endif | 
 | 2108 | #ifdef AL_BAD_FILLPOINT | 
 | 2109 | 	x =  PyInt_FromLong((long) AL_BAD_FILLPOINT); | 
 | 2110 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_FILLPOINT", x) < 0) | 
 | 2111 | 		goto error; | 
 | 2112 | 	Py_DECREF(x); | 
 | 2113 | #endif | 
 | 2114 | #ifdef AL_BAD_FLOATMAX | 
 | 2115 | 	x =  PyInt_FromLong((long) AL_BAD_FLOATMAX); | 
 | 2116 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_FLOATMAX", x) < 0) | 
 | 2117 | 		goto error; | 
 | 2118 | 	Py_DECREF(x); | 
 | 2119 | #endif | 
 | 2120 | #ifdef AL_BAD_ILLEGAL_STATE | 
 | 2121 | 	x =  PyInt_FromLong((long) AL_BAD_ILLEGAL_STATE); | 
 | 2122 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_ILLEGAL_STATE", x) < 0) | 
 | 2123 | 		goto error; | 
 | 2124 | 	Py_DECREF(x); | 
 | 2125 | #endif | 
 | 2126 | #ifdef AL_BAD_NO_PORTS | 
 | 2127 | 	x =  PyInt_FromLong((long) AL_BAD_NO_PORTS); | 
 | 2128 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_NO_PORTS", x) < 0) | 
 | 2129 | 		goto error; | 
 | 2130 | 	Py_DECREF(x); | 
 | 2131 | #endif | 
 | 2132 | #ifdef AL_BAD_NOT_FOUND | 
 | 2133 | 	x =  PyInt_FromLong((long) AL_BAD_NOT_FOUND); | 
 | 2134 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_FOUND", x) < 0) | 
 | 2135 | 		goto error; | 
 | 2136 | 	Py_DECREF(x); | 
 | 2137 | #endif | 
 | 2138 | #ifdef AL_BAD_NOT_IMPLEMENTED | 
 | 2139 | 	x =  PyInt_FromLong((long) AL_BAD_NOT_IMPLEMENTED); | 
 | 2140 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_NOT_IMPLEMENTED", x) < 0) | 
 | 2141 | 		goto error; | 
 | 2142 | 	Py_DECREF(x); | 
 | 2143 | #endif | 
 | 2144 | #ifdef AL_BAD_OUT_OF_MEM | 
 | 2145 | 	x =  PyInt_FromLong((long) AL_BAD_OUT_OF_MEM); | 
 | 2146 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_OUT_OF_MEM", x) < 0) | 
 | 2147 | 		goto error; | 
 | 2148 | 	Py_DECREF(x); | 
 | 2149 | #endif | 
 | 2150 | #ifdef AL_BAD_PARAM | 
 | 2151 | 	x =  PyInt_FromLong((long) AL_BAD_PARAM); | 
 | 2152 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0) | 
 | 2153 | 		goto error; | 
 | 2154 | 	Py_DECREF(x); | 
 | 2155 | #endif | 
 | 2156 | #ifdef AL_BAD_PERMISSIONS | 
 | 2157 | 	x =  PyInt_FromLong((long) AL_BAD_PERMISSIONS); | 
 | 2158 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_PERMISSIONS", x) < 0) | 
 | 2159 | 		goto error; | 
 | 2160 | 	Py_DECREF(x); | 
 | 2161 | #endif | 
 | 2162 | #ifdef AL_BAD_PORT | 
 | 2163 | 	x =  PyInt_FromLong((long) AL_BAD_PORT); | 
 | 2164 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_PORT", x) < 0) | 
 | 2165 | 		goto error; | 
 | 2166 | 	Py_DECREF(x); | 
 | 2167 | #endif | 
 | 2168 | #ifdef AL_BAD_PORTSTYLE | 
 | 2169 | 	x =  PyInt_FromLong((long) AL_BAD_PORTSTYLE); | 
 | 2170 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_PORTSTYLE", x) < 0) | 
 | 2171 | 		goto error; | 
 | 2172 | 	Py_DECREF(x); | 
 | 2173 | #endif | 
 | 2174 | #ifdef AL_BAD_PVBUFFER | 
 | 2175 | 	x =  PyInt_FromLong((long) AL_BAD_PVBUFFER); | 
 | 2176 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0) | 
 | 2177 | 		goto error; | 
 | 2178 | 	Py_DECREF(x); | 
 | 2179 | #endif | 
 | 2180 | #ifdef AL_BAD_QSIZE | 
 | 2181 | 	x =  PyInt_FromLong((long) AL_BAD_QSIZE); | 
 | 2182 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_QSIZE", x) < 0) | 
 | 2183 | 		goto error; | 
 | 2184 | 	Py_DECREF(x); | 
 | 2185 | #endif | 
 | 2186 | #ifdef AL_BAD_RATE | 
 | 2187 | 	x =  PyInt_FromLong((long) AL_BAD_RATE); | 
 | 2188 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_RATE", x) < 0) | 
 | 2189 | 		goto error; | 
 | 2190 | 	Py_DECREF(x); | 
 | 2191 | #endif | 
 | 2192 | #ifdef AL_BAD_RESOURCE | 
 | 2193 | 	x =  PyInt_FromLong((long) AL_BAD_RESOURCE); | 
 | 2194 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_RESOURCE", x) < 0) | 
 | 2195 | 		goto error; | 
 | 2196 | 	Py_DECREF(x); | 
 | 2197 | #endif | 
 | 2198 | #ifdef AL_BAD_SAMPFMT | 
 | 2199 | 	x =  PyInt_FromLong((long) AL_BAD_SAMPFMT); | 
 | 2200 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_SAMPFMT", x) < 0) | 
 | 2201 | 		goto error; | 
 | 2202 | 	Py_DECREF(x); | 
 | 2203 | #endif | 
 | 2204 | #ifdef AL_BAD_TRANSFER_SIZE | 
 | 2205 | 	x =  PyInt_FromLong((long) AL_BAD_TRANSFER_SIZE); | 
 | 2206 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_TRANSFER_SIZE", x) < 0) | 
 | 2207 | 		goto error; | 
 | 2208 | 	Py_DECREF(x); | 
 | 2209 | #endif | 
 | 2210 | #ifdef AL_BAD_WIDTH | 
 | 2211 | 	x =  PyInt_FromLong((long) AL_BAD_WIDTH); | 
 | 2212 | 	if (x == NULL || PyDict_SetItemString(d, "BAD_WIDTH", x) < 0) | 
 | 2213 | 		goto error; | 
 | 2214 | 	Py_DECREF(x); | 
 | 2215 | #endif | 
 | 2216 | #ifdef AL_CHANNEL_MODE | 
 | 2217 | 	x =  PyInt_FromLong((long) AL_CHANNEL_MODE); | 
 | 2218 | 	if (x == NULL || PyDict_SetItemString(d, "CHANNEL_MODE", x) < 0) | 
 | 2219 | 		goto error; | 
 | 2220 | 	Py_DECREF(x); | 
 | 2221 | #endif | 
 | 2222 | #ifdef AL_CHANNELS | 
 | 2223 | 	x =  PyInt_FromLong((long) AL_CHANNELS); | 
 | 2224 | 	if (x == NULL || PyDict_SetItemString(d, "CHANNELS", x) < 0) | 
 | 2225 | 		goto error; | 
 | 2226 | 	Py_DECREF(x); | 
 | 2227 | #endif | 
 | 2228 | #ifdef AL_CHAR_ELEM | 
 | 2229 | 	x =  PyInt_FromLong((long) AL_CHAR_ELEM); | 
 | 2230 | 	if (x == NULL || PyDict_SetItemString(d, "CHAR_ELEM", x) < 0) | 
 | 2231 | 		goto error; | 
 | 2232 | 	Py_DECREF(x); | 
 | 2233 | #endif | 
 | 2234 | #ifdef AL_CLOCK_GEN | 
 | 2235 | 	x =  PyInt_FromLong((long) AL_CLOCK_GEN); | 
 | 2236 | 	if (x == NULL || PyDict_SetItemString(d, "CLOCK_GEN", x) < 0) | 
 | 2237 | 		goto error; | 
 | 2238 | 	Py_DECREF(x); | 
 | 2239 | #endif | 
 | 2240 | #ifdef AL_CLOCKGEN_TYPE | 
 | 2241 | 	x =  PyInt_FromLong((long) AL_CLOCKGEN_TYPE); | 
 | 2242 | 	if (x == NULL || PyDict_SetItemString(d, "CLOCKGEN_TYPE", x) < 0) | 
 | 2243 | 		goto error; | 
 | 2244 | 	Py_DECREF(x); | 
 | 2245 | #endif | 
 | 2246 | #ifdef AL_CONNECT | 
 | 2247 | 	x =  PyInt_FromLong((long) AL_CONNECT); | 
 | 2248 | 	if (x == NULL || PyDict_SetItemString(d, "CONNECT", x) < 0) | 
 | 2249 | 		goto error; | 
 | 2250 | 	Py_DECREF(x); | 
 | 2251 | #endif | 
 | 2252 | #ifdef AL_CONNECTION_TYPE | 
 | 2253 | 	x =  PyInt_FromLong((long) AL_CONNECTION_TYPE); | 
 | 2254 | 	if (x == NULL || PyDict_SetItemString(d, "CONNECTION_TYPE", x) < 0) | 
 | 2255 | 		goto error; | 
 | 2256 | 	Py_DECREF(x); | 
 | 2257 | #endif | 
 | 2258 | #ifdef AL_CONNECTIONS | 
 | 2259 | 	x =  PyInt_FromLong((long) AL_CONNECTIONS); | 
 | 2260 | 	if (x == NULL || PyDict_SetItemString(d, "CONNECTIONS", x) < 0) | 
 | 2261 | 		goto error; | 
 | 2262 | 	Py_DECREF(x); | 
 | 2263 | #endif | 
 | 2264 | #ifdef AL_CRYSTAL_MCLK_TYPE | 
 | 2265 | 	x =  PyInt_FromLong((long) AL_CRYSTAL_MCLK_TYPE); | 
 | 2266 | 	if (x == NULL || PyDict_SetItemString(d, "CRYSTAL_MCLK_TYPE", x) < 0) | 
 | 2267 | 		goto error; | 
 | 2268 | 	Py_DECREF(x); | 
 | 2269 | #endif | 
 | 2270 | #ifdef AL_DEFAULT_DEVICE | 
 | 2271 | 	x =  PyInt_FromLong((long) AL_DEFAULT_DEVICE); | 
 | 2272 | 	if (x == NULL || PyDict_SetItemString(d, "DEFAULT_DEVICE", x) < 0) | 
 | 2273 | 		goto error; | 
 | 2274 | 	Py_DECREF(x); | 
 | 2275 | #endif | 
 | 2276 | #ifdef AL_DEFAULT_INPUT | 
 | 2277 | 	x =  PyInt_FromLong((long) AL_DEFAULT_INPUT); | 
 | 2278 | 	if (x == NULL || PyDict_SetItemString(d, "DEFAULT_INPUT", x) < 0) | 
 | 2279 | 		goto error; | 
 | 2280 | 	Py_DECREF(x); | 
 | 2281 | #endif | 
 | 2282 | #ifdef AL_DEFAULT_OUTPUT | 
 | 2283 | 	x =  PyInt_FromLong((long) AL_DEFAULT_OUTPUT); | 
 | 2284 | 	if (x == NULL || PyDict_SetItemString(d, "DEFAULT_OUTPUT", x) < 0) | 
 | 2285 | 		goto error; | 
 | 2286 | 	Py_DECREF(x); | 
 | 2287 | #endif | 
 | 2288 | #ifdef AL_DEST | 
 | 2289 | 	x =  PyInt_FromLong((long) AL_DEST); | 
 | 2290 | 	if (x == NULL || PyDict_SetItemString(d, "DEST", x) < 0) | 
 | 2291 | 		goto error; | 
 | 2292 | 	Py_DECREF(x); | 
 | 2293 | #endif | 
 | 2294 | #ifdef AL_DEVICE_TYPE | 
 | 2295 | 	x =  PyInt_FromLong((long) AL_DEVICE_TYPE); | 
 | 2296 | 	if (x == NULL || PyDict_SetItemString(d, "DEVICE_TYPE", x) < 0) | 
 | 2297 | 		goto error; | 
 | 2298 | 	Py_DECREF(x); | 
 | 2299 | #endif | 
 | 2300 | #ifdef AL_DEVICES | 
 | 2301 | 	x =  PyInt_FromLong((long) AL_DEVICES); | 
 | 2302 | 	if (x == NULL || PyDict_SetItemString(d, "DEVICES", x) < 0) | 
 | 2303 | 		goto error; | 
 | 2304 | 	Py_DECREF(x); | 
 | 2305 | #endif | 
 | 2306 | #ifdef AL_DIGITAL_IF_TYPE | 
 | 2307 | 	x =  PyInt_FromLong((long) AL_DIGITAL_IF_TYPE); | 
 | 2308 | 	if (x == NULL || PyDict_SetItemString(d, "DIGITAL_IF_TYPE", x) < 0) | 
 | 2309 | 		goto error; | 
 | 2310 | 	Py_DECREF(x); | 
 | 2311 | #endif | 
 | 2312 | #ifdef AL_DIGITAL_INPUT_RATE | 
 | 2313 | 	x =  PyInt_FromLong((long) AL_DIGITAL_INPUT_RATE); | 
 | 2314 | 	if (x == NULL || PyDict_SetItemString(d, "DIGITAL_INPUT_RATE", x) < 0) | 
 | 2315 | 		goto error; | 
 | 2316 | 	Py_DECREF(x); | 
 | 2317 | #endif | 
 | 2318 | #ifdef AL_DISCONNECT | 
 | 2319 | 	x =  PyInt_FromLong((long) AL_DISCONNECT); | 
 | 2320 | 	if (x == NULL || PyDict_SetItemString(d, "DISCONNECT", x) < 0) | 
 | 2321 | 		goto error; | 
 | 2322 | 	Py_DECREF(x); | 
 | 2323 | #endif | 
 | 2324 | #ifdef AL_ENUM_ELEM | 
 | 2325 | 	x =  PyInt_FromLong((long) AL_ENUM_ELEM); | 
 | 2326 | 	if (x == NULL || PyDict_SetItemString(d, "ENUM_ELEM", x) < 0) | 
 | 2327 | 		goto error; | 
 | 2328 | 	Py_DECREF(x); | 
 | 2329 | #endif | 
 | 2330 | #ifdef AL_ENUM_VALUE | 
 | 2331 | 	x =  PyInt_FromLong((long) AL_ENUM_VALUE); | 
 | 2332 | 	if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0) | 
 | 2333 | 		goto error; | 
 | 2334 | 	Py_DECREF(x); | 
 | 2335 | #endif | 
 | 2336 | #ifdef AL_ERROR_INPUT_OVERFLOW | 
 | 2337 | 	x =  PyInt_FromLong((long) AL_ERROR_INPUT_OVERFLOW); | 
 | 2338 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_INPUT_OVERFLOW", x) < 0) | 
 | 2339 | 		goto error; | 
 | 2340 | 	Py_DECREF(x); | 
 | 2341 | #endif | 
 | 2342 | #ifdef AL_ERROR_LENGTH | 
 | 2343 | 	x =  PyInt_FromLong((long) AL_ERROR_LENGTH); | 
 | 2344 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_LENGTH", x) < 0) | 
 | 2345 | 		goto error; | 
 | 2346 | 	Py_DECREF(x); | 
 | 2347 | #endif | 
 | 2348 | #ifdef AL_ERROR_LOCATION_LSP | 
 | 2349 | 	x =  PyInt_FromLong((long) AL_ERROR_LOCATION_LSP); | 
 | 2350 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_LSP", x) < 0) | 
 | 2351 | 		goto error; | 
 | 2352 | 	Py_DECREF(x); | 
 | 2353 | #endif | 
 | 2354 | #ifdef AL_ERROR_LOCATION_MSP | 
 | 2355 | 	x =  PyInt_FromLong((long) AL_ERROR_LOCATION_MSP); | 
 | 2356 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_LOCATION_MSP", x) < 0) | 
 | 2357 | 		goto error; | 
 | 2358 | 	Py_DECREF(x); | 
 | 2359 | #endif | 
 | 2360 | #ifdef AL_ERROR_NUMBER | 
 | 2361 | 	x =  PyInt_FromLong((long) AL_ERROR_NUMBER); | 
 | 2362 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_NUMBER", x) < 0) | 
 | 2363 | 		goto error; | 
 | 2364 | 	Py_DECREF(x); | 
 | 2365 | #endif | 
 | 2366 | #ifdef AL_ERROR_OUTPUT_UNDERFLOW | 
 | 2367 | 	x =  PyInt_FromLong((long) AL_ERROR_OUTPUT_UNDERFLOW); | 
 | 2368 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_OUTPUT_UNDERFLOW", x) < 0) | 
 | 2369 | 		goto error; | 
 | 2370 | 	Py_DECREF(x); | 
 | 2371 | #endif | 
 | 2372 | #ifdef AL_ERROR_TYPE | 
 | 2373 | 	x =  PyInt_FromLong((long) AL_ERROR_TYPE); | 
 | 2374 | 	if (x == NULL || PyDict_SetItemString(d, "ERROR_TYPE", x) < 0) | 
 | 2375 | 		goto error; | 
 | 2376 | 	Py_DECREF(x); | 
 | 2377 | #endif | 
 | 2378 | #ifdef AL_FIXED_ELEM | 
 | 2379 | 	x =  PyInt_FromLong((long) AL_FIXED_ELEM); | 
 | 2380 | 	if (x == NULL || PyDict_SetItemString(d, "FIXED_ELEM", x) < 0) | 
 | 2381 | 		goto error; | 
 | 2382 | 	Py_DECREF(x); | 
 | 2383 | #endif | 
 | 2384 | #ifdef AL_FIXED_MCLK_TYPE | 
 | 2385 | 	x =  PyInt_FromLong((long) AL_FIXED_MCLK_TYPE); | 
 | 2386 | 	if (x == NULL || PyDict_SetItemString(d, "FIXED_MCLK_TYPE", x) < 0) | 
 | 2387 | 		goto error; | 
 | 2388 | 	Py_DECREF(x); | 
 | 2389 | #endif | 
 | 2390 | #ifdef AL_GAIN | 
 | 2391 | 	x =  PyInt_FromLong((long) AL_GAIN); | 
 | 2392 | 	if (x == NULL || PyDict_SetItemString(d, "GAIN", x) < 0) | 
 | 2393 | 		goto error; | 
 | 2394 | 	Py_DECREF(x); | 
 | 2395 | #endif | 
 | 2396 | #ifdef AL_GAIN_REF | 
 | 2397 | 	x =  PyInt_FromLong((long) AL_GAIN_REF); | 
 | 2398 | 	if (x == NULL || PyDict_SetItemString(d, "GAIN_REF", x) < 0) | 
 | 2399 | 		goto error; | 
 | 2400 | 	Py_DECREF(x); | 
 | 2401 | #endif | 
 | 2402 | #ifdef AL_HRB_TYPE | 
 | 2403 | 	x =  PyInt_FromLong((long) AL_HRB_TYPE); | 
 | 2404 | 	if (x == NULL || PyDict_SetItemString(d, "HRB_TYPE", x) < 0) | 
 | 2405 | 		goto error; | 
 | 2406 | 	Py_DECREF(x); | 
 | 2407 | #endif | 
 | 2408 | #ifdef AL_INPUT_COUNT | 
 | 2409 | 	x =  PyInt_FromLong((long) AL_INPUT_COUNT); | 
 | 2410 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_COUNT", x) < 0) | 
 | 2411 | 		goto error; | 
 | 2412 | 	Py_DECREF(x); | 
 | 2413 | #endif | 
 | 2414 | #ifdef AL_INPUT_DEVICE_TYPE | 
 | 2415 | 	x =  PyInt_FromLong((long) AL_INPUT_DEVICE_TYPE); | 
 | 2416 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_DEVICE_TYPE", x) < 0) | 
 | 2417 | 		goto error; | 
 | 2418 | 	Py_DECREF(x); | 
 | 2419 | #endif | 
 | 2420 | #ifdef AL_INPUT_DIGITAL | 
 | 2421 | 	x =  PyInt_FromLong((long) AL_INPUT_DIGITAL); | 
 | 2422 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_DIGITAL", x) < 0) | 
 | 2423 | 		goto error; | 
 | 2424 | 	Py_DECREF(x); | 
 | 2425 | #endif | 
 | 2426 | #ifdef AL_INPUT_HRB_TYPE | 
 | 2427 | 	x =  PyInt_FromLong((long) AL_INPUT_HRB_TYPE); | 
 | 2428 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_HRB_TYPE", x) < 0) | 
 | 2429 | 		goto error; | 
 | 2430 | 	Py_DECREF(x); | 
 | 2431 | #endif | 
 | 2432 | #ifdef AL_INPUT_LINE | 
 | 2433 | 	x =  PyInt_FromLong((long) AL_INPUT_LINE); | 
 | 2434 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_LINE", x) < 0) | 
 | 2435 | 		goto error; | 
 | 2436 | 	Py_DECREF(x); | 
 | 2437 | #endif | 
 | 2438 | #ifdef AL_INPUT_MIC | 
 | 2439 | 	x =  PyInt_FromLong((long) AL_INPUT_MIC); | 
 | 2440 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_MIC", x) < 0) | 
 | 2441 | 		goto error; | 
 | 2442 | 	Py_DECREF(x); | 
 | 2443 | #endif | 
 | 2444 | #ifdef AL_INPUT_PORT_TYPE | 
 | 2445 | 	x =  PyInt_FromLong((long) AL_INPUT_PORT_TYPE); | 
 | 2446 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_PORT_TYPE", x) < 0) | 
 | 2447 | 		goto error; | 
 | 2448 | 	Py_DECREF(x); | 
 | 2449 | #endif | 
 | 2450 | #ifdef AL_INPUT_RATE | 
 | 2451 | 	x =  PyInt_FromLong((long) AL_INPUT_RATE); | 
 | 2452 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_RATE", x) < 0) | 
 | 2453 | 		goto error; | 
 | 2454 | 	Py_DECREF(x); | 
 | 2455 | #endif | 
 | 2456 | #ifdef AL_INPUT_SOURCE | 
 | 2457 | 	x =  PyInt_FromLong((long) AL_INPUT_SOURCE); | 
 | 2458 | 	if (x == NULL || PyDict_SetItemString(d, "INPUT_SOURCE", x) < 0) | 
 | 2459 | 		goto error; | 
 | 2460 | 	Py_DECREF(x); | 
 | 2461 | #endif | 
 | 2462 | #ifdef AL_INT32_ELEM | 
 | 2463 | 	x =  PyInt_FromLong((long) AL_INT32_ELEM); | 
 | 2464 | 	if (x == NULL || PyDict_SetItemString(d, "INT32_ELEM", x) < 0) | 
 | 2465 | 		goto error; | 
 | 2466 | 	Py_DECREF(x); | 
 | 2467 | #endif | 
 | 2468 | #ifdef AL_INT64_ELEM | 
 | 2469 | 	x =  PyInt_FromLong((long) AL_INT64_ELEM); | 
 | 2470 | 	if (x == NULL || PyDict_SetItemString(d, "INT64_ELEM", x) < 0) | 
 | 2471 | 		goto error; | 
 | 2472 | 	Py_DECREF(x); | 
 | 2473 | #endif | 
 | 2474 | #ifdef AL_INTERFACE | 
 | 2475 | 	x =  PyInt_FromLong((long) AL_INTERFACE); | 
 | 2476 | 	if (x == NULL || PyDict_SetItemString(d, "INTERFACE", x) < 0) | 
 | 2477 | 		goto error; | 
 | 2478 | 	Py_DECREF(x); | 
 | 2479 | #endif | 
 | 2480 | #ifdef AL_INTERFACE_TYPE | 
 | 2481 | 	x =  PyInt_FromLong((long) AL_INTERFACE_TYPE); | 
 | 2482 | 	if (x == NULL || PyDict_SetItemString(d, "INTERFACE_TYPE", x) < 0) | 
 | 2483 | 		goto error; | 
 | 2484 | 	Py_DECREF(x); | 
 | 2485 | #endif | 
 | 2486 | #ifdef AL_INVALID_PARAM | 
 | 2487 | 	x =  PyInt_FromLong((long) AL_INVALID_PARAM); | 
 | 2488 | 	if (x == NULL || PyDict_SetItemString(d, "INVALID_PARAM", x) < 0) | 
 | 2489 | 		goto error; | 
 | 2490 | 	Py_DECREF(x); | 
 | 2491 | #endif | 
 | 2492 | #ifdef AL_INVALID_VALUE | 
 | 2493 | 	x =  PyInt_FromLong((long) AL_INVALID_VALUE); | 
 | 2494 | 	if (x == NULL || PyDict_SetItemString(d, "INVALID_VALUE", x) < 0) | 
 | 2495 | 		goto error; | 
 | 2496 | 	Py_DECREF(x); | 
 | 2497 | #endif | 
 | 2498 | #ifdef AL_JITTER | 
 | 2499 | 	x =  PyInt_FromLong((long) AL_JITTER); | 
 | 2500 | 	if (x == NULL || PyDict_SetItemString(d, "JITTER", x) < 0) | 
 | 2501 | 		goto error; | 
 | 2502 | 	Py_DECREF(x); | 
 | 2503 | #endif | 
 | 2504 | #ifdef AL_LABEL | 
 | 2505 | 	x =  PyInt_FromLong((long) AL_LABEL); | 
 | 2506 | 	if (x == NULL || PyDict_SetItemString(d, "LABEL", x) < 0) | 
 | 2507 | 		goto error; | 
 | 2508 | 	Py_DECREF(x); | 
 | 2509 | #endif | 
 | 2510 | #ifdef AL_LEFT_INPUT_ATTEN | 
 | 2511 | 	x =  PyInt_FromLong((long) AL_LEFT_INPUT_ATTEN); | 
 | 2512 | 	if (x == NULL || PyDict_SetItemString(d, "LEFT_INPUT_ATTEN", x) < 0) | 
 | 2513 | 		goto error; | 
 | 2514 | 	Py_DECREF(x); | 
 | 2515 | #endif | 
 | 2516 | #ifdef AL_LEFT_MONITOR_ATTEN | 
 | 2517 | 	x =  PyInt_FromLong((long) AL_LEFT_MONITOR_ATTEN); | 
 | 2518 | 	if (x == NULL || PyDict_SetItemString(d, "LEFT_MONITOR_ATTEN", x) < 0) | 
 | 2519 | 		goto error; | 
 | 2520 | 	Py_DECREF(x); | 
 | 2521 | #endif | 
 | 2522 | #ifdef AL_LEFT_SPEAKER_GAIN | 
 | 2523 | 	x =  PyInt_FromLong((long) AL_LEFT_SPEAKER_GAIN); | 
 | 2524 | 	if (x == NULL || PyDict_SetItemString(d, "LEFT_SPEAKER_GAIN", x) < 0) | 
 | 2525 | 		goto error; | 
 | 2526 | 	Py_DECREF(x); | 
 | 2527 | #endif | 
 | 2528 | #ifdef AL_LEFT1_INPUT_ATTEN | 
 | 2529 | 	x =  PyInt_FromLong((long) AL_LEFT1_INPUT_ATTEN); | 
 | 2530 | 	if (x == NULL || PyDict_SetItemString(d, "LEFT1_INPUT_ATTEN", x) < 0) | 
 | 2531 | 		goto error; | 
 | 2532 | 	Py_DECREF(x); | 
 | 2533 | #endif | 
 | 2534 | #ifdef AL_LEFT2_INPUT_ATTEN | 
 | 2535 | 	x =  PyInt_FromLong((long) AL_LEFT2_INPUT_ATTEN); | 
 | 2536 | 	if (x == NULL || PyDict_SetItemString(d, "LEFT2_INPUT_ATTEN", x) < 0) | 
 | 2537 | 		goto error; | 
 | 2538 | 	Py_DECREF(x); | 
 | 2539 | #endif | 
 | 2540 | #ifdef AL_LINE_IF_TYPE | 
 | 2541 | 	x =  PyInt_FromLong((long) AL_LINE_IF_TYPE); | 
 | 2542 | 	if (x == NULL || PyDict_SetItemString(d, "LINE_IF_TYPE", x) < 0) | 
 | 2543 | 		goto error; | 
 | 2544 | 	Py_DECREF(x); | 
 | 2545 | #endif | 
| Neal Norwitz | ddb4f62 | 2003-03-30 21:49:18 +0000 | [diff] [blame] | 2546 | #ifdef AL_LOCKED | 
 | 2547 | 	x =  PyInt_FromLong((long) AL_LOCKED); | 
 | 2548 | 	if (x == NULL || PyDict_SetItemString(d, "LOCKED", x) < 0) | 
 | 2549 | 		goto error; | 
 | 2550 | 	Py_DECREF(x); | 
 | 2551 | #endif | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 2552 | #ifdef AL_MASTER_CLOCK | 
 | 2553 | 	x =  PyInt_FromLong((long) AL_MASTER_CLOCK); | 
 | 2554 | 	if (x == NULL || PyDict_SetItemString(d, "MASTER_CLOCK", x) < 0) | 
 | 2555 | 		goto error; | 
 | 2556 | 	Py_DECREF(x); | 
 | 2557 | #endif | 
 | 2558 | #ifdef AL_MATRIX_VAL | 
 | 2559 | 	x =  PyInt_FromLong((long) AL_MATRIX_VAL); | 
 | 2560 | 	if (x == NULL || PyDict_SetItemString(d, "MATRIX_VAL", x) < 0) | 
 | 2561 | 		goto error; | 
 | 2562 | 	Py_DECREF(x); | 
 | 2563 | #endif | 
 | 2564 | #ifdef AL_MAX_ERROR | 
 | 2565 | 	x =  PyInt_FromLong((long) AL_MAX_ERROR); | 
 | 2566 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_ERROR", x) < 0) | 
 | 2567 | 		goto error; | 
 | 2568 | 	Py_DECREF(x); | 
 | 2569 | #endif | 
 | 2570 | #ifdef AL_MAX_EVENT_PARAM | 
 | 2571 | 	x =  PyInt_FromLong((long) AL_MAX_EVENT_PARAM); | 
 | 2572 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_EVENT_PARAM", x) < 0) | 
 | 2573 | 		goto error; | 
 | 2574 | 	Py_DECREF(x); | 
 | 2575 | #endif | 
 | 2576 | #ifdef AL_MAX_PBUFSIZE | 
 | 2577 | 	x =  PyInt_FromLong((long) AL_MAX_PBUFSIZE); | 
 | 2578 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_PBUFSIZE", x) < 0) | 
 | 2579 | 		goto error; | 
 | 2580 | 	Py_DECREF(x); | 
 | 2581 | #endif | 
 | 2582 | #ifdef AL_MAX_PORTS | 
 | 2583 | 	x =  PyInt_FromLong((long) AL_MAX_PORTS); | 
 | 2584 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_PORTS", x) < 0) | 
 | 2585 | 		goto error; | 
 | 2586 | 	Py_DECREF(x); | 
 | 2587 | #endif | 
 | 2588 | #ifdef AL_MAX_RESOURCE_ID | 
 | 2589 | 	x =  PyInt_FromLong((long) AL_MAX_RESOURCE_ID); | 
 | 2590 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_RESOURCE_ID", x) < 0) | 
 | 2591 | 		goto error; | 
 | 2592 | 	Py_DECREF(x); | 
 | 2593 | #endif | 
 | 2594 | #ifdef AL_MAX_SETSIZE | 
 | 2595 | 	x =  PyInt_FromLong((long) AL_MAX_SETSIZE); | 
 | 2596 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_SETSIZE", x) < 0) | 
 | 2597 | 		goto error; | 
 | 2598 | 	Py_DECREF(x); | 
 | 2599 | #endif | 
 | 2600 | #ifdef AL_MAX_STRLEN | 
 | 2601 | 	x =  PyInt_FromLong((long) AL_MAX_STRLEN); | 
 | 2602 | 	if (x == NULL || PyDict_SetItemString(d, "MAX_STRLEN", x) < 0) | 
 | 2603 | 		goto error; | 
 | 2604 | 	Py_DECREF(x); | 
 | 2605 | #endif | 
 | 2606 | #ifdef AL_MCLK_TYPE | 
 | 2607 | 	x =  PyInt_FromLong((long) AL_MCLK_TYPE); | 
 | 2608 | 	if (x == NULL || PyDict_SetItemString(d, "MCLK_TYPE", x) < 0) | 
 | 2609 | 		goto error; | 
 | 2610 | 	Py_DECREF(x); | 
 | 2611 | #endif | 
 | 2612 | #ifdef AL_MIC_IF_TYPE | 
 | 2613 | 	x =  PyInt_FromLong((long) AL_MIC_IF_TYPE); | 
 | 2614 | 	if (x == NULL || PyDict_SetItemString(d, "MIC_IF_TYPE", x) < 0) | 
 | 2615 | 		goto error; | 
 | 2616 | 	Py_DECREF(x); | 
 | 2617 | #endif | 
 | 2618 | #ifdef AL_MONITOR_CTL | 
 | 2619 | 	x =  PyInt_FromLong((long) AL_MONITOR_CTL); | 
 | 2620 | 	if (x == NULL || PyDict_SetItemString(d, "MONITOR_CTL", x) < 0) | 
 | 2621 | 		goto error; | 
 | 2622 | 	Py_DECREF(x); | 
 | 2623 | #endif | 
 | 2624 | #ifdef AL_MONITOR_OFF | 
 | 2625 | 	x =  PyInt_FromLong((long) AL_MONITOR_OFF); | 
 | 2626 | 	if (x == NULL || PyDict_SetItemString(d, "MONITOR_OFF", x) < 0) | 
 | 2627 | 		goto error; | 
 | 2628 | 	Py_DECREF(x); | 
 | 2629 | #endif | 
 | 2630 | #ifdef AL_MONITOR_ON | 
 | 2631 | 	x =  PyInt_FromLong((long) AL_MONITOR_ON); | 
 | 2632 | 	if (x == NULL || PyDict_SetItemString(d, "MONITOR_ON", x) < 0) | 
 | 2633 | 		goto error; | 
 | 2634 | 	Py_DECREF(x); | 
 | 2635 | #endif | 
 | 2636 | #ifdef AL_MONO | 
 | 2637 | 	x =  PyInt_FromLong((long) AL_MONO); | 
 | 2638 | 	if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0) | 
 | 2639 | 		goto error; | 
 | 2640 | 	Py_DECREF(x); | 
 | 2641 | #endif | 
 | 2642 | #ifdef AL_MUTE | 
 | 2643 | 	x =  PyInt_FromLong((long) AL_MUTE); | 
 | 2644 | 	if (x == NULL || PyDict_SetItemString(d, "MUTE", x) < 0) | 
 | 2645 | 		goto error; | 
 | 2646 | 	Py_DECREF(x); | 
 | 2647 | #endif | 
 | 2648 | #ifdef AL_NAME | 
 | 2649 | 	x =  PyInt_FromLong((long) AL_NAME); | 
 | 2650 | 	if (x == NULL || PyDict_SetItemString(d, "NAME", x) < 0) | 
 | 2651 | 		goto error; | 
 | 2652 | 	Py_DECREF(x); | 
 | 2653 | #endif | 
 | 2654 | #ifdef AL_NEG_INFINITY | 
 | 2655 | 	x =  PyInt_FromLong((long) AL_NEG_INFINITY); | 
 | 2656 | 	if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY", x) < 0) | 
 | 2657 | 		goto error; | 
 | 2658 | 	Py_DECREF(x); | 
 | 2659 | #endif | 
 | 2660 | #ifdef AL_NEG_INFINITY_BIT | 
 | 2661 | 	x =  PyInt_FromLong((long) AL_NEG_INFINITY_BIT); | 
 | 2662 | 	if (x == NULL || PyDict_SetItemString(d, "NEG_INFINITY_BIT", x) < 0) | 
 | 2663 | 		goto error; | 
 | 2664 | 	Py_DECREF(x); | 
 | 2665 | #endif | 
 | 2666 | #ifdef AL_NO_CHANGE | 
 | 2667 | 	x =  PyInt_FromLong((long) AL_NO_CHANGE); | 
 | 2668 | 	if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE", x) < 0) | 
 | 2669 | 		goto error; | 
 | 2670 | 	Py_DECREF(x); | 
 | 2671 | #endif | 
 | 2672 | #ifdef AL_NO_CHANGE_BIT | 
 | 2673 | 	x =  PyInt_FromLong((long) AL_NO_CHANGE_BIT); | 
 | 2674 | 	if (x == NULL || PyDict_SetItemString(d, "NO_CHANGE_BIT", x) < 0) | 
 | 2675 | 		goto error; | 
 | 2676 | 	Py_DECREF(x); | 
 | 2677 | #endif | 
 | 2678 | #ifdef AL_NO_ELEM | 
 | 2679 | 	x =  PyInt_FromLong((long) AL_NO_ELEM); | 
 | 2680 | 	if (x == NULL || PyDict_SetItemString(d, "NO_ELEM", x) < 0) | 
 | 2681 | 		goto error; | 
 | 2682 | 	Py_DECREF(x); | 
 | 2683 | #endif | 
 | 2684 | #ifdef AL_NO_ERRORS | 
 | 2685 | 	x =  PyInt_FromLong((long) AL_NO_ERRORS); | 
 | 2686 | 	if (x == NULL || PyDict_SetItemString(d, "NO_ERRORS", x) < 0) | 
 | 2687 | 		goto error; | 
 | 2688 | 	Py_DECREF(x); | 
 | 2689 | #endif | 
 | 2690 | #ifdef AL_NO_OP | 
 | 2691 | 	x =  PyInt_FromLong((long) AL_NO_OP); | 
 | 2692 | 	if (x == NULL || PyDict_SetItemString(d, "NO_OP", x) < 0) | 
 | 2693 | 		goto error; | 
 | 2694 | 	Py_DECREF(x); | 
 | 2695 | #endif | 
 | 2696 | #ifdef AL_NO_VAL | 
 | 2697 | 	x =  PyInt_FromLong((long) AL_NO_VAL); | 
 | 2698 | 	if (x == NULL || PyDict_SetItemString(d, "NO_VAL", x) < 0) | 
 | 2699 | 		goto error; | 
 | 2700 | 	Py_DECREF(x); | 
 | 2701 | #endif | 
| Neal Norwitz | ddb4f62 | 2003-03-30 21:49:18 +0000 | [diff] [blame] | 2702 | #ifdef AL_NULL_INTERFACE | 
 | 2703 | 	x =  PyInt_FromLong((long) AL_NULL_INTERFACE); | 
 | 2704 | 	if (x == NULL || PyDict_SetItemString(d, "NULL_INTERFACE", x) < 0) | 
 | 2705 | 		goto error; | 
 | 2706 | 	Py_DECREF(x); | 
 | 2707 | #endif | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 2708 | #ifdef AL_NULL_RESOURCE | 
 | 2709 | 	x =  PyInt_FromLong((long) AL_NULL_RESOURCE); | 
 | 2710 | 	if (x == NULL || PyDict_SetItemString(d, "NULL_RESOURCE", x) < 0) | 
 | 2711 | 		goto error; | 
 | 2712 | 	Py_DECREF(x); | 
 | 2713 | #endif | 
| Neal Norwitz | ddb4f62 | 2003-03-30 21:49:18 +0000 | [diff] [blame] | 2714 | #ifdef AL_OPTICAL_IF_TYPE | 
 | 2715 | 	x =  PyInt_FromLong((long) AL_OPTICAL_IF_TYPE); | 
 | 2716 | 	if (x == NULL || PyDict_SetItemString(d, "OPTICAL_IF_TYPE", x) < 0) | 
 | 2717 | 		goto error; | 
 | 2718 | 	Py_DECREF(x); | 
 | 2719 | #endif | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 2720 | #ifdef AL_OUTPUT_COUNT | 
 | 2721 | 	x =  PyInt_FromLong((long) AL_OUTPUT_COUNT); | 
 | 2722 | 	if (x == NULL || PyDict_SetItemString(d, "OUTPUT_COUNT", x) < 0) | 
 | 2723 | 		goto error; | 
 | 2724 | 	Py_DECREF(x); | 
 | 2725 | #endif | 
 | 2726 | #ifdef AL_OUTPUT_DEVICE_TYPE | 
 | 2727 | 	x =  PyInt_FromLong((long) AL_OUTPUT_DEVICE_TYPE); | 
 | 2728 | 	if (x == NULL || PyDict_SetItemString(d, "OUTPUT_DEVICE_TYPE", x) < 0) | 
 | 2729 | 		goto error; | 
 | 2730 | 	Py_DECREF(x); | 
 | 2731 | #endif | 
 | 2732 | #ifdef AL_OUTPUT_HRB_TYPE | 
 | 2733 | 	x =  PyInt_FromLong((long) AL_OUTPUT_HRB_TYPE); | 
 | 2734 | 	if (x == NULL || PyDict_SetItemString(d, "OUTPUT_HRB_TYPE", x) < 0) | 
 | 2735 | 		goto error; | 
 | 2736 | 	Py_DECREF(x); | 
 | 2737 | #endif | 
 | 2738 | #ifdef AL_OUTPUT_PORT_TYPE | 
 | 2739 | 	x =  PyInt_FromLong((long) AL_OUTPUT_PORT_TYPE); | 
 | 2740 | 	if (x == NULL || PyDict_SetItemString(d, "OUTPUT_PORT_TYPE", x) < 0) | 
 | 2741 | 		goto error; | 
 | 2742 | 	Py_DECREF(x); | 
 | 2743 | #endif | 
 | 2744 | #ifdef AL_OUTPUT_RATE | 
 | 2745 | 	x =  PyInt_FromLong((long) AL_OUTPUT_RATE); | 
 | 2746 | 	if (x == NULL || PyDict_SetItemString(d, "OUTPUT_RATE", x) < 0) | 
 | 2747 | 		goto error; | 
 | 2748 | 	Py_DECREF(x); | 
 | 2749 | #endif | 
 | 2750 | #ifdef AL_PARAM_BIT | 
 | 2751 | 	x =  PyInt_FromLong((long) AL_PARAM_BIT); | 
 | 2752 | 	if (x == NULL || PyDict_SetItemString(d, "PARAM_BIT", x) < 0) | 
 | 2753 | 		goto error; | 
 | 2754 | 	Py_DECREF(x); | 
 | 2755 | #endif | 
 | 2756 | #ifdef AL_PARAMS | 
 | 2757 | 	x =  PyInt_FromLong((long) AL_PARAMS); | 
 | 2758 | 	if (x == NULL || PyDict_SetItemString(d, "PARAMS", x) < 0) | 
 | 2759 | 		goto error; | 
 | 2760 | 	Py_DECREF(x); | 
 | 2761 | #endif | 
 | 2762 | #ifdef AL_PORT_COUNT | 
 | 2763 | 	x =  PyInt_FromLong((long) AL_PORT_COUNT); | 
 | 2764 | 	if (x == NULL || PyDict_SetItemString(d, "PORT_COUNT", x) < 0) | 
 | 2765 | 		goto error; | 
 | 2766 | 	Py_DECREF(x); | 
 | 2767 | #endif | 
 | 2768 | #ifdef AL_PORT_TYPE | 
 | 2769 | 	x =  PyInt_FromLong((long) AL_PORT_TYPE); | 
 | 2770 | 	if (x == NULL || PyDict_SetItemString(d, "PORT_TYPE", x) < 0) | 
 | 2771 | 		goto error; | 
 | 2772 | 	Py_DECREF(x); | 
 | 2773 | #endif | 
 | 2774 | #ifdef AL_PORTS | 
 | 2775 | 	x =  PyInt_FromLong((long) AL_PORTS); | 
 | 2776 | 	if (x == NULL || PyDict_SetItemString(d, "PORTS", x) < 0) | 
 | 2777 | 		goto error; | 
 | 2778 | 	Py_DECREF(x); | 
 | 2779 | #endif | 
 | 2780 | #ifdef AL_PORTSTYLE_DIRECT | 
 | 2781 | 	x =  PyInt_FromLong((long) AL_PORTSTYLE_DIRECT); | 
 | 2782 | 	if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_DIRECT", x) < 0) | 
 | 2783 | 		goto error; | 
 | 2784 | 	Py_DECREF(x); | 
 | 2785 | #endif | 
 | 2786 | #ifdef AL_PORTSTYLE_SERIAL | 
 | 2787 | 	x =  PyInt_FromLong((long) AL_PORTSTYLE_SERIAL); | 
 | 2788 | 	if (x == NULL || PyDict_SetItemString(d, "PORTSTYLE_SERIAL", x) < 0) | 
 | 2789 | 		goto error; | 
 | 2790 | 	Py_DECREF(x); | 
 | 2791 | #endif | 
 | 2792 | #ifdef AL_PRINT_ERRORS | 
 | 2793 | 	x =  PyInt_FromLong((long) AL_PRINT_ERRORS); | 
 | 2794 | 	if (x == NULL || PyDict_SetItemString(d, "PRINT_ERRORS", x) < 0) | 
 | 2795 | 		goto error; | 
 | 2796 | 	Py_DECREF(x); | 
 | 2797 | #endif | 
 | 2798 | #ifdef AL_PTR_ELEM | 
 | 2799 | 	x =  PyInt_FromLong((long) AL_PTR_ELEM); | 
 | 2800 | 	if (x == NULL || PyDict_SetItemString(d, "PTR_ELEM", x) < 0) | 
 | 2801 | 		goto error; | 
 | 2802 | 	Py_DECREF(x); | 
 | 2803 | #endif | 
 | 2804 | #ifdef AL_RANGE_VALUE | 
 | 2805 | 	x =  PyInt_FromLong((long) AL_RANGE_VALUE); | 
 | 2806 | 	if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0) | 
 | 2807 | 		goto error; | 
 | 2808 | 	Py_DECREF(x); | 
 | 2809 | #endif | 
 | 2810 | #ifdef AL_RATE | 
 | 2811 | 	x =  PyInt_FromLong((long) AL_RATE); | 
 | 2812 | 	if (x == NULL || PyDict_SetItemString(d, "RATE", x) < 0) | 
 | 2813 | 		goto error; | 
 | 2814 | 	Py_DECREF(x); | 
 | 2815 | #endif | 
 | 2816 | #ifdef AL_RATE_11025 | 
 | 2817 | 	x =  PyInt_FromLong((long) AL_RATE_11025); | 
 | 2818 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_11025", x) < 0) | 
 | 2819 | 		goto error; | 
 | 2820 | 	Py_DECREF(x); | 
 | 2821 | #endif | 
 | 2822 | #ifdef AL_RATE_16000 | 
 | 2823 | 	x =  PyInt_FromLong((long) AL_RATE_16000); | 
 | 2824 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_16000", x) < 0) | 
 | 2825 | 		goto error; | 
 | 2826 | 	Py_DECREF(x); | 
 | 2827 | #endif | 
 | 2828 | #ifdef AL_RATE_22050 | 
 | 2829 | 	x =  PyInt_FromLong((long) AL_RATE_22050); | 
 | 2830 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_22050", x) < 0) | 
 | 2831 | 		goto error; | 
 | 2832 | 	Py_DECREF(x); | 
 | 2833 | #endif | 
 | 2834 | #ifdef AL_RATE_32000 | 
 | 2835 | 	x =  PyInt_FromLong((long) AL_RATE_32000); | 
 | 2836 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_32000", x) < 0) | 
 | 2837 | 		goto error; | 
 | 2838 | 	Py_DECREF(x); | 
 | 2839 | #endif | 
 | 2840 | #ifdef AL_RATE_44100 | 
 | 2841 | 	x =  PyInt_FromLong((long) AL_RATE_44100); | 
 | 2842 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_44100", x) < 0) | 
 | 2843 | 		goto error; | 
 | 2844 | 	Py_DECREF(x); | 
 | 2845 | #endif | 
 | 2846 | #ifdef AL_RATE_48000 | 
 | 2847 | 	x =  PyInt_FromLong((long) AL_RATE_48000); | 
 | 2848 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_48000", x) < 0) | 
 | 2849 | 		goto error; | 
 | 2850 | 	Py_DECREF(x); | 
 | 2851 | #endif | 
 | 2852 | #ifdef AL_RATE_8000 | 
 | 2853 | 	x =  PyInt_FromLong((long) AL_RATE_8000); | 
 | 2854 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_8000", x) < 0) | 
 | 2855 | 		goto error; | 
 | 2856 | 	Py_DECREF(x); | 
 | 2857 | #endif | 
 | 2858 | #ifdef AL_RATE_AES_1 | 
 | 2859 | 	x =  PyInt_FromLong((long) AL_RATE_AES_1); | 
 | 2860 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1", x) < 0) | 
 | 2861 | 		goto error; | 
 | 2862 | 	Py_DECREF(x); | 
 | 2863 | #endif | 
 | 2864 | #ifdef AL_RATE_AES_1s | 
 | 2865 | 	x =  PyInt_FromLong((long) AL_RATE_AES_1s); | 
 | 2866 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_AES_1s", x) < 0) | 
 | 2867 | 		goto error; | 
 | 2868 | 	Py_DECREF(x); | 
 | 2869 | #endif | 
 | 2870 | #ifdef AL_RATE_AES_2 | 
 | 2871 | 	x =  PyInt_FromLong((long) AL_RATE_AES_2); | 
 | 2872 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_AES_2", x) < 0) | 
 | 2873 | 		goto error; | 
 | 2874 | 	Py_DECREF(x); | 
 | 2875 | #endif | 
 | 2876 | #ifdef AL_RATE_AES_3 | 
 | 2877 | 	x =  PyInt_FromLong((long) AL_RATE_AES_3); | 
 | 2878 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_AES_3", x) < 0) | 
 | 2879 | 		goto error; | 
 | 2880 | 	Py_DECREF(x); | 
 | 2881 | #endif | 
 | 2882 | #ifdef AL_RATE_AES_4 | 
 | 2883 | 	x =  PyInt_FromLong((long) AL_RATE_AES_4); | 
 | 2884 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_AES_4", x) < 0) | 
 | 2885 | 		goto error; | 
 | 2886 | 	Py_DECREF(x); | 
 | 2887 | #endif | 
 | 2888 | #ifdef AL_RATE_AES_6 | 
 | 2889 | 	x =  PyInt_FromLong((long) AL_RATE_AES_6); | 
 | 2890 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_AES_6", x) < 0) | 
 | 2891 | 		goto error; | 
 | 2892 | 	Py_DECREF(x); | 
 | 2893 | #endif | 
 | 2894 | #ifdef AL_RATE_FRACTION_D | 
 | 2895 | 	x =  PyInt_FromLong((long) AL_RATE_FRACTION_D); | 
 | 2896 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_D", x) < 0) | 
 | 2897 | 		goto error; | 
 | 2898 | 	Py_DECREF(x); | 
 | 2899 | #endif | 
 | 2900 | #ifdef AL_RATE_FRACTION_N | 
 | 2901 | 	x =  PyInt_FromLong((long) AL_RATE_FRACTION_N); | 
 | 2902 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_FRACTION_N", x) < 0) | 
 | 2903 | 		goto error; | 
 | 2904 | 	Py_DECREF(x); | 
 | 2905 | #endif | 
 | 2906 | #ifdef AL_RATE_INPUTRATE | 
 | 2907 | 	x =  PyInt_FromLong((long) AL_RATE_INPUTRATE); | 
 | 2908 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_INPUTRATE", x) < 0) | 
 | 2909 | 		goto error; | 
 | 2910 | 	Py_DECREF(x); | 
 | 2911 | #endif | 
 | 2912 | #ifdef AL_RATE_NO_DIGITAL_INPUT | 
 | 2913 | 	x =  PyInt_FromLong((long) AL_RATE_NO_DIGITAL_INPUT); | 
 | 2914 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_NO_DIGITAL_INPUT", x) < 0) | 
 | 2915 | 		goto error; | 
 | 2916 | 	Py_DECREF(x); | 
 | 2917 | #endif | 
 | 2918 | #ifdef AL_RATE_UNACQUIRED | 
 | 2919 | 	x =  PyInt_FromLong((long) AL_RATE_UNACQUIRED); | 
 | 2920 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_UNACQUIRED", x) < 0) | 
 | 2921 | 		goto error; | 
 | 2922 | 	Py_DECREF(x); | 
 | 2923 | #endif | 
 | 2924 | #ifdef AL_RATE_UNDEFINED | 
 | 2925 | 	x =  PyInt_FromLong((long) AL_RATE_UNDEFINED); | 
 | 2926 | 	if (x == NULL || PyDict_SetItemString(d, "RATE_UNDEFINED", x) < 0) | 
 | 2927 | 		goto error; | 
 | 2928 | 	Py_DECREF(x); | 
 | 2929 | #endif | 
 | 2930 | #ifdef AL_REF_0DBV | 
 | 2931 | 	x =  PyInt_FromLong((long) AL_REF_0DBV); | 
 | 2932 | 	if (x == NULL || PyDict_SetItemString(d, "REF_0DBV", x) < 0) | 
 | 2933 | 		goto error; | 
 | 2934 | 	Py_DECREF(x); | 
 | 2935 | #endif | 
 | 2936 | #ifdef AL_REF_NONE | 
 | 2937 | 	x =  PyInt_FromLong((long) AL_REF_NONE); | 
 | 2938 | 	if (x == NULL || PyDict_SetItemString(d, "REF_NONE", x) < 0) | 
 | 2939 | 		goto error; | 
 | 2940 | 	Py_DECREF(x); | 
 | 2941 | #endif | 
 | 2942 | #ifdef AL_RESERVED1_TYPE | 
 | 2943 | 	x =  PyInt_FromLong((long) AL_RESERVED1_TYPE); | 
 | 2944 | 	if (x == NULL || PyDict_SetItemString(d, "RESERVED1_TYPE", x) < 0) | 
 | 2945 | 		goto error; | 
 | 2946 | 	Py_DECREF(x); | 
 | 2947 | #endif | 
 | 2948 | #ifdef AL_RESERVED2_TYPE | 
 | 2949 | 	x =  PyInt_FromLong((long) AL_RESERVED2_TYPE); | 
 | 2950 | 	if (x == NULL || PyDict_SetItemString(d, "RESERVED2_TYPE", x) < 0) | 
 | 2951 | 		goto error; | 
 | 2952 | 	Py_DECREF(x); | 
 | 2953 | #endif | 
 | 2954 | #ifdef AL_RESERVED3_TYPE | 
 | 2955 | 	x =  PyInt_FromLong((long) AL_RESERVED3_TYPE); | 
 | 2956 | 	if (x == NULL || PyDict_SetItemString(d, "RESERVED3_TYPE", x) < 0) | 
 | 2957 | 		goto error; | 
 | 2958 | 	Py_DECREF(x); | 
 | 2959 | #endif | 
 | 2960 | #ifdef AL_RESERVED4_TYPE | 
 | 2961 | 	x =  PyInt_FromLong((long) AL_RESERVED4_TYPE); | 
 | 2962 | 	if (x == NULL || PyDict_SetItemString(d, "RESERVED4_TYPE", x) < 0) | 
 | 2963 | 		goto error; | 
 | 2964 | 	Py_DECREF(x); | 
 | 2965 | #endif | 
 | 2966 | #ifdef AL_RESOURCE | 
 | 2967 | 	x =  PyInt_FromLong((long) AL_RESOURCE); | 
 | 2968 | 	if (x == NULL || PyDict_SetItemString(d, "RESOURCE", x) < 0) | 
 | 2969 | 		goto error; | 
 | 2970 | 	Py_DECREF(x); | 
 | 2971 | #endif | 
 | 2972 | #ifdef AL_RESOURCE_ELEM | 
 | 2973 | 	x =  PyInt_FromLong((long) AL_RESOURCE_ELEM); | 
 | 2974 | 	if (x == NULL || PyDict_SetItemString(d, "RESOURCE_ELEM", x) < 0) | 
 | 2975 | 		goto error; | 
 | 2976 | 	Py_DECREF(x); | 
 | 2977 | #endif | 
 | 2978 | #ifdef AL_RESOURCE_TYPE | 
 | 2979 | 	x =  PyInt_FromLong((long) AL_RESOURCE_TYPE); | 
 | 2980 | 	if (x == NULL || PyDict_SetItemString(d, "RESOURCE_TYPE", x) < 0) | 
 | 2981 | 		goto error; | 
 | 2982 | 	Py_DECREF(x); | 
 | 2983 | #endif | 
 | 2984 | #ifdef AL_RIGHT_INPUT_ATTEN | 
 | 2985 | 	x =  PyInt_FromLong((long) AL_RIGHT_INPUT_ATTEN); | 
 | 2986 | 	if (x == NULL || PyDict_SetItemString(d, "RIGHT_INPUT_ATTEN", x) < 0) | 
 | 2987 | 		goto error; | 
 | 2988 | 	Py_DECREF(x); | 
 | 2989 | #endif | 
 | 2990 | #ifdef AL_RIGHT_MONITOR_ATTEN | 
 | 2991 | 	x =  PyInt_FromLong((long) AL_RIGHT_MONITOR_ATTEN); | 
 | 2992 | 	if (x == NULL || PyDict_SetItemString(d, "RIGHT_MONITOR_ATTEN", x) < 0) | 
 | 2993 | 		goto error; | 
 | 2994 | 	Py_DECREF(x); | 
 | 2995 | #endif | 
 | 2996 | #ifdef AL_RIGHT_SPEAKER_GAIN | 
 | 2997 | 	x =  PyInt_FromLong((long) AL_RIGHT_SPEAKER_GAIN); | 
 | 2998 | 	if (x == NULL || PyDict_SetItemString(d, "RIGHT_SPEAKER_GAIN", x) < 0) | 
 | 2999 | 		goto error; | 
 | 3000 | 	Py_DECREF(x); | 
 | 3001 | #endif | 
 | 3002 | #ifdef AL_RIGHT1_INPUT_ATTEN | 
 | 3003 | 	x =  PyInt_FromLong((long) AL_RIGHT1_INPUT_ATTEN); | 
 | 3004 | 	if (x == NULL || PyDict_SetItemString(d, "RIGHT1_INPUT_ATTEN", x) < 0) | 
 | 3005 | 		goto error; | 
 | 3006 | 	Py_DECREF(x); | 
 | 3007 | #endif | 
 | 3008 | #ifdef AL_RIGHT2_INPUT_ATTEN | 
 | 3009 | 	x =  PyInt_FromLong((long) AL_RIGHT2_INPUT_ATTEN); | 
 | 3010 | 	if (x == NULL || PyDict_SetItemString(d, "RIGHT2_INPUT_ATTEN", x) < 0) | 
 | 3011 | 		goto error; | 
 | 3012 | 	Py_DECREF(x); | 
 | 3013 | #endif | 
 | 3014 | #ifdef AL_SAMPFMT_DOUBLE | 
 | 3015 | 	x =  PyInt_FromLong((long) AL_SAMPFMT_DOUBLE); | 
 | 3016 | 	if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_DOUBLE", x) < 0) | 
 | 3017 | 		goto error; | 
 | 3018 | 	Py_DECREF(x); | 
 | 3019 | #endif | 
 | 3020 | #ifdef AL_SAMPFMT_FLOAT | 
 | 3021 | 	x =  PyInt_FromLong((long) AL_SAMPFMT_FLOAT); | 
 | 3022 | 	if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_FLOAT", x) < 0) | 
 | 3023 | 		goto error; | 
 | 3024 | 	Py_DECREF(x); | 
 | 3025 | #endif | 
 | 3026 | #ifdef AL_SAMPFMT_TWOSCOMP | 
 | 3027 | 	x =  PyInt_FromLong((long) AL_SAMPFMT_TWOSCOMP); | 
 | 3028 | 	if (x == NULL || PyDict_SetItemString(d, "SAMPFMT_TWOSCOMP", x) < 0) | 
 | 3029 | 		goto error; | 
 | 3030 | 	Py_DECREF(x); | 
 | 3031 | #endif | 
 | 3032 | #ifdef AL_SAMPLE_16 | 
 | 3033 | 	x =  PyInt_FromLong((long) AL_SAMPLE_16); | 
 | 3034 | 	if (x == NULL || PyDict_SetItemString(d, "SAMPLE_16", x) < 0) | 
 | 3035 | 		goto error; | 
 | 3036 | 	Py_DECREF(x); | 
 | 3037 | #endif | 
 | 3038 | #ifdef AL_SAMPLE_24 | 
 | 3039 | 	x =  PyInt_FromLong((long) AL_SAMPLE_24); | 
 | 3040 | 	if (x == NULL || PyDict_SetItemString(d, "SAMPLE_24", x) < 0) | 
 | 3041 | 		goto error; | 
 | 3042 | 	Py_DECREF(x); | 
 | 3043 | #endif | 
 | 3044 | #ifdef AL_SAMPLE_8 | 
 | 3045 | 	x =  PyInt_FromLong((long) AL_SAMPLE_8); | 
 | 3046 | 	if (x == NULL || PyDict_SetItemString(d, "SAMPLE_8", x) < 0) | 
 | 3047 | 		goto error; | 
 | 3048 | 	Py_DECREF(x); | 
 | 3049 | #endif | 
 | 3050 | #ifdef AL_SCALAR_VAL | 
 | 3051 | 	x =  PyInt_FromLong((long) AL_SCALAR_VAL); | 
 | 3052 | 	if (x == NULL || PyDict_SetItemString(d, "SCALAR_VAL", x) < 0) | 
 | 3053 | 		goto error; | 
 | 3054 | 	Py_DECREF(x); | 
 | 3055 | #endif | 
 | 3056 | #ifdef AL_SET_VAL | 
 | 3057 | 	x =  PyInt_FromLong((long) AL_SET_VAL); | 
 | 3058 | 	if (x == NULL || PyDict_SetItemString(d, "SET_VAL", x) < 0) | 
 | 3059 | 		goto error; | 
 | 3060 | 	Py_DECREF(x); | 
 | 3061 | #endif | 
 | 3062 | #ifdef AL_SHORT_NAME | 
 | 3063 | 	x =  PyInt_FromLong((long) AL_SHORT_NAME); | 
 | 3064 | 	if (x == NULL || PyDict_SetItemString(d, "SHORT_NAME", x) < 0) | 
 | 3065 | 		goto error; | 
 | 3066 | 	Py_DECREF(x); | 
 | 3067 | #endif | 
| Neal Norwitz | ddb4f62 | 2003-03-30 21:49:18 +0000 | [diff] [blame] | 3068 | #ifdef AL_SMPTE272M_IF_TYPE | 
 | 3069 | 	x =  PyInt_FromLong((long) AL_SMPTE272M_IF_TYPE); | 
 | 3070 | 	if (x == NULL || PyDict_SetItemString(d, "SMPTE272M_IF_TYPE", x) < 0) | 
 | 3071 | 		goto error; | 
 | 3072 | 	Py_DECREF(x); | 
 | 3073 | #endif | 
| Guido van Rossum | d641d67 | 1997-04-03 17:06:32 +0000 | [diff] [blame] | 3074 | #ifdef AL_SOURCE | 
 | 3075 | 	x =  PyInt_FromLong((long) AL_SOURCE); | 
 | 3076 | 	if (x == NULL || PyDict_SetItemString(d, "SOURCE", x) < 0) | 
 | 3077 | 		goto error; | 
 | 3078 | 	Py_DECREF(x); | 
 | 3079 | #endif | 
 | 3080 | #ifdef AL_SPEAKER_IF_TYPE | 
 | 3081 | 	x =  PyInt_FromLong((long) AL_SPEAKER_IF_TYPE); | 
 | 3082 | 	if (x == NULL || PyDict_SetItemString(d, "SPEAKER_IF_TYPE", x) < 0) | 
 | 3083 | 		goto error; | 
 | 3084 | 	Py_DECREF(x); | 
 | 3085 | #endif | 
 | 3086 | #ifdef AL_SPEAKER_MUTE_CTL | 
 | 3087 | 	x =  PyInt_FromLong((long) AL_SPEAKER_MUTE_CTL); | 
 | 3088 | 	if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_CTL", x) < 0) | 
 | 3089 | 		goto error; | 
 | 3090 | 	Py_DECREF(x); | 
 | 3091 | #endif | 
 | 3092 | #ifdef AL_SPEAKER_MUTE_OFF | 
 | 3093 | 	x =  PyInt_FromLong((long) AL_SPEAKER_MUTE_OFF); | 
 | 3094 | 	if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_OFF", x) < 0) | 
 | 3095 | 		goto error; | 
 | 3096 | 	Py_DECREF(x); | 
 | 3097 | #endif | 
 | 3098 | #ifdef AL_SPEAKER_MUTE_ON | 
 | 3099 | 	x =  PyInt_FromLong((long) AL_SPEAKER_MUTE_ON); | 
 | 3100 | 	if (x == NULL || PyDict_SetItemString(d, "SPEAKER_MUTE_ON", x) < 0) | 
 | 3101 | 		goto error; | 
 | 3102 | 	Py_DECREF(x); | 
 | 3103 | #endif | 
 | 3104 | #ifdef AL_SPEAKER_PLUS_LINE_IF_TYPE | 
 | 3105 | 	x =  PyInt_FromLong((long) AL_SPEAKER_PLUS_LINE_IF_TYPE); | 
 | 3106 | 	if (x == NULL || PyDict_SetItemString(d, "SPEAKER_PLUS_LINE_IF_TYPE", x) < 0) | 
 | 3107 | 		goto error; | 
 | 3108 | 	Py_DECREF(x); | 
 | 3109 | #endif | 
 | 3110 | #ifdef AL_STEREO | 
 | 3111 | 	x =  PyInt_FromLong((long) AL_STEREO); | 
 | 3112 | 	if (x == NULL || PyDict_SetItemString(d, "STEREO", x) < 0) | 
 | 3113 | 		goto error; | 
 | 3114 | 	Py_DECREF(x); | 
 | 3115 | #endif | 
 | 3116 | #ifdef AL_STRING_VAL | 
 | 3117 | 	x =  PyInt_FromLong((long) AL_STRING_VAL); | 
 | 3118 | 	if (x == NULL || PyDict_SetItemString(d, "STRING_VAL", x) < 0) | 
 | 3119 | 		goto error; | 
 | 3120 | 	Py_DECREF(x); | 
 | 3121 | #endif | 
 | 3122 | #ifdef AL_SUBSYSTEM | 
 | 3123 | 	x =  PyInt_FromLong((long) AL_SUBSYSTEM); | 
 | 3124 | 	if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM", x) < 0) | 
 | 3125 | 		goto error; | 
 | 3126 | 	Py_DECREF(x); | 
 | 3127 | #endif | 
 | 3128 | #ifdef AL_SUBSYSTEM_TYPE | 
 | 3129 | 	x =  PyInt_FromLong((long) AL_SUBSYSTEM_TYPE); | 
 | 3130 | 	if (x == NULL || PyDict_SetItemString(d, "SUBSYSTEM_TYPE", x) < 0) | 
 | 3131 | 		goto error; | 
 | 3132 | 	Py_DECREF(x); | 
 | 3133 | #endif | 
 | 3134 | #ifdef AL_SYNC_INPUT_TO_AES | 
 | 3135 | 	x =  PyInt_FromLong((long) AL_SYNC_INPUT_TO_AES); | 
 | 3136 | 	if (x == NULL || PyDict_SetItemString(d, "SYNC_INPUT_TO_AES", x) < 0) | 
 | 3137 | 		goto error; | 
 | 3138 | 	Py_DECREF(x); | 
 | 3139 | #endif | 
 | 3140 | #ifdef AL_SYNC_OUTPUT_TO_AES | 
 | 3141 | 	x =  PyInt_FromLong((long) AL_SYNC_OUTPUT_TO_AES); | 
 | 3142 | 	if (x == NULL || PyDict_SetItemString(d, "SYNC_OUTPUT_TO_AES", x) < 0) | 
 | 3143 | 		goto error; | 
 | 3144 | 	Py_DECREF(x); | 
 | 3145 | #endif | 
 | 3146 | #ifdef AL_SYSTEM | 
 | 3147 | 	x =  PyInt_FromLong((long) AL_SYSTEM); | 
 | 3148 | 	if (x == NULL || PyDict_SetItemString(d, "SYSTEM", x) < 0) | 
 | 3149 | 		goto error; | 
 | 3150 | 	Py_DECREF(x); | 
 | 3151 | #endif | 
 | 3152 | #ifdef AL_SYSTEM_TYPE | 
 | 3153 | 	x =  PyInt_FromLong((long) AL_SYSTEM_TYPE); | 
 | 3154 | 	if (x == NULL || PyDict_SetItemString(d, "SYSTEM_TYPE", x) < 0) | 
 | 3155 | 		goto error; | 
 | 3156 | 	Py_DECREF(x); | 
 | 3157 | #endif | 
 | 3158 | #ifdef AL_TEST_IF_TYPE | 
 | 3159 | 	x =  PyInt_FromLong((long) AL_TEST_IF_TYPE); | 
 | 3160 | 	if (x == NULL || PyDict_SetItemString(d, "TEST_IF_TYPE", x) < 0) | 
 | 3161 | 		goto error; | 
 | 3162 | 	Py_DECREF(x); | 
 | 3163 | #endif | 
 | 3164 | #ifdef AL_TYPE | 
 | 3165 | 	x =  PyInt_FromLong((long) AL_TYPE); | 
 | 3166 | 	if (x == NULL || PyDict_SetItemString(d, "TYPE", x) < 0) | 
 | 3167 | 		goto error; | 
 | 3168 | 	Py_DECREF(x); | 
 | 3169 | #endif | 
 | 3170 | #ifdef AL_TYPE_BIT | 
 | 3171 | 	x =  PyInt_FromLong((long) AL_TYPE_BIT); | 
 | 3172 | 	if (x == NULL || PyDict_SetItemString(d, "TYPE_BIT", x) < 0) | 
 | 3173 | 		goto error; | 
 | 3174 | 	Py_DECREF(x); | 
 | 3175 | #endif | 
 | 3176 | #ifdef AL_UNUSED_COUNT | 
 | 3177 | 	x =  PyInt_FromLong((long) AL_UNUSED_COUNT); | 
 | 3178 | 	if (x == NULL || PyDict_SetItemString(d, "UNUSED_COUNT", x) < 0) | 
 | 3179 | 		goto error; | 
 | 3180 | 	Py_DECREF(x); | 
 | 3181 | #endif | 
 | 3182 | #ifdef AL_UNUSED_PORTS | 
 | 3183 | 	x =  PyInt_FromLong((long) AL_UNUSED_PORTS); | 
 | 3184 | 	if (x == NULL || PyDict_SetItemString(d, "UNUSED_PORTS", x) < 0) | 
 | 3185 | 		goto error; | 
 | 3186 | 	Py_DECREF(x); | 
 | 3187 | #endif | 
 | 3188 | #ifdef AL_VARIABLE_MCLK_TYPE | 
 | 3189 | 	x =  PyInt_FromLong((long) AL_VARIABLE_MCLK_TYPE); | 
 | 3190 | 	if (x == NULL || PyDict_SetItemString(d, "VARIABLE_MCLK_TYPE", x) < 0) | 
 | 3191 | 		goto error; | 
 | 3192 | 	Py_DECREF(x); | 
 | 3193 | #endif | 
 | 3194 | #ifdef AL_VECTOR_VAL | 
 | 3195 | 	x =  PyInt_FromLong((long) AL_VECTOR_VAL); | 
 | 3196 | 	if (x == NULL || PyDict_SetItemString(d, "VECTOR_VAL", x) < 0) | 
 | 3197 | 		goto error; | 
 | 3198 | 	Py_DECREF(x); | 
 | 3199 | #endif | 
 | 3200 | #ifdef AL_VIDEO_MCLK_TYPE | 
 | 3201 | 	x =  PyInt_FromLong((long) AL_VIDEO_MCLK_TYPE); | 
 | 3202 | 	if (x == NULL || PyDict_SetItemString(d, "VIDEO_MCLK_TYPE", x) < 0) | 
 | 3203 | 		goto error; | 
 | 3204 | 	Py_DECREF(x); | 
 | 3205 | #endif | 
 | 3206 | #ifdef AL_WORDSIZE | 
 | 3207 | 	x =  PyInt_FromLong((long) AL_WORDSIZE); | 
 | 3208 | 	if (x == NULL || PyDict_SetItemString(d, "WORDSIZE", x) < 0) | 
 | 3209 | 		goto error; | 
 | 3210 | 	Py_DECREF(x); | 
 | 3211 | #endif | 
 | 3212 |  | 
 | 3213 | #ifdef AL_NO_ELEM		/* IRIX 6 */ | 
 | 3214 | 	(void) alSetErrorHandler(ErrorHandler); | 
 | 3215 | #endif /* AL_NO_ELEM */ | 
 | 3216 | #ifdef OLD_INTERFACE | 
 | 3217 | 	(void) ALseterrorhandler(ErrorHandler); | 
 | 3218 | #endif /* OLD_INTERFACE */ | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 3219 | 	 | 
| Barry Warsaw | 9bfd2bf | 2000-09-01 09:01:32 +0000 | [diff] [blame] | 3220 |   error: | 
 | 3221 | 	return; | 
| Guido van Rossum | e3db862 | 1991-09-09 23:33:34 +0000 | [diff] [blame] | 3222 | } |