diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/InputPort.cpp | 18 | ||||
-rw-r--r-- | src/engine/InputPort.hpp | 16 | ||||
-rw-r--r-- | src/engine/LADSPANode.cpp | 45 | ||||
-rw-r--r-- | src/engine/OutputPort.cpp | 18 | ||||
-rw-r--r-- | src/engine/OutputPort.hpp | 16 | ||||
-rw-r--r-- | src/engine/PortImpl.cpp | 16 | ||||
-rw-r--r-- | src/engine/PortImpl.hpp | 16 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 23 |
8 files changed, 81 insertions, 87 deletions
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp index e1859b79..75f0234e 100644 --- a/src/engine/InputPort.cpp +++ b/src/engine/InputPort.cpp @@ -38,15 +38,15 @@ namespace Ingen { namespace Shared { class Patch; } using namespace Shared; -InputPort::InputPort(BufferFactory& bufs, - NodeImpl* parent, - const string& name, - uint32_t index, - uint32_t poly, - PortType type, - const Raul::Atom& value, - size_t buffer_size) - : PortImpl(bufs, parent, name, index, poly, type, value, buffer_size) +InputPort::InputPort(BufferFactory& bufs, + NodeImpl* parent, + const Raul::Symbol& symbol, + uint32_t index, + uint32_t poly, + PortType type, + const Raul::Atom& value, + size_t buffer_size) + : PortImpl(bufs, parent, symbol, index, poly, type, value, buffer_size) { const LV2URIMap& uris = Shared::LV2URIMap::instance(); diff --git a/src/engine/InputPort.hpp b/src/engine/InputPort.hpp index 4ed1bc0e..16e25cab 100644 --- a/src/engine/InputPort.hpp +++ b/src/engine/InputPort.hpp @@ -46,14 +46,14 @@ class NodeImpl; class InputPort : virtual public PortImpl { public: - InputPort(BufferFactory& bufs, - NodeImpl* parent, - const std::string& name, - uint32_t index, - uint32_t poly, - Shared::PortType type, - const Raul::Atom& value, - size_t buffer_size); + InputPort(BufferFactory& bufs, + NodeImpl* parent, + const Raul::Symbol& symbol, + uint32_t index, + uint32_t poly, + Shared::PortType type, + const Raul::Atom& value, + size_t buffer_size); virtual ~InputPort() {} diff --git a/src/engine/LADSPANode.cpp b/src/engine/LADSPANode.cpp index ecfb9d32..2a10042a 100644 --- a/src/engine/LADSPANode.cpp +++ b/src/engine/LADSPANode.cpp @@ -121,19 +121,6 @@ LADSPANode::apply_poly(Raul::Maid& maid, uint32_t poly) } -static string -nameify_if_invalid(const string& name) -{ - if (Path::is_valid_name(name)) { - return name; - } else { - const string new_name = Path::nameify(name); - assert(Path::is_valid_name(new_name)); - return new_name; - } -} - - /** Instantiate self from LADSPA plugin descriptor. * * Implemented as a seperate function (rather than in the constructor) to @@ -162,37 +149,37 @@ LADSPANode::instantiate(BufferFactory& bufs) } PortImpl* port = NULL; - std::map<std::string, uint32_t> names; + std::map<Symbol, uint32_t> symbols; for (uint32_t j=0; j < _descriptor->PortCount; ++j) { - string port_name = nameify_if_invalid(_descriptor->PortNames[j]); + // Convert name into valid symbol + Symbol symbol = Symbol::symbolify(_descriptor->PortNames[j]); - string name = port_name; - std::map<std::string, uint32_t>::iterator existing = names.find(port_name); + // Ensure symbol is unique + std::map<Symbol, uint32_t>::iterator existing = symbols.find(symbol); uint32_t offset = 2; bool type_clash = false; - while (existing != names.end()) { + while (existing != symbols.end()) { const uint32_t e = existing->second; if (!type_clash && LADSPA_IS_PORT_CONTROL(_descriptor->PortDescriptors[j]) && LADSPA_IS_PORT_AUDIO(_descriptor->PortDescriptors[e])) { - name = port_name + "_CR"; + symbol = string(symbol.c_str()) + "_CR"; type_clash = true; } else if (!type_clash && LADSPA_IS_PORT_AUDIO(_descriptor->PortDescriptors[j]) && LADSPA_IS_PORT_CONTROL(_descriptor->PortDescriptors[e])) { - name = port_name + "_AR"; + symbol = string(symbol.c_str()) + "_AR"; type_clash = true; } else { std::ostringstream ss; - ss << port_name << "_" << offset; - name = ss.str(); + ss << symbol << "_" << offset; + symbol = ss.str(); } - existing = names.find(name); + existing = symbols.find(symbol); } - port_name = name; - names.insert(make_pair(port_name, j)); + symbols.insert(make_pair(symbol, j)); - Path port_path(path().child(port_name)); + Path port_path(path().child(symbol)); PortType type = PortType::AUDIO; port_buffer_size = _buffer_size * sizeof(Sample); @@ -212,13 +199,15 @@ LADSPANode::instantiate(BufferFactory& bufs) const float value = default_val ? default_val.get() : 0.0f; if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) { - port = new InputPort(bufs, this, port_name, j, _polyphony, type, value, port_buffer_size); + port = new InputPort(bufs, this, symbol, j, _polyphony, type, value, port_buffer_size); _ports->at(j) = port; } else if (LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])) { - port = new OutputPort(bufs, this, port_name, j, _polyphony, type, value, port_buffer_size); + port = new OutputPort(bufs, this, symbol, j, _polyphony, type, value, port_buffer_size); _ports->at(j) = port; } + port->set_property(uris.lv2_name, _descriptor->PortNames[j]); + assert(port); assert(_ports->at(j) == port); diff --git a/src/engine/OutputPort.cpp b/src/engine/OutputPort.cpp index e0b8dc23..c6ad3356 100644 --- a/src/engine/OutputPort.cpp +++ b/src/engine/OutputPort.cpp @@ -29,15 +29,15 @@ namespace Ingen { namespace Shared { class Patch; } using namespace Shared; -OutputPort::OutputPort(BufferFactory& bufs, - NodeImpl* parent, - const string& name, - uint32_t index, - uint32_t poly, - PortType type, - const Raul::Atom& value, - size_t buffer_size) - : PortImpl(bufs, parent, name, index, poly, type, value, buffer_size) +OutputPort::OutputPort(BufferFactory& bufs, + NodeImpl* parent, + const Raul::Symbol& symbol, + uint32_t index, + uint32_t poly, + PortType type, + const Raul::Atom& value, + size_t buffer_size) + : PortImpl(bufs, parent, symbol, index, poly, type, value, buffer_size) { const LV2URIMap& uris = Shared::LV2URIMap::instance(); diff --git a/src/engine/OutputPort.hpp b/src/engine/OutputPort.hpp index c936de29..8fdd4b2e 100644 --- a/src/engine/OutputPort.hpp +++ b/src/engine/OutputPort.hpp @@ -39,14 +39,14 @@ namespace Ingen { class OutputPort : virtual public PortImpl { public: - OutputPort(BufferFactory& bufs, - NodeImpl* parent, - const std::string& name, - uint32_t index, - uint32_t poly, - Shared::PortType type, - const Raul::Atom& value, - size_t buffer_size); + OutputPort(BufferFactory& bufs, + NodeImpl* parent, + const Raul::Symbol& symbol, + uint32_t index, + uint32_t poly, + Shared::PortType type, + const Raul::Atom& value, + size_t buffer_size); void pre_process(Context& context); void post_process(Context& context); diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp index e9dd4f7f..22492378 100644 --- a/src/engine/PortImpl.cpp +++ b/src/engine/PortImpl.cpp @@ -40,14 +40,14 @@ namespace Ingen { using namespace Shared; -PortImpl::PortImpl(BufferFactory& bufs, - NodeImpl* const node, - const string& name, - uint32_t index, - uint32_t poly, - PortType type, - const Atom& value, - size_t buffer_size) +PortImpl::PortImpl(BufferFactory& bufs, + NodeImpl* const node, + const Raul::Symbol& name, + uint32_t index, + uint32_t poly, + PortType type, + const Atom& value, + size_t buffer_size) : GraphObjectImpl(node, name, (type == PortType::AUDIO || type == PortType::CONTROL)) , _bufs(bufs) , _index(index) diff --git a/src/engine/PortImpl.hpp b/src/engine/PortImpl.hpp index 2210431b..06887f4a 100644 --- a/src/engine/PortImpl.hpp +++ b/src/engine/PortImpl.hpp @@ -111,14 +111,14 @@ public: void set_context(Context::ID c); protected: - PortImpl(BufferFactory& bufs, - NodeImpl* node, - const std::string& name, - uint32_t index, - uint32_t poly, - Shared::PortType type, - const Raul::Atom& value, - size_t buffer_size); + PortImpl(BufferFactory& bufs, + NodeImpl* node, + const Raul::Symbol& name, + uint32_t index, + uint32_t poly, + Shared::PortType type, + const Raul::Atom& value, + size_t buffer_size); BufferFactory& _bufs; uint32_t _index; diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 024e054d..cb6a06af 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -123,24 +123,29 @@ NodeModule::show_human_names(bool b) { if (b && node()->plugin()) { Glib::Mutex::Lock lock(App::instance().world()->rdf_world->mutex()); - set_name(((PluginModel*)node()->plugin())->human_name()); + set_name(node()->plugin_model()->human_name()); } else { b = false; + set_name(node()->symbol().c_str()); } - if (!b) - set_name(node()->symbol().c_str()); + const LV2URIMap& uris = App::instance().uris(); - uint32_t index = 0; for (PortVector::const_iterator i = ports().begin(); i != ports().end(); ++i) { - Glib::ustring label(node()->port(index)->symbol().c_str()); + SharedPtr<Ingen::GUI::Port> port = PtrCast<Ingen::GUI::Port>(*i); + Glib::ustring label(port->model()->symbol().c_str()); if (b) { - Glib::ustring hn = ((PluginModel*)node()->plugin())->port_human_name(index); - if (hn != "") - label = hn; + const Raul::Atom& name_property = port->model()->get_property(uris.lv2_name); + if (name_property.type() == Atom::STRING) { + label = name_property.get_string(); + } else { + Glib::ustring hn = node()->plugin_model()->port_human_name( + port->model()->index()); + if (hn != "") + label = hn; + } } (*i)->set_name(label); - ++index; } resize(); |