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

Lua API for playing sounds

This commit is contained in:
Perttu Ahola 2012-03-24 19:01:26 +02:00
parent 06e93f8d95
commit 601d1936c9
11 changed files with 533 additions and 21 deletions

View file

@ -482,6 +482,24 @@ public:
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)