Planeshift

dummysndmngr.h

Go to the documentation of this file.
00001 /*
00002 * dummysndmngr.h, Author: Andrea Rizzi <[email protected]>
00003 *
00004 * Copyright (C) 2001-2008 Atomic Blue ([email protected], http://www.atomicblue.org) 
00005 *
00006 *
00007 * This program is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU General Public License
00009 * as published by the Free Software Foundation (version 2 of the License)
00010 * This program is distributed in the hope that it will be useful,
00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 * GNU General Public License for more details.
00014 * You should have received a copy of the GNU General Public License
00015 * along with this program; if not, write to the Free Software
00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 *
00018 */
00019 
00020 #ifndef _DUMMYSNDMNGR_H_
00021 #define _DUMMYSNDMNGR_H_
00022 
00023 //====================================================================================
00024 // Crystal Space Includes
00025 //====================================================================================
00026 #include <iutil/comp.h>
00027 #include <csgeom/vector3.h>
00028 #include <iutil/document.h>
00029 
00030 //====================================================================================
00031 // Project Includes
00032 //====================================================================================
00033 #include <isoundmngr.h>
00034 
00035 //------------------------------------------------------------------------------------
00036 // Forward Declarations
00037 //------------------------------------------------------------------------------------
00038 struct iObjectRegistry;
00039 class DummySoundControl;
00040 
00045 class DummySoundManager: public scfImplementation2<DummySoundManager, iSoundManager, iComponent>
00046 {
00047 public:
00048     DummySoundManager(iBase* parent);
00049     virtual ~DummySoundManager();
00050 
00051     //From iComponent
00052     virtual bool Initialize(iObjectRegistry* objReg);
00053 
00054     //From iSoundManager
00055     //Sectors managing
00056     virtual bool InitializeSectors();
00057     virtual bool LoadActiveSector(const char* sectorName);
00058     virtual bool ReloadSectors();
00059 
00060     //SoundControls and SoundQueue managing
00061     virtual iSoundControl* GetSndCtrl(SndCtrlID sndCtrlID);
00062     virtual bool AddSndQueue(int queueID, SndCtrlID sndCtrlID);
00063     virtual void RemoveSndQueue(int queueID);
00064     virtual bool PushQueueItem(int queueID, const char* fileName);
00065 
00066     //State
00067     virtual bool IsSoundActive(SndCtrlID sndCtrlID);
00068     virtual void SetCombatStance(int newCombatStance);
00069     virtual int GetCombatStance() const;
00070     virtual void SetPlayerMovement(csVector3 playerPosition, csVector3 playerVelocity);
00071     virtual csVector3 GetPosition() const;
00072     virtual void SetTimeOfDay(int newTimeOfDay);
00073     virtual void SetWeather(int newWeather);
00074     virtual void SetEntityState(int state, iMeshWrapper* mesh, const char* meshName, bool forceChange);
00075     virtual void AddObjectEntity(iMeshWrapper* mesh, const char* meshName);
00076     virtual void RemoveObjectEntity(iMeshWrapper* mesh, const char* meshName);
00077     virtual void UpdateObjectEntity(iMeshWrapper* mesh, const char* meshName);
00078 
00079     //Toggles
00080     virtual void SetLoopBGMToggle(bool toggle);
00081     virtual bool IsLoopBGMToggleOn();
00082     virtual void SetCombatMusicToggle(bool toggle);
00083     virtual bool IsCombatMusicToggleOn();
00084     virtual void SetListenerOnCameraToggle(bool toggle);
00085     virtual bool IsListenerOnCameraToggleOn();
00086     virtual void SetChatToggle(bool toggle);
00087     virtual bool IsChatToggleOn();
00088 
00089     //Play sounds
00090     virtual bool IsSoundValid(uint soundID) const;
00091     virtual uint PlaySound(const char* fileName, bool loop, SndCtrlID sndCtrlID);
00092     virtual uint PlaySound(const char* fileName, bool loop, SndCtrlID sndCtrlID, csVector3 pos, csVector3 dir, float minDist, float maxDist);
00093     virtual uint PlaySong(csRef<iDocument> musicalSheet, const char* instrument,
00094         SndCtrlID sndCtrlID, csVector3 pos, csVector3 dir);
00095     virtual bool StopSound(uint soundID);
00096     virtual bool SetSoundSource(uint soundID, csVector3 position);
00097 
00098     //Updating function
00099     virtual void Update();
00100     virtual void UpdateListener(iView* view);
00101     
00102 
00103 private:
00104     DummySoundControl* defaultSndCtrl;    
00105     csVector3          position;          
00106     int                combat;            
00107     bool               loopToggle;        
00108     bool               combatToggle;      
00109     bool               listenerToggle;    
00110     bool               chatToggle;        
00111 };    
00112 
00113 #endif // __DUMMYSNDMNGR_H_