aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/dsound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends/dsound.cpp')
-rw-r--r--Alc/backends/dsound.cpp66
1 files changed, 25 insertions, 41 deletions
diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp
index 8b181d0d..00deafc1 100644
--- a/Alc/backends/dsound.cpp
+++ b/Alc/backends/dsound.cpp
@@ -99,38 +99,6 @@ HRESULT (WINAPI *pDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW pDSEnumCallbac
#endif
-bool DSoundLoad(void)
-{
-#ifdef HAVE_DYNLOAD
- if(!ds_handle)
- {
- ds_handle = LoadLib("dsound.dll");
- if(!ds_handle)
- {
- ERR("Failed to load dsound.dll\n");
- return false;
- }
-
-#define LOAD_FUNC(f) do { \
- p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(ds_handle, #f)); \
- if(!p##f) \
- { \
- CloseLib(ds_handle); \
- ds_handle = nullptr; \
- return false; \
- } \
-} while(0)
- LOAD_FUNC(DirectSoundCreate);
- LOAD_FUNC(DirectSoundEnumerateW);
- LOAD_FUNC(DirectSoundCaptureCreate);
- LOAD_FUNC(DirectSoundCaptureEnumerateW);
-#undef LOAD_FUNC
- }
-#endif
- return true;
-}
-
-
#define MAX_UPDATES 128
struct DevMap {
@@ -892,18 +860,34 @@ BackendFactory &DSoundBackendFactory::getFactory()
}
bool DSoundBackendFactory::init()
-{ return DSoundLoad(); }
-
-void DSoundBackendFactory::deinit()
{
- PlaybackDevices.clear();
- CaptureDevices.clear();
-
#ifdef HAVE_DYNLOAD
- if(ds_handle)
- CloseLib(ds_handle);
- ds_handle = nullptr;
+ if(!ds_handle)
+ {
+ ds_handle = LoadLib("dsound.dll");
+ if(!ds_handle)
+ {
+ ERR("Failed to load dsound.dll\n");
+ return false;
+ }
+
+#define LOAD_FUNC(f) do { \
+ p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(ds_handle, #f)); \
+ if(!p##f) \
+ { \
+ CloseLib(ds_handle); \
+ ds_handle = nullptr; \
+ return false; \
+ } \
+} while(0)
+ LOAD_FUNC(DirectSoundCreate);
+ LOAD_FUNC(DirectSoundEnumerateW);
+ LOAD_FUNC(DirectSoundCaptureCreate);
+ LOAD_FUNC(DirectSoundCaptureEnumerateW);
+#undef LOAD_FUNC
+ }
#endif
+ return true;
}
bool DSoundBackendFactory::querySupport(BackendType type)