summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-04-06 06:14:04 +0000
committerDavid Robillard <d@drobilla.net>2014-04-06 06:14:04 +0000
commit898aff4f18131c19e659e8e0c04ab020e9e66bea (patch)
treef8a206db354abe26c55e7f0ae746657a4212266e /src
parent5ef495e58358dcf28d45e69574f189ac51376a39 (diff)
downloadingen-898aff4f18131c19e659e8e0c04ab020e9e66bea.tar.gz
ingen-898aff4f18131c19e659e8e0c04ab020e9e66bea.tar.bz2
ingen-898aff4f18131c19e659e8e0c04ab020e9e66bea.zip
Support port pretty names via new Jack metadata API.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5357 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/DirectDriver.hpp4
-rw-r--r--src/server/Driver.hpp5
-rw-r--r--src/server/DuplexPort.cpp8
-rw-r--r--src/server/DuplexPort.hpp2
-rw-r--r--src/server/GraphImpl.hpp2
-rw-r--r--src/server/JackDriver.cpp34
-rw-r--r--src/server/JackDriver.hpp7
-rw-r--r--src/server/ingen_lv2.cpp5
8 files changed, 65 insertions, 2 deletions
diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp
index 5f8c4da5..ca9c3ae4 100644
--- a/src/server/DirectDriver.hpp
+++ b/src/server/DirectDriver.hpp
@@ -65,6 +65,10 @@ public:
virtual void rename_port(const Raul::Path& old_path,
const Raul::Path& new_path) {}
+ virtual void port_property(const Raul::Path& path,
+ const Raul::URI& uri,
+ const Atom& value) {}
+
virtual void register_port(EnginePort& port) {}
virtual void unregister_port(EnginePort& port) {}
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index 4b5e0ae0..2b4c837d 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -76,6 +76,11 @@ public:
virtual void rename_port(const Raul::Path& old_path,
const Raul::Path& new_path) = 0;
+ /** Apply a system visible port property. */
+ virtual void port_property(const Raul::Path& path,
+ const Raul::URI& uri,
+ const Atom& value) = 0;
+
/** Return the audio buffer size in frames */
virtual SampleCount block_length() const = 0;
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp
index 256d45b1..fe958e58 100644
--- a/src/server/DuplexPort.cpp
+++ b/src/server/DuplexPort.cpp
@@ -17,7 +17,9 @@
#include "ingen/URIs.hpp"
#include "Buffer.hpp"
+#include "Driver.hpp"
#include "DuplexPort.hpp"
+#include "Engine.hpp"
#include "GraphImpl.hpp"
#include "OutputPort.hpp"
@@ -95,6 +97,12 @@ DuplexPort::inherit_neighbour(const PortImpl* port,
}
}
+void
+DuplexPort::on_property(const Raul::URI& uri, const Atom& value)
+{
+ _bufs.engine().driver()->port_property(_path, uri, value);
+}
+
bool
DuplexPort::get_buffers(BufferFactory& bufs,
Raul::Array<Voice>* voices,
diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp
index 46ab18bf..ba9658fb 100644
--- a/src/server/DuplexPort.hpp
+++ b/src/server/DuplexPort.hpp
@@ -60,6 +60,8 @@ public:
Resource::Properties& remove,
Resource::Properties& add);
+ void on_property(const Raul::URI& uri, const Atom& value);
+
uint32_t max_tail_poly(Context& context) const;
bool get_buffers(BufferFactory& bufs,
diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp
index 049d7bff..0aba78bd 100644
--- a/src/server/GraphImpl.hpp
+++ b/src/server/GraphImpl.hpp
@@ -42,7 +42,7 @@ class ProcessContext;
*
* Note that this is also a Block, just one which contains Blocks.
* Therefore infinite subgraphing is possible, of polyphonic
- * graphes of polyphonic blocks etc. etc.
+ * graphs of polyphonic blocks etc. etc.
*
* \ingroup engine
*/
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 94183e42..9b1bf512 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -25,6 +25,9 @@
#include <boost/format.hpp>
#include "ingen/serialisation/Serialiser.hpp"
#endif
+#ifdef HAVE_JACK_METADATA
+#include <jack/metadata.h>
+#endif
#include "ingen/Configuration.hpp"
#include "ingen/LV2Features.hpp"
@@ -231,6 +234,10 @@ JackDriver::register_port(EnginePort& port)
}
port.set_handle(jack_port);
+
+ for (const auto& p : port.graph_port()->properties()) {
+ port_property_internal(jack_port, p.first, p.second);
+ }
}
void
@@ -252,6 +259,33 @@ JackDriver::rename_port(const Raul::Path& old_path,
}
}
+void
+JackDriver::port_property(const Raul::Path& path,
+ const Raul::URI& uri,
+ const Atom& value)
+{
+#ifdef HAVE_JACK_METADATA
+ EnginePort* eport = get_port(path);
+ if (eport) {
+ const jack_port_t* const jport = (const jack_port_t*)eport->handle();
+ port_property_internal(jport, uri, value);
+ }
+#endif
+}
+
+void
+JackDriver::port_property_internal(const jack_port_t* jport,
+ const Raul::URI& uri,
+ const Atom& value)
+{
+#ifdef HAVE_JACK_METADATA
+ if (uri == _engine.world()->uris().lv2_name) {
+ jack_set_property(_client, jack_port_uuid(jport),
+ JACK_METADATA_PRETTY_NAME, value.ptr<char>(), NULL);
+ }
+#endif
+}
+
EnginePort*
JackDriver::create_port(DuplexPort* graph_port)
{
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index e2bafd7c..2fe86387 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -49,7 +49,7 @@ class PortImpl;
/** The Jack Driver.
*
* The process callback here drives the entire audio thread by "pulling"
- * events from queues, processing them, running the graphes, and passing
+ * events from queues, processing them, running the graphs, and passing
* events along to the PostProcessor.
*
* \ingroup engine
@@ -73,6 +73,7 @@ public:
EnginePort* get_port(const Raul::Path& path);
void rename_port(const Raul::Path& old_path, const Raul::Path& new_path);
+ void port_property(const Raul::Path& path, const Raul::URI& uri, const Atom& value);
void add_port(ProcessContext& context, EnginePort* port);
void remove_port(ProcessContext& context, EnginePort* port);
void register_port(EnginePort& port);
@@ -119,6 +120,10 @@ private:
void pre_process_port(ProcessContext& context, EnginePort* port);
void post_process_port(ProcessContext& context, EnginePort* port);
+ void port_property_internal(const jack_port_t* jport,
+ const Raul::URI& uri,
+ const Atom& value);
+
// Non static callbacks (methods)
void _thread_init_cb();
void _shutdown_cb();
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 9d64c07b..e73cc4ee 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -250,6 +250,11 @@ public:
virtual void rename_port(const Raul::Path& old_path,
const Raul::Path& new_path) {}
+ /** Unused since LV2 has no dynamic ports. */
+ virtual void port_property(const Raul::Path& path,
+ const Raul::URI& uri,
+ const Atom& value) {}
+
virtual EnginePort* create_port(DuplexPort* graph_port) {
return new EnginePort(graph_port);
}