summaryrefslogtreecommitdiff
path: root/src/resources/soundeffect.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-11 15:47:35 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-11 15:47:35 +0000
commit8da32105732949b4b0273c718d118bcfae70a1c9 (patch)
tree0a354974d48268cfaafcdb1e06b498fa26a59c1e /src/resources/soundeffect.cpp
parentf9ce4e302cb3ed203d89a7a18e10b7ad4f11519c (diff)
downloadmana-client-8da32105732949b4b0273c718d118bcfae70a1c9.tar.gz
mana-client-8da32105732949b4b0273c718d118bcfae70a1c9.tar.bz2
mana-client-8da32105732949b4b0273c718d118bcfae70a1c9.tar.xz
mana-client-8da32105732949b4b0273c718d118bcfae70a1c9.zip
Merged 0.0 changes from revision 2825 to 2898 to trunk.
Diffstat (limited to 'src/resources/soundeffect.cpp')
-rw-r--r--src/resources/soundeffect.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index 3340e5ea..bb35218e 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -23,6 +23,8 @@
#include "soundeffect.h"
+#include "../log.h"
+
SoundEffect::SoundEffect(const std::string &idPath, Mix_Chunk *soundEffect):
Resource(idPath),
mChunk(soundEffect)
@@ -41,13 +43,18 @@ SoundEffect::load(void *buffer, unsigned int bufferSize,
// Load the raw file data from the buffer in an RWops structure
SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
- // Use Mix_LoadWAV_RW to load the raw music data
- Mix_Chunk *tmpSoundEffect = Mix_LoadWAV_RW(rw, 0);
-
- // Now free the SDL_RWops data
- SDL_FreeRW(rw);
+ // Load the music data and free the RWops structure
+ Mix_Chunk *tmpSoundEffect = Mix_LoadWAV_RW(rw, 1);
- return new SoundEffect(idPath, tmpSoundEffect);
+ if (tmpSoundEffect)
+ {
+ return new SoundEffect(idPath, tmpSoundEffect);
+ }
+ else
+ {
+ logger->log("Error while loading sound effect (%s)", idPath.c_str());
+ return NULL;
+ }
}
bool