summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/InputPort.cpp18
-rw-r--r--src/engine/InputPort.hpp16
-rw-r--r--src/engine/LADSPANode.cpp45
-rw-r--r--src/engine/OutputPort.cpp18
-rw-r--r--src/engine/OutputPort.hpp16
-rw-r--r--src/engine/PortImpl.cpp16
-rw-r--r--src/engine/PortImpl.hpp16
7 files changed, 67 insertions, 78 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;