# HG changeset patch # User koda # Date 1254090327 0 # Node ID ddde0ac1472b16bd72568027a954f47cdda853c3 # Parent 1b8dde74880ce2bd277815a0d385da697452158a fix a bug that prevented from hearing team voicepacks if frontend started with music disabled diff -r 1b8dde74880c -r ddde0ac1472b QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Sun Sep 27 20:25:49 2009 +0000 +++ b/QTfrontend/CMakeLists.txt Sun Sep 27 22:25:27 2009 +0000 @@ -191,7 +191,7 @@ ) if (SPARKLE_FOUND) set(HW_LINK_LIBS ${HW_LINK_LIBS} ${SPARKLE_LIBRARY}) - set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS} "-DSPARKLE_ENABLED") + set(CMAKE_CXX_FLAGS -DSPARKLE_ENABLED) endif() endif() diff -r 1b8dde74880c -r ddde0ac1472b QTfrontend/SDLs.cpp --- a/QTfrontend/SDLs.cpp Sun Sep 27 20:25:49 2009 +0000 +++ b/QTfrontend/SDLs.cpp Sun Sep 27 22:25:27 2009 +0000 @@ -21,11 +21,12 @@ #include "SDL.h" #include "hwconsts.h" -SDLInteraction::SDLInteraction() +SDLInteraction::SDLInteraction(bool hardware_snd) { music = -1; SDL_Init(SDL_INIT_VIDEO); + openal_init(hardware_snd ? 1 : 0, 5); } @@ -56,10 +57,9 @@ return result; } -void SDLInteraction::StartMusic(bool hardware) +void SDLInteraction::StartMusic() { if (music < 0) { - openal_init(hardware ? 1 : 0, 5); music = openal_loadfile(QString(datadir->absolutePath() + "/Music/main theme.ogg").toLocal8Bit().constData()); openal_toggleloop(music); diff -r 1b8dde74880c -r ddde0ac1472b QTfrontend/SDLs.h --- a/QTfrontend/SDLs.h Sun Sep 27 20:25:49 2009 +0000 +++ b/QTfrontend/SDLs.h Sun Sep 27 22:25:27 2009 +0000 @@ -44,10 +44,10 @@ int music; public: - SDLInteraction(); + SDLInteraction(bool); ~SDLInteraction(); QStringList getResolutions() const; - void StartMusic(bool); + void StartMusic(); void StopMusic(); }; diff -r 1b8dde74880c -r ddde0ac1472b QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Sun Sep 27 20:25:49 2009 +0000 +++ b/QTfrontend/hwform.cpp Sun Sep 27 22:25:27 2009 +0000 @@ -73,8 +73,10 @@ ui.setupUi(this); CustomizePalettes(); - - ui.pageOptions->CBResolution->addItems(sdli.getResolutions()); + + sdli = new SDLInteraction(ui.pageOptions->CBHardwareSound->isChecked()); + + ui.pageOptions->CBResolution->addItems(sdli->getResolutions()); config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); @@ -876,9 +878,9 @@ void HWForm::Music(bool checked) { if (checked) - sdli.StartMusic(ui.pageOptions->CBHardwareSound->isChecked()); + sdli->StartMusic(); else - sdli.StopMusic(); + sdli->StopMusic(); } void HWForm::NetGameChangeStatus(bool isMaster) diff -r 1b8dde74880c -r ddde0ac1472b QTfrontend/hwform.h --- a/QTfrontend/hwform.h Sun Sep 27 20:25:49 2009 +0000 +++ b/QTfrontend/hwform.h Sun Sep 27 22:25:27 2009 +0000 @@ -144,7 +144,7 @@ AmmoSchemeModel * ammoSchemeModel; QStack PagesStack; QTime eggTimer; - SDLInteraction sdli; + SDLInteraction * sdli; BGWidget * wBackground; void OnPageShown(quint8 id, quint8 lastid=0); };