Planeshift
clientsongmngr.h
Go to the documentation of this file.
1 /*
2  * clientsongmngr.h, Author: Andrea Rizzi <88whacko@gmail.com>
3  *
4  * Copyright (C) 2001-2011 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef CLIENT_SONG_MANAGER_H
21 #define CLIENT_SONG_MANAGER_H
22 
23 //====================================================================================
24 // Crystal Space Includes
25 //====================================================================================
26 #include <cssysdef.h>
27 #include <csutil/ref.h>
28 #include <csutil/hash.h>
29 #include <iutil/document.h>
30 
31 //====================================================================================
32 // Project Includes
33 //====================================================================================
34 #include <net/cmdbase.h>
35 
36 //------------------------------------------------------------------------------------
37 // Forward Declarations
38 //------------------------------------------------------------------------------------
39 class MsgEntry;
40 class csString;
41 class csVector3;
42 
43 
48 {
49 public:
53  virtual void OnMainPlayerSongStop() = 0;
54 };
55 
61 {
62 public:
67 
72 
80  void PlayMainPlayerSong(uint32_t itemID, const csString &musicalSheet);
81 
86  void StopMainPlayerSong(bool notifyServer);
87 
91  void Update();
92 
97  void Subscribe(iSongManagerListener* listener);
98 
103  void Unsubscribe(iSongManagerListener* listener);
104 
105 
106  // From psClientNetSubscriber
107  //----------------------------
108  virtual void HandleMessage(MsgEntry* message);
109 
110 private:
114  enum
115  {
116  PENDING = -1,
117  NO_SONG = 0
118  };
119 
120  uint mainSongID;
121  csString sheet;
122  csHash<uint, uint32> songMap;
123  csArray<iSongManagerListener*> listeners;
124 
133  uint PlaySong(const char* musicalSheet, const char* instrName, csVector3 playerPos);
134 
139  void StopSong(uint songID);
140 
144  void TriggerListeners();
145 };
146 
147 #endif // CLIENT_SONG_MANAGER_H
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
This interface implemets a listener to client song events.
This class connect the GUI and the server side of the instruments system to the sound plugin...
virtual void OnMainPlayerSongStop()=0
This is called when the main player&#39;s song is stopped.