diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-22 18:31:25 +0100 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-24 21:46:13 +0300 |
commit | b4e47fb41a19ca09c02bcd009b28cb7c3caa2256 (patch) | |
tree | eada17175623f6281a83aced143bb0940758a547 /src/resources/soundeffect.cpp | |
parent | 80f61e80228aa0fa617961a4ec30d954fcb15eba (diff) | |
download | manaplus-b4e47fb41a19ca09c02bcd009b28cb7c3caa2256.tar.gz manaplus-b4e47fb41a19ca09c02bcd009b28cb7c3caa2256.tar.bz2 manaplus-b4e47fb41a19ca09c02bcd009b28cb7c3caa2256.tar.xz manaplus-b4e47fb41a19ca09c02bcd009b28cb7c3caa2256.zip |
Use SDL_RWops directly on top of PhysFS
This avoids the creation of a temporary buffer containing a complete
file for the sole purpose of wrapping it up in an SDL_RWops.
The necessary wrapper is by Ryan C. Gordon and is included in the
PhysFS repository under 'extras'.
Reviewed-by: Yohann Ferreira
Conflicts:
mana.files
src/CMakeLists.txt
src/resources/resourcemanager.cpp
src/resources/soundeffect.cpp
Diffstat (limited to 'src/resources/soundeffect.cpp')
-rw-r--r-- | src/resources/soundeffect.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp index eaa323bd6..6a3a980a7 100644 --- a/src/resources/soundeffect.cpp +++ b/src/resources/soundeffect.cpp @@ -31,14 +31,10 @@ SoundEffect::~SoundEffect() Mix_FreeChunk(mChunk); } -Resource *SoundEffect::load(void *buffer, unsigned bufferSize) +Resource *SoundEffect::load(SDL_RWops *rw) { - if (!buffer) + if (!rw) return nullptr; - - // Load the raw file data from the buffer in an RWops structure - SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize); - // Load the music data and free the RWops structure Mix_Chunk *tmpSoundEffect = Mix_LoadWAV_RW(rw, 1); |