diff options
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/sound.cpp | 7 | ||||
-rw-r--r-- | src/sound.h | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index b7518ac5..51e39335 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -339,6 +339,7 @@ int main(int argc, char *argv[]) switch (state) { case LOGIN: logger.log("State: LOGIN"); + sound.startBgm("data/music/Ivano(de)Jeanette.ogg"); login(); break; case CHAR_SERVER: diff --git a/src/sound.cpp b/src/sound.cpp index 8de4077e..0013cb21 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -85,7 +85,12 @@ void Sound::startBgm(char *in, int loop) logger.log("Sound::startBgm() playing \"%s\" %d times", in, loop); bgm = Mix_LoadMUS(in); - Mix_PlayMusic(bgm, loop); + if (bgm) { + Mix_PlayMusic(bgm, loop); + } + else { + logger.log("Sound::startBgm() warning: error loading file."); + } } void Sound::stopBgm() diff --git a/src/sound.h b/src/sound.h index c4a53b44..44499618 100644 --- a/src/sound.h +++ b/src/sound.h @@ -68,7 +68,7 @@ class Sound { * \param in Full path to file * \param loop The number of times the song is played (-1 = infinite) */ - void startBgm(char *in, int loop); + void startBgm(char *in, int loop = -1); /** * \brief Stop all currently running background music tracks |