QTfrontend/SDLs.cpp
changeset 2191 20c62f787a4d
parent 2050 8149802b4f14
child 2192 4763a778c033
--- a/QTfrontend/SDLs.cpp	Mon Jun 22 13:49:16 2009 +0000
+++ b/QTfrontend/SDLs.cpp	Wed Jun 24 15:59:32 2009 +0000
@@ -23,14 +23,17 @@
 
 SDLInteraction::SDLInteraction()
 {
-	music = NULL;
+	music = -1;
 
 	SDL_Init(SDL_INIT_VIDEO);
+	openal_init(50);
+
 }
 
 SDLInteraction::~SDLInteraction()
 {
 	SDL_Quit();
+	openal_close();
 }
 
 QStringList SDLInteraction::getResolutions() const
@@ -53,21 +56,18 @@
 
 	return result;
 }
+
 void SDLInteraction::StartMusic()
 {
-	if (!music)
-    {
-   	    SDL_Init(SDL_INIT_AUDIO);
-	    Mix_OpenAudio(22050, 0x8010, 2, 512);
-  
-	    Mix_VolumeMusic(33);
-		music = Mix_LoadMUS(QString(datadir->absolutePath() + "/Music/main theme.ogg").toLocal8Bit().constData());
+	if (music < 0) {
+		music = openal_loadfile(QString(datadir->absolutePath() + "/Music/main theme.ogg").toLocal8Bit().constData());
+		openal_toggleloop(music);
+		openal_setvolume(music,66);
     }
-
-	Mix_FadeInMusic(music, -1, 3000);
+	openal_fadein(music, 50);
 }
 
 void SDLInteraction::StopMusic()
 {
-	Mix_FadeOutMusic(2000);
+	openal_fadeout(music, 50);
 }