diff options
-rw-r--r-- | src/server/DirectDriver.hpp | 4 | ||||
-rw-r--r-- | src/server/Driver.hpp | 5 | ||||
-rw-r--r-- | src/server/DuplexPort.cpp | 8 | ||||
-rw-r--r-- | src/server/DuplexPort.hpp | 2 | ||||
-rw-r--r-- | src/server/GraphImpl.hpp | 2 | ||||
-rw-r--r-- | src/server/JackDriver.cpp | 34 | ||||
-rw-r--r-- | src/server/JackDriver.hpp | 7 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 5 | ||||
-rw-r--r-- | wscript | 8 |
9 files changed, 73 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); } @@ -87,6 +87,12 @@ def configure(conf): if not Options.options.no_jack_session: autowaf.define(conf, 'INGEN_JACK_SESSION', 1) + conf.check(function_name='jack_set_property', + header_name='jack/metadata.h', + define_name='HAVE_JACK_METADATA', + uselib='JACK', + mandatory=False) + conf.env.BUILD_TESTS = Options.options.build_tests if conf.env.BUILD_TESTS: conf.check_cxx(lib='gcov', @@ -126,6 +132,8 @@ def configure(conf): autowaf.display_msg(conf, "Jack", conf.is_defined('HAVE_JACK')) autowaf.display_msg(conf, "Jack session support", conf.is_defined('INGEN_JACK_SESSION')) + autowaf.display_msg(conf, "Jack metadata support", + conf.is_defined('HAVE_JACK_METADATA')) autowaf.display_msg(conf, "Socket interface", conf.is_defined('HAVE_SOCKET')) autowaf.display_msg(conf, "LV2", conf.is_defined('HAVE_LILV')) autowaf.display_msg(conf, "GUI", str(conf.env.INGEN_BUILD_GUI == 1)) |