Had to change the #includes of dependend headers from "dir/header.h" to "../dir...
[supertux.git] / lib / audio / sound_manager.h
index 4a74244..48a1440 100644 (file)
 #include <map>
 
 #include "SDL_mixer.h"
+#include "../math/vector.h"
 
-#include "math/vector.h"
+namespace SuperTux
+  {
 
-class MusicRef;
-class MovingObject;
+  class MusicRef;
+  class MovingObject;
 
-/** This class handles all sounds that are played
- */
-class SoundManager
-{
-public:
-  SoundManager();
-  ~SoundManager();
+  /// Sound manager
+  /** This class handles all sounds that are played
+   */
+  class SoundManager
+    {
+    public:
+      SoundManager();
+      ~SoundManager();
 
-  void play_sound(Mix_Chunk* sound);
-  void play_sound(Mix_Chunk* sound, const Vector& pos, const Vector& pos2);
-  void play_sound(Mix_Chunk* sound, const MovingObject* object, const Vector& pos);
+      /// Play sound.
+      void play_sound(Mix_Chunk* sound);
+      /// Play sound relative to two Vectors.
+      void play_sound(Mix_Chunk* sound, const Vector& pos, const Vector& pos2);
+      /// Play sound relative to a MovingObject and a Vector.
+      void play_sound(Mix_Chunk* sound, const MovingObject* object, const Vector& pos);
 
-  MusicRef load_music(const std::string& file);
-  bool exists_music(const std::string& filename);
-  
-  void play_music(const MusicRef& music, int loops = -1);
-  void halt_music();
+      /// Load music.
+      /** Is used to load the music for a MusicRef. */
+      MusicRef load_music(const std::string& file);
+      /// Test if a certain music file exists.
+      bool exists_music(const std::string& filename);
 
-  void enable_music(bool enable);
+      /// Play music.
+      /** @param loops: Defaults to -1, which means endless loops. */
+      void play_music(const MusicRef& music, int loops = -1);
 
-private:
-  // music part
-  friend class MusicRef;
-  class MusicResource
-  {
-  public:
-    ~MusicResource();
+      /// Halt music.
+      void halt_music();
+
+      /// Enable/Disable music.
+      void enable_music(bool enable);
+
+    private:
+      // music part
+      friend class MusicRef;
+
+      /// Resource for music.
+      /** Contains the raw music data and
+          information for music reference
+          counting. */
+      class MusicResource
+        {
+        public:
+          ~MusicResource();
+
+          SoundManager* manager;
+          Mix_Music* music;
+          int refcount;
+        };
 
-    SoundManager* manager;
-    Mix_Music* music;
-    int refcount;
-  };
+      void free_music(MusicResource* music);
 
-  void free_music(MusicResource* music);
+      std::map<std::string, MusicResource> musics;
+      MusicResource* current_music;
+      bool music_enabled;
+    };
 
-  std::map<std::string, MusicResource> musics;
-  MusicResource* current_music;
-  bool music_enabled;
-};
+} // namespace SuperTux
 
 #endif /*SUPERTUX_SOUND_MANAGER_H*/