Build configuration fixes/improvements on Windows
[oweals/minetest.git] / src / sound_openal.cpp
index edcb9e8d4e91ea1e644487d45fe543dc817862b3..6f9ff3bd60b00c6ff11d8d69c38804168334d7c5 100644 (file)
@@ -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 <al.h>
        #include <alc.h>
-       #include <alext.h>
+       //#include <alext.h>
 #elif defined(__APPLE__)
        #include <OpenAL/al.h>
        #include <OpenAL/alc.h>
@@ -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)