From 6972a4a3990a573937e420864268fcca39a7741a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 1 Jan 2007 06:30:55 +0000 Subject: Jack toolbar, modification of Jack buffer size on the fly. git-svn-id: http://svn.drobilla.net/lad/patchage@226 a436a847-0d15-0410-975c-d299462d15a1 --- src/JackDriver.h | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'src/JackDriver.h') diff --git a/src/JackDriver.h b/src/JackDriver.h index 01dc49d..c581df0 100644 --- a/src/JackDriver.h +++ b/src/JackDriver.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "Driver.h" class Patchage; @@ -46,6 +47,7 @@ public: void detach(); bool is_attached() const { return (m_client != NULL); } + bool is_realtime() const { return m_client && jack_is_realtime(m_client); } void refresh(); bool connect(boost::shared_ptr src, @@ -57,6 +59,9 @@ public: void start_transport() { jack_transport_start(m_client); } void stop_transport() { jack_transport_stop(m_client); } + void reset_xruns(); + void reset_delay() { jack_reset_max_delayed_usecs(m_client); } + void rewind_transport() { jack_position_t zero; zero.frame = 0; @@ -64,18 +69,20 @@ public: jack_transport_reposition(m_client, &zero); } + //jack_client_t* client() { return m_client; } + + jack_nframes_t buffer_size(); + void set_buffer_size(jack_nframes_t size); -private: - Patchage* m_app; + inline float sample_rate() { return jack_get_sample_rate(m_client); } - jack_client_t* m_client; + void set_realtime(bool realtime, int priority=80); - Mutex m_mutex; + inline size_t xruns() { return m_xruns; } - list m_added_ports; - list m_removed_ports; + inline float max_delay() { return jack_get_max_delayed_usecs(m_client); } - jack_position_t m_last_pos; +private: boost::shared_ptr create_port(boost::shared_ptr parent, jack_port_t* port); @@ -86,9 +93,30 @@ private: void update_time(); - static void jack_port_registration_cb(jack_port_id_t port_id, int registered, void* controller); - static int jack_graph_order_cb(void* controller); - static void jack_shutdown_cb(void* controller); + 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_buffer_size_cb(jack_nframes_t buffer_size, void* me); + static int jack_xrun_cb(void* me); + static void jack_shutdown_cb(void* me); + + Patchage* m_app; + + jack_client_t* m_client; + + bool m_is_activated; + + //Mutex m_mutex; + + list m_added_ports; + list m_removed_ports; + + jack_position_t m_last_pos; + + jack_nframes_t m_buffer_size; + size_t m_xruns; + float m_xrun_delay; + + bool m_settings_changed; }; -- cgit v1.2.1