From 2acbcc2963ca7e4c369f0b0a70818dcd3b8dd8d4 Mon Sep 17 00:00:00 2001
From: opa <opa@ken16.net>
Date: Thu, 29 Aug 2024 02:14:06 +0900
Subject: [PATCH] Call AudioManager::init/deinit when ES starts/ends and game
 ends

---
 es-app/src/FileData.cpp | 1 +
 es-app/src/main.cpp     | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp
index 1aa4f0f07..6303412b8 100644
--- a/es-app/src/FileData.cpp
+++ b/es-app/src/FileData.cpp
@@ -311,6 +311,7 @@ void FileData::launchGame(Window* window)
 	window->init();
 	InputManager::getInstance()->init();
 	VolumeControl::getInstance()->init();
+	AudioManager::getInstance()->init();
 	window->normalizeNextUpdate();
 
 	//update number of times the game has been launched
diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp
index 437b23b19..58550bf1e 100644
--- a/es-app/src/main.cpp
+++ b/es-app/src/main.cpp
@@ -17,6 +17,7 @@
 #include "Settings.h"
 #include "SystemData.h"
 #include "SystemScreenSaver.h"
+#include "AudioManager.h"
 #include <SDL_events.h>
 #include <SDL_main.h>
 #include <SDL_timer.h>
@@ -395,6 +396,7 @@ int main(int argc, char* argv[])
 		window.renderLoadingScreen("Done.");
 
 	InputManager::getInstance()->init();
+	AudioManager::getInstance()->init();
 
 	//choose which GUI to open depending on if an input configuration already exists
 	if(errorMsg == NULL)
@@ -467,6 +469,7 @@ int main(int argc, char* argv[])
 	while(window.peekGui() != ViewController::get())
 		delete window.peekGui();
 
+	AudioManager::getInstance()->deinit();
 	InputManager::getInstance()->deinit();
 	window.deinit();