From cbd666d1ba7681264c2c509c1bbc8999136d4f17 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 25 Mar 2012 03:05:52 +0000 Subject: Update for latest atom extension. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4104 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/shared/URIs.hpp | 3 +-- src/gui/App.cpp | 2 +- src/gui/Configuration.cpp | 2 +- src/gui/PatchCanvas.cpp | 4 ++-- src/gui/PortMenu.cpp | 2 +- src/server/ConnectionImpl.cpp | 2 +- src/server/Engine.cpp | 2 +- src/server/JackDriver.cpp | 2 +- src/server/LV2Info.cpp | 6 ++---- src/server/LV2Info.hpp | 3 +-- src/server/LV2Node.cpp | 8 +++----- src/server/PortImpl.cpp | 3 +-- src/server/PortType.hpp | 17 ++++++----------- src/server/events/CreatePort.cpp | 6 ++---- src/server/internals/Controller.cpp | 2 +- src/server/internals/Note.cpp | 2 +- src/server/internals/Trigger.cpp | 2 +- src/shared/URIs.cpp | 3 +-- 18 files changed, 28 insertions(+), 43 deletions(-) diff --git a/ingen/shared/URIs.hpp b/ingen/shared/URIs.hpp index 43a83aa5..5add8c71 100644 --- a/ingen/shared/URIs.hpp +++ b/ingen/shared/URIs.hpp @@ -46,17 +46,16 @@ public: Ingen::Forge& forge; + const Quark atom_AtomPort; const Quark atom_Blank; const Quark atom_Bool; const Quark atom_Float; const Quark atom_Int; - const Quark atom_MessagePort; const Quark atom_Sequence; const Quark atom_Sound; const Quark atom_String; const Quark atom_URI; const Quark atom_URID; - const Quark atom_ValuePort; const Quark atom_Vector; const Quark atom_bufferType; const Quark atom_eventTransfer; diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 431b144c..6f93d85e 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -398,7 +398,7 @@ App::can_control(const Client::PortModel* port) const { return port->is_a(uris().lv2_ControlPort) || port->is_a(uris().cv_CVPort) - || (port->is_a(uris().atom_ValuePort) + || (port->is_a(uris().atom_AtomPort) && (port->supports(uris().atom_Float) || port->supports(uris().atom_String))); } diff --git a/src/gui/Configuration.cpp b/src/gui/Configuration.cpp index b85a997c..2a304a9f 100644 --- a/src/gui/Configuration.cpp +++ b/src/gui/Configuration.cpp @@ -91,7 +91,7 @@ Configuration::get_port_color(const PortModel* p) return _string_port_color; } else if (_app.can_control(p)) { return _control_port_color; - } else if (p->is_a(uris.atom_MessagePort)) { + } else if (p->is_a(uris.atom_AtomPort)) { return _event_port_color; } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 070a1da2..1fe38e4a 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -112,10 +112,10 @@ PatchCanvas::PatchCanvas(App& app, "control_out", "Control Out", LV2_CORE__ControlPort, true)); _menu_add_event_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_in", "Event In", LV2_ATOM__MessagePort, false)); + "event_in", "Event In", LV2_ATOM__AtomPort, false)); _menu_add_event_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_out", "Event Out", LV2_ATOM__MessagePort, true)); + "event_out", "Event Out", LV2_ATOM__AtomPort, true)); signal_event.connect( sigc::mem_fun(this, &PatchCanvas::on_event)); diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index dbd5890f..802628b2 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -63,7 +63,7 @@ PortMenu::init(App& app, SharedPtr port, bool patch_port) _destroy_menuitem->set_sensitive(false); } - if (port->is_a(uris.atom_MessagePort)) + if (port->is_a(uris.atom_AtomPort)) _polyphonic_menuitem->hide(); const bool is_control = app.can_control(port.get()) diff --git a/src/server/ConnectionImpl.cpp b/src/server/ConnectionImpl.cpp index 7abda828..5d622a4c 100644 --- a/src/server/ConnectionImpl.cpp +++ b/src/server/ConnectionImpl.cpp @@ -89,7 +89,7 @@ ConnectionImpl::get_sources(Context& context, uint32_t voice, _queue->peek(sizeof(LV2_Atom), &obj); boost::intrusive_ptr buf = context.engine().buffer_factory()->get( dst_port()->buffer_type(), sizeof(LV2_Atom) + obj.size); - void* data = buf->port_data(PortType::MESSAGE, context.offset()); + void* data = buf->port_data(PortType::ATOM, context.offset()); _queue->read(sizeof(LV2_Atom) + obj.size, (LV2_Atom*)data); srcs[num_srcs++] = buf; } else if (must_mix()) { diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index d4904f0c..68ba5ca3 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -176,7 +176,7 @@ Engine::activate() control_properties.insert(make_pair(uris.lv2_name, forge.alloc("Control"))); control_properties.insert(make_pair(uris.rdf_type, - uris.atom_MessagePort)); + uris.atom_AtomPort)); control_properties.insert(make_pair(uris.atom_bufferType, uris.atom_Sequence)); diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index b81a25a6..983da457 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -370,7 +370,7 @@ JackDriver::create_port(DuplexPort* patch_port) { try { if (patch_port->is_a(PortType::AUDIO) - || (patch_port->is_a(PortType::MESSAGE) && + || (patch_port->is_a(PortType::ATOM) && patch_port->buffer_type() == patch_port->bufs().uris().atom_Sequence)) { return new JackPort(this, patch_port); } else { diff --git a/src/server/LV2Info.cpp b/src/server/LV2Info.cpp index 07c9b2a7..f88aa83a 100644 --- a/src/server/LV2Info.cpp +++ b/src/server/LV2Info.cpp @@ -40,8 +40,7 @@ LV2Info::LV2Info(Ingen::Shared::World* world) , control_class(lilv_new_uri(world->lilv_world(), LV2_CORE__ControlPort)) , cv_class(lilv_new_uri(world->lilv_world(), "http://lv2plug.in/ns/ext/cv-port#CVPort")) , audio_class(lilv_new_uri(world->lilv_world(), LV2_CORE__AudioPort)) - , value_port_class(lilv_new_uri(world->lilv_world(), LV2_ATOM__ValuePort)) - , message_port_class(lilv_new_uri(world->lilv_world(), LV2_ATOM__MessagePort)) + , atom_port_class(lilv_new_uri(world->lilv_world(), LV2_ATOM__AtomPort)) , _world(world) { assert(world); @@ -59,8 +58,7 @@ LV2Info::~LV2Info() lilv_node_free(control_class); lilv_node_free(cv_class); lilv_node_free(audio_class); - lilv_node_free(value_port_class); - lilv_node_free(message_port_class); + lilv_node_free(atom_port_class); } } // namespace Server diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp index 17132bcc..76f98d4e 100644 --- a/src/server/LV2Info.hpp +++ b/src/server/LV2Info.hpp @@ -42,8 +42,7 @@ public: LilvNode* control_class; LilvNode* cv_class; LilvNode* audio_class; - LilvNode* value_port_class; - LilvNode* message_port_class; + LilvNode* atom_port_class; Ingen::Shared::World& world() { return *_world; } LilvWorld* lv2_world() { return _world->lilv_world(); } diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index d9934823..3a4af47b 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -237,10 +237,8 @@ LV2Node::instantiate(BufferFactory& bufs) } else if (lilv_port_is_a(plug, id, info->audio_class)) { port_type = PortType::AUDIO; buffer_type = uris.atom_Sound; - } else if (lilv_port_is_a(plug, id, info->value_port_class)) { - port_type = PortType::VALUE; - } else if (lilv_port_is_a(plug, id, info->message_port_class)) { - port_type = PortType::MESSAGE; + } else if (lilv_port_is_a(plug, id, info->atom_port_class)) { + port_type = PortType::ATOM; } // Get buffer type if necessary (value and message ports) @@ -259,7 +257,7 @@ LV2Node::instantiate(BufferFactory& bufs) port_buffer_size = bufs.default_buffer_size(buffer_type); - if (port_type == PortType::VALUE || port_type == PortType::MESSAGE) { + if (port_type == PortType::ATOM) { // Get default value, and its length LilvNodes* defaults = lilv_port_get_value(plug, id, default_pred); LILV_FOREACH(nodes, i, defaults) { diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index c414d99a..c3a010f6 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -236,8 +236,7 @@ PortImpl::broadcast_value(Context& context, bool force) case PortType::CV: val = forge.make(((AudioBuffer*)buffer(0).get())->value_at(0)); break; - case PortType::VALUE: - case PortType::MESSAGE: + case PortType::ATOM: if (_buffer_type == _bufs.uris().atom_Sequence) { LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)buffer(0)->atom(); if (seq->atom.size > sizeof(LV2_Atom_Sequence_Body)) { diff --git a/src/server/PortType.hpp b/src/server/PortType.hpp index a2eac676..8dd7c3a9 100644 --- a/src/server/PortType.hpp +++ b/src/server/PortType.hpp @@ -35,8 +35,7 @@ public: AUDIO = 1, CONTROL = 2, CV = 3, - VALUE = 4, - MESSAGE = 5, + ATOM = 4 }; PortType(const Raul::URI& uri) @@ -48,10 +47,8 @@ public: _symbol = CONTROL; } else if (uri == type_uri(CV)) { _symbol = CV; - } else if (uri == type_uri(VALUE)) { - _symbol = VALUE; - } else if (uri == type_uri(MESSAGE)) { - _symbol = MESSAGE; + } else if (uri == type_uri(ATOM)) { + _symbol = ATOM; } } @@ -71,19 +68,17 @@ public: inline bool is_audio() { return _symbol == AUDIO; } inline bool is_control() { return _symbol == CONTROL; } inline bool is_cv() { return _symbol == CV; } - inline bool is_value() { return _symbol == VALUE; } - inline bool is_message() { return _symbol == MESSAGE; } + inline bool is_atom() { return _symbol == ATOM; } private: static inline const Raul::URI& type_uri(unsigned symbol_num) { - assert(symbol_num <= MESSAGE); + assert(symbol_num <= ATOM); static const Raul::URI uris[] = { "http://drobilla.net/ns/ingen#nil", "http://lv2plug.in/ns/lv2core#AudioPort", "http://lv2plug.in/ns/lv2core#ControlPort", "http://lv2plug.in/ns/ext/cv-port#CVPort", - "http://lv2plug.in/ns/ext/atom#ValuePort", - "http://lv2plug.in/ns/ext/atom#MessagePort" + "http://lv2plug.in/ns/ext/atom#AtomPort" }; return uris[symbol_num]; } diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index cc6f7e93..8f3d267a 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -72,10 +72,8 @@ CreatePort::CreatePort(Engine& engine, _port_type = PortType::CONTROL; } else if (type == uris.cv_CVPort) { _port_type = PortType::CV; - } else if (type == uris.atom_ValuePort) { - _port_type = PortType::VALUE; - } else if (type == uris.atom_MessagePort) { - _port_type = PortType::MESSAGE; + } else if (type == uris.atom_AtomPort) { + _port_type = PortType::ATOM; } } diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 3c29edd3..25971e79 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -55,7 +55,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, _ports = new Raul::Array(6); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, - PortType::MESSAGE, uris.atom_Sequence, Raul::Atom()); + PortType::ATOM, uris.atom_Sequence, Raul::Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); _ports->at(0) = _midi_in_port; diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index e591bfd8..268c2586 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -65,7 +65,7 @@ NoteNode::NoteNode( _ports = new Raul::Array(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, - PortType::MESSAGE, uris.atom_Sequence, Raul::Atom()); + PortType::ATOM, uris.atom_Sequence, Raul::Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); _ports->at(0) = _midi_in_port; diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 3ccc44d7..f1b2d2d2 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -59,7 +59,7 @@ TriggerNode::TriggerNode( _ports = new Raul::Array(5); _midi_in_port = new InputPort(bufs, this, "input", 0, 1, - PortType::MESSAGE, uris.atom_Sequence, Raul::Atom()); + PortType::ATOM, uris.atom_Sequence, Raul::Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); _ports->at(0) = _midi_in_port; diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp index 45cd7592..a2d4efef 100644 --- a/src/shared/URIs.cpp +++ b/src/shared/URIs.cpp @@ -51,17 +51,16 @@ URIs::Quark::Quark(Ingen::Forge& forge, LV2URIMap* map, const char* c_str) URIs::URIs(Ingen::Forge& f, LV2URIMap* map) : forge(f) + , atom_AtomPort (forge, map, LV2_ATOM__AtomPort) , atom_Blank (forge, map, LV2_ATOM__Blank) , atom_Bool (forge, map, LV2_ATOM__Bool) , atom_Float (forge, map, LV2_ATOM__Float) , atom_Int (forge, map, LV2_ATOM__Int) - , atom_MessagePort (forge, map, LV2_ATOM__MessagePort) , atom_Sequence (forge, map, LV2_ATOM__Sequence) , atom_Sound (forge, map, LV2_ATOM__Sound) , atom_String (forge, map, LV2_ATOM__String) , atom_URI (forge, map, LV2_ATOM__URI) , atom_URID (forge, map, LV2_ATOM__URID) - , atom_ValuePort (forge, map, LV2_ATOM__ValuePort) , atom_Vector (forge, map, LV2_ATOM__Vector) , atom_bufferType (forge, map, LV2_ATOM__bufferType) , atom_eventTransfer (forge, map, LV2_ATOM__eventTransfer) -- cgit v1.2.1