summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-09 12:22:59 +0000
committerDavid Robillard <d@drobilla.net>2012-05-09 12:22:59 +0000
commited80c779a6085ce62b9f61a28263607983db93a1 (patch)
tree4bab2fa47443068fa9fbae3598131289982d1cd3 /src
parentba2e3fac36f4db4ec4c27775f1a2246c111ce403 (diff)
downloadingen-ed80c779a6085ce62b9f61a28263607983db93a1.tar.gz
ingen-ed80c779a6085ce62b9f61a28263607983db93a1.tar.bz2
ingen-ed80c779a6085ce62b9f61a28263607983db93a1.zip
DriverPort => EnginePort.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4327 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/Driver.hpp40
-rw-r--r--src/server/EnginePort.hpp69
-rw-r--r--src/server/JackDriver.cpp14
-rw-r--r--src/server/JackDriver.hpp13
-rw-r--r--src/server/events/CreatePort.cpp11
-rw-r--r--src/server/events/CreatePort.hpp4
-rw-r--r--src/server/events/Delete.cpp11
-rw-r--r--src/server/events/Delete.hpp4
-rw-r--r--src/server/events/Move.cpp8
-rw-r--r--src/server/ingen_lv2.cpp13
10 files changed, 117 insertions, 70 deletions
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index cce1be7e..77d49234 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -31,37 +31,7 @@ namespace Ingen {
namespace Server {
class DuplexPort;
-class ProcessContext;
-
-/** Representation of a "system" (eg outside Ingen) port.
- *
- * This is the class through which the rest of the engine manages everything
- * related to driver ports. Derived classes are expected to have a pointer to
- * their driver (to be able to perform the operation necessary).
- *
- * \ingroup engine
- */
-class DriverPort : boost::noncopyable, public Raul::Deletable {
-public:
- virtual ~DriverPort() {}
-
- /** Set the name of the system port according to new path */
- virtual void move(const Raul::Path& path) = 0;
-
- /** Create system port */
- virtual void create() = 0;
-
- /** Destroy system port */
- virtual void destroy() = 0;
-
- bool is_input() const { return _patch_port->is_input(); }
- DuplexPort* patch_port() const { return _patch_port; }
-
-protected:
- explicit DriverPort(DuplexPort* port) : _patch_port(port) {}
-
- DuplexPort* _patch_port;
-};
+class EnginePort;
/** Driver abstract base class.
*
@@ -84,17 +54,17 @@ public:
/** Create a port ready to be inserted with add_input (non realtime).
* May return NULL if the Driver can not create the port for some reason.
*/
- virtual DriverPort* create_port(DuplexPort* patch_port) = 0;
+ virtual EnginePort* create_port(DuplexPort* patch_port) = 0;
/** Return the DriverPort for a particular path, iff one exists. */
- virtual DriverPort* driver_port(const Raul::Path& path) = 0;
+ virtual EnginePort* engine_port(const Raul::Path& path) = 0;
/** Add a system visible port (e.g. a port on the root patch). */
- virtual void add_port(DriverPort* port) = 0;
+ virtual void add_port(EnginePort* port) = 0;
/** Remove a system visible port. */
virtual Raul::Deletable* remove_port(const Raul::Path& path,
- DriverPort** port=NULL) = 0;
+ EnginePort** port=NULL) = 0;
/** Return the audio buffer size in frames */
virtual SampleCount block_length() const = 0;
diff --git a/src/server/EnginePort.hpp b/src/server/EnginePort.hpp
new file mode 100644
index 00000000..39f25d5c
--- /dev/null
+++ b/src/server/EnginePort.hpp
@@ -0,0 +1,69 @@
+/*
+ This file is part of Ingen.
+ Copyright 2007-2012 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
+ Software Foundation, either version 3 of the License, or any later version.
+
+ Ingen 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 Affero General Public License for details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Ingen. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef INGEN_ENGINE_ENGINE_PORT_HPP
+#define INGEN_ENGINE_ENGINE_PORT_HPP
+
+#include <string>
+
+#include <boost/utility.hpp>
+
+#include "raul/Deletable.hpp"
+
+#include "DuplexPort.hpp"
+
+namespace Raul { class Path; }
+
+namespace Ingen {
+namespace Server {
+
+class DuplexPort;
+class ProcessContext;
+
+/** Representation of a "system" (eg outside Ingen) port.
+ *
+ * This is the class through which the rest of the engine manages everything
+ * related to driver ports. Derived classes are expected to have a pointer to
+ * their driver (to be able to perform the operation necessary).
+ *
+ * \ingroup engine
+ */
+class EnginePort : boost::noncopyable, public Raul::Deletable {
+public:
+ virtual ~EnginePort() {}
+
+ /** Set the name of the system port according to new path */
+ virtual void move(const Raul::Path& path) = 0;
+
+ /** Create system port */
+ virtual void create() = 0;
+
+ /** Destroy system port */
+ virtual void destroy() = 0;
+
+ bool is_input() const { return _patch_port->is_input(); }
+ DuplexPort* patch_port() const { return _patch_port; }
+
+protected:
+ explicit EnginePort(DuplexPort* port) : _patch_port(port) {}
+
+ DuplexPort* _patch_port;
+};
+
+} // namespace Server
+} // namespace Ingen
+
+#endif // INGEN_ENGINE_ENGINE_PORT_HPP
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 46b80a40..24e5f86c 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -61,7 +61,7 @@ namespace Server {
//// JackPort ////
JackPort::JackPort(JackDriver* driver, DuplexPort* patch_port)
- : DriverPort(patch_port)
+ : EnginePort(patch_port)
, Raul::List<JackPort*>::Node(this)
, _driver(driver)
, _jack_port(NULL)
@@ -318,7 +318,7 @@ JackDriver::deactivate()
* See create_port() and remove_port().
*/
void
-JackDriver::add_port(DriverPort* port)
+JackDriver::add_port(EnginePort* port)
{
ThreadManager::assert_thread(THREAD_PROCESS);
assert(dynamic_cast<JackPort*>(port));
@@ -334,7 +334,7 @@ JackDriver::add_port(DriverPort* port)
* It is the callers responsibility to delete the returned port.
*/
Raul::Deletable*
-JackDriver::remove_port(const Path& path, DriverPort** port)
+JackDriver::remove_port(const Path& path, EnginePort** port)
{
ThreadManager::assert_thread(THREAD_PROCESS);
@@ -351,7 +351,7 @@ JackDriver::remove_port(const Path& path, DriverPort** port)
return NULL;
}
-DriverPort*
+EnginePort*
JackDriver::port(const Path& path)
{
for (Raul::List<JackPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i)
@@ -361,7 +361,7 @@ JackDriver::port(const Path& path)
return NULL;
}
-DriverPort*
+EnginePort*
JackDriver::create_port(DuplexPort* patch_port)
{
try {
@@ -377,8 +377,8 @@ JackDriver::create_port(DuplexPort* patch_port)
}
}
-DriverPort*
-JackDriver::driver_port(const Path& path)
+EnginePort*
+JackDriver::engine_port(const Path& path)
{
ThreadManager::assert_thread(THREAD_PROCESS);
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index 24a2dab8..3bc9c037 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -35,6 +35,7 @@
#include "Buffer.hpp"
#include "Driver.hpp"
+#include "EnginePort.hpp"
namespace Raul { class Path; }
@@ -51,7 +52,7 @@ class JackDriver;
*
* A Jack port always has a one-to-one association with a Patch port.
*/
-class JackPort : public DriverPort, public Raul::List<JackPort*>::Node
+class JackPort : public EnginePort, public Raul::List<JackPort*>::Node
{
public:
JackPort(JackDriver* driver, DuplexPort* patch_port);
@@ -95,13 +96,13 @@ public:
void enable();
void disable();
- DriverPort* port(const Raul::Path& path);
- DriverPort* create_port(DuplexPort* patch_port);
+ EnginePort* port(const Raul::Path& path);
+ EnginePort* create_port(DuplexPort* patch_port);
- void add_port(DriverPort* port);
- DriverPort* driver_port(const Raul::Path& path);
+ void add_port(EnginePort* port);
+ EnginePort* engine_port(const Raul::Path& path);
- Raul::Deletable* remove_port(const Raul::Path& path, DriverPort** port=NULL);
+ Raul::Deletable* remove_port(const Raul::Path& path, EnginePort** port=NULL);
/** Transport state for this frame.
* Intended to only be called from the audio thread. */
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index e9589eaa..386f1d59 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -53,7 +53,7 @@ CreatePort::CreatePort(Engine& engine,
, _patch(NULL)
, _patch_port(NULL)
, _ports_array(NULL)
- , _driver_port(NULL)
+ , _engine_port(NULL)
, _properties(properties)
, _is_output(is_output)
{
@@ -148,9 +148,10 @@ CreatePort::pre_process()
_ports_array->at(old_num_ports) = _patch_port;
_engine.engine_store()->add(_patch_port);
- if (!_patch->parent())
- _driver_port = _engine.driver()->create_port(
+ if (!_patch->parent()) {
+ _engine_port = _engine.driver()->create_port(
dynamic_cast<DuplexPort*>(_patch_port));
+ }
assert(_ports_array->size() == _patch->num_ports());
@@ -171,8 +172,8 @@ CreatePort::execute(ProcessContext& context)
_patch->external_ports(_ports_array);
}
- if (_driver_port) {
- _engine.driver()->add_port(_driver_port);
+ if (_engine_port) {
+ _engine.driver()->add_port(_engine_port);
}
}
diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp
index 74dc5698..6050cc18 100644
--- a/src/server/events/CreatePort.hpp
+++ b/src/server/events/CreatePort.hpp
@@ -30,7 +30,7 @@ namespace Server {
class PatchImpl;
class PortImpl;
-class DriverPort;
+class EnginePort;
namespace Events {
@@ -61,7 +61,7 @@ private:
PatchImpl* _patch;
PortImpl* _patch_port;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports array for Patch
- DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port
+ EnginePort* _engine_port; ///< Driver (eg Jack) port if this is a toplevel port
Resource::Properties _properties;
bool _is_output;
};
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index 13173ddb..a91702cc 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -16,12 +16,14 @@
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
+
#include "ClientBroadcaster.hpp"
#include "ControlBindings.hpp"
#include "Delete.hpp"
#include "DisconnectAll.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
+#include "EnginePort.hpp"
#include "EngineStore.hpp"
#include "NodeImpl.hpp"
#include "PatchImpl.hpp"
@@ -43,7 +45,7 @@ Delete::Delete(Engine& engine,
, _uri(uri)
, _store_iterator(engine.engine_store()->end())
, _garbage(NULL)
- , _driver_port(NULL)
+ , _engine_port(NULL)
, _patch_node_listnode(NULL)
, _patch_port_listnode(NULL)
, _ports_array(NULL)
@@ -155,7 +157,7 @@ Delete::execute(ProcessContext& context)
_port->parent_patch()->external_ports(_ports_array);
if ( ! _port->parent_patch()->parent())
- _garbage = _engine.driver()->remove_port(_port->path(), &_driver_port);
+ _garbage = _engine.driver()->remove_port(_port->path(), &_engine_port);
}
if (parent_patch) {
@@ -198,8 +200,9 @@ Delete::post_process()
respond(FAILURE);
}
- if (_driver_port)
- _driver_port->destroy();
+ if (_engine_port) {
+ _engine_port->destroy();
+ }
_engine.maid()->push(_garbage);
}
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index d5e07812..ff4a4e07 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -33,7 +33,7 @@ namespace Server {
class GraphObjectImpl;
class NodeImpl;
class PortImpl;
-class DriverPort;
+class EnginePort;
class CompiledPatch;
namespace Events {
@@ -76,7 +76,7 @@ private:
SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
SharedPtr<PortImpl> _port; ///< Non-NULL iff a port
Raul::Deletable* _garbage;
- DriverPort* _driver_port;
+ EnginePort* _engine_port;
PatchImpl::Nodes::Node* _patch_node_listnode;
Raul::List<PortImpl*>::Node* _patch_port_listnode;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index 34ba6181..0969eea2 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -21,6 +21,7 @@
#include "ClientBroadcaster.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
+#include "EnginePort.hpp"
#include "EngineStore.hpp"
#include "NodeImpl.hpp"
#include "PatchImpl.hpp"
@@ -105,9 +106,10 @@ Move::execute(ProcessContext& context)
SharedPtr<PortImpl> port = PtrCast<PortImpl>(_store_iterator->second);
if (port && port->parent()->parent() == NULL) {
- DriverPort* driver_port = _engine.driver()->driver_port(_new_path);
- if (driver_port)
- driver_port->move(_new_path);
+ EnginePort* engine_port = _engine.driver()->engine_port(_new_path);
+ if (engine_port) {
+ engine_port->move(_new_path);
+ }
}
}
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 731c2f6f..5e418485 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -43,6 +43,7 @@
#include "raul/log.hpp"
#include "AudioBuffer.hpp"
+#include "EnginePort.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
#include "EventWriter.hpp"
@@ -81,11 +82,11 @@ class LV2Driver;
void handle_message(LV2Driver* driver, const LV2_Atom* msg);
-class LV2Port : public DriverPort
+class LV2Port : public EnginePort
{
public:
LV2Port(LV2Driver* driver, DuplexPort* patch_port)
- : DriverPort(patch_port)
+ : EnginePort(patch_port)
, _driver(driver)
, _buffer(NULL)
{}
@@ -178,7 +179,7 @@ public:
virtual void set_root_patch(PatchImpl* patch) { _root_patch = patch; }
virtual PatchImpl* root_patch() { return _root_patch; }
- virtual void add_port(DriverPort* port) {
+ virtual void add_port(EnginePort* port) {
// Note this doesn't have to be realtime safe since there's no dynamic LV2 ports
ThreadManager::assert_thread(THREAD_PROCESS);
assert(dynamic_cast<LV2Port*>(port));
@@ -187,7 +188,7 @@ public:
}
virtual Raul::Deletable* remove_port(const Raul::Path& path,
- DriverPort** port=NULL) {
+ EnginePort** port=NULL) {
// Note this doesn't have to be realtime safe since there's no dynamic LV2 ports
ThreadManager::assert_thread(THREAD_PROCESS);
@@ -202,11 +203,11 @@ public:
return NULL;
}
- virtual DriverPort* create_port(DuplexPort* patch_port) {
+ virtual EnginePort* create_port(DuplexPort* patch_port) {
return new LV2Port(this, patch_port);
}
- virtual DriverPort* driver_port(const Raul::Path& path) {
+ virtual EnginePort* engine_port(const Raul::Path& path) {
ThreadManager::assert_thread(THREAD_PROCESS);
for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i)