From beac98b7d093bca0fa921e5e30c2b766fb0298e9 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 14 Apr 2009 23:47:22 +0200 Subject: 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 --- src/sound.h | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'src/sound.h') diff --git a/src/sound.h b/src/sound.h index 2e43ef37..3fce5447 100644 --- a/src/sound.h +++ b/src/sound.h @@ -45,11 +45,6 @@ class Sound */ void init(); - /** - * Logs various info about sound device. - */ - void info(); - /** * Removes all sound functionalities. */ @@ -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; }; -- cgit v1.2.3-70-g09d2