Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@PilzAdam
Last active December 20, 2015 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PilzAdam/6096947 to your computer and use it in GitHub Desktop.
Save PilzAdam/6096947 to your computer and use it in GitHub Desktop.
diff --git a/src/main.cpp b/src/main.cpp
index 8ed164d..4a6d83e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1535,6 +1535,18 @@ int main(int argc, char *argv[])
std::string current_address = "does-not-exist";
int current_port = 0;
+ MenuMusicFetcher soundfetcher;
+ ISoundManager *sound = NULL;
+#if USE_SOUND
+ sound = createOpenALSoundManager(&soundfetcher);
+#endif
+ if(!sound)
+ sound = &dummySoundManager;
+ SimpleSoundSpec spec;
+ spec.name = "main_menu";
+ spec.gain = 1;
+ s32 handle = sound->playSound(spec, true);
+
/*
Out-of-game menu loop.
@@ -1711,7 +1723,13 @@ int main(int argc, char *argv[])
// Continue to game
break;
}
-
+
+ sound->stopSound(handle);
+ if(sound != &dummySoundManager){
+ delete sound;
+ sound = NULL;
+ }
+
// Break out of menu-game loop to shut down cleanly
if(device->run() == false || kill == true) {
g_settings->updateConfigFile(configpath.c_str());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment