1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Almost support loading sounds from server

This commit is contained in:
Perttu Ahola 2012-03-25 14:47:51 +03:00
parent 524c78a8d6
commit 1cac1de3b2
9 changed files with 183 additions and 186 deletions

View file

@ -286,22 +286,6 @@ public:
return bufs[j];
}
bool loadSound(const std::string &name,
const std::string &filepath)
{
SoundBuffer *buf = loadOggFile(filepath);
if(buf)
addBuffer(name, buf);
return false;
}
bool loadSound(const std::string &name,
const std::vector<char> &filedata)
{
errorstream<<"OpenALSoundManager: Loading from filedata not"
" implemented"<<std::endl;
return false;
}
PlayingSound* createPlayingSound(SoundBuffer *buf, bool loop,
float volume)
{
@ -392,15 +376,15 @@ public:
if(!m_fetcher)
return NULL;
std::set<std::string> paths;
std::set<std::vector<char> > datas;
std::set<std::string> datas;
m_fetcher->fetchSounds(name, paths, datas);
for(std::set<std::string>::iterator i = paths.begin();
i != paths.end(); i++){
loadSound(name, *i);
loadSoundFile(name, *i);
}
for(std::set<std::vector<char> >::iterator i = datas.begin();
for(std::set<std::string>::iterator i = datas.begin();
i != datas.end(); i++){
loadSound(name, *i);
loadSoundData(name, *i);
}
return getBuffer(name);
}
@ -439,6 +423,22 @@ public:
/* Interface */
bool loadSoundFile(const std::string &name,
const std::string &filepath)
{
SoundBuffer *buf = loadOggFile(filepath);
if(buf)
addBuffer(name, buf);
return false;
}
bool loadSoundData(const std::string &name,
const std::string &filedata)
{
errorstream<<"OpenALSoundManager: Loading from filedata not"
" implemented"<<std::endl;
return false;
}
void updateListener(v3f pos, v3f vel, v3f at, v3f up)
{
m_listener_pos = pos;