summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/sound/oalsound/alsound.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp
index a37cced..ef8ff8d 100644
--- a/src/sound/oalsound/alsound.cpp
+++ b/src/sound/oalsound/alsound.cpp
@@ -169,17 +169,18 @@ bool ALSound::Cache(Sound sound, std::string filename)
bool ALSound::CacheMusic(std::string filename)
{
- Buffer *buffer = new Buffer();
- std::stringstream file;
- file << m_soundPath << "/" << filename;
- if (buffer->LoadFromFile(file.str(), static_cast<Sound>(-1))) {
- mMusic[filename] = buffer;
- return true;
+ if(mMusic.find(filename) == mMusic.end()) {
+ Buffer *buffer = new Buffer();
+ std::stringstream file;
+ file << m_soundPath << "/" << filename;
+ if (buffer->LoadFromFile(file.str(), static_cast<Sound>(-1))) {
+ mMusic[filename] = buffer;
+ return true;
+ }
}
return false;
}
-
int ALSound::GetPriority(Sound sound)
{
if ( sound == SOUND_FLYh ||