diff options
author | Chris Robinson <[email protected]> | 2009-12-26 08:49:11 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-12-26 08:49:11 -0800 |
commit | c6340ce12d64062fa0723b2d24cb567bb375b378 (patch) | |
tree | e48bdbb3e0c82107f2e6d7e6df9b505b6d5d1844 /Alc/dsound.c | |
parent | 7bc739e965ff45b5c9504d90883ffe167f7d50d3 (diff) |
Clean up some loading checks
Diffstat (limited to 'Alc/dsound.c')
-rw-r--r-- | Alc/dsound.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Alc/dsound.c b/Alc/dsound.c index 966b6236..63047824 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -74,7 +74,7 @@ static ALuint NumDevices; static volatile ALuint load_count; -void DSoundLoad(void) +void *DSoundLoad(void) { if(load_count == 0) { @@ -83,7 +83,7 @@ void DSoundLoad(void) if(ds_handle == NULL) { AL_PRINT("Failed to load dsound.dll\n"); - return; + return NULL; } #define LOAD_FUNC(f) do { \ @@ -93,7 +93,7 @@ void DSoundLoad(void) FreeLibrary(ds_handle); \ ds_handle = NULL; \ AL_PRINT("Could not load %s from dsound.dll\n", #f); \ - return; \ + return NULL; \ } \ } while(0) #else @@ -106,6 +106,8 @@ LOAD_FUNC(DirectSoundEnumerateA); #undef LOAD_FUNC } ++load_count; + + return ds_handle; } void DSoundUnload(void) @@ -223,8 +225,7 @@ static ALCboolean DSoundOpenPlayback(ALCdevice *device, const ALCchar *deviceNam return ALC_FALSE; } - DSoundLoad(); - if(ds_handle == NULL) + if(!DSoundLoad()) return ALC_FALSE; //Initialise requested device @@ -550,8 +551,7 @@ void alcDSoundDeinit(void) void alcDSoundProbe(int type) { - DSoundLoad(); - if(!ds_handle) return; + if(!DSoundLoad()) return; if(type == DEVICE_PROBE) AppendDeviceList(dsDevice); |