Skip to content

Commit

Permalink
Return a more appropriate error from DSOAL_DirectSoundCreate8
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Apr 13, 2023
1 parent 1ba60c3 commit dcaa78b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dsoal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,20 +296,21 @@ HRESULT WINAPI DSOAL_DirectSoundCreate8(const GUID *deviceId, IDirectSound8 **ds
return DSERR_INVALIDPARAM;
}

HRESULT hr{};
try {
auto dsobj = DSound8OAL::Create();
HRESULT hr{dsobj->Initialize(deviceId)};
hr = dsobj->Initialize(deviceId);
if(SUCCEEDED(hr))
{
*ds = dsobj.release()->as<IDirectSound8*>();
return DS_OK;
}
}
catch(std::bad_alloc&) {
return DSERR_OUTOFMEMORY;
hr = DSERR_OUTOFMEMORY;
}

return E_NOTIMPL;
return hr;
}

HRESULT WINAPI DSOAL_DirectSoundCaptureCreate(const GUID *deviceId, IDirectSoundCapture **ds,
Expand Down

0 comments on commit dcaa78b

Please sign in to comment.