6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL LICENSE BLOCK *****
32 #ifndef __KX_SOUNDACTUATOR
33 #define __KX_SOUNDACTUATOR
35 #include "SCA_IActuator.h"
37 #include "AUD_C-API.h"
38 #include "BKE_sound.h"
40 typedef struct KX_3DSoundSettings
44 float reference_distance;
47 float cone_inner_angle;
48 float cone_outer_angle;
49 float cone_outer_gain;
52 class KX_SoundActuator : public SCA_IActuator
60 KX_3DSoundSettings m_3d;
69 KX_SOUNDACT_NODEF = 0,
74 KX_SOUNDACT_LOOPBIDIRECTIONAL,
75 KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP,
79 KX_SOUNDACT_TYPE m_type;
81 KX_SoundActuator(SCA_IObject* gameobj,
86 KX_3DSoundSettings settings,
87 KX_SOUNDACT_TYPE type);
91 virtual bool Update(double curtime, bool frame);
94 void ProcessReplica();
96 #ifndef DISABLE_PYTHON
98 /* -------------------------------------------------------------------- */
99 /* Python interface --------------------------------------------------- */
100 /* -------------------------------------------------------------------- */
102 KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, startSound);
103 KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, pauseSound);
104 KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, stopSound);
106 static int pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
107 static int pyattr_set_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
108 static int pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
109 static int pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
110 static int pyattr_set_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
111 static int pyattr_set_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
113 static PyObject* pyattr_get_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
114 static PyObject* pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
115 static PyObject* pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
116 static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
117 static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
118 static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
120 #endif // DISABLE_PYTHON
124 #endif //__KX_SOUNDACTUATOR