home *** CD-ROM | disk | FTP | other *** search
/ Game Audio Programming / GameAudioProgramming.iso / Game_Audio / audio_sdk / src / AudioScript / MusicMgr.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-07-25  |  2.1 KB  |  95 lines

  1. /***********************************************************\
  2. Copyright (C) James Boer, 2002. 
  3. All rights reserved worldwide.
  4.  
  5. This software is provided "as is" without express or implied
  6. warranties. You may freely copy and compile this source into
  7. applications you distribute provided that the copyright text
  8. below is included in the resulting source code, for example:
  9. "Portions Copyright (C) James Boer, 2002"
  10. \***********************************************************/
  11. #ifndef __MUSICMGR_H
  12. #define __MUSICMGR_H
  13.  
  14. #include "Audio.h"
  15. #include "Script.h"
  16.  
  17. namespace Audio
  18. {
  19.  
  20. class Theme;
  21.  
  22. typedef std::map<std::string, IDLS*> IDLSMap;
  23. typedef std::map<std::string, ISegment*> ISegmentMap;
  24. typedef std::map<std::string, Theme*> ThemeMap;
  25.  
  26. class MusicManager : public IMusicManager
  27. {
  28. // Interface functions
  29. public:
  30.     
  31.     bool Init();
  32.     void Term();
  33.     bool IsInitialized()        {  return m_bInitialized;  }
  34.  
  35.     bool LoadScript(std::string sFileName);
  36.  
  37.     // Theme functions
  38.     bool PlayTheme(std::string sThemeName);
  39.     void ResetThemeItr();
  40.     bool GetNextTheme(std::string& sThemeName);
  41.     bool RemoveTheme(std::string& sThemeName);
  42.     bool RemoveAll();
  43.  
  44.     void OnSegmentStart();
  45.  
  46. // Concrete functions    
  47. public:
  48.     MusicManager();
  49.     virtual ~MusicManager();
  50.  
  51.     void Clear();
  52.  
  53.  
  54.  
  55. // Internal functions and types
  56. private:
  57.     
  58.  
  59.     bool LoadDLS(ScriptNode* pNode);
  60.     bool LoadSegment(ScriptNode* pNode);
  61.     bool LoadTheme(ScriptNode* pNode);
  62.     bool LoadThemeNode(ScriptNode* pNode, Theme* pTheme);
  63.  
  64.  
  65. // Internal data
  66. private:
  67.     // Bool indicating initialization status
  68.     bool                    m_bInitialized;
  69.     // Script loader object
  70.     ScriptLoader            m_Loader;
  71.  
  72.     // DLS data
  73.     IDLSMap                    m_DLSMap;
  74.     // Segment data
  75.     ISegmentMap                m_SegmentMap;
  76.     // Theme collection
  77.     ThemeMap                m_ThemeMap;
  78.     ThemeMap::iterator        m_ThemeItr;
  79.  
  80.     IDLS*                    m_pCurrentDLS;
  81.  
  82.     // Currently playing theme
  83.     Theme*                    m_pPlayingTheme;
  84.     Theme*                    m_pPlayingInterlude;
  85.     Theme*                    m_pPreviousTheme;
  86.  
  87.     bool                    m_bIsPlaying;
  88. };
  89.  
  90. inline static MusicManager* CMusicMgr()
  91. {  return static_cast<MusicManager*>(MusicMgr());  }
  92.  
  93. }; // namespace Audio
  94.  
  95. #endif // __MUSICMGR_H