summaryrefslogtreecommitdiff
path: root/src/resources/music.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-13 15:31:46 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-13 20:55:48 +0100
commit3764664b20b8b85a6c0a0ec3a098251c3bcec4a0 (patch)
tree4f3fc5d8b98ca665a7d3dc59fb614b87ad9d6bfb /src/resources/music.cpp
parentc70be70cab3615cb36cc5f244671cf5d39f1fda8 (diff)
downloadmana-3764664b20b8b85a6c0a0ec3a098251c3bcec4a0.tar.gz
mana-3764664b20b8b85a6c0a0ec3a098251c3bcec4a0.tar.bz2
mana-3764664b20b8b85a6c0a0ec3a098251c3bcec4a0.tar.xz
mana-3764664b20b8b85a6c0a0ec3a098251c3bcec4a0.zip
Fixed music playback
A faulty version check was disabling music loading entirely.
Diffstat (limited to 'src/resources/music.cpp')
-rw-r--r--src/resources/music.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/resources/music.cpp b/src/resources/music.cpp
index c6760865..12c723bd 100644
--- a/src/resources/music.cpp
+++ b/src/resources/music.cpp
@@ -35,28 +35,16 @@ Music::~Music()
Resource *Music::load(SDL_RWops *rw)
{
-#if SDL_MIXER_MAJOR_VERSION >= 1 &&\
- SDL_MIXER_MINOR_VERSION >= 2 &&\
- SDL_MIXER_PATCHLEVEL >= 9
- if (Mix_Music *music = Mix_LoadMUS_RW(rw))
+ if (Mix_Music *music = Mix_LoadMUS_RW(rw, 1))
{
return new Music(music);
}
- else
- {
- logger->log("Error, failed to load music: %s", Mix_GetError());
- return 0;
- }
-#else
- SDL_FreeRW(rw);
+
+ logger->log("Error, failed to load music: %s", Mix_GetError());
return nullptr;
-#endif
}
bool Music::play(int loops, int fadeIn)
{
- if (fadeIn > 0)
- return Mix_FadeInMusic(mMusic, loops, fadeIn);
- else
- return Mix_PlayMusic(mMusic, loops);
+ return Mix_FadeInMusic(mMusic, loops, fadeIn);
}