Commit 78897b3e authored by David Reid's avatar David Reid

Don't try using the DirectSound backend if not all APIs are available.

This affects Windows 95. It does not appear to have at least one of
these functions. This is convenient because the function
IDirectSound::CreateSoundBuffer() is failing in my tests and I wasn't
able to figure out what was going on. Simply failing context
initialization outright is an acceptable solution for now since
Windows 95 is such an uncommon target and it can always fall back to
WinMM which works.
parent fcdd14cd
...@@ -25010,6 +25010,18 @@ static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_ ...@@ -25010,6 +25010,18 @@ static ma_result ma_context_init__dsound(ma_context* pContext, const ma_context_
pContext->dsound.DirectSoundCaptureCreate = ma_dlsym(pContext, pContext->dsound.hDSoundDLL, "DirectSoundCaptureCreate"); pContext->dsound.DirectSoundCaptureCreate = ma_dlsym(pContext, pContext->dsound.hDSoundDLL, "DirectSoundCaptureCreate");
pContext->dsound.DirectSoundCaptureEnumerateA = ma_dlsym(pContext, pContext->dsound.hDSoundDLL, "DirectSoundCaptureEnumerateA"); pContext->dsound.DirectSoundCaptureEnumerateA = ma_dlsym(pContext, pContext->dsound.hDSoundDLL, "DirectSoundCaptureEnumerateA");
/*
We need to support all functions or nothing. DirectSound with Windows 95 seems to not work too
well in my testing. For example, it's missing DirectSoundCaptureEnumerateA(). This is a convenient
place to just disable the DirectSound backend for Windows 95.
*/
if (pContext->dsound.DirectSoundCreate == NULL ||
pContext->dsound.DirectSoundEnumerateA == NULL ||
pContext->dsound.DirectSoundCaptureCreate == NULL ||
pContext->dsound.DirectSoundCaptureEnumerateA == NULL) {
return MA_API_NOT_FOUND;
}
pCallbacks->onContextInit = ma_context_init__dsound; pCallbacks->onContextInit = ma_context_init__dsound;
pCallbacks->onContextUninit = ma_context_uninit__dsound; pCallbacks->onContextUninit = ma_context_uninit__dsound;
pCallbacks->onContextEnumerateDevices = ma_context_enumerate_devices__dsound; pCallbacks->onContextEnumerateDevices = ma_context_enumerate_devices__dsound;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment