diff options
author | Chris Robinson <[email protected]> | 2020-04-28 19:25:58 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-28 19:25:58 -0700 |
commit | 4094135ed7e7d1f2c22cf944094f7f0daf2cd8e6 (patch) | |
tree | 4ab7df9fb3afb2554fbe4c48e522263fb7e2d670 /alc/backends/jack.cpp | |
parent | 065775d814a972bfedf2cc8e5db35a56f1eecb93 (diff) |
Don't return a bool from the backend start method
Diffstat (limited to 'alc/backends/jack.cpp')
-rw-r--r-- | alc/backends/jack.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index a8d54f88..547bf66f 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -163,7 +163,7 @@ struct JackPlayback final : public BackendBase { void open(const ALCchar *name) override; bool reset() override; - bool start() override; + void start() override; void stop() override; ClockLatency getClockLatency() override; @@ -380,21 +380,17 @@ bool JackPlayback::reset() return true; } -bool JackPlayback::start() +void JackPlayback::start() { if(jack_activate(mClient)) - { - ERR("Failed to activate client\n"); - return false; - } + throw al::backend_exception{ALC_INVALID_DEVICE, "Failed to activate client"}; const char **ports{jack_get_ports(mClient, nullptr, nullptr, JackPortIsPhysical|JackPortIsInput)}; if(ports == nullptr) { - ERR("No physical playback ports found\n"); jack_deactivate(mClient); - return false; + throw al::backend_exception{ALC_INVALID_DEVICE, "No physical playback ports found"}; } std::mismatch(std::begin(mPort), std::end(mPort), ports, [this](const jack_port_t *port, const char *pname) -> bool @@ -432,16 +428,13 @@ bool JackPlayback::start() mPlaying.store(true, std::memory_order_release); mKillNow.store(false, std::memory_order_release); mThread = std::thread{std::mem_fn(&JackPlayback::mixerProc), this}; - return true; } catch(std::exception& e) { - ERR("Could not create playback thread: %s\n", e.what()); - } - catch(...) { + jack_deactivate(mClient); + mPlaying.store(false, std::memory_order_release); + throw al::backend_exception{ALC_INVALID_DEVICE, "Failed to start mixing thread: %s", + e.what()}; } - jack_deactivate(mClient); - mPlaying.store(false, std::memory_order_release); - return false; } void JackPlayback::stop() |