# HG changeset patch # User koda # Date 1254509814 0 # Node ID edd12b259e7caa3f24971e4d3024477d7f97fe02 # Parent 2a694ea2a4372b6a4f1fb5dde311f361885358bf revert to manual startup of frontend's OpenAL session (keeping voices' bug fixed) diff -r 2a694ea2a437 -r edd12b259e7c QTfrontend/SDLs.cpp --- a/QTfrontend/SDLs.cpp Fri Oct 02 18:44:37 2009 +0000 +++ b/QTfrontend/SDLs.cpp Fri Oct 02 18:56:54 2009 +0000 @@ -21,13 +21,13 @@ #include "SDL.h" #include "hwconsts.h" +bool hardware; + SDLInteraction::SDLInteraction(bool hardware_snd) { music = -1; - + hardware = hardware_snd; SDL_Init(SDL_INIT_VIDEO); - openal_init(hardware_snd ? 1 : 0, 5); - } SDLInteraction::~SDLInteraction() @@ -59,6 +59,7 @@ void SDLInteraction::StartMusic() { + OpenAL_Init(); if (music < 0) { music = openal_loadfile(QString(datadir->absolutePath() + "/Music/main theme.ogg").toLocal8Bit().constData()); openal_toggleloop(music); @@ -72,3 +73,12 @@ { if (music >= 0) openal_fadeout(music, 40); } + +//we need thjs wrapper because of some issues with windows drivers +//beware that this cause a slight delay when playing the first sound +void OpenAL_Init() +{ + if (!openal_ready()) + openal_init(hardware ? 1 : 0, 5); +} + diff -r 2a694ea2a437 -r edd12b259e7c QTfrontend/SDLs.h --- a/QTfrontend/SDLs.h Fri Oct 02 18:44:37 2009 +0000 +++ b/QTfrontend/SDLs.h Fri Oct 02 18:56:54 2009 +0000 @@ -51,4 +51,6 @@ void StopMusic(); }; +void OpenAL_Init(); + #endif diff -r 2a694ea2a437 -r edd12b259e7c QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Fri Oct 02 18:44:37 2009 +0000 +++ b/QTfrontend/pages.cpp Fri Oct 02 18:56:54 2009 +0000 @@ -289,6 +289,9 @@ { int sound; QDir tmpdir; + + OpenAL_Init(); + tmpdir.cd(datadir->absolutePath()); tmpdir.cd("Sounds/voices"); tmpdir.cd(CBVoicepack->currentText()); diff -r 2a694ea2a437 -r edd12b259e7c openalbridge/openalbridge.h --- a/openalbridge/openalbridge.h Fri Oct 02 18:44:37 2009 +0000 +++ b/openalbridge/openalbridge.h Fri Oct 02 18:56:54 2009 +0000 @@ -27,6 +27,7 @@ ALboolean openal_init (unsigned int usehardware, unsigned int memorysize); ALboolean openal_close (void); + ALboolean openal_ready (void); ALint openal_loadfile (const char *filename); ALboolean openal_toggleloop (unsigned int index); ALboolean openal_setposition (unsigned int index, float x, float y, float z);