From 0a9297ed2a1622d252a389d8babc0656fedbe7fd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 15 Aug 2012 04:18:31 +0000 Subject: Simpler and more unified EnginePort implementation. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4699 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/JackDriver.hpp | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) (limited to 'src/server/JackDriver.hpp') diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index 5724afa7..93f24ece 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -29,7 +29,6 @@ #endif #include "raul/AtomicInt.hpp" -#include "raul/List.hpp" #include "raul/Semaphore.hpp" #include "raul/Thread.hpp" @@ -47,29 +46,6 @@ class PortImpl; class DuplexPort; class JackDriver; -/** Used internally by JackDriver to represent a Jack port. - * - * A Jack port always has a one-to-one association with a Patch port. - */ -class JackPort : public EnginePort, public Raul::List::Node -{ -public: - JackPort(JackDriver* driver, DuplexPort* patch_port); - ~JackPort(); - - void create(); - void destroy(); - - void pre_process(ProcessContext& context); - void post_process(ProcessContext& context); - - jack_port_t* jack_port() const { return _jack_port; } - -private: - JackDriver* _driver; - jack_port_t* _jack_port; -}; - /** The Jack Driver. * * The process callback here drives the entire audio thread by "pulling" @@ -93,16 +69,14 @@ public: void enable(); void disable(); - EnginePort* port(const Raul::Path& path); EnginePort* create_port(DuplexPort* patch_port); + EnginePort* get_port(const Raul::Path& path); + void rename_port(const Raul::Path& old_path, const Raul::Path& new_path); void add_port(ProcessContext& context, EnginePort* port); - - void rename_port(const Raul::Path& old_path, - const Raul::Path& new_path); - - Raul::Deletable* remove_port(ProcessContext& context, - EnginePort* port); + void remove_port(ProcessContext& context, EnginePort* port); + void register_port(EnginePort& port); + void unregister_port(EnginePort& port); /** Transport state for this frame. * Intended to only be called from the audio thread. */ @@ -141,6 +115,9 @@ private: } #endif + void pre_process_port(ProcessContext& context, EnginePort* port); + void post_process_port(ProcessContext& context, EnginePort* port); + // Non static callbacks (methods) void _thread_init_cb(); void _shutdown_cb(); @@ -150,7 +127,11 @@ private: void _session_cb(jack_session_event_t* event); #endif +protected: + typedef boost::intrusive::list Ports; + Engine& _engine; + Ports _ports; std::list< SharedPtr > _jack_threads; Raul::Semaphore _sem; Raul::AtomicInt _flag; @@ -161,7 +142,6 @@ private: bool _is_activated; jack_position_t _position; jack_transport_state_t _transport_state; - Raul::List _ports; }; } // namespace Server -- cgit v1.2.1