diff options
Diffstat (limited to 'src/JackDriver.hpp')
-rw-r--r-- | src/JackDriver.hpp | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/src/JackDriver.hpp b/src/JackDriver.hpp deleted file mode 100644 index 078e7d2..0000000 --- a/src/JackDriver.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/* 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/>. - */ - -#ifndef PATCHAGE_JACKDRIVER_HPP -#define PATCHAGE_JACKDRIVER_HPP - -#include "AudioDriver.hpp" -#include "ClientInfo.hpp" -#include "PortInfo.hpp" - -#include <jack/jack.h> - -#include <cstdint> -#include <mutex> -#include <string> - -class ILog; - -/// Driver for JACK audio and midi ports that uses libjack -class JackDriver : public AudioDriver -{ -public: - explicit JackDriver(ILog& log, EventSink emit_event); - - JackDriver(const JackDriver&) = delete; - JackDriver& operator=(const JackDriver&) = delete; - - JackDriver(JackDriver&&) = delete; - JackDriver& operator=(JackDriver&&) = delete; - - ~JackDriver() override; - - // Driver interface - void attach(bool launch_daemon) override; - void detach() override; - bool is_attached() const override; - void refresh(const EventSink& sink) override; - bool connect(const PortID& tail_id, const PortID& head_id) override; - bool disconnect(const PortID& tail_id, const PortID& head_id) override; - - // AudioDriver interface - uint32_t xruns() override; - void reset_xruns() override; - uint32_t buffer_size() override; - bool set_buffer_size(uint32_t frames) override; - uint32_t sample_rate() override; - -private: - ClientInfo get_client_info(const char* name); - PortInfo get_port_info(const jack_port_t* port); - - void shutdown(); - - static void jack_client_registration_cb(const char* name, - int registered, - void* jack_driver); - - static void jack_port_registration_cb(jack_port_id_t port_id, - int registered, - void* jack_driver); - - static void jack_port_connect_cb(jack_port_id_t src, - jack_port_id_t dst, - int connect, - void* jack_driver); - - static int jack_xrun_cb(void* jack_driver); - - static void jack_shutdown_cb(void* jack_driver); - - ILog& _log; - std::mutex _shutdown_mutex; - - jack_client_t* _client = nullptr; - jack_nframes_t _buffer_size = 0u; - uint32_t _xruns = 0u; - - bool _is_activated : 1; -}; - -#endif // PATCHAGE_JACKDRIVER_HPP |