Planeshift
|
00001 /* 00002 * clientsongmngr.h, Author: Andrea Rizzi <[email protected]> 00003 * 00004 * Copyright (C) 2001-2011 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 CLIENT_SONG_MANAGER_H 00021 #define CLIENT_SONG_MANAGER_H 00022 00023 //==================================================================================== 00024 // Crystal Space Includes 00025 //==================================================================================== 00026 #include <cssysdef.h> 00027 #include <csutil/ref.h> 00028 #include <csutil/hash.h> 00029 #include <iutil/document.h> 00030 00031 //==================================================================================== 00032 // Project Includes 00033 //==================================================================================== 00034 #include <net/cmdbase.h> 00035 00036 //------------------------------------------------------------------------------------ 00037 // Forward Declarations 00038 //------------------------------------------------------------------------------------ 00039 class MsgEntry; 00040 class csString; 00041 class csVector3; 00042 00043 00047 class iSongManagerListener 00048 { 00049 public: 00053 virtual void OnMainPlayerSongStop() = 0; 00054 }; 00055 00060 class ClientSongManager: public psClientNetSubscriber 00061 { 00062 public: 00066 ClientSongManager(); 00067 00071 ~ClientSongManager(); 00072 00080 void PlayMainPlayerSong(uint32_t itemID, const csString &musicalSheet); 00081 00086 void StopMainPlayerSong(bool notifyServer); 00087 00091 void Update(); 00092 00097 void Subscribe(iSongManagerListener* listener); 00098 00103 void Unsubscribe(iSongManagerListener* listener); 00104 00105 00106 // From psClientNetSubscriber 00107 //---------------------------- 00108 virtual void HandleMessage(MsgEntry* message); 00109 00110 private: 00114 enum 00115 { 00116 PENDING = -1, 00117 NO_SONG = 0 00118 }; 00119 00120 uint mainSongID; 00121 csString sheet; 00122 csHash<uint, uint32> songMap; 00123 csArray<iSongManagerListener*> listeners; 00124 00133 uint PlaySong(const char* musicalSheet, const char* instrName, csVector3 playerPos); 00134 00139 void StopSong(uint songID); 00140 00144 void TriggerListeners(); 00145 }; 00146 00147 #endif // CLIENT_SONG_MANAGER_H