diff options
Diffstat (limited to 'intern/audaspace/Python/AUD_PyAPI.cpp')
-rw-r--r-- | intern/audaspace/Python/AUD_PyAPI.cpp | 71 |
1 files changed, 24 insertions, 47 deletions
diff --git a/intern/audaspace/Python/AUD_PyAPI.cpp b/intern/audaspace/Python/AUD_PyAPI.cpp index b0c55d5856e..1fccafa2599 100644 --- a/intern/audaspace/Python/AUD_PyAPI.cpp +++ b/intern/audaspace/Python/AUD_PyAPI.cpp @@ -1,28 +1,34 @@ /* * $Id$ * - * ***** BEGIN LGPL LICENSE BLOCK ***** + * ***** BEGIN GPL LICENSE BLOCK ***** * - * Copyright 2009 Jörg Hermann Müller + * Copyright 2009-2011 Jörg Hermann Müller * * This file is part of AudaSpace. * - * AudaSpace is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or + * Audaspace is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * AudaSpace is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public License - * along with AudaSpace. If not, see <http://www.gnu.org/licenses/>. + * You should have received a copy of the GNU General Public License + * along with Audaspace; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * ***** END LGPL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ +/** \file audaspace/Python/AUD_PyAPI.cpp + * \ingroup audpython + */ + + #include "AUD_PyAPI.h" #include "structmember.h" @@ -851,7 +857,7 @@ Factory_filter(Factory* self, PyObject* args) return NULL; } - if(!PySequence_Length(py_b) || (py_a != NULL && !PySequence_Length(py_a))) + if(!PySequence_Size(py_b) || (py_a != NULL && !PySequence_Size(py_a))) { PyErr_SetString(PyExc_ValueError, "The sequence has to contain at least one value!"); return NULL; @@ -862,7 +868,7 @@ Factory_filter(Factory* self, PyObject* args) float value; int result; - for(int i = 0; i < PySequence_Length(py_b); i++) + for(int i = 0; i < PySequence_Size(py_b); i++) { py_value = PySequence_GetItem(py_b, i); result = PyArg_Parse(py_value, "f:filter", &value); @@ -876,7 +882,7 @@ Factory_filter(Factory* self, PyObject* args) if(py_a) { - for(int i = 0; i < PySequence_Length(py_a); i++) + for(int i = 0; i < PySequence_Size(py_a); i++) { py_value = PySequence_GetItem(py_a, i); result = PyArg_Parse(py_value, "f:filter", &value); @@ -1044,18 +1050,13 @@ Handle_pause(Handle *self) try { - if(device->device->pause(self->handle)) - { - Py_RETURN_TRUE; - } + return PyBool_FromLong((long)device->device->pause(self->handle)); } catch(AUD_Exception& e) { PyErr_SetString(AUDError, e.str); return NULL; } - - Py_RETURN_FALSE; } PyDoc_STRVAR(M_aud_Handle_resume_doc, @@ -1071,18 +1072,13 @@ Handle_resume(Handle *self) try { - if(device->device->resume(self->handle)) - { - Py_RETURN_TRUE; - } + return PyBool_FromLong((long)device->device->resume(self->handle)); } catch(AUD_Exception& e) { PyErr_SetString(AUDError, e.str); return NULL; } - - Py_RETURN_FALSE; } PyDoc_STRVAR(M_aud_Handle_stop_doc, @@ -1099,18 +1095,13 @@ Handle_stop(Handle *self) try { - if(device->device->stop(self->handle)) - { - Py_RETURN_TRUE; - } + return PyBool_FromLong((long)device->device->stop(self->handle)); } catch(AUD_Exception& e) { PyErr_SetString(AUDError, e.str); return NULL; } - - Py_RETURN_FALSE; } static PyMethodDef Handle_methods[] = { @@ -1185,14 +1176,7 @@ Handle_get_keep(Handle *self, void* nothing) try { - if(device->device->getKeep(self->handle)) - { - Py_RETURN_TRUE; - } - else - { - Py_RETURN_FALSE; - } + return PyBool_FromLong((long)device->device->getKeep(self->handle)); } catch(AUD_Exception& e) { @@ -1237,7 +1221,7 @@ Handle_get_status(Handle *self, void* nothing) try { - return Py_BuildValue("i", device->device->getStatus(self->handle)); + return PyBool_FromLong((long)device->device->getStatus(self->handle)); } catch(AUD_Exception& e) { @@ -1568,14 +1552,7 @@ Handle_get_relative(Handle *self, void* nothing) AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(dev->device); if(device) { - if(device->isRelative(self->handle)) - { - Py_RETURN_TRUE; - } - else - { - Py_RETURN_FALSE; - } + return PyBool_FromLong((long)device->isRelative(self->handle)); } else { |