Planeshift

system.h

Go to the documentation of this file.
00001 /*
00002  * system.h
00003  *
00004  * Copyright (C) 2001-2010 Atomic Blue ([email protected], http://www.planeshift.it)
00005  *
00006  * Credits : Saul Leite <[email protected]>
00007  *           Mathias 'AgY' Voeroes <[email protected]>
00008  *           and all past and present planeshift coders
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License
00012  * as published by the Free Software Foundation (version 2 of the License.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021  *
00022  */
00023 
00024 #ifndef _SOUND_SYSTEM_H_
00025 #define _SOUND_SYSTEM_H_
00026 
00027 #include <cssysdef.h>
00028 #include <iutil/objreg.h>
00029 #include <isndsys.h>
00030 
00031 #define DEFAULT_LISTENER_ROLL_OFF 1.0
00032 
00033 
00040 class SoundSystem
00041 {
00042 public:
00049     bool Initialize(iObjectRegistry* objectReg);
00050 
00060     bool CreateStream(csRef<iSndSysData> &sndData, bool loop, int type,
00061                       csRef<iSndSysStream> &sndStream);
00062 
00067     void RemoveStream(csRef<iSndSysStream> &sndStream);
00068 
00075     bool CreateSource(csRef<iSndSysStream> &sndStream,
00076                       csRef<iSndSysSource> &sndSource);
00077 
00084     void RemoveSource(csRef<iSndSysSource> &sndSource);
00085 
00096     void Create3DSource(csRef<iSndSysSource> &sndSource,
00097                         csRef<iSndSysSource3D> &sndSource3D,
00098                         float minDist, float maxDist, csVector3 pos);
00099 
00109     void CreateDirectional3DSource(csRef<iSndSysSource3D> &sndSource3D,
00110                                    csRef<iSndSysSource3DDirectionalSimple> &sndSourceDir,
00111                                    csVector3 direction, float rad);
00112 
00119     void UpdateListener(csVector3 v, csVector3 f, csVector3 t);
00120 
00126     csVector3 GetListenerPosition() const;
00127 
00128 private:
00129     csRef<iSndSysRenderer> sndRenderer; 
00130     csRef<iSndSysListener> listener;    
00131 };
00132 
00133 #endif /*_SOUND_SYSTEM_H_*/