From 848893c6a25e70a6f898ceaa8a647558060ac06e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Dec 2013 00:30:22 +0000 Subject: Implement port methods for DirectDriver. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5210 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/DirectDriver.hpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp index 87192599..301a43cc 100644 --- a/src/server/DirectDriver.hpp +++ b/src/server/DirectDriver.hpp @@ -17,6 +17,8 @@ #ifndef INGEN_ENGINE_DIRECT_DRIVER_HPP #define INGEN_ENGINE_DIRECT_DRIVER_HPP +#include + #include "Driver.hpp" namespace Ingen { @@ -39,13 +41,26 @@ public: virtual void deactivate() {} virtual EnginePort* create_port(DuplexPort* graph_port) { + return new EnginePort(graph_port); + } + + virtual EnginePort* get_port(const Raul::Path& path) { + for (auto& p : _ports) { + if (p.graph_port()->path() == path) { + return &p; + } + } + return NULL; } - virtual EnginePort* get_port(const Raul::Path& path) { return NULL; } + virtual void add_port(ProcessContext& context, EnginePort* port) { + _ports.push_back(*port); + } - virtual void add_port(ProcessContext& context, EnginePort* port) {} - virtual void remove_port(ProcessContext& context, EnginePort* port) {} + virtual void remove_port(ProcessContext& context, EnginePort* port) { + _ports.erase(_ports.iterator_to(*port)); + } virtual void rename_port(const Raul::Path& old_path, const Raul::Path& new_path) {} @@ -57,18 +72,17 @@ public: virtual SampleCount sample_rate() const { return _sample_rate; } - virtual SampleCount frame_time() const { - return 0; - } + virtual SampleCount frame_time() const { return 0; } - virtual bool is_realtime() const { - return false; - } + virtual bool is_realtime() const { return false; } virtual void append_time_events(ProcessContext& context, Buffer& buffer) {} private: + typedef boost::intrusive::list Ports; + + Ports _ports; SampleCount _sample_rate; SampleCount _block_length; }; -- cgit v1.2.1