From 27c3aec25ca4eefa88df64b63d50ed4451bec190 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 30 Nov 2010 23:01:30 +0000 Subject: Consistent naming for URI quarks. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2678 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/DeprecatedLoader.cpp | 4 +- src/client/PluginUI.cpp | 6 +- src/engine/BufferFactory.cpp | 6 +- src/engine/ConnectionImpl.cpp | 8 +-- src/engine/ControlBindings.cpp | 6 +- src/engine/Engine.cpp | 6 +- src/engine/events/SetPortValue.cpp | 2 +- src/gui/App.cpp | 4 +- src/gui/Configuration.cpp | 2 +- src/gui/ControlPanel.cpp | 4 +- src/shared/LV2Atom.cpp | 16 +++--- src/shared/LV2URIMap.cpp | 114 ++++++++++++++++++------------------- src/shared/LV2URIMap.hpp | 24 ++++---- src/shared/ResourceImpl.cpp | 2 +- 14 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/client/DeprecatedLoader.cpp b/src/client/DeprecatedLoader.cpp index a3e13db5..a1e76314 100644 --- a/src/client/DeprecatedLoader.cpp +++ b/src/client/DeprecatedLoader.cpp @@ -458,10 +458,10 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr props.insert(make_pair(_uris->rdf_type, _uris->lv2_ControlPort)); props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); } else if (plugin_label == "midi_input") { - props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort)); + props.insert(make_pair(_uris->rdf_type, _uris->ev_EventPort)); props.insert(make_pair(_uris->rdf_type, _uris->lv2_InputPort)); } else if (plugin_label == "midi_output" ) { - props.insert(make_pair(_uris->rdf_type, _uris->lv2ev_EventPort)); + props.insert(make_pair(_uris->rdf_type, _uris->ev_EventPort)); props.insert(make_pair(_uris->rdf_type, _uris->lv2_OutputPort)); } else { is_port = false; diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index e0c7463b..cae67156 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -73,14 +73,14 @@ lv2_ui_write(LV2UI_Controller controller, ui->world()->engine()->set_property(port->path(), uris.ingen_value, Atom(*(float*)buffer)); - } else if (format == uris.ui_format_events.id) { + } else if (format == uris.ui_Events.id) { LV2_Event_Buffer* buf = (LV2_Event_Buffer*)buffer; LV2_Event_Iterator iter; uint8_t* data; lv2_event_begin(&iter, buf); while (lv2_event_is_valid(&iter)) { LV2_Event* const ev = lv2_event_get(&iter, &data); - if (ev->type == uris.midi_event.id) { + if (ev->type == uris.midi_MidiEvent.id) { // FIXME: bundle multiple events by writing an entire buffer here ui->world()->engine()->set_property(port->path(), uris.ingen_value, Atom("http://lv2plug.in/ns/ext/midi#MidiEvent", ev->size, data)); @@ -92,7 +92,7 @@ lv2_ui_write(LV2UI_Controller controller, lv2_event_increment(&iter); } - } else if (format == uris.object_transfer.id) { + } else if (format == uris.atom_AtomTransfer.id) { LV2_Atom* buf = (LV2_Atom*)buffer; Raul::Atom val; Shared::LV2Atom::to_atom(uris, buf, val); diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp index 75803649..0d2fc76e 100644 --- a/src/engine/BufferFactory.cpp +++ b/src/engine/BufferFactory.cpp @@ -133,12 +133,12 @@ BufferFactory::create(Shared::PortType type, size_t size) if (type.is_control()) { AudioBuffer* ret = new AudioBuffer(*this, type, size); - ret->atom()->type = _uris->object_class_vector.id; - ((LV2_Atom_Vector*)ret->atom()->body)->elem_type = _uris->object_class_float32.id; + ret->atom()->type = _uris->atom_Vector.id; + ((LV2_Atom_Vector*)ret->atom()->body)->elem_type = _uris->atom_Float32.id; buffer = ret; } else if (type.is_audio()) { AudioBuffer* ret = new AudioBuffer(*this, type, size); - ret->atom()->type = _uris->object_class_float32.id; + ret->atom()->type = _uris->atom_Float32.id; buffer = ret; } else if (type.is_events()) { buffer = new EventBuffer(*this, size); diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp index 43f9136a..40530694 100644 --- a/src/engine/ConnectionImpl.cpp +++ b/src/engine/ConnectionImpl.cpp @@ -142,16 +142,16 @@ ConnectionImpl::can_connect(const OutputPort* src, const InputPort* dst) && (dst->is_a(PortType::MESSAGE) || dst->is_a(PortType::VALUE))) // Control => atom:Float32 Value - || (src->is_a(PortType::CONTROL) && dst->supports(uris.object_class_float32)) + || (src->is_a(PortType::CONTROL) && dst->supports(uris.atom_Float32)) // Audio => atom:Vector Value - || (src->is_a(PortType::AUDIO) && dst->supports(uris.object_class_vector)) + || (src->is_a(PortType::AUDIO) && dst->supports(uris.atom_Vector)) // atom:Float32 Value => Control - || (src->supports(uris.object_class_float32) && dst->is_a(PortType::CONTROL)) + || (src->supports(uris.atom_Float32) && dst->is_a(PortType::CONTROL)) // atom:Vector Value => Audio - || (src->supports(uris.object_class_vector) && dst->is_a(PortType::AUDIO))); + || (src->supports(uris.atom_Vector) && dst->is_a(PortType::AUDIO))); } diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp index bc8dccba..12fcc9b1 100644 --- a/src/engine/ControlBindings.cpp +++ b/src/engine/ControlBindings.cpp @@ -152,7 +152,7 @@ ControlBindings::port_value_changed(ProcessContext& context, PortImpl* port) break; } if (size > 0) - _feedback->append(0, 0, uris.midi_event.id, size, buf); + _feedback->append(0, 0, uris.midi_MidiEvent.id, size, buf); } } @@ -345,7 +345,7 @@ ControlBindings::pre_process(ProcessContext& context, EventBuffer* buffer) for (buffer->rewind(); buffer->get_event(&frames, &subframes, &type, &size, &buf); buffer->increment()) { - if (type != uris.midi_event.id) + if (type != uris.midi_MidiEvent.id) continue; const Key key = midi_event_key(size, buf, value); @@ -362,7 +362,7 @@ ControlBindings::pre_process(ProcessContext& context, EventBuffer* buffer) for (buffer->rewind(); buffer->get_event(&frames, &subframes, &type, &size, &buf); buffer->increment()) { - if (type != uris.midi_event.id) + if (type != uris.midi_MidiEvent.id) continue; const Key key = midi_event_key(size, buf, value); diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index a1d81a10..bedd6438 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -192,7 +192,7 @@ Engine::activate() Shared::Resource::Properties control_properties; control_properties.insert(make_pair(uris.lv2_name, "Control")); - control_properties.insert(make_pair(uris.rdf_type, uris.lv2ev_EventPort)); + control_properties.insert(make_pair(uris.rdf_type, uris.ev_EventPort)); // Add control input Shared::Resource::Properties in_properties(control_properties); @@ -203,7 +203,7 @@ Engine::activate() execute_and_delete_event(context, new Events::CreatePort( *this, SharedPtr(), 0, - "/control_in", uris.lv2ev_EventPort, false, in_properties)); + "/control_in", uris.ev_EventPort, false, in_properties)); // Add control out Shared::Resource::Properties out_properties(control_properties); @@ -214,7 +214,7 @@ Engine::activate() execute_and_delete_event(context, new Events::CreatePort( *this, SharedPtr(), 0, - "/control_out", uris.lv2ev_EventPort, true, out_properties)); + "/control_out", uris.ev_EventPort, true, out_properties)); } _driver->activate(); diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp index c793845e..a4b1554b 100644 --- a/src/engine/events/SetPortValue.cpp +++ b/src/engine/events/SetPortValue.cpp @@ -166,7 +166,7 @@ SetPortValue::apply(Context& context) } else if (!strcmp(_value.get_blob_type(), "http://lv2plug.in/ns/ext/midi#MidiEvent")) { ebuf->prepare_write(context); - ebuf->append(frames, 0, uris.midi_event.id, _value.data_size(), + ebuf->append(frames, 0, uris.midi_MidiEvent.id, _value.data_size(), (const uint8_t*)_value.get_blob()); _port->raise_set_by_user_flag(); return; diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 292cf29f..9c9864cb 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -393,8 +393,8 @@ App::can_control(const Shared::Port* port) const { return port->is_a(PortType::CONTROL) || (port->is_a(PortType::VALUE) - && (port->supports(uris().object_class_float32) - || port->supports(uris().object_class_string))); + && (port->supports(uris().atom_Float32) + || port->supports(uris().atom_String))); } diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp index 6a6c2914..de4ed424 100644 --- a/src/gui/Configuration.cpp +++ b/src/gui/Configuration.cpp @@ -92,7 +92,7 @@ Configuration::get_port_color(const PortModel* p) const Shared::LV2URIMap& uris = App::instance().uris(); if (p->is_a(Shared::PortType::AUDIO)) { return _audio_port_color; - } else if (p->supports(uris.object_class_string)) { + } else if (p->supports(uris.atom_String)) { return _string_port_color; } else if (App::instance().can_control(p)) { return _control_port_color; diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp index 76136719..9434ba0e 100644 --- a/src/gui/ControlPanel.cpp +++ b/src/gui/ControlPanel.cpp @@ -97,13 +97,13 @@ ControlPanel::add_port(SharedPtr pm) xml->get_widget_derived("toggle_control", tc); control = tc; } else if (pm->is_a(Shared::PortType::CONTROL) - || pm->supports(App::instance().uris().object_class_float32)) { + || pm->supports(App::instance().uris().atom_Float32)) { SliderControl* sc; Glib::RefPtr xml = GladeFactory::new_glade_reference("control_strip"); xml->get_widget_derived("control_strip", sc); control = sc; - } else if (pm->supports(App::instance().uris().object_class_string)) { + } else if (pm->supports(App::instance().uris().atom_String)) { StringControl* sc; Glib::RefPtr xml = GladeFactory::new_glade_reference("string_control"); diff --git a/src/shared/LV2Atom.cpp b/src/shared/LV2Atom.cpp index ea6a4fa2..aa004f6f 100644 --- a/src/shared/LV2Atom.cpp +++ b/src/shared/LV2Atom.cpp @@ -34,16 +34,16 @@ namespace LV2Atom { bool to_atom(const Shared::LV2URIMap& uris, const LV2_Atom* object, Raul::Atom& atom) { - if (object->type == uris.object_class_string.id) { + if (object->type == uris.atom_String.id) { atom = Raul::Atom((char*)(object + 1)); return true; - } else if (object->type == uris.object_class_bool.id) { + } else if (object->type == uris.atom_Bool.id) { atom = Raul::Atom((bool)(int32_t*)(object + 1)); return true; - } else if (object->type == uris.object_class_int32.id) { + } else if (object->type == uris.atom_Int32.id) { atom = Raul::Atom((int32_t*)(object + 1)); return true; - } else if (object->type == uris.object_class_float32.id) { + } else if (object->type == uris.atom_Float32.id) { atom = Raul::Atom((float*)(object + 1)); return true; } @@ -60,17 +60,17 @@ from_atom(const Shared::LV2URIMap& uris, const Raul::Atom& atom, LV2_Atom* objec char* str; switch (atom.type()) { case Raul::Atom::FLOAT: - object->type = uris.object_class_float32.id; + object->type = uris.atom_Float32.id; object->size = sizeof(float); *(float*)(object + 1) = atom.get_float(); break; case Raul::Atom::INT: - object->type = uris.object_class_int32.id; + object->type = uris.atom_Int32.id; object->size = sizeof(int32_t); *(int32_t*)(object + 1) = atom.get_int32(); break; case Raul::Atom::STRING: - object->type = uris.object_class_string.id; + object->type = uris.atom_String.id; object->size = std::min((uint16_t)object->size, (uint16_t)(strlen(atom.get_string()) + 1)); str = ((char*)(object + 1)); str[object->size - 1] = '\0'; @@ -78,7 +78,7 @@ from_atom(const Shared::LV2URIMap& uris, const Raul::Atom& atom, LV2_Atom* objec break; case Raul::Atom::BLOB: error << "TODO: Blob support" << endl; - /*object->type = uris.object_class_string; + /*object->type = uris.atom_String; *(uint16_t*)(object + 1) = uris.uri_to_id(NULL, atom.get_blob_type()); memcpy(((char*)(object + 1) + sizeof(uint32_t)), atom.get_blob(), std::min(atom.data_size(), (size_t)object->size));*/ diff --git a/src/shared/LV2URIMap.cpp b/src/shared/LV2URIMap.cpp index 34721db6..5a8dbff0 100644 --- a/src/shared/LV2URIMap.cpp +++ b/src/shared/LV2URIMap.cpp @@ -53,63 +53,63 @@ LV2URIMap::Quark::c_str() const #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" LV2URIMap::LV2URIMap() - : ctx_AudioContext(NS_CTX "AudioContext") - , ctx_MessageContext(NS_CTX "MessageContext") - , ctx_context(NS_CTX "context") - , doap_name("http://usefulinc.com/ns/doap#name") - , ingen_Internal(NS_INGEN "Internal") - , ingen_LADSPAPlugin(NS_INGEN "LADSPAPlugin") - , ingen_Node(NS_INGEN "Node") - , ingen_Patch(NS_INGEN "Patch") - , ingen_Port(NS_INGEN "Port") - , ingen_broadcast(NS_INGEN "broadcast") - , ingen_controlBinding(NS_INGEN "controlBinding") - , ingen_document(NS_INGEN "document") - , ingen_enabled(NS_INGEN "enabled") - , ingen_nil(NS_INGEN "nil") - , ingen_node(NS_INGEN "node") - , ingen_polyphonic(NS_INGEN "polyphonic") - , ingen_polyphony(NS_INGEN "polyphony") - , ingen_selected(NS_INGEN "selected") - , ingen_value(NS_INGEN "value") - , ingenui_canvas_x(NS_INGENUI "canvas-x") - , ingenui_canvas_y(NS_INGENUI "canvas-y") - , lv2_AudioPort(NS_LV2 "AudioPort") - , lv2_ControlPort(NS_LV2 "ControlPort") - , lv2_InputPort(NS_LV2 "InputPort") - , lv2_OutputPort(NS_LV2 "OutputPort") - , lv2_Plugin(NS_LV2 "Plugin") - , lv2_default(NS_LV2 "default") - , lv2_index(NS_LV2 "index") - , lv2_integer(NS_LV2 "integer") - , lv2_maximum(NS_LV2 "maximum") - , lv2_minimum(NS_LV2 "minimum") - , lv2_name(NS_LV2 "name") - , lv2_portProperty(NS_LV2 "portProperty") - , lv2_symbol(NS_LV2 "symbol") - , lv2_toggled(NS_LV2 "toggled") - , lv2ev_EventPort("http://lv2plug.in/ns/ext/event#EventPort") - , midi_Bender(NS_MIDI "Bender") - , midi_ChannelPressure(NS_MIDI "ChannelPressure") - , midi_Controller(NS_MIDI "Controller") - , midi_Note(NS_MIDI "Note") - , midi_controllerNumber(NS_MIDI "controllerNumber") - , midi_event("http://lv2plug.in/ns/ext/midi#MidiEvent") - , midi_noteNumber(NS_MIDI "noteNumber") - , atom_MessagePort("http://lv2plug.in/ns/ext/atom#MessagePort") - , atom_ValuePort("http://lv2plug.in/ns/ext/atom#ValuePort") - , atom_supports("http://lv2plug.in/ns/ext/atom#supports") - , object_class_bool(LV2_ATOM_URI "#Bool") - , object_class_float32(LV2_ATOM_URI "#Float32") - , object_class_int32(LV2_ATOM_URI "#Int32") - , object_class_string(LV2_ATOM_URI "#String") - , object_class_vector(LV2_ATOM_URI "#Vector") - , object_transfer(LV2_ATOM_URI "#ObjectTransfer") - , rdf_instanceOf(NS_RDF "instanceOf") - , rdf_type(NS_RDF "type") - , rdfs_seeAlso(NS_RDFS "seeAlso") - , ui_format_events("http://lv2plug.in/ns/extensions/ui#Events") - , wildcard(NS_INGEN "wildcard") + : atom_MessagePort (LV2_ATOM_URI "#MessagePort") + , atom_AtomTransfer (LV2_ATOM_URI "#AtomTransfer") + , atom_Bool (LV2_ATOM_URI "#Bool") + , atom_Float32 (LV2_ATOM_URI "#Float32") + , atom_Int32 (LV2_ATOM_URI "#Int32") + , atom_String (LV2_ATOM_URI "#String") + , atom_ValuePort (LV2_ATOM_URI "#ValuePort") + , atom_Vector (LV2_ATOM_URI "#Vector") + , atom_supports (LV2_ATOM_URI "#supports") + , ctx_AudioContext (NS_CTX "AudioContext") + , ctx_MessageContext (NS_CTX "MessageContext") + , ctx_context (NS_CTX "context") + , doap_name ("http://usefulinc.com/ns/doap#name") + , ev_EventPort ("http://lv2plug.in/ns/ext/event#EventPort") + , ingen_Internal (NS_INGEN "Internal") + , ingen_LADSPAPlugin (NS_INGEN "LADSPAPlugin") + , ingen_Node (NS_INGEN "Node") + , ingen_Patch (NS_INGEN "Patch") + , ingen_Port (NS_INGEN "Port") + , ingen_broadcast (NS_INGEN "broadcast") + , ingen_controlBinding (NS_INGEN "controlBinding") + , ingen_document (NS_INGEN "document") + , ingen_enabled (NS_INGEN "enabled") + , ingen_nil (NS_INGEN "nil") + , ingen_node (NS_INGEN "node") + , ingen_polyphonic (NS_INGEN "polyphonic") + , ingen_polyphony (NS_INGEN "polyphony") + , ingen_selected (NS_INGEN "selected") + , ingen_value (NS_INGEN "value") + , ingenui_canvas_x (NS_INGENUI "canvas-x") + , ingenui_canvas_y (NS_INGENUI "canvas-y") + , lv2_AudioPort (NS_LV2 "AudioPort") + , lv2_ControlPort (NS_LV2 "ControlPort") + , lv2_InputPort (NS_LV2 "InputPort") + , lv2_OutputPort (NS_LV2 "OutputPort") + , lv2_Plugin (NS_LV2 "Plugin") + , lv2_default (NS_LV2 "default") + , lv2_index (NS_LV2 "index") + , lv2_integer (NS_LV2 "integer") + , lv2_maximum (NS_LV2 "maximum") + , lv2_minimum (NS_LV2 "minimum") + , lv2_name (NS_LV2 "name") + , lv2_portProperty (NS_LV2 "portProperty") + , lv2_symbol (NS_LV2 "symbol") + , lv2_toggled (NS_LV2 "toggled") + , midi_Bender (NS_MIDI "Bender") + , midi_ChannelPressure (NS_MIDI "ChannelPressure") + , midi_Controller (NS_MIDI "Controller") + , midi_MidiEvent ("http://lv2plug.in/ns/ext/midi#MidiEvent") + , midi_Note (NS_MIDI "Note") + , midi_controllerNumber (NS_MIDI "controllerNumber") + , midi_noteNumber (NS_MIDI "noteNumber") + , rdf_instanceOf (NS_RDF "instanceOf") + , rdf_type (NS_RDF "type") + , rdfs_seeAlso (NS_RDFS "seeAlso") + , ui_Events ("http://lv2plug.in/ns/extensions/ui#Events") + , wildcard (NS_INGEN "wildcard") { uri_map_feature_data.uri_to_id = &LV2URIMap::uri_map_uri_to_id; uri_map_feature_data.callback_data = this; diff --git a/src/shared/LV2URIMap.hpp b/src/shared/LV2URIMap.hpp index 13a97129..c63214ea 100644 --- a/src/shared/LV2URIMap.hpp +++ b/src/shared/LV2URIMap.hpp @@ -78,10 +78,20 @@ public: uint32_t id; }; + const Quark atom_AtomTransfer; + const Quark atom_Bool; + const Quark atom_Float32; + const Quark atom_Int32; + const Quark atom_MessagePort; + const Quark atom_String; + const Quark atom_ValuePort; + const Quark atom_Vector; + const Quark atom_supports; const Quark ctx_AudioContext; const Quark ctx_MessageContext; const Quark ctx_context; const Quark doap_name; + const Quark ev_EventPort; const Quark ingen_Internal; const Quark ingen_LADSPAPlugin; const Quark ingen_Node; @@ -113,27 +123,17 @@ public: const Quark lv2_portProperty; const Quark lv2_symbol; const Quark lv2_toggled; - const Quark lv2ev_EventPort; const Quark midi_Bender; const Quark midi_ChannelPressure; const Quark midi_Controller; + const Quark midi_MidiEvent; const Quark midi_Note; const Quark midi_controllerNumber; - const Quark midi_event; const Quark midi_noteNumber; - const Quark atom_MessagePort; - const Quark atom_ValuePort; - const Quark atom_supports; - const Quark object_class_bool; - const Quark object_class_float32; - const Quark object_class_int32; - const Quark object_class_string; - const Quark object_class_vector; - const Quark object_transfer; const Quark rdf_instanceOf; const Quark rdf_type; const Quark rdfs_seeAlso; - const Quark ui_format_events; + const Quark ui_Events; const Quark wildcard; }; diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index 5d79ed9b..1801eb9f 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -146,7 +146,7 @@ ResourceImpl::type( } else if (atom == uris.lv2_ControlPort) { port = true; data_type = PortType::CONTROL; - } else if (atom == uris.lv2ev_EventPort) { + } else if (atom == uris.ev_EventPort) { data_type = PortType::EVENTS; port = true; } else if (atom == uris.atom_ValuePort) { -- cgit v1.2.1