summaryrefslogtreecommitdiff
path: root/src/sound.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-14 23:47:22 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-14 23:53:26 +0200
commitbeac98b7d093bca0fa921e5e30c2b766fb0298e9 (patch)
tree74adb5d59e6bd074a8483d14966ab2913fd50cc1 /src/sound.h
parent2f04d1c1aa1fca06754eb5c8bad631d4fbfab6df (diff)
downloadmana-client-beac98b7d093bca0fa921e5e30c2b766fb0298e9.tar.gz
mana-client-beac98b7d093bca0fa921e5e30c2b766fb0298e9.tar.bz2
mana-client-beac98b7d093bca0fa921e5e30c2b766fb0298e9.tar.xz
mana-client-beac98b7d093bca0fa921e5e30c2b766fb0298e9.zip
Cleanup of Sound class, fixing restoring of volumes and music
While a previous commit fixed the restoring of music of the current map in the setup window, this commit makes sure that the Sound class itself will resume a previously playing song when it is re-initialized. Other fixes: * Restore the correct volumes when enabling sound * Play the right audio track during login * Specify which font to use for bold text
Diffstat (limited to 'src/sound.h')
-rw-r--r--src/sound.h32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/sound.h b/src/sound.h
index 2e43ef37..3fce5447 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -46,11 +46,6 @@ class Sound
void init();
/**
- * Logs various info about sound device.
- */
- void info();
-
- /**
* Removes all sound functionalities.
*/
void close();
@@ -59,9 +54,8 @@ class Sound
* Starts background music.
*
* @param path The full path to the music file.
- * @param loop The number of times the song is played (-1 = infinite)
*/
- void playMusic(const std::string &path, int loop = -1);
+ void playMusic(const std::string &path);
/**
* Stops currently running background music track.
@@ -72,11 +66,9 @@ class Sound
* Fades in background music.
*
* @param path The full path to the music file.
- * @param loop The number of times the song is played (-1 = infinite)
* @param ms Duration of fade-in effect (ms)
*/
- void fadeInMusic(const std::string &path, int loop = -1,
- int ms = 2000);
+ void fadeInMusic(const std::string &path, int ms = 2000);
/**
* Fades out currently running background music track.
@@ -85,18 +77,9 @@ class Sound
*/
void fadeOutMusic(int ms);
- /**
- * Sets music volume.
- *
- * @param volume Volume value
- */
- void setMusicVolume(int volume);
+ int getMaxVolume() const;
- /**
- * Sets sfx volume.
- *
- * @param volume Volume value
- */
+ void setMusicVolume(int volume);
void setSfxVolume(int volume);
/**
@@ -107,11 +90,18 @@ class Sound
void playSfx(const std::string &path);
private:
+ /** Logs various info about sound device. */
+ void info();
+
+ /** Halts and frees currently playing music. */
+ void haltMusic();
+
bool mInstalled;
int mSfxVolume;
int mMusicVolume;
+ std::string mCurrentMusicFile;
Mix_Music *mMusic;
};