00001 /* 00002 Smacky - Music emulator on speakers 00003 Copyright (C) 2006 - Nicolas Lermé 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 3 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef __TAB_H__ 00021 #define __TAB_H__ 00022 00023 #include <string> 00024 #include <vector> 00025 #include "types.h" 00026 #include "block.h" 00027 #include "entity.h" 00028 00029 00030 class CScore 00031 { 00032 friend class CSmartPtr<CScore>; 00033 00034 private : 00035 std::string m_Name; 00036 uint m_Tempo, m_NbBlocks, m_NbNotes, m_NbPauses; 00037 std::vector<CSmartPtr<IEntity> > m_Entities; 00038 00039 typedef std::vector<CSmartPtr<IEntity> > TEntities; 00040 typedef TEntities::iterator TEntitiesIt; 00041 typedef TEntities::const_iterator TEntitiesCIt; 00042 00043 CScore( const std::string & Name, const uint Tempo ); 00044 00045 public : 00046 static CSmartPtr<CScore> Create( const std::string & Name, const uint Tempo ) 00047 { 00048 return new CScore(Name, Tempo); 00049 } 00050 00051 virtual ~CScore(); 00052 00053 static std::string DefaultName() 00054 { 00055 return "My music score"; 00056 } 00057 00058 static uint DefaultTempo() 00059 { 00060 return 500; 00061 } 00062 00063 const std::string & Name() const; 00064 const uint & Tempo() const; 00065 void AddEntity( const CSmartPtr<IEntity> & Entity ); 00066 void Purge(); 00067 void Play() const; 00068 }; 00069 00070 #endif //__TAB_H__