فهرست منبع

Pause gameplay when restarting SoundEngine

kiwec 4 ماه پیش
والد
کامیت
0bbfa9d241
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      src/Engine/SoundEngine.cpp

+ 6 - 0
src/Engine/SoundEngine.cpp

@@ -9,6 +9,7 @@
 #include "Environment.h"
 #include "OptionsMenu.h"
 #include "Osu.h"
+#include "PauseMenu.h"
 #include "Skin.h"
 #include "Sound.h"
 #include "WinEnvironment.h"
@@ -781,6 +782,11 @@ void SoundEngine::setOutputDevice(OUTPUT_DEVICE device) {
     if(osu->getSelectedBeatmap()->getMusic() != NULL) {
         was_playing = osu->getSelectedBeatmap()->getMusic()->isPlaying();
         prevMusicPositionMS = osu->getSelectedBeatmap()->getMusic()->getPositionMS();
+
+        if(osu->isInPlayMode() && was_playing) {
+            osu->getSelectedBeatmap()->pause(false);
+            osu->m_pauseMenu->setVisible(osu->getSelectedBeatmap()->isPaused());
+        }
     }
 
     // TODO: This is blocking main thread, can freeze for a long time on some sound cards