summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-15 02:01:28 +0000
committerDavid Robillard <d@drobilla.net>2012-08-15 02:01:28 +0000
commit859ace60e8b1c4c0d9c5bea88d8eed1265ea859e (patch)
tree8750f85fa429dea5384bb309c8b09adfc75549e3
parent68c2d72ba4e2208ff926461bb6faccfbadcf2a61 (diff)
downloadingen-859ace60e8b1c4c0d9c5bea88d8eed1265ea859e.tar.gz
ingen-859ace60e8b1c4c0d9c5bea88d8eed1265ea859e.tar.bz2
ingen-859ace60e8b1c4c0d9c5bea88d8eed1265ea859e.zip
Remove EnginePort::move() in favour of Driver::rename_port().
Remove redundant Driver::engine_port(). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4698 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/server/DirectDriver.hpp8
-rw-r--r--src/server/Driver.hpp8
-rw-r--r--src/server/EnginePort.hpp3
-rw-r--r--src/server/JackDriver.cpp29
-rw-r--r--src/server/JackDriver.hpp8
-rw-r--r--src/server/events/Move.cpp14
-rw-r--r--src/server/events/Move.hpp1
-rw-r--r--src/server/ingen_lv2.cpp25
-rw-r--r--src/server/util.hpp6
9 files changed, 42 insertions, 60 deletions
diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp
index 8acb3f11..ccf65fee 100644
--- a/src/server/DirectDriver.hpp
+++ b/src/server/DirectDriver.hpp
@@ -42,15 +42,13 @@ public:
return NULL;
}
- virtual EnginePort* engine_port(ProcessContext& context,
- const Raul::Path& path) {
- return NULL;
- }
-
virtual EnginePort* port(const Raul::Path& path) { return NULL; }
virtual void add_port(ProcessContext& context, EnginePort* port) {}
+ virtual void rename_port(const Raul::Path& old_path,
+ const Raul::Path& new_path) {}
+
virtual Raul::Deletable* remove_port(ProcessContext& context,
EnginePort* port) {
return NULL;
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index da9f09a5..e551f636 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -56,10 +56,6 @@ public:
*/
virtual EnginePort* create_port(DuplexPort* patch_port) = 0;
- /** Return the DriverPort for a particular path, iff one exists. */
- virtual EnginePort* engine_port(ProcessContext& context,
- const Raul::Path& path) = 0;
-
/** Find a system port by path. */
virtual EnginePort* port(const Raul::Path& path) = 0;
@@ -70,6 +66,10 @@ public:
virtual Raul::Deletable* remove_port(ProcessContext& context,
EnginePort* port) = 0;
+ /** Rename a system visible port. */
+ virtual void rename_port(const Raul::Path& old_path,
+ const Raul::Path& new_path) = 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
index 6e6d0d1a..c911c118 100644
--- a/src/server/EnginePort.hpp
+++ b/src/server/EnginePort.hpp
@@ -49,9 +49,6 @@ public:
virtual ~EnginePort() {}
- /** Set the name of the system port according to new path */
- virtual void move(const Raul::Path& path) {}
-
/** Create system port */
virtual void create() {}
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 372feaa6..65566472 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -75,7 +75,7 @@ JackPort::create()
{
_jack_port = jack_port_register(
_driver->jack_client(),
- ingen_jack_port_name(_patch_port->path()).c_str(),
+ _patch_port->path().substr(1).c_str(),
(_patch_port->is_a(PortType::AUDIO))
? JACK_DEFAULT_AUDIO_TYPE : JACK_DEFAULT_MIDI_TYPE,
(_patch_port->is_input())
@@ -99,12 +99,6 @@ JackPort::destroy()
}
void
-JackPort::move(const Raul::Path& path)
-{
- jack_port_set_name(_jack_port, ingen_jack_port_name(path).c_str());
-}
-
-void
JackPort::pre_process(ProcessContext& context)
{
const SampleCount nframes = context.nframes();
@@ -339,6 +333,16 @@ JackDriver::remove_port(ProcessContext& context,
return NULL;
}
+void
+JackDriver::rename_port(const Raul::Path& old_path,
+ const Raul::Path& new_path)
+{
+ JackPort* jport = dynamic_cast<JackPort*>(port(old_path));
+ if (jport) {
+ jack_port_set_name(jport->jack_port(), new_path.substr(1).c_str());
+ }
+}
+
EnginePort*
JackDriver::port(const Raul::Path& path)
{
@@ -365,17 +369,6 @@ JackDriver::create_port(DuplexPort* patch_port)
}
}
-EnginePort*
-JackDriver::engine_port(ProcessContext& context,
- const Raul::Path& path)
-{
- for (Raul::List<JackPort*>::iterator i = _ports.begin(); i != _ports.end(); ++i)
- if ((*i)->patch_port()->path() == path)
- return (*i);
-
- return NULL;
-}
-
/**** Jack Callbacks ****/
/** Jack process callback, drives entire audio thread.
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index b41ebca5..5724afa7 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -60,8 +60,6 @@ public:
void create();
void destroy();
- void move(const Raul::Path& path);
-
void pre_process(ProcessContext& context);
void post_process(ProcessContext& context);
@@ -98,8 +96,10 @@ public:
EnginePort* port(const Raul::Path& path);
EnginePort* create_port(DuplexPort* patch_port);
- void add_port(ProcessContext& context, EnginePort* port);
- EnginePort* engine_port(ProcessContext& context, const Raul::Path& 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);
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index 5044ce3e..4d72e9ba 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -40,8 +40,6 @@ Move::Move(Engine& engine,
: Event(engine, client, id, timestamp)
, _old_path(path)
, _new_path(new_path)
- , _parent_patch(NULL)
- , _port(NULL)
{
}
@@ -67,7 +65,11 @@ Move::pre_process()
return Event::pre_process_done(EXISTS, _new_path);
}
- _port = dynamic_cast<PortImpl*>(i->second.get());
+ EnginePort* eport = _engine.driver()->port(_old_path);
+ if (eport) {
+ _engine.driver()->rename_port(_old_path, _new_path);
+ }
+
_engine.store()->rename(i, _new_path);
return Event::pre_process_done(SUCCESS);
@@ -76,12 +78,6 @@ Move::pre_process()
void
Move::execute(ProcessContext& context)
{
- if (_port && !_port->parent()->parent()) {
- EnginePort* eport = _engine.driver()->engine_port(context, _new_path);
- if (eport) {
- eport->move(_new_path);
- }
- }
}
void
diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp
index 0e46df1b..6c38347f 100644
--- a/src/server/events/Move.hpp
+++ b/src/server/events/Move.hpp
@@ -63,7 +63,6 @@ private:
const Raul::Path _old_path;
const Raul::Path _new_path;
PatchImpl* _parent_patch;
- PortImpl* _port;
};
} // namespace Events
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 1ad6ac72..a28eb5fc 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -209,7 +209,17 @@ public:
virtual void set_root_patch(PatchImpl* patch) { _root_patch = patch; }
virtual PatchImpl* root_patch() { return _root_patch; }
- /** Unused since LV2 has no dynamic ports. */
+ virtual EnginePort* engine_port(ProcessContext& context,
+ const Raul::Path& path) {
+ for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i) {
+ if ((*i)->patch_port()->path() == path) {
+ return (*i);
+ }
+ }
+
+ return NULL;
+ }
+
EnginePort* port(const Raul::Path& path) { return NULL; }
/** Doesn't have to be real-time safe since LV2 has no dynamic ports. */
@@ -232,19 +242,14 @@ public:
return NULL;
}
+ /** UNused since LV2 has no dynamic ports. */
+ virtual void rename_port(const Raul::Path& old_path,
+ const Raul::Path& new_path) {}
+
virtual EnginePort* create_port(DuplexPort* patch_port) {
return new LV2Port(this, patch_port);
}
- virtual EnginePort* engine_port(ProcessContext& context,
- const Raul::Path& path) {
- for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i)
- if ((*i)->patch_port()->path() == path)
- return (*i);
-
- return NULL;
- }
-
/** Called in run thread for events received at control input port. */
void enqueue_message(const LV2_Atom* atom) {
if (_from_ui.write(lv2_atom_total_size(atom), atom) == 0) {
diff --git a/src/server/util.hpp b/src/server/util.hpp
index 54649c7e..cae43c35 100644
--- a/src/server/util.hpp
+++ b/src/server/util.hpp
@@ -81,12 +81,6 @@ set_denormal_flags()
#endif
}
-static inline std::string
-ingen_jack_port_name(const Raul::Path& path)
-{
- return path.substr(1);
-}
-
} // namespace Server
} // namespace Ingen