diff options
-rw-r--r-- | src/client/DeprecatedLoader.cpp | 8 | ||||
-rw-r--r-- | src/client/NodeModel.cpp | 4 | ||||
-rw-r--r-- | src/client/PortModel.hpp | 4 | ||||
-rw-r--r-- | src/common/interface/DataType.hpp | 12 | ||||
-rw-r--r-- | src/engine/LADSPANode.cpp | 6 | ||||
-rw-r--r-- | src/engine/MidiControlNode.cpp | 8 | ||||
-rw-r--r-- | src/engine/MidiNoteNode.cpp | 8 | ||||
-rw-r--r-- | src/engine/MidiTriggerNode.cpp | 6 | ||||
-rw-r--r-- | src/engine/OSCEngineReceiver.cpp | 2 | ||||
-rw-r--r-- | src/engine/events/CreatePortEvent.cpp | 8 | ||||
-rw-r--r-- | src/gui/Controls.cpp | 4 | ||||
-rw-r--r-- | src/gui/PatchCanvas.cpp | 12 | ||||
-rw-r--r-- | src/gui/PatchPropertiesWindow.cpp | 23 | ||||
-rw-r--r-- | src/gui/PatchPropertiesWindow.hpp | 1 | ||||
-rw-r--r-- | src/gui/Port.cpp | 6 | ||||
-rw-r--r-- | src/gui/PortPropertiesWindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/ingen_gui.glade | 42 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 19 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 37 | ||||
-rw-r--r-- | src/serialisation/Serialiser.hpp | 1 |
20 files changed, 145 insertions, 78 deletions
diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index 2b4e34a4..82b99aa9 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -462,16 +462,16 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr if (plugin_type == "Internal") { // FIXME: indices if (plugin_label == "audio_input") { - _engine->new_port(path, 0, "ingen:AudioPort", false); + _engine->new_port(path, 0, "lv2:AudioPort", false); is_port = true; } else if (plugin_label == "audio_output") { - _engine->new_port(path, 0, "ingen:AudioPort", true); + _engine->new_port(path, 0, "lv2:AudioPort", true); is_port = true; } else if (plugin_label == "control_input") { - _engine->new_port(path, 0, "ingen:ControlPort", false); + _engine->new_port(path, 0, "lv2:ControlPort", false); is_port = true; } else if (plugin_label == "control_output" ) { - _engine->new_port(path, 0, "ingen:ControlPort", true); + _engine->new_port(path, 0, "lv2:ControlPort", true); is_port = true; } else if (plugin_label == "midi_input") { _engine->new_port(path, 0, "ingen:MIDIPort", false); diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index ad04892f..ee4988e3 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -198,8 +198,8 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max) c #endif // Possibly overriden - const Atom& min_atom = port->get_variable("ingen:minimum"); - const Atom& max_atom = port->get_variable("ingen:maximum"); + const Atom& min_atom = port->get_variable("lv2:minimum"); + const Atom& max_atom = port->get_variable("lv2:maximum"); if (min_atom.type() == Atom::FLOAT) min = min_atom.get_float(); if (max_atom.type() == Atom::FLOAT) diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp index cf0d7ddc..0a078aaa 100644 --- a/src/client/PortModel.hpp +++ b/src/client/PortModel.hpp @@ -50,8 +50,8 @@ public: bool has_hint(const std::string& qname) const; bool is_logarithmic() const { return has_hint("ingen:logarithmic"); } - bool is_integer() const { return has_hint("ingen:integer"); } - bool is_toggle() const { return has_hint("ingen:toggled"); } + bool is_integer() const { return has_hint("lv2:integer"); } + bool is_toggle() const { return has_hint("lv2:toggled"); } inline bool operator==(const PortModel& pm) const { return (_path == pm._path); } diff --git a/src/common/interface/DataType.hpp b/src/common/interface/DataType.hpp index aa17a66b..1651e41d 100644 --- a/src/common/interface/DataType.hpp +++ b/src/common/interface/DataType.hpp @@ -48,7 +48,7 @@ public: } else if (uri == type_uri(CONTROL)) { _symbol = CONTROL; } else if (uri == type_uri(EVENT) - || (uri == "ingen:MIDIPort") || uri == "ingen:OSCPort" || uri == "ingen:EventPort") { + || (uri == "ingen:MIDIPort") || uri == "ingen:OSCPort" || uri == "lv2ev:EventPort") { _symbol = EVENT; } } @@ -72,11 +72,11 @@ private: static inline const char* type_uri(unsigned symbol_num) { switch (symbol_num) { - case 1: return "ingen:AudioPort"; - case 2: return "ingen:ControlPort"; - case 3: return "ingen:EventPort"; - case 4: return "ingen:EventPort"; // MIDI - case 5: return "ingen:EventPort"; // OSC + case 1: return "lv2:AudioPort"; + case 2: return "lv2:ControlPort"; + case 3: return "lv2ev:EventPort"; + case 4: return "lv2ev:EventPort"; // MIDI + case 5: return "lv2ev:EventPort"; // OSC default: return ""; } } diff --git a/src/engine/LADSPANode.cpp b/src/engine/LADSPANode.cpp index 6af45985..cea1ef78 100644 --- a/src/engine/LADSPANode.cpp +++ b/src/engine/LADSPANode.cpp @@ -236,11 +236,11 @@ LADSPANode::instantiate() if (port->is_input() && port->buffer_size() == 1) { if (min) - port->set_variable("ingen:minimum", min.get()); + port->set_variable("lv2:minimum", min.get()); if (max) - port->set_variable("ingen:maximum", max.get()); + port->set_variable("lv2:maximum", max.get()); if (default_val) - port->set_variable("ingen:default", default_val.get()); + port->set_variable("lv2:default", default_val.get()); } } diff --git a/src/engine/MidiControlNode.cpp b/src/engine/MidiControlNode.cpp index 0aeac448..c7cd64ed 100644 --- a/src/engine/MidiControlNode.cpp +++ b/src/engine/MidiControlNode.cpp @@ -46,13 +46,13 @@ MidiControlNode::MidiControlNode(const string& path, _ports->at(0) = _midi_in_port; _param_port = new InputPort(this, "controller", 1, 1, DataType::CONTROL, 0.0f, 1); - _param_port->set_variable("ingen:minimum", 0.0f); - _param_port->set_variable("ingen:maximum", 127.0f); - _param_port->set_variable("ingen:integer", true); + _param_port->set_variable("lv2:minimum", 0.0f); + _param_port->set_variable("lv2:maximum", 127.0f); + _param_port->set_variable("lv2:integer", true); _ports->at(1) = _param_port; _log_port = new InputPort(this, "logarithmic", 2, 1, DataType::CONTROL, 0.0f, 1); - _log_port->set_variable("ingen:toggled", true); + _log_port->set_variable("lv2:toggled", true); _ports->at(2) = _log_port; _min_port = new InputPort(this, "minimum", 3, 1, DataType::CONTROL, 0.0f, 1); diff --git a/src/engine/MidiNoteNode.cpp b/src/engine/MidiNoteNode.cpp index ae7a7f0e..c6b116bb 100644 --- a/src/engine/MidiNoteNode.cpp +++ b/src/engine/MidiNoteNode.cpp @@ -52,16 +52,16 @@ MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, PatchImpl* paren _ports->at(1) = _freq_port; _vel_port = new OutputPort(this, "velocity", 2, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); - _vel_port->set_variable("ingen:minimum", 0.0f); - _vel_port->set_variable("ingen:maximum", 1.0f); + _vel_port->set_variable("lv2:minimum", 0.0f); + _vel_port->set_variable("lv2:maximum", 1.0f); _ports->at(2) = _vel_port; _gate_port = new OutputPort(this, "gate", 3, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); - _gate_port->set_variable("ingen:toggled", true); + _gate_port->set_variable("lv2:toggled", true); _ports->at(3) = _gate_port; _trig_port = new OutputPort(this, "trigger", 4, _polyphony, DataType::AUDIO, 0.0f, _buffer_size); - _trig_port->set_variable("ingen:toggled", true); + _trig_port->set_variable("lv2:toggled", true); _ports->at(4) = _trig_port; } diff --git a/src/engine/MidiTriggerNode.cpp b/src/engine/MidiTriggerNode.cpp index aa2c272f..8ab4991e 100644 --- a/src/engine/MidiTriggerNode.cpp +++ b/src/engine/MidiTriggerNode.cpp @@ -41,9 +41,9 @@ MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, PatchImpl* _ports->at(0) = _midi_in_port; _note_port = new InputPort(this, "note", 1, 1, DataType::CONTROL, 60.0f, 1); - _note_port->set_variable("ingen:minimum", 0.0f); - _note_port->set_variable("ingen:maximum", 127.0f); - _note_port->set_variable("ingen:integer", true); + _note_port->set_variable("lv2:minimum", 0.0f); + _note_port->set_variable("lv2:maximum", 127.0f); + _note_port->set_variable("lv2:integer", true); _ports->at(1) = _note_port; _gate_port = new OutputPort(this, "gate", 2, 1, DataType::AUDIO, 0.0f, _buffer_size); diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp index e4e2fec1..87f4abd2 100644 --- a/src/engine/OSCEngineReceiver.cpp +++ b/src/engine/OSCEngineReceiver.cpp @@ -456,7 +456,7 @@ OSCEngineReceiver::_set_polyphonic_cb(const char* path, const char* types, lo_ar * <p> \b /ingen/new_port - Add a port into a given patch (load a plugin by URI) * \arg \b response-id (integer) * \arg \b path (string) - Full path of the new port (ie. /patch2/subpatch/newport) - * \arg \b data-type (string) - Type of port (ingen:AudioPort, ingen:ControlPort, ingen:MIDIPort, or ingen:OSCPort) + * \arg \b data-type (string) - Type of port (lv2:AudioPort, lv2:ControlPort, lv2ev:EventPort, ingen:MIDIPort, or ingen:OSCPort) * \arg \b direction ("is-output") (integer) - Direction of data flow (Input = 0, Output = 1) </p> \n \n */ int diff --git a/src/engine/events/CreatePortEvent.cpp b/src/engine/events/CreatePortEvent.cpp index e767f522..30b019e9 100644 --- a/src/engine/events/CreatePortEvent.cpp +++ b/src/engine/events/CreatePortEvent.cpp @@ -110,10 +110,10 @@ CreatePortEvent::pre_process() _engine.engine_store()->add(_patch_port); if (!_patch->parent()) { - if (_type == "ingen:AudioPort") + if (_type == "lv2:AudioPort") _driver_port = _engine.audio_driver()->create_port( dynamic_cast<DuplexPort*>(_patch_port)); - else if (_type == "ingen:MIDIPort" || _type == "ingen:EventPort") + else if (_type == "ingen:MIDIPort" || _type == "lv2ev:EventPort") _driver_port = _engine.midi_driver()->create_port( dynamic_cast<DuplexPort*>(_patch_port)); else if (_type == "ingen:OSCPort" && _engine.osc_driver()) @@ -143,9 +143,9 @@ CreatePortEvent::execute(ProcessContext& context) } if (_driver_port) { - if (_type == "ingen:AudioPort") + if (_type == "lv2:AudioPort") _engine.audio_driver()->add_port(_driver_port); - else if (_type == "ingen:MIDIPort" || _type == "ingen:EventPort") + else if (_type == "ingen:MIDIPort" || _type == "lv2ev:EventPort") _engine.midi_driver()->add_port(_driver_port); else if (_type == "ingen:OSCPort") cerr << "OSC DRIVER PORT" << endl; diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index 456439ea..27de1259 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -191,9 +191,9 @@ SliderControl::set_value(const Atom& atom) void SliderControl::port_variable_change(const string& key, const Atom& value) { - if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) + if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT) set_range(value.get_float(), _slider->get_adjustment()->get_upper()); - else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) + else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT) set_range(_slider->get_adjustment()->get_lower(), value.get_float()); } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 91c8a926..107cdaa8 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -87,16 +87,16 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) // Add port menu items _menu_add_audio_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "audio_input", "ingen:AudioPort", false)); + "audio_input", "lv2:AudioPort", false)); _menu_add_audio_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "audio_output", "ingen:AudioPort", true)); + "audio_output", "lv2:AudioPort", true)); _menu_add_control_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "control_input", "ingen:ControlPort", false)); + "control_input", "lv2:ControlPort", false)); _menu_add_control_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "control_output", "ingen:ControlPort", true)); + "control_output", "lv2:ControlPort", true)); _menu_add_midi_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), "midi_input", "ingen:MIDIPort", false)); @@ -111,10 +111,10 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height) "osc_output", "ingen:OSCPort", true)); _menu_add_event_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_input", "ingen:EventPort", false)); + "event_input", "lv2ev:EventPort", false)); _menu_add_event_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_output", "ingen:EventPort", true)); + "event_output", "lv2ev:EventPort", true)); // Add control menu items /*_menu_add_number_control->signal_activate().connect( diff --git a/src/gui/PatchPropertiesWindow.cpp b/src/gui/PatchPropertiesWindow.cpp index f4003d31..caf81452 100644 --- a/src/gui/PatchPropertiesWindow.cpp +++ b/src/gui/PatchPropertiesWindow.cpp @@ -30,6 +30,7 @@ namespace GUI { PatchPropertiesWindow::PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml) : Gtk::Window(cobject) { + glade_xml->get_widget("properties_name_entry", _name_entry); glade_xml->get_widget("properties_author_entry", _author_entry); glade_xml->get_widget("properties_description_textview", _textview); glade_xml->get_widget("properties_cancel_button", _cancel_button); @@ -51,11 +52,15 @@ PatchPropertiesWindow::set_patch(SharedPtr<PatchModel> patch_model) property_title() = patch_model->path() + " Properties"; _patch_model = patch_model; - const Atom& author_atom = _patch_model->get_variable("dc:creator"); + const Atom& name_atom = _patch_model->get_property("doap:name"); + _name_entry->set_text( + (name_atom.type() == Atom::STRING) ? name_atom.get_string() : "" ); + + const Atom& author_atom = _patch_model->get_property("dc:creator"); _author_entry->set_text( (author_atom.type() == Atom::STRING) ? author_atom.get_string() : "" ); - const Atom& desc_atom = _patch_model->get_variable("dc:description"); + const Atom& desc_atom = _patch_model->get_property("dc:description"); _textview->get_buffer()->set_text( (desc_atom.type() == Atom::STRING) ? desc_atom.get_string() : "" ); } @@ -64,11 +69,15 @@ PatchPropertiesWindow::set_patch(SharedPtr<PatchModel> patch_model) void PatchPropertiesWindow::cancel_clicked() { - const Atom& author_atom = _patch_model->get_variable("dc:creator"); + const Atom& name_atom = _patch_model->get_property("doap:name"); + _name_entry->set_text( + (name_atom.type() == Atom::STRING) ? name_atom.get_string() : "" ); + + const Atom& author_atom = _patch_model->get_property("dc:creator"); _author_entry->set_text( (author_atom.type() == Atom::STRING) ? author_atom.get_string() : "" ); - const Atom& desc_atom = _patch_model->get_variable("dc:description"); + const Atom& desc_atom = _patch_model->get_property("dc:description"); _textview->get_buffer()->set_text( (desc_atom.type() == Atom::STRING) ? desc_atom.get_string() : "" ); @@ -79,9 +88,11 @@ PatchPropertiesWindow::cancel_clicked() void PatchPropertiesWindow::ok_clicked() { - App::instance().engine()->set_variable(_patch_model->path(), "dc:creator", + App::instance().engine()->set_property(_patch_model->path(), "doap:name", + Atom(_name_entry->get_text())); + App::instance().engine()->set_property(_patch_model->path(), "dc:creator", Atom(_author_entry->get_text())); - App::instance().engine()->set_variable(_patch_model->path(), "dc:description", + App::instance().engine()->set_property(_patch_model->path(), "dc:description", Atom(_textview->get_buffer()->get_text())); hide(); } diff --git a/src/gui/PatchPropertiesWindow.hpp b/src/gui/PatchPropertiesWindow.hpp index 0f60b147..59d27389 100644 --- a/src/gui/PatchPropertiesWindow.hpp +++ b/src/gui/PatchPropertiesWindow.hpp @@ -51,6 +51,7 @@ public: private: SharedPtr<PatchModel> _patch_model; + Gtk::Entry* _name_entry; Gtk::Entry* _author_entry; Gtk::TextView* _textview; Gtk::Button* _cancel_button; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 38db6d25..efca1a54 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -138,11 +138,11 @@ Port::set_control(float value, bool signal) void Port::variable_changed(const string& key, const Atom& value) { - if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) + if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT) set_control_min(value.get_float()); - else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) + else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT) set_control_max(value.get_float()); - else if ( (key == "ingen:toggled") && value.type() == Atom::BOOL) + else if ( (key == "lv2:toggled") && value.type() == Atom::BOOL) set_toggled(value.get_bool()); } diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index ddab5715..d2a1041c 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -94,9 +94,9 @@ PortPropertiesWindow::variable_change(const string& key, const Atom& value) { _enable_signal = false; - if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) + if ( (key == "lv2:minimum") && value.type() == Atom::FLOAT) _min_spinner->set_value(value.get_float()); - else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) + else if ( (key == "lv2:maximum") && value.type() == Atom::FLOAT) _max_spinner->set_value(value.get_float()); _enable_signal = true; @@ -115,7 +115,7 @@ PortPropertiesWindow::min_changed() } if (_enable_signal) - App::instance().engine()->set_variable(_port_model->path(), "ingen:minimum", min); + App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", min); } @@ -131,15 +131,15 @@ PortPropertiesWindow::max_changed() } if (_enable_signal) - App::instance().engine()->set_variable(_port_model->path(), "ingen:maximum", max); + App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", max); } void PortPropertiesWindow::cancel() { - App::instance().engine()->set_variable(_port_model->path(), "ingen:minimum", _initial_min); - App::instance().engine()->set_variable(_port_model->path(), "ingen:maximum", _initial_max); + App::instance().engine()->set_variable(_port_model->path(), "lv2:minimum", _initial_min); + App::instance().engine()->set_variable(_port_model->path(), "lv2:maximum", _initial_max); hide(); } diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade index a86a4b4a..892e0cab 100644 --- a/src/gui/ingen_gui.glade +++ b/src/gui/ingen_gui.glade @@ -1935,17 +1935,30 @@ <property name="visible">True</property> <property name="spacing">6</property> <child> - <widget class="GtkHBox" id="hbox51"> + <widget class="GtkTable" id="table2"> <property name="visible">True</property> - <property name="spacing">5</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="column_spacing">8</property> + <property name="row_spacing">8</property> <child> - <widget class="GtkLabel" id="label93"> + <widget class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="label" translatable="yes">Author:</property> + <property name="label" translatable="yes">Name:</property> </widget> <packing> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="x_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkEntry" id="properties_name_entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">*</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> </packing> </child> <child> @@ -1955,13 +1968,26 @@ <property name="invisible_char">*</property> </widget> <packing> - <property name="position">1</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label93"> + <property name="visible">True</property> + <property name="label" translatable="yes">Author:</property> + </widget> + <packing> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">GTK_FILL</property> </packing> </child> </widget> <packing> <property name="expand">False</property> - <property name="fill">False</property> </packing> </child> <child> diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 3eae4814..3dda415c 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -36,7 +36,8 @@ namespace Ingen { namespace Serialisation { #define NS_INGEN "http://drobilla.net/ns/ingen#" - +#define NS_LV2 "http://lv2plug.in/ns/lv2core#" +#define NS_LV2EV "http://lv2plug.in/ns/ext/event#" Glib::ustring Parser::uri_relative_to_base(Glib::ustring base, const Glib::ustring uri) @@ -130,8 +131,8 @@ Parser::parse( const Redland::Node patch_class(*world->rdf_world, res, NS_INGEN "Patch"); const Redland::Node node_class(*world->rdf_world, res, NS_INGEN "Node"); - const Redland::Node in_port_class(*world->rdf_world, res, NS_INGEN "InputPort"); - const Redland::Node out_port_class(*world->rdf_world, res, NS_INGEN "OutputPort"); + const Redland::Node in_port_class(*world->rdf_world, res, NS_LV2 "InputPort"); + const Redland::Node out_port_class(*world->rdf_world, res, NS_LV2 "OutputPort"); string subject_str = ((object_uri && object_uri.get() != "") ? object_uri.get() : base_uri); if (subject_str[0] == '/') @@ -333,7 +334,7 @@ Parser::parse_patch( "SELECT DISTINCT ?nodename ?portname ?portval WHERE {\n") + subject + " ingen:node ?node .\n" "?node lv2:symbol ?nodename ;\n" - " ingen:port ?port .\n" + " lv2:port ?port .\n" "?port lv2:symbol ?portname ;\n" " ingen:value ?portval .\n" "FILTER ( datatype(?portval) = xsd:decimal )\n" @@ -355,11 +356,11 @@ Parser::parse_patch( /* Load this patch's ports */ query = Redland::Query(*world->rdf_world, Glib::ustring( "SELECT DISTINCT ?port ?type ?name ?datatype ?varkey ?varval ?portval WHERE {\n") + - subject + " ingen:port ?port .\n" + subject + " lv2:port ?port .\n" "?port a ?type ;\n" " a ?datatype ;\n" " lv2:symbol ?name .\n" - " FILTER (?type != ?datatype && ((?type = ingen:InputPort) || (?type = ingen:OutputPort)))\n" + " FILTER (?type != ?datatype && ((?type = lv2:InputPort) || (?type = lv2:OutputPort)))\n" "OPTIONAL { ?port ingen:value ?portval . \n" " FILTER ( datatype(?portval) = xsd:decimal ) }\n" "OPTIONAL { ?port lv2var:variable ?variable .\n" @@ -379,7 +380,7 @@ Parser::parse_patch( const Path port_path = patch_path.base() + name; if (created.find(port_path) == created.end()) { - bool is_output = (type == "ingen:OutputPort"); // FIXME: check validity + bool is_output = (type == "lv2:OutputPort"); // FIXME: check validity // FIXME: read index target->new_port(port_path, 0, datatype, is_output); created.insert(port_path); @@ -468,7 +469,7 @@ Parser::parse_port( "SELECT DISTINCT ?type ?datatype ?value WHERE {\n") + subject + " a ?type ;\n" " a ?datatype .\n" - " FILTER (?type != ?datatype && ((?type = ingen:InputPort) || (?type = ingen:OutputPort)))\n" + " FILTER (?type != ?datatype && ((?type = lv2:InputPort) || (?type = lv2:OutputPort)))\n" "OPTIONAL { " + subject + " ingen:value ?value . }\n" "}"); @@ -479,7 +480,7 @@ Parser::parse_port( const string type = world->rdf_world->qualify((*i)["type"].to_string()); const string datatype = world->rdf_world->qualify((*i)["datatype"].to_string()); - bool is_output = (type == "ingen:OutputPort"); + bool is_output = (type == "lv2:OutputPort"); // FIXME: read index target->new_port(path, 0, datatype, is_output); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 2f0d9877..7dccbe2c 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -301,6 +301,11 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch) patch_id, "rdf:type", Redland::Node(_model->world(), Redland::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch")); + + _model->add_statement( + patch_id, + "rdf:type", + Redland::Node(_model->world(), Redland::Node::RESOURCE, "http://lv2plug.in/ns/lv2core#Plugin")); GraphObject::Variables::const_iterator s = patch->variables().find("lv2:symbol"); // If symbol is stored as a variable, write that @@ -324,6 +329,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch) "ingen:enabled", AtomRDF::atom_to_node(_model->world(), Atom((bool)patch->enabled()))); + serialise_properties(patch_id, patch->properties()); serialise_variables(patch_id, patch->variables()); for (GraphObject::const_iterator n = _store->children_begin(patch); @@ -347,7 +353,12 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch) for (uint32_t i=0; i < patch->num_ports(); ++i) { Port* p = patch->port(i); const Redland::Node port_id = path_to_rdf_node(p->path()); - _model->add_statement(patch_id, "ingen:port", port_id); + + // Ensure lv2:name always exists so Patch is a valid LV2 plugin + if (p->properties().find("lv2:name") == p->properties().end()) + p->properties()["lv2:name"] = p->symbol(); // FIXME: use human name + + _model->add_statement(patch_id, "lv2:port", port_id); serialise_port(p, port_id); } @@ -405,9 +416,10 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, const Redland::Node& no assert(p); const Redland::Node port_id = path_to_rdf_node(p->path()); serialise_port(p, port_id); - _model->add_statement(node_id, "ingen:port", port_id); + _model->add_statement(node_id, "lv2:port", port_id); } + serialise_properties(node_id, node->properties()); serialise_variables(node_id, node->variables()); } @@ -421,10 +433,10 @@ Serialiser::serialise_port(const Port* port, const Redland::Node& port_id) { if (port->is_input()) _model->add_statement(port_id, "rdf:type", - Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:InputPort")); + Redland::Node(_model->world(), Redland::Node::RESOURCE, "lv2:InputPort")); else _model->add_statement(port_id, "rdf:type", - Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:OutputPort")); + Redland::Node(_model->world(), Redland::Node::RESOURCE, "lv2:OutputPort")); _model->add_statement(port_id, "lv2:index", AtomRDF::atom_to_node(_model->world(), Atom((int)port->index()))); @@ -439,6 +451,7 @@ Serialiser::serialise_port(const Port* port, const Redland::Node& port_id) _model->add_statement(port_id, "ingen:value", AtomRDF::atom_to_node(_model->world(), Atom(port->value()))); + serialise_properties(port_id, port->properties()); serialise_variables(port_id, port->variables()); } @@ -468,13 +481,27 @@ Serialiser::serialise_connection(SharedPtr<GraphObject> parent, /* ... but this is cleaner */ //_model->add_statement(dst_node, "ingen:connectedTo", src_node); } + + +void +Serialiser::serialise_properties(Redland::Node subject, const GraphObject::Variables& properties) +{ + for (GraphObject::Variables::const_iterator v = properties.begin(); v != properties.end(); ++v) { + if (v->first.find(":") && v->second.is_valid()) { + const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second); + _model->add_statement(subject, v->first, value); + } else { + cerr << "Warning: unable to serialize property \'" << v->first << "\'" << endl; + } + } +} void Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Variables& variables) { for (GraphObject::Variables::const_iterator v = variables.begin(); v != variables.end(); ++v) { - if (v->first.find(":") != string::npos && v->first != "ingen:document") { + if (v->first.find(":") && v->first != "ingen:document") { if (v->second.is_valid()) { const Redland::Node var_id = _world.blank_id(); const Redland::Node key(_model->world(), Redland::Node::RESOURCE, v->first); diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp index f27cad83..a739980c 100644 --- a/src/serialisation/Serialiser.hpp +++ b/src/serialisation/Serialiser.hpp @@ -84,6 +84,7 @@ private: void serialise_node(SharedPtr<Shared::Node> n, const Redland::Node& id); void serialise_port(const Shared::Port* p, const Redland::Node& id); + void serialise_properties(Redland::Node subject, const GraphObject::Variables& properties); void serialise_variables(Redland::Node subject, const GraphObject::Variables& variables); Redland::Node path_to_rdf_node(const Path& path); |