|
|
|
@ -5,6 +5,8 @@ |
|
|
|
#include "fmod_errors.h" |
|
|
|
|
|
|
|
extern qboolean sound_started; // in snd_dma.c |
|
|
|
extern sfx_t *known_sfx; |
|
|
|
extern int num_sfx; |
|
|
|
|
|
|
|
FMOD_SYSTEM *fmod_system = NULL; |
|
|
|
static qboolean fmod_ownership = false; |
|
|
|
@ -76,6 +78,12 @@ void S_Startup(void) |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (version < FMOD_VERSION) |
|
|
|
{ |
|
|
|
Con_Printf("Incorrect FMOD library version, expected: 0x%x, found: 0x%x", FMOD_VERSION, version); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
result = FMOD_System_GetDriver(fmod_system, &driver); |
|
|
|
if (result != FMOD_OK) |
|
|
|
{ |
|
|
|
@ -112,11 +120,24 @@ void S_Startup(void) |
|
|
|
|
|
|
|
void S_Shutdown(void) |
|
|
|
{ |
|
|
|
sfx_t *sfx; |
|
|
|
int i; |
|
|
|
|
|
|
|
Con_DPrintf("[FMOD] Shutdown\n"); |
|
|
|
|
|
|
|
S_StopAllSounds(true); |
|
|
|
|
|
|
|
// TODO: destroy all FMOD_SOUNDs that are attached to sfx_t's |
|
|
|
// Release all sounds that were loaded and attached to sfx_t's |
|
|
|
for (i = 0; i < num_sfx; i++) |
|
|
|
{ |
|
|
|
sfx = &known_sfx[i]; |
|
|
|
|
|
|
|
if (sfx->sound) |
|
|
|
{ |
|
|
|
FMOD_Sound_Release(sfx->sound); |
|
|
|
sfx->sound = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// If we created the FMOD System (and consequently own it), destroy it here |
|
|
|
if (fmod_ownership) |
|
|
|
|