From eabd60dc1352bd3427c035605ef261cf69cdcebc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 2 Oct 2008 22:02:57 +0000 Subject: Remove JACK dependence from RAUL. git-svn-id: http://svn.drobilla.net/lad/trunk/raul@1596 a436a847-0d15-0410-975c-d299462d15a1 --- raul/JackDriver.hpp | 120 ---------------------------------------------------- 1 file changed, 120 deletions(-) delete mode 100644 raul/JackDriver.hpp (limited to 'raul/JackDriver.hpp') diff --git a/raul/JackDriver.hpp b/raul/JackDriver.hpp deleted file mode 100644 index f1b92f1..0000000 --- a/raul/JackDriver.hpp +++ /dev/null @@ -1,120 +0,0 @@ -/* This file is part of Raul. - * Copyright (C) 2007 Dave Robillard - * - * Raul 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 2 of the License, or (at your option) any later - * version. - * - * Raul 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef RAUL_JACK_DRIVER_HPP -#define RAUL_JACK_DRIVER_HPP - -#include -#include -#include -#include - -namespace Raul { - - -/** Jack based driver for an audio context. - * - * Apps can override the on_* methods of this class to implement reactions - * to Jack events (e.g. new port, process callback, etc). - */ -class JackDriver -{ -public: - JackDriver(); - virtual ~JackDriver(); - - void attach(const std::string& client_name, std::string server_name=""); - void detach(); - - void activate(); - void deactivate(); - - bool is_activated() const { return _is_activated; } - bool is_attached() const { return (_client != NULL); } - bool is_realtime() const { return _client && jack_is_realtime(_client); } - - void start_transport() { jack_transport_start(_client); } - void stop_transport() { jack_transport_stop(_client); } - - void rewind_transport() { - jack_position_t zero; - zero.frame = 0; - zero.valid = (jack_position_bits_t)0; - jack_transport_reposition(_client, &zero); - } - - jack_nframes_t buffer_size(); - bool set_buffer_size(jack_nframes_t size); - - inline jack_nframes_t sample_rate() { return jack_get_sample_rate(_client); } - - inline size_t xruns() { return _xruns; } - void reset_xruns(); - - inline float max_delay() { return jack_get_max_delayed_usecs(_client); } - inline void reset_delay() { jack_reset_max_delayed_usecs(_client); } - - jack_client_t* jack_client() { return _client; } - - -protected: - /** Process callback. Derived classes should do all audio processing here. */ - virtual void on_process(jack_nframes_t /*nframes*/) {} - - /** Graph order change callback. */ - virtual void on_graph_order_changed() {} - - /** Buffer size changed callback. - * At the time this is called, buffer_size() will still return the old - * size. Immediately afterwards, it will be set to the new value. - */ - virtual void on_buffer_size_changed(jack_nframes_t /*size*/) {} - - virtual void on_xrun() {} - virtual void on_shutdown() {} - virtual void on_error() {} - -protected: - jack_client_t* _client; - -private: - - static void error_cb(const char* msg); - - void destroy_all_ports(); - - void update_time(); - - static void jack_port_registration_cb(jack_port_id_t port_id, int registered, void* me); - static int jack_graph_order_cb(void* me); - static int jack_xrun_cb(void* me); - static int jack_buffer_size_cb(jack_nframes_t buffer_size, void* me); - static int jack_process_cb(jack_nframes_t nframes, void* me); - - static void jack_shutdown_cb(void* me); - - bool _is_activated; - jack_position_t _last_pos; - jack_nframes_t _buffer_size; - size_t _xruns; - float _xrun_delay; -}; - - -} // namespace Raul - -#endif // RAUL_JACK_DRIVER_HPP -- cgit v1.2.1