revert to manual startup of frontend's OpenAL session (keeping voices' bug fixed)
--- 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);
+}
+
--- 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
--- 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());
--- 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);