Skip to content

Instantly share code, notes, and snippets.

@PilzAdam

PilzAdam/gist:6096947

Last active Dec 20, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.