Prechádzať zdrojové kódy

Merge pull request #1747 from rgngl/androidAudioFix

Fix for not releasing audio device on Android
Sean Taylor 10 rokov pred
rodič
commit
f6770313ec
2 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 6 0
      gameplay/src/AudioController.cpp
  2. 2 0
      gameplay/src/Base.h

+ 6 - 0
gameplay/src/AudioController.cpp

@@ -81,11 +81,17 @@ void AudioController::pause()
         _pausingSource = NULL;
         _pausingSource = NULL;
         itr++;
         itr++;
     }
     }
+#ifdef ALC_SOFT_pause_device
+    alcDevicePauseSOFT(_alcDevice);
+#endif
 }
 }
 
 
 void AudioController::resume()
 void AudioController::resume()
 {   
 {   
     alcMakeContextCurrent(_alcContext);
     alcMakeContextCurrent(_alcContext);
+#ifdef ALC_SOFT_pause_device
+    alcDeviceResumeSOFT(_alcDevice);
+#endif
 
 
     std::set<AudioSource*>::iterator itr = _playingSources.begin();
     std::set<AudioSource*>::iterator itr = _playingSources.begin();
 
 

+ 2 - 0
gameplay/src/Base.h

@@ -182,6 +182,8 @@ extern int strcmpnocase(const char* s1, const char* s2);
 #ifdef __ANDROID__
 #ifdef __ANDROID__
     #include <AL/al.h>
     #include <AL/al.h>
     #include <AL/alc.h>
     #include <AL/alc.h>
+    #define AL_ALEXT_PROTOTYPES
+    #include <AL/alext.h>
 #elif WIN32
 #elif WIN32
     #define AL_LIBTYPE_STATIC
     #define AL_LIBTYPE_STATIC
     #include <AL/al.h>
     #include <AL/al.h>