X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fsound_openal.cpp;h=6f9ff3bd60b00c6ff11d8d69c38804168334d7c5;hb=c8997e48c070b8fcc460f01ba90896ad3afbf8b5;hp=edcb9e8d4e91ea1e644487d45fe543dc817862b3;hpb=93219e3b9d2eae11a447556dfe837706baeff22a;p=oweals%2Fminetest.git diff --git a/src/sound_openal.cpp b/src/sound_openal.cpp index edcb9e8d4..6f9ff3bd6 100644 --- a/src/sound_openal.cpp +++ b/src/sound_openal.cpp @@ -23,10 +23,10 @@ with this program; ifnot, write to the Free Software Foundation, Inc., #include "sound_openal.h" -#if defined(_MSC_VER) +#if defined(_WIN32) #include #include - #include + //#include #elif defined(__APPLE__) #include #include @@ -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::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)