diff options
Diffstat (limited to 'src/JackLibDriver.cpp')
-rw-r--r-- | src/JackLibDriver.cpp | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/src/JackLibDriver.cpp b/src/JackLibDriver.cpp index 8728222..5133bc6 100644 --- a/src/JackLibDriver.cpp +++ b/src/JackLibDriver.cpp @@ -1,18 +1,5 @@ -/* This file is part of Patchage. - * Copyright 2007-2020 David Robillard <d@drobilla.net> - * - * Patchage is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Patchage is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License - * along with Patchage. If not, see <http://www.gnu.org/licenses/>. - */ +// Copyright 2007-2020 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: GPL-3.0-or-later #include "AudioDriver.hpp" #include "ClientID.hpp" @@ -31,7 +18,7 @@ #include "patchage_config.h" #include "warnings.hpp" -#ifdef HAVE_JACK_METADATA +#if USE_JACK_METADATA # include <jack/metadata.h> #endif @@ -39,7 +26,6 @@ PATCHAGE_DISABLE_FMT_WARNINGS #include <fmt/core.h> PATCHAGE_RESTORE_WARNINGS -#include <boost/optional/optional.hpp> #include <jack/jack.h> #include <jack/types.h> @@ -48,6 +34,7 @@ PATCHAGE_RESTORE_WARNINGS #include <functional> #include <memory> #include <mutex> +#include <optional> #include <set> #include <string> #include <unordered_set> @@ -62,10 +49,10 @@ class JackLibDriver : public AudioDriver public: explicit JackLibDriver(ILog& log, EventSink emit_event); - JackLibDriver(const JackLibDriver&) = delete; + JackLibDriver(const JackLibDriver&) = delete; JackLibDriver& operator=(const JackLibDriver&) = delete; - JackLibDriver(JackLibDriver&&) = delete; + JackLibDriver(JackLibDriver&&) = delete; JackLibDriver& operator=(JackLibDriver&&) = delete; ~JackLibDriver() override; @@ -159,7 +146,7 @@ JackLibDriver::attach(const bool launch_daemon) void JackLibDriver::detach() { - std::lock_guard<std::mutex> lock{_shutdown_mutex}; + const std::lock_guard<std::mutex> lock{_shutdown_mutex}; if (_client) { jack_deactivate(_client); @@ -182,7 +169,7 @@ get_property(const jack_uuid_t subject, const char* const key) { std::string result; -#ifdef HAVE_JACK_METADATA +#if USE_JACK_METADATA char* value = nullptr; char* datatype = nullptr; if (!jack_get_property(subject, key, &value, &datatype)) { @@ -213,7 +200,7 @@ JackLibDriver::get_port_info(const jack_port_t* const port) auto label = PortNames{name}.port(); // Get pretty name to use as a label, if present -#ifdef HAVE_JACK_METADATA +#if USE_JACK_METADATA const auto pretty_name = get_property(uuid, JACK_METADATA_PRETTY_NAME); if (!pretty_name.empty()) { label = pretty_name; @@ -243,8 +230,8 @@ JackLibDriver::get_port_info(const jack_port_t* const port) : SignalDirection::output); // Get port order from metadata if possible - boost::optional<int> order; - const std::string order_str = get_property(uuid, JACKEY_ORDER); + std::optional<int> order; + const std::string order_str = get_property(uuid, JACKEY_ORDER); if (!order_str.empty()) { order = std::stoi(order_str); } @@ -255,7 +242,7 @@ JackLibDriver::get_port_info(const jack_port_t* const port) void JackLibDriver::refresh(const EventSink& sink) { - std::lock_guard<std::mutex> lock{_shutdown_mutex}; + const std::lock_guard<std::mutex> lock{_shutdown_mutex}; if (!_client) { return; @@ -483,7 +470,7 @@ JackLibDriver::on_shutdown(void* const driver) So, since JACK is a hot mess and it's impossible to gracefully handle this situation, just leak the client. */ - std::lock_guard<std::mutex> lock{me->_shutdown_mutex}; + const std::lock_guard<std::mutex> lock{me->_shutdown_mutex}; me->_client = nullptr; me->_is_activated = false; |