Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/Ketsji/KX_SoundActuator.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp57
1 files changed, 18 insertions, 39 deletions
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 5c02a2db646..673f42283dd 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -50,9 +50,8 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
SND_Scene* sndscene,
KX_SOUNDACT_TYPE type,
short start,
- short end,
- PyTypeObject* T)
- : SCA_IActuator(gameobj,T)
+ short end)
+ : SCA_IActuator(gameobj)
{
m_soundObject = sndobj;
m_soundScene = sndscene;
@@ -112,7 +111,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
return false;
// actual audio device playing state
- bool isplaying = (m_soundObject->GetPlaystate() != SND_STOPPED) ? true : false;
+ bool isplaying = (m_soundObject->GetPlaystate() != SND_STOPPED && m_soundObject->GetPlaystate() != SND_INITIAL) ? true : false;
if (m_pino)
{
@@ -194,7 +193,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
}
}
// verify that the sound is still playing
- isplaying = (m_soundObject->GetPlaystate() != SND_STOPPED) ? true : false;
+ isplaying = (m_soundObject->GetPlaystate() != SND_STOPPED && m_soundObject->GetPlaystate() != SND_INITIAL) ? true : false;
if (isplaying)
{
@@ -250,25 +249,17 @@ PyTypeObject KX_SoundActuator::Type = {
0,
0,
py_base_repr,
- 0,0,0,0,0,0,
- py_base_getattro,
- py_base_setattro,
0,0,0,0,0,0,0,0,0,
- Methods
-};
-
-
-
-PyParentObject KX_SoundActuator::Parents[] = {
- &KX_SoundActuator::Type,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ 0,0,0,0,0,0,0,
+ Methods,
+ 0,
+ 0,
&SCA_IActuator::Type,
- &SCA_ILogicBrick::Type,
- &CValue::Type,
- NULL
+ 0,0,0,0,0,0,
+ py_base_new
};
-
-
PyMethodDef KX_SoundActuator::Methods[] = {
// Deprecated ----->
{"setFilename", (PyCFunction) KX_SoundActuator::sPySetFilename, METH_VARARGS,NULL},
@@ -340,25 +331,13 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound,
}
/* Atribute setting and getting -------------------------------------------- */
-PyObject* KX_SoundActuator::py_getattro(PyObject *attr)
-{
- py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_SoundActuator::py_getattro_dict() {
- py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_SoundActuator::py_setattro(PyObject *attr, PyObject* value) {
- py_setattro_up(SCA_IActuator);
-}
PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
if (!actuator->m_soundObject)
{
- return PyString_FromString("");
+ return PyUnicode_FromString("");
}
STR_String objectname = actuator->m_soundObject->GetObjectName();
char* name = objectname.Ptr();
@@ -367,7 +346,7 @@ PyObject* KX_SoundActuator::pyattr_get_filename(void *self, const struct KX_PYAT
PyErr_SetString(PyExc_RuntimeError, "value = actuator.fileName: KX_SoundActuator, unable to get sound fileName");
return NULL;
} else
- return PyString_FromString(name);
+ return PyUnicode_FromString(name);
}
PyObject* KX_SoundActuator::pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
@@ -402,7 +381,7 @@ PyObject* KX_SoundActuator::pyattr_get_looping(void *self, const struct KX_PYATT
{
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
int looping = (actuator->m_soundObject) ? actuator->m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
- PyObject* result = PyInt_FromLong(looping);
+ PyObject* result = PyLong_FromSsize_t(looping);
return result;
}
@@ -580,7 +559,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
ShowDeprecationWarning("getFilename()", "the fileName property");
if (!m_soundObject)
{
- return PyString_FromString("");
+ return PyUnicode_FromString("");
}
STR_String objectname = m_soundObject->GetObjectName();
char* name = objectname.Ptr();
@@ -589,7 +568,7 @@ PyObject* KX_SoundActuator::PyGetFilename()
PyErr_SetString(PyExc_RuntimeError, "Unable to get sound fileName");
return NULL;
} else
- return PyString_FromString(name);
+ return PyUnicode_FromString(name);
}
PyObject* KX_SoundActuator::PySetGain(PyObject* args)
@@ -689,7 +668,7 @@ PyObject* KX_SoundActuator::PyGetLooping()
{
ShowDeprecationWarning("getLooping()", "the looping property");
int looping = (m_soundObject) ? m_soundObject->GetLoopMode() : (int)SND_LOOP_OFF;
- PyObject* result = PyInt_FromLong(looping);
+ PyObject* result = PyLong_FromSsize_t(looping);
return result;
}
@@ -777,7 +756,7 @@ PyObject* KX_SoundActuator::PySetType(PyObject* args)
PyObject* KX_SoundActuator::PyGetType()
{
ShowDeprecationWarning("getType()", "the mode property");
- return PyInt_FromLong(m_type);
+ return PyLong_FromSsize_t(m_type);
}
// <-----