Planeshift
system.h
Go to the documentation of this file.
1 /*
2  * system.h
3  *
4  * Copyright (C) 2001-2010 Atomic Blue (info@planeshift.it, http://www.planeshift.it)
5  *
6  * Credits : Saul Leite <leite@engineer.com>
7  * Mathias 'AgY' Voeroes <agy@operswithoutlife.net>
8  * and all past and present planeshift coders
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation (version 2 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * 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
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 
24 #ifndef _SOUND_SYSTEM_H_
25 #define _SOUND_SYSTEM_H_
26 
27 #include <cssysdef.h>
28 #include <iutil/objreg.h>
29 #include <isndsys.h>
30 
31 #define DEFAULT_LISTENER_ROLL_OFF 1.0
32 
33 
40 class SoundSystem
41 {
42 public:
49  bool Initialize(iObjectRegistry* objectReg);
50 
60  bool CreateStream(csRef<iSndSysData> &sndData, bool loop, int type,
61  csRef<iSndSysStream> &sndStream);
62 
67  void RemoveStream(csRef<iSndSysStream> &sndStream);
68 
75  bool CreateSource(csRef<iSndSysStream> &sndStream,
76  csRef<iSndSysSource> &sndSource);
77 
84  void RemoveSource(csRef<iSndSysSource> &sndSource);
85 
96  void Create3DSource(csRef<iSndSysSource> &sndSource,
97  csRef<iSndSysSource3D> &sndSource3D,
98  float minDist, float maxDist, csVector3 pos);
99 
109  void CreateDirectional3DSource(csRef<iSndSysSource3D> &sndSource3D,
110  csRef<iSndSysSource3DDirectionalSimple> &sndSourceDir,
111  csVector3 direction, float rad);
112 
119  void UpdateListener(csVector3 v, csVector3 f, csVector3 t);
120 
126  csVector3 GetListenerPosition() const;
127 
128 private:
129  csRef<iSndSysRenderer> sndRenderer;
130  csRef<iSndSysListener> listener;
131 };
132 
133 #endif /*_SOUND_SYSTEM_H_*/
void Create3DSource(csRef< iSndSysSource > &sndSource, csRef< iSndSysSource3D > &sndSource3D, float minDist, float maxDist, csVector3 pos)
Creates a 3D source on top of a 2D source.
void RemoveSource(csRef< iSndSysSource > &sndsource)
Removes a Source.
bool CreateSource(csRef< iSndSysStream > &sndstream, csRef< iSndSysSource > &sndsource)
Create a Source associated to your Stream.
bool Initialize(iObjectRegistry *objectReg)
initializes this object and tries to load the soundrenderer.
csVector3 GetListenerPosition() const
Gets the current listener&#39;s position.
bool CreateStream(csRef< iSndSysData > &snddata, int loop, int type, csRef< iSndSysStream > &sndstream)
Creates a stream out of the given snddata.
void RemoveStream(csRef< iSndSysStream > &sndstream)
Removes a stream.
void UpdateListener(csVector3 v, csVector3 f, csVector3 t)
Updates listener position.
void CreateDirectional3DSource(csRef< iSndSysSource3D > &sndSource3D, csRef< iSndSysSource3DDirectionalSimple > &sndSourceDir, csVector3 direction, float rad)
Creates a directional source on top of a 3D source.
This is an Interface Class to the Crystalspace Soundrenderer.
Definition: system.h:37