Planeshift

songdata.h

Go to the documentation of this file.
00001 /*
00002  * songdata.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 SONGDATA_H
00021 #define SONGDATA_H
00022 
00023 //====================================================================================
00024 // Crystal Space Includes
00025 //====================================================================================
00026 #include <cssysdef.h>
00027 #include <csutil/refarr.h>
00028 #include <iutil/document.h>
00029 #include <isndsys/ss_data.h>
00030 #include <csutil/csstring.h>
00031 #include <csutil/scf_implementation.h>
00032 
00033 //====================================================================================
00034 // Project Includes
00035 //====================================================================================
00036 #include <music/musicutil.h>
00037 
00038 //------------------------------------------------------------------------------------
00039 // Forward Declarations
00040 //------------------------------------------------------------------------------------
00041 class Instrument;
00042 struct ScoreStatistics;
00043 
00044 
00048 struct SongData
00049 {
00050     Instrument* instrument;             
00051     uint divisions;                     
00052     int fifths;                         
00053     uint beats;                         
00054     uint beatType;                      
00055     uint tempo;                         
00056     ScoreStatistics scoreStats;         
00057     csRefArray<iDocumentNode> measures; 
00058 
00062     SongData()
00063     {
00064         instrument = 0;
00065         divisions = 0;
00066         fifths = 0;
00067         beats = 0;
00068         beatType = 0;
00069         tempo = 0;
00070     }
00071 };
00072 
00073 
00078 class SndSysSongData: public scfImplementation1<SndSysSongData, iSndSysData>
00079 {
00080 public:
00085     SndSysSongData(Instrument* instrument);
00086 
00090     ~SndSysSongData();
00091 
00097     bool Initialize(csRef<iDocument> musicalScore);
00098 
00099     // From iSndSysData
00100     //------------------
00101 
00105     virtual size_t GetDataSize();
00106 
00110     virtual size_t GetFrameCount();
00111     virtual const char* GetDescription();
00112     virtual const csSndSysSoundFormat* GetFormat();
00113     virtual void SetDescription(const char* description);
00114 
00115     // This function is called by the renderer
00116     virtual iSndSysStream* CreateStream(csSndSysSoundFormat* renderFormat, int mode3D);
00117 
00118 private:
00119     SongData* songData;
00120     csString description;
00121 };
00122 
00123 #endif /* SONGDATA_H */
00124