Planeshift
songdata.h
Go to the documentation of this file.
1 /*
2  * songdata.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 SONGDATA_H
21 #define SONGDATA_H
22 
23 //====================================================================================
24 // Crystal Space Includes
25 //====================================================================================
26 #include <cssysdef.h>
27 #include <csutil/refarr.h>
28 #include <iutil/document.h>
29 #include <isndsys/ss_data.h>
30 #include <csutil/csstring.h>
31 #include <csutil/scf_implementation.h>
32 
33 //====================================================================================
34 // Project Includes
35 //====================================================================================
36 #include <music/musicutil.h>
37 
38 //------------------------------------------------------------------------------------
39 // Forward Declarations
40 //------------------------------------------------------------------------------------
41 class Instrument;
42 struct ScoreStatistics;
43 
44 
48 struct SongData
49 {
51  uint divisions;
52  int fifths;
53  uint beats;
54  uint beatType;
55  uint tempo;
57  csRefArray<iDocumentNode> measures;
58 
63  {
64  instrument = 0;
65  divisions = 0;
66  fifths = 0;
67  beats = 0;
68  beatType = 0;
69  tempo = 0;
70  }
71 };
72 
73 
78 class SndSysSongData: public scfImplementation1<SndSysSongData, iSndSysData>
79 {
80 public:
86 
90  ~SndSysSongData();
91 
97  bool Initialize(csRef<iDocument> musicalScore);
98 
99  // From iSndSysData
100  //------------------
101 
105  virtual size_t GetDataSize();
106 
110  virtual size_t GetFrameCount();
111  virtual const char* GetDescription();
112  virtual const csSndSysSoundFormat* GetFormat();
113  virtual void SetDescription(const char* description);
114 
115  // This function is called by the renderer
116  virtual iSndSysStream* CreateStream(csSndSysSoundFormat* renderFormat, int mode3D);
117 
118 private:
119  SongData* songData;
120  csString description;
121 };
122 
123 #endif /* SONGDATA_H */
124 
ScoreStatistics scoreStats
keep the statistics of the score.
Definition: songdata.h:56
uint tempo
suggested tempo in quarter notes per minute.
Definition: songdata.h:55
csRefArray< iDocumentNode > measures
the measures of the musical sheet.
Definition: songdata.h:57
This implements a data class that can be used for the CS sound system to play a song from a musical s...
Definition: songdata.h:78
uint beats
numerator of the time signature.
Definition: songdata.h:53
This struct keeps the data about the instrument and the musical sheet.
Definition: songdata.h:48
Instrument * instrument
the instrument that the player uses to play this song.
Definition: songdata.h:50
int fifths
0 is the number of sharps, < 0 the number of flats.
Definition: songdata.h:52
void void Initialize(iObjectRegistry *object_reg)
uint divisions
number of divisions of the quarter coded in the sheet.
Definition: songdata.h:51
This struct keeps general information about a score.
Definition: musicutil.h:43
uint beatType
denumerator of the time signature.
Definition: songdata.h:54
SongData()
Constructor.
Definition: songdata.h:62
This class represent a musical instrument.
Definition: instrument.h:68