diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_SoundActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_SoundActuator.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index e2b4022a312..024c51cabc1 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -296,6 +296,17 @@ PyTypeObject KX_SoundActuator::Type = { }; PyMethodDef KX_SoundActuator::Methods[] = { + // Deprecated -----> + {"setGain",(PyCFunction) KX_SoundActuator::sPySetGain,METH_VARARGS,NULL}, + {"getGain",(PyCFunction) KX_SoundActuator::sPyGetGain,METH_NOARGS,NULL}, + {"setPitch",(PyCFunction) KX_SoundActuator::sPySetPitch,METH_VARARGS,NULL}, + {"getPitch",(PyCFunction) KX_SoundActuator::sPyGetPitch,METH_NOARGS,NULL}, + {"setRollOffFactor",(PyCFunction) KX_SoundActuator::sPySetRollOffFactor,METH_VARARGS,NULL}, + {"getRollOffFactor",(PyCFunction) KX_SoundActuator::sPyGetRollOffFactor,METH_NOARGS,NULL}, + {"setType",(PyCFunction) KX_SoundActuator::sPySetType,METH_VARARGS,NULL}, + {"getType",(PyCFunction) KX_SoundActuator::sPyGetType,METH_NOARGS,NULL}, + // <----- + KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, startSound), KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, pauseSound), KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, stopSound), @@ -416,3 +427,109 @@ int KX_SoundActuator::pyattr_set_rollOffFactor(void *self, const struct KX_PYATT return PY_SET_ATTR_SUCCESS; } + +PyObject* KX_SoundActuator::PySetGain(PyObject* args) +{ + ShowDeprecationWarning("setGain()", "the volume property"); + float gain = 1.0; + if (!PyArg_ParseTuple(args, "f:setGain", &gain)) + return NULL; + + m_volume = gain; + if(m_handle) + AUD_setSoundVolume(m_handle, gain); + + Py_RETURN_NONE; +} + + + +PyObject* KX_SoundActuator::PyGetGain() +{ + ShowDeprecationWarning("getGain()", "the volume property"); + float gain = m_volume; + PyObject* result = PyFloat_FromDouble(gain); + + return result; +} + + + +PyObject* KX_SoundActuator::PySetPitch(PyObject* args) +{ + ShowDeprecationWarning("setPitch()", "the pitch property"); + float pitch = 1.0; + if (!PyArg_ParseTuple(args, "f:setPitch", &pitch)) + return NULL; + + m_pitch = pitch; + if(m_handle) + AUD_setSoundPitch(m_handle, pitch); + + Py_RETURN_NONE; +} + + + +PyObject* KX_SoundActuator::PyGetPitch() +{ + ShowDeprecationWarning("getPitch()", "the pitch property"); + float pitch = m_pitch; + PyObject* result = PyFloat_FromDouble(pitch); + + return result; +} + + + +PyObject* KX_SoundActuator::PySetRollOffFactor(PyObject* args) +{ + ShowDeprecationWarning("setRollOffFactor()", "the rollOffFactor property"); + float rollofffactor = 1.0; + if (!PyArg_ParseTuple(args, "f:setRollOffFactor", &rollofffactor)) + return NULL; + + m_3d.rolloff_factor = rollofffactor; + if(m_handle) + AUD_set3DSourceSetting(m_handle, AUD_3DSS_ROLLOFF_FACTOR, rollofffactor); + + Py_RETURN_NONE; +} + + + +PyObject* KX_SoundActuator::PyGetRollOffFactor() +{ + ShowDeprecationWarning("getRollOffFactor()", "the rollOffFactor property"); + float rollofffactor = m_3d.rolloff_factor; + PyObject* result = PyFloat_FromDouble(rollofffactor); + + return result; +} + + + +PyObject* KX_SoundActuator::PySetType(PyObject* args) +{ + int typeArg; + ShowDeprecationWarning("setType()", "the mode property"); + + if (!PyArg_ParseTuple(args, "i:setType", &typeArg)) { + return NULL; + } + + if ( (typeArg > KX_SOUNDACT_NODEF) + && (typeArg < KX_SOUNDACT_MAX) ) { + m_type = (KX_SOUNDACT_TYPE) typeArg; + } + + Py_RETURN_NONE; +} + +PyObject* KX_SoundActuator::PyGetType() +{ + ShowDeprecationWarning("getType()", "the mode property"); + return PyLong_FromSsize_t(m_type); +} +// <----- + |