Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

soundList.h

Go to the documentation of this file.
00001 #ifndef soundListH
00002 #define soundListH
00003 
00008 #include <map>
00009 
00010 #include "global.h"
00011 #include "sdl/sound.h"
00012 #include "ascstring.h"
00013 #include "textfile_evaluation.h"
00014 
00019 class SoundLoopManager {
00020       Sound* sound;
00021       bool active;
00022    public:
00023       SoundLoopManager ( Sound* snd, bool _active = true );
00024       // void setSound ( Sound* snd ) { sound = snd; };
00025       void activate ( int dummy );
00026       void fadeOut ( int ms ) { if ( sound && active ) sound->fadeOut( ms ); };
00027       ~SoundLoopManager() { if ( sound && active ) sound->stop(); };
00028 };
00029 
00030 
00031 
00035 class SoundList {
00036     SoundList() {};
00037     static SoundList* instance;
00038 public:
00039     static SoundList& getInstance();
00040     enum Sample { shooting, unitExplodes, buildingCollapses, moving, menu_ack, conquer_building, repair, refuel, jumpdrive };
00041 
00042     static void init( );
00043     Sound* playSound ( Sample snd, int subType = 0, bool looping = false, const ASCString& label = "" );
00044     Sound* getSound ( Sample snd, int subType = 0, const ASCString& label = "", int height = -1);
00045 
00046    ~SoundList();
00047 private:
00048      void initialize();
00049 
00050      typedef map<ASCString,Sound*> SoundFiles;
00051      SoundFiles  soundFiles;
00052 
00053      Sound* getSound( const ASCString& filename );
00054 
00055       struct SoundAssignment {
00056            SoundList::Sample sample;
00057            int subType;
00058            Sound* defaultSound;
00059            map<ASCString,Sound*> snd;
00060       };
00061      vector<SoundAssignment> soundAssignments;
00062      void readLine( PropertyContainer& pc, const ASCString& name, SoundList::Sample sample, int subtype = 0 );
00063 };
00064 
00065 #endif

Generated on Tue Jun 24 01:27:52 2008 for Advanced Strategic Command by  doxygen 1.4.2