summaryrefslogtreecommitdiffstats
path: root/src/server/PortImpl.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-12-13 17:51:55 -0500
committerDavid Robillard <d@drobilla.net>2016-12-13 19:15:29 -0500
commitad43d2e08cea225635b56c5473a768bc853ecda3 (patch)
tree472a8c6dc605ba63903206a14549e8340efcf137 /src/server/PortImpl.hpp
parent0752556bde5659a933744658cdf63509000a5080 (diff)
downloadingen-ad43d2e08cea225635b56c5473a768bc853ecda3.tar.gz
ingen-ad43d2e08cea225635b56c5473a768bc853ecda3.tar.bz2
ingen-ad43d2e08cea225635b56c5473a768bc853ecda3.zip
Remove virtual inheritance from Port hierarchy
This was confusing stoat, and is questionable design anyway. The OutputPort functionality has been moved to PortImpl, which is a basic port with buffers suitable for use as an output, and is overridden by InputPort and DuplexPort where necessary.
Diffstat (limited to 'src/server/PortImpl.hpp')
-rw-r--r--src/server/PortImpl.hpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp
index 94fdd50c..05ca3ff4 100644
--- a/src/server/PortImpl.hpp
+++ b/src/server/PortImpl.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2007-2015 David Robillard <http://drobilla.net/>
+ Copyright 2007-2016 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -38,6 +38,10 @@ class BufferFactory;
/** A port (input or output) on a Block.
*
+ * The base implementation here is general and/or for output ports (which are
+ * simplest), InputPort and DuplexPort override functions to provide
+ * specialized behaviour where necessary.
+ *
* \ingroup engine
*/
class PortImpl : public NodeImpl
@@ -80,6 +84,17 @@ public:
BufferRef buffer;
};
+ PortImpl(BufferFactory& bufs,
+ BlockImpl* block,
+ const Raul::Symbol& name,
+ uint32_t index,
+ uint32_t poly,
+ PortType type,
+ LV2_URID buffer_type,
+ const Atom& value,
+ size_t buffer_size = 0,
+ bool is_output = true);
+
~PortImpl();
virtual GraphType graph_type() const { return GraphType::PORT; }
@@ -153,9 +168,9 @@ public:
bool is_driver_port() const { return _is_driver_port; }
/** Called once per process cycle */
- virtual void pre_process(RunContext& context) = 0;
+ virtual void pre_process(RunContext& context);
virtual void pre_run(RunContext& context) {}
- virtual void post_process(RunContext& context) = 0;
+ virtual void post_process(RunContext& context);
/** Empty buffer contents completely (ie silence) */
virtual void clear_buffers();
@@ -164,7 +179,7 @@ public:
virtual bool get_buffers(BufferFactory& bufs,
Raul::Array<Voice>* voices,
uint32_t poly,
- bool real_time) const = 0;
+ bool real_time) const;
void setup_buffers(BufferFactory& bufs, uint32_t poly, bool real_time) {
get_buffers(bufs, _voices, poly, real_time);
@@ -186,9 +201,6 @@ public:
virtual void connect_buffers(SampleCount offset=0);
virtual void recycle_buffers();
- virtual bool is_input() const = 0;
- virtual bool is_output() const = 0;
-
uint32_t index() const { return _index; }
inline bool is_a(PortType type) const { return _type == type; }
@@ -238,7 +250,7 @@ public:
SampleCount end) const;
/** Update value buffer for `voice` to be current as of `offset`. */
- virtual void update_values(SampleCount offset, uint32_t voice) = 0;
+ virtual void update_values(SampleCount offset, uint32_t voice);
void force_monitor_update() { _force_monitor_update = true; }
@@ -251,6 +263,8 @@ public:
void cache_properties();
+ bool is_input() const { return !_is_output; }
+ bool is_output() const { return _is_output; }
bool is_morph() const { return _is_morph; }
bool is_auto_morph() const { return _is_auto_morph; }
bool is_logarithmic() const { return _is_logarithmic; }
@@ -258,16 +272,6 @@ public:
bool is_toggled() const { return _is_toggled; }
protected:
- PortImpl(BufferFactory& bufs,
- BlockImpl* block,
- const Raul::Symbol& name,
- uint32_t index,
- uint32_t poly,
- PortType type,
- LV2_URID buffer_type,
- const Atom& value,
- size_t buffer_size);
-
BufferFactory& _bufs;
uint32_t _index;
uint32_t _poly;
@@ -291,6 +295,7 @@ protected:
bool _is_sample_rate;
bool _is_toggled;
bool _is_driver_port;
+ bool _is_output;
};
} // namespace Server