Planeshift
|
00001 /* 00002 * manager.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_MANAGER_H_ 00025 #define _SOUND_MANAGER_H_ 00026 00027 #include <cssysdef.h> 00028 #include <iutil/objreg.h> 00029 #include <csgeom/vector3.h> 00030 #include <csutil/parray.h> 00031 00032 class SoundSystem; 00033 class SoundData; 00034 class SoundHandle; 00035 class SoundControl; 00036 00037 enum 00038 { 00039 LOOP = true, 00040 DONT_LOOP = false 00041 }; 00042 00043 00044 #define VOLUME_ZERO 0.0f 00045 #define VOLUME_MIN 0.0f 00046 #define VOLUME_NORM 1.0f 00047 #define VOLUME_MAX 2.0f 00048 00062 class SoundSystemManager 00063 { 00064 public: 00065 bool Initialised; 00066 SoundControl *mainSndCtrl; 00067 SoundControl *guiSndCtrl; 00068 SoundControl *effectSndCtrl; 00069 00078 SoundSystemManager (iObjectRegistry* objectReg); 00085 ~SoundSystemManager (); 00086 00090 void UpdateSound (); 00091 00102 bool Play2DSound (const char *name, bool loop, size_t loopstart, 00103 size_t loopend, float volume_preset, 00104 SoundControl* &sndCtrl, SoundHandle * &handle); 00105 00122 bool Play3DSound (const char *name, bool loop, size_t loopstart, 00123 size_t loopend, float volume_preset, 00124 SoundControl* &sndCtrl, csVector3 pos, csVector3 dir, 00125 float mindist, float maxdist, float rad, int type3d, 00126 SoundHandle * &handle); 00127 00133 void StopSound (SoundHandle *handle); 00134 00141 void UpdateListener (csVector3 v, csVector3 f, csVector3 t); 00142 00148 void Update (); 00155 SoundControl* GetSoundControl (); 00156 00157 SoundSystem* GetSoundSystem() { return soundSystem; } 00158 SoundData* GetSoundData() { return soundData; } 00159 00160 private: 00161 SoundSystem *soundSystem; 00162 SoundData *soundData; 00163 csPDelArray<SoundControl> soundController; 00164 00165 csPDelArray<SoundHandle> soundHandles; 00166 00167 csTicks SndTime; 00168 csTicks LastUpdateTime; 00169 }; 00170 00171 #endif /*_SOUND_MANAGER_H_*/