summaryrefslogtreecommitdiffstats
path: root/src/sound
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-07-10 15:38:37 +0200
committerkrzys-h <krzys_h@interia.pl>2014-07-10 15:38:37 +0200
commit7b04f673580f0c24aecc103a25c4c4b82da1380f (patch)
tree57fa168513ab2bc99daa434032f538abfc3bf444 /src/sound
parent1ee0c0e8fe2b4f0cba35b65b2c17deaa9f1dc8e8 (diff)
downloadcolobot-7b04f673580f0c24aecc103a25c4c4b82da1380f.tar.gz
colobot-7b04f673580f0c24aecc103a25c4c4b82da1380f.tar.bz2
colobot-7b04f673580f0c24aecc103a25c4c4b82da1380f.zip
Fixed music loading
Diffstat (limited to 'src/sound')
-rw-r--r--src/sound/oalsound/alsound.cpp20
-rw-r--r--src/sound/sound.cpp8
2 files changed, 14 insertions, 14 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)
diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp
index 9c9f483..5d99cdb 100644
--- a/src/sound/sound.cpp
+++ b/src/sound/sound.cpp
@@ -54,10 +54,10 @@ void CSoundInterface::CacheAll()
void CSoundInterface::AddMusicFiles()
{
- CacheMusic("music/Intro1.ogg");
- CacheMusic("music/Intro2.ogg");
- CacheMusic("music/music010.ogg");
- CacheMusic("music/music011.ogg");
+ CacheMusic("Intro1.ogg");
+ CacheMusic("Intro2.ogg");
+ CacheMusic("music010.ogg");
+ CacheMusic("music011.ogg");
}
bool CSoundInterface::Cache(Sound bSound, const std::string &bFile)