Added clearing of the audio stream at some appropriate places.

Also made a constant explicitly floating point.
This commit is contained in:
Leon Styhre 2021-05-12 23:03:29 +02:00
parent 4465342724
commit c108387257
4 changed files with 8 additions and 2 deletions

View file

@ -652,6 +652,6 @@ void SystemScreensaver::generateOverlayInfo()
mGameOverlayRectangleCoords.clear(); mGameOverlayRectangleCoords.clear();
mGameOverlayRectangleCoords.push_back(posX - marginX); mGameOverlayRectangleCoords.push_back(posX - marginX);
mGameOverlayRectangleCoords.push_back(posY); mGameOverlayRectangleCoords.push_back(posY);
mGameOverlayRectangleCoords.push_back(textSizeX + marginX * 2); mGameOverlayRectangleCoords.push_back(textSizeX + marginX * 2.0f);
mGameOverlayRectangleCoords.push_back(textSizeY); mGameOverlayRectangleCoords.push_back(textSizeY);
} }

View file

@ -818,6 +818,7 @@ bool ViewController::input(InputConfig* config, Input input)
mCurrentView->stopListScrolling(); mCurrentView->stopListScrolling();
// Finally, if the camera is currently moving, reset its position. // Finally, if the camera is currently moving, reset its position.
cancelViewTransitions(); cancelViewTransitions();
AudioManager::getInstance()->clearStream();
mWindow->pushGui(new GuiMenu(mWindow)); mWindow->pushGui(new GuiMenu(mWindow));
return true; return true;
@ -841,6 +842,7 @@ void ViewController::update(int deltaTime)
updateSelf(deltaTime); updateSelf(deltaTime);
if (mGameToLaunch) { if (mGameToLaunch) {
AudioManager::getInstance()->clearStream();
launch(mGameToLaunch); launch(mGameToLaunch);
mGameToLaunch = nullptr; mGameToLaunch = nullptr;
} }

View file

@ -11,6 +11,7 @@
#include "guis/GuiGamelistOptions.h" #include "guis/GuiGamelistOptions.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "AudioManager.h"
#include "Sound.h" #include "Sound.h"
#include "Window.h" #include "Window.h"
@ -21,6 +22,7 @@ bool IGameListView::input(InputConfig* config, Input input)
config->isMappedTo("select", input) && input.value) { config->isMappedTo("select", input) && input.value) {
ViewController::get()->cancelViewTransitions(); ViewController::get()->cancelViewTransitions();
stopListScrolling(); stopListScrolling();
AudioManager::getInstance()->clearStream();
mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem())); mWindow->pushGui(new GuiGamelistOptions(mWindow, this->mRoot->getSystem()));
return true; return true;
} }

View file

@ -13,10 +13,11 @@
#include "components/ImageComponent.h" #include "components/ImageComponent.h"
#include "components/VideoVlcComponent.h" #include "components/VideoVlcComponent.h"
#include "resources/Font.h" #include "resources/Font.h"
#include "Sound.h" #include "AudioManager.h"
#include "InputManager.h" #include "InputManager.h"
#include "Log.h" #include "Log.h"
#include "Scripting.h" #include "Scripting.h"
#include "Sound.h"
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
@ -679,6 +680,7 @@ void Window::startScreensaver()
(*it)->onScreensaverActivate(); (*it)->onScreensaverActivate();
stopInfoPopup(); stopInfoPopup();
AudioManager::getInstance()->clearStream();
mScreensaver->startScreensaver(true); mScreensaver->startScreensaver(true);
mRenderScreensaver = true; mRenderScreensaver = true;
} }