int playSound(const std::string &name, bool loop, float volume)
{
maintain();
+ if(name == "")
+ return 0;
SoundBuffer *buf = getFetchBuffer(name);
if(!buf){
infostream<<"OpenALSoundManager: \""<<name<<"\" not found."
int playSoundAt(const std::string &name, bool loop, float volume, v3f pos)
{
maintain();
+ if(name == "")
+ return 0;
SoundBuffer *buf = getFetchBuffer(name);
if(!buf){
infostream<<"OpenALSoundManager: \""<<name<<"\" not found."
maintain();
deleteSound(sound);
}
+ bool soundExists(int sound)
+ {
+ maintain();
+ return (m_sounds_playing.count(sound) != 0);
+ }
+ void updateSoundPosition(int id, v3f pos)
+ {
+ std::map<int, PlayingSound*>::iterator i =
+ m_sounds_playing.find(id);
+ if(i == m_sounds_playing.end())
+ return;
+ PlayingSound *sound = i->second;
+
+ alSourcei(sound->source_id, AL_SOURCE_RELATIVE, false);
+ alSource3f(sound->source_id, AL_POSITION, pos.X, pos.Y, pos.Z);
+ alSource3f(sound->source_id, AL_VELOCITY, 0, 0, 0);
+ alSourcef(sound->source_id, AL_REFERENCE_DISTANCE, 30.0);
+ }
};
ISoundManager *createOpenALSoundManager(OnDemandSoundFetcher *fetcher)