doxygen: prevent GPL license block from being parsed as doxygen comment.
[blender.git] / source / gameengine / Ketsji / KX_SoundActuator.h
1 /*
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28  */
29
30 /** \file KX_SoundActuator.h
31  *  \ingroup ketsji
32  */
33
34 #ifndef __KX_SOUNDACTUATOR
35 #define __KX_SOUNDACTUATOR
36
37 #include "SCA_IActuator.h"
38
39 #include "AUD_C-API.h"
40 #include "BKE_sound.h"
41
42 typedef struct KX_3DSoundSettings
43 {
44         float min_gain;
45         float max_gain;
46         float reference_distance;
47         float max_distance;
48         float rolloff_factor;
49         float cone_inner_angle;
50         float cone_outer_angle;
51         float cone_outer_gain;
52 } KX_3DSoundSettings;
53
54 class KX_SoundActuator : public SCA_IActuator
55 {
56         Py_Header;
57         bool                                    m_isplaying;
58         AUD_Sound*                              m_sound;
59         float                                   m_volume;
60         float                                   m_pitch;
61         bool                                    m_is3d;
62         KX_3DSoundSettings              m_3d;
63                 AUD_Channel*                            m_handle;
64
65         void play();
66
67 public:
68
69         enum KX_SOUNDACT_TYPE
70         {
71                         KX_SOUNDACT_NODEF = 0,
72                         KX_SOUNDACT_PLAYSTOP,
73                         KX_SOUNDACT_PLAYEND,
74                         KX_SOUNDACT_LOOPSTOP,
75                         KX_SOUNDACT_LOOPEND,
76                         KX_SOUNDACT_LOOPBIDIRECTIONAL,
77                         KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP,
78                         KX_SOUNDACT_MAX
79         };
80
81         KX_SOUNDACT_TYPE                m_type;
82
83         KX_SoundActuator(SCA_IObject* gameobj,
84                                          AUD_Sound* sound,
85                                          float volume,
86                                          float pitch,
87                                          bool is3d,
88                                          KX_3DSoundSettings settings,
89                                          KX_SOUNDACT_TYPE type);
90
91         ~KX_SoundActuator();
92
93         virtual bool Update(double curtime, bool frame);
94
95         CValue* GetReplica();
96         void ProcessReplica();
97
98 #ifdef WITH_PYTHON
99
100         /* -------------------------------------------------------------------- */
101         /* Python interface --------------------------------------------------- */
102         /* -------------------------------------------------------------------- */
103
104         KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, startSound);
105         KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, pauseSound);
106         KX_PYMETHOD_DOC_NOARGS(KX_SoundActuator, stopSound);
107
108         static int pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
109         static int pyattr_set_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
110         static int pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
111         static int pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
112         static int pyattr_set_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
113
114         static PyObject* pyattr_get_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
115         static PyObject* pyattr_get_audposition(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
116         static PyObject* pyattr_get_gain(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
117         static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
118         static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
119
120 #endif // WITH_PYTHON
121
122 };
123
124 #endif //__KX_SOUNDACTUATOR
125