diff options
author | krzys-h <krzys_h@interia.pl> | 2014-07-10 15:38:37 +0200 |
---|---|---|
committer | krzys-h <krzys_h@interia.pl> | 2014-07-10 15:38:37 +0200 |
commit | 7b04f673580f0c24aecc103a25c4c4b82da1380f (patch) | |
tree | 57fa168513ab2bc99daa434032f538abfc3bf444 /src/sound/oalsound | |
parent | 1ee0c0e8fe2b4f0cba35b65b2c17deaa9f1dc8e8 (diff) | |
download | colobot-7b04f673580f0c24aecc103a25c4c4b82da1380f.tar.gz colobot-7b04f673580f0c24aecc103a25c4c4b82da1380f.tar.bz2 colobot-7b04f673580f0c24aecc103a25c4c4b82da1380f.zip |
Fixed music loading
Diffstat (limited to 'src/sound/oalsound')
-rw-r--r-- | src/sound/oalsound/alsound.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/sound/oalsound/alsound.cpp b/src/sound/oalsound/alsound.cpp index e9bc116..54c94a5 100644 --- a/src/sound/oalsound/alsound.cpp +++ b/src/sound/oalsound/alsound.cpp @@ -173,12 +173,12 @@ bool ALSound::Cache(Sound sound, const std::string &filename) bool ALSound::CacheMusic(const std::string &filename) { - if (m_music.find(filename) == m_music.end()) + if (m_music.find("music/"+filename) == m_music.end()) { Buffer *buffer = new Buffer(); - if (buffer->LoadFromFile(filename, static_cast<Sound>(-1))) + if (buffer->LoadFromFile("music/"+filename, static_cast<Sound>(-1))) { - m_music[filename] = buffer; + m_music["music/"+filename] = buffer; return true; } } @@ -609,7 +609,7 @@ void ALSound::SetListener(const Math::Vector &eye, const Math::Vector &lookat) bool ALSound::PlayMusic(int rank, bool bRepeat, float fadeTime) { std::stringstream filename; - filename << "music/music" << std::setfill('0') << std::setw(3) << rank << ".ogg"; + filename << "music" << std::setfill('0') << std::setw(3) << rank << ".ogg"; return PlayMusic(filename.str(), bRepeat, fadeTime); } @@ -636,26 +636,26 @@ bool ALSound::PlayMusic(const std::string &filename, bool bRepeat, float fadeTim Buffer *buffer; // check if we have music in cache - if (m_music.find(filename) == m_music.end()) + if (m_music.find("music/"+filename) == m_music.end()) { GetLogger()->Debug("Music %s was not cached!\n", filename.c_str()); - if (!boost::filesystem::exists(filename)) + /* TODO: if (!boost::filesystem::exists("music/"+filename)) { GetLogger()->Debug("Requested music %s was not found.\n", filename.c_str()); return false; - } + } */ buffer = new Buffer(); - if (!buffer->LoadFromFile(filename, static_cast<Sound>(-1))) + if (!buffer->LoadFromFile("music/"+filename, static_cast<Sound>(-1))) { return false; } - m_music[filename] = buffer; + m_music["music/"+filename] = buffer; } else { GetLogger()->Debug("Music loaded from cache\n"); - buffer = m_music[filename]; + buffer = m_music["music/"+filename]; } if (m_currentMusic) |