tSoundInit() is now always called; SoundClose() now only closes the active plug… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 6d6fff2c9e53aa3a184d9d323e89f6806cee345b | |
parent 1d149880ac4a1f88998f022124e982eb282b409b | |
Author: Ben Webb <[email protected]> | |
Date: Tue, 14 May 2002 13:00:42 +0000 | |
SoundInit() is now always called; SoundClose() now only closes the active | |
plugin if SoundOpen() has been previously called. | |
Diffstat: | |
M src/sound.c | 10 +++++++--- | |
1 file changed, 7 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/src/sound.c b/src/sound.c | |
t@@ -41,7 +41,8 @@ | |
static SoundDriver *driver = NULL; | |
typedef SoundDriver *(*InitFunc)(void); | |
-void *soundmodule = NULL; | |
+static void *soundmodule = NULL; | |
+static gboolean module_open = FALSE; | |
static void AddPlugin(InitFunc ifunc) | |
{ | |
t@@ -127,19 +128,22 @@ void SoundInit(void) | |
AddPlugin(sound_winmm_init); | |
#endif | |
#endif | |
+ module_open = FALSE; | |
} | |
void SoundOpen(gchar *drivername) | |
{ | |
- if (driver && driver->open) { | |
+ if (driver && driver->open && !module_open) { | |
driver->open(); | |
+ module_open = TRUE; | |
} | |
} | |
void SoundClose(void) | |
{ | |
- if (driver && driver->close) { | |
+ if (driver && driver->close && module_open) { | |
driver->close(); | |
+ module_open = FALSE; | |
} | |
#ifdef PLUGINS | |
if (soundmodule) { |