summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-09 03:05:13 +0000
committerDavid Robillard <d@drobilla.net>2013-01-09 03:05:13 +0000
commit67067320cb53f3c84bb7901e446f3d1798667e57 (patch)
treeefaf94976fbef5f7ed9843bcd8056ee3289167ea
parent19b6f2d1c1e8ddcc52b45b4a2c17d4f0317ceabc (diff)
downloadingen-67067320cb53f3c84bb7901e446f3d1798667e57.tar.gz
ingen-67067320cb53f3c84bb7901e446f3d1798667e57.tar.bz2
ingen-67067320cb53f3c84bb7901e446f3d1798667e57.zip
Load internal plugin data files and rework documentation code to work the same as LV2 plugins (fix #671).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4910 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--bundles/ingen.lv2/internals.ttl40
-rw-r--r--bundles/ingen.lv2/manifest.ttl17
-rw-r--r--ingen/client/PluginModel.hpp2
-rw-r--r--src/World.cpp15
-rw-r--r--src/client/PluginModel.cpp37
-rw-r--r--src/gui/GraphBox.cpp1
-rw-r--r--src/gui/NodeModule.cpp8
7 files changed, 79 insertions, 41 deletions
diff --git a/bundles/ingen.lv2/internals.ttl b/bundles/ingen.lv2/internals.ttl
index 63f6d799..b4e713b3 100644
--- a/bundles/ingen.lv2/internals.ttl
+++ b/bundles/ingen.lv2/internals.ttl
@@ -1,41 +1,33 @@
-@prefix ingen: <http://drobilla.net/ns/ingen-internals#> .
-@prefix ingen: <http://drobilla.net/ns/ingen#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix ingen: <http://drobilla.net/ns/ingen#> .
+@prefix internals: <http://drobilla.net/ns/ingen-internals#> .
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema> .
-ingen:Controller
+internals:Controller
a ingen:Plugin ;
rdfs:label "Controller" ;
- rdfs:comment """
-Receives events and outputs signals for some specific controller
-(e.g. MIDI CC).
-""" .
+ rdfs:comment """Outputs the value of a specific MIDI control as a signal. The output value will be scaled to be between the range specified by the minimum and maximum controls.""" .
-ingen:Trigger
+internals:Trigger
a ingen:Plugin ;
rdfs:label "Trigger" ;
- rdfs:comment """
-Receives events and outputs a trigger signal when a specific note is received.
-""" .
+ rdfs:comment """Outputs a gate, trigger, and velocity signal whenever the specified note is received. This is particularly useful for building percussive instruments.""" .
-ingen:Note
+internals:Note
a ingen:Plugin ;
rdfs:label "Note" ;
- rdfs:comment """
-Receives events and outputs signals for the individual properties of the
-received notes. This plugin is special because it is internally aware of
-Ingen's polyphony and controls voice allocation.
-""" .
+ rdfs:comment """Outputs the attributes of a note as signals. Typically the frequency output controls an oscillator and the gate and trigger control an envelope. This plugin is special because it is internally aware of polyphony and controls voice allocation.""" .
+
+internals:Time
+ a ingen:Plugin ;
+ rdfs:label "Time" ;
+ rdfs:comment """Emits time and transport information like tempo, time signature, and speed. The emitted events are in the standard LV2 format expected by transport-aware LV2 plugins.""" .
-ingen:Transport
+internals:Delay
a ingen:Plugin ;
- rdfs:label "Transport" ;
- rdfs:comment """
-Listens to system transport information (when available) and outputs signals
-for the various transport properties. When no system transport information
-is available this plugin outputs "default" values: 4/4, 120bpm.
-""" .
+ rdfs:label "Delay" ;
+ rdfs:comment """Special internal delay block. In theory, this block can be used for sample-accurate delay loops since Ingen can specially handle this case unlike a generic LV2 plugin. However, this is not currently implemented.""" . \ No newline at end of file
diff --git a/bundles/ingen.lv2/manifest.ttl b/bundles/ingen.lv2/manifest.ttl
index d0151df1..b7f6163c 100644
--- a/bundles/ingen.lv2/manifest.ttl
+++ b/bundles/ingen.lv2/manifest.ttl
@@ -1,4 +1,5 @@
@prefix ingen: <http://drobilla.net/ns/ingen#> .
+@prefix internals: <http://drobilla.net/ns/ingen-internals#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
@@ -11,3 +12,19 @@ ingen:GraphUIGtk2
a ui:GtkUI ;
ui:binary <libingen_gui_lv2.so> ;
rdfs:comment "The Ingen patcher interface." .
+
+internals:Controller
+ a ingen:Plugin ;
+ rdfs:seeAlso <internals.ttl> .
+
+internals:Trigger
+ a ingen:Plugin ;
+ rdfs:seeAlso <internals.ttl> .
+
+internals:Note
+ a ingen:Plugin ;
+ rdfs:seeAlso <internals.ttl> .
+
+internals:Transport
+ a ingen:Plugin ;
+ rdfs:seeAlso <internals.ttl> .
diff --git a/ingen/client/PluginModel.hpp b/ingen/client/PluginModel.hpp
index 7e082879..4195dfe2 100644
--- a/ingen/client/PluginModel.hpp
+++ b/ingen/client/PluginModel.hpp
@@ -80,7 +80,7 @@ public:
const std::string& icon_path() const;
static std::string get_lv2_icon_path(const LilvPlugin* plugin);
- std::string documentation(bool* html) const;
+ std::string documentation(bool html) const;
std::string port_documentation(uint32_t index) const;
static void set_rdf_world(Sord::World& world) {
diff --git a/src/World.cpp b/src/World.cpp
index cccb5044..8b6a58ea 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -42,7 +42,6 @@ class Store;
namespace Serialisation { class Parser; class Serialiser; }
-
/** Load a dynamic module from the default path.
*
* This will check in the directories specified in the environment variable
@@ -135,6 +134,20 @@ public:
rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#");
rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
+
+ // Load internal 'plugin' information into lilv world
+ LilvNode* rdf_type = lilv_new_uri(
+ lilv_world, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+ LilvNode* ingen_Plugin = lilv_new_uri(
+ lilv_world, "http://drobilla.net/ns/ingen#Plugin");
+ LilvNodes* internals = lilv_world_find_nodes(
+ lilv_world, NULL, rdf_type, ingen_Plugin);
+ LILV_FOREACH(nodes, i, internals) {
+ const LilvNode* internal = lilv_nodes_get(internals, i);
+ lilv_world_load_resource(lilv_world, internal);
+ }
+ lilv_node_free(rdf_type);
+ lilv_node_free(ingen_Plugin);
}
~Impl()
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 87d1aa92..63113e54 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -273,27 +273,38 @@ PluginModel::get_lv2_icon_path(const LilvPlugin* plugin)
return result;
}
+static std::string
+heading(const std::string& text, bool html)
+{
+ if (html) {
+ return std::string("<h2>") + text + "</h2>\n";
+ } else {
+ return text + ":\n\n";
+ }
+}
+
std::string
-PluginModel::documentation(bool* html) const
+PluginModel::documentation(bool html) const
{
std::string doc;
- if (!_lilv_plugin) {
- return doc;
- }
+
+ LilvNode* subject = (_lilv_plugin)
+ ? lilv_node_duplicate(lilv_plugin_get_uri(_lilv_plugin))
+ : lilv_new_uri(_lilv_world, uri().c_str());
LilvNode* lv2_documentation = lilv_new_uri(_lilv_world,
LILV_NS_LV2 "documentation");
LilvNode* rdfs_comment = lilv_new_uri(_lilv_world,
LILV_NS_RDFS "comment");
- LilvNodes* vals = lilv_plugin_get_value(_lilv_plugin, lv2_documentation);
- if (vals) {
- *html = true;
- doc += std::string("<h2>") + human_name() + "</h2>\n";
- } else {
- *html = false;
- vals = lilv_plugin_get_value(_lilv_plugin, rdfs_comment);
+ LilvNodes* vals = lilv_world_find_nodes(
+ _lilv_world, subject, lv2_documentation, NULL);
+ if (!vals) {
+ vals = lilv_world_find_nodes(
+ _lilv_world, subject, rdfs_comment, NULL);
+ // TODO: If not html, must convert to plain text
}
+ doc += heading(human_name(), html);
if (vals) {
const LilvNode* val = lilv_nodes_get_first(vals);
@@ -303,7 +314,7 @@ PluginModel::documentation(bool* html) const
}
lilv_node_free(rdfs_comment);
lilv_node_free(lv2_documentation);
-
+ lilv_node_free(subject);
lilv_nodes_free(vals);
return doc;
@@ -317,7 +328,7 @@ PluginModel::port_documentation(uint32_t index) const
if (!_lilv_plugin)
return doc;
- const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index);
+ const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index);
//LilvNode lv2_documentation = lilv_new_uri(
// _lilv_world, LILV_NAMESPACE_LV2 "documentation");
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 17631794..ef3b3c8c 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -325,6 +325,7 @@ GraphBox::set_documentation(const std::string& doc, bool html)
#else
Gtk::TextView* view = Gtk::manage(new Gtk::TextView());
view->get_buffer()->set_text(doc);
+ view->set_wrap_mode(Gtk::WRAP_WORD);
_doc_scrolledwindow->add(*view);
view->show();
#endif
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 5542bef6..1409368e 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -41,6 +41,7 @@
#include "SubgraphModule.hpp"
#include "WidgetFactory.hpp"
#include "WindowFactory.hpp"
+#include "ingen_config.h"
using namespace std;
@@ -441,9 +442,12 @@ NodeModule::on_selected(gboolean selected)
if (selected && win->documentation_is_visible()) {
GraphWindow* win = app().window_factory()->parent_graph_window(block());
std::string doc;
- bool html = false;
+ bool html = false;
+#ifdef HAVE_WEBKIT
+ html = true;
+#endif
if (block()->plugin_model()) {
- doc = block()->plugin_model()->documentation(&html);
+ doc = block()->plugin_model()->documentation(html);
}
win->set_documentation(doc, html);
}