aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/dsound.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-28 19:25:58 -0700
committerChris Robinson <[email protected]>2020-04-28 19:25:58 -0700
commit4094135ed7e7d1f2c22cf944094f7f0daf2cd8e6 (patch)
tree4ab7df9fb3afb2554fbe4c48e522263fb7e2d670 /alc/backends/dsound.cpp
parent065775d814a972bfedf2cc8e5db35a56f1eecb93 (diff)
Don't return a bool from the backend start method
Diffstat (limited to 'alc/backends/dsound.cpp')
-rw-r--r--alc/backends/dsound.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/alc/backends/dsound.cpp b/alc/backends/dsound.cpp
index 68b63a50..24fba98c 100644
--- a/alc/backends/dsound.cpp
+++ b/alc/backends/dsound.cpp
@@ -169,7 +169,7 @@ struct DSoundPlayback final : public BackendBase {
void open(const ALCchar *name) override;
bool reset() override;
- bool start() override;
+ void start() override;
void stop() override;
IDirectSound *mDS{nullptr};
@@ -563,19 +563,16 @@ retry_open:
return true;
}
-bool DSoundPlayback::start()
+void DSoundPlayback::start()
{
try {
mKillNow.store(false, std::memory_order_release);
mThread = std::thread{std::mem_fn(&DSoundPlayback::mixerProc), this};
- return true;
}
catch(std::exception& e) {
- ERR("Failed to start mixing thread: %s\n", e.what());
+ throw al::backend_exception{ALC_INVALID_DEVICE, "Failed to start mixing thread: %s",
+ e.what()};
}
- catch(...) {
- }
- return false;
}
void DSoundPlayback::stop()
@@ -593,7 +590,7 @@ struct DSoundCapture final : public BackendBase {
~DSoundCapture() override;
void open(const ALCchar *name) override;
- bool start() override;
+ void start() override;
void stop() override;
ALCenum captureSamples(al::byte *buffer, ALCuint samples) override;
ALCuint availableSamples() override;
@@ -762,16 +759,11 @@ void DSoundCapture::open(const ALCchar *name)
mDevice->DeviceName = name;
}
-bool DSoundCapture::start()
+void DSoundCapture::start()
{
- HRESULT hr{mDSCbuffer->Start(DSCBSTART_LOOPING)};
+ const HRESULT hr{mDSCbuffer->Start(DSCBSTART_LOOPING)};
if(FAILED(hr))
- {
- ERR("start failed: 0x%08lx\n", hr);
- aluHandleDisconnect(mDevice, "Failure starting capture: 0x%lx", hr);
- return false;
- }
- return true;
+ throw al::backend_exception{ALC_INVALID_DEVICE, "Failure starting capture: 0x%lx", hr};
}
void DSoundCapture::stop()