diff options
Diffstat (limited to 'src')
35 files changed, 222 insertions, 215 deletions
diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp index b389f358..2a00c33e 100644 --- a/src/ClashAvoider.cpp +++ b/src/ClashAvoider.cpp @@ -107,13 +107,14 @@ ClashAvoider::map_path(const Raul::Path& in) std::stringstream ss; ss << base_path << "_" << offset; if (!exists(ss.str())) { - string name = base_path.symbol(); + std::string name = base_path.symbol(); if (name == "") name = "_"; + Raul::Symbol sym(name); string str = ss.str(); InsertRecord i = _symbol_map.insert(make_pair(in, str)); Raul::debug << "HIT: offset = " << offset << ", str = " << str << endl; - offset = _store.child_name_offset(in.parent(), name, false); + offset = _store.child_name_offset(in.parent(), sym, false); _offsets.insert(make_pair(base_path, offset)); Raul::debug << " (4) " << i.first->second << endl; return i.first->second; diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 2679186b..d6e8d115 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -91,7 +91,7 @@ void ObjectModel::set_path(const Raul::Path& p) { _path = p; - _symbol = p.symbol(); + _symbol = Raul::Symbol(p.is_root() ? "root" : p.symbol()); _signal_moved.emit(); } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index ab1df485..460051a7 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -159,7 +159,7 @@ PluginModel::default_node_symbol() const if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) return Raul::Symbol::symbolify(name_atom.get_string()); else - return "_"; + return Raul::Symbol("_"); } string diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp index add13996..9170ed9b 100644 --- a/src/gui/LoadPatchWindow.cpp +++ b/src/gui/LoadPatchWindow.cpp @@ -221,7 +221,7 @@ LoadPatchWindow::avoid_symbol_clash(const Raul::Symbol& symbol) if (offset != 0) { std::stringstream ss; ss << symbol << "_" << offset; - return ss.str(); + return Raul::Symbol(ss.str()); } else { return symbol; } @@ -238,7 +238,7 @@ LoadPatchWindow::selection_changed() _symbol_entry->set_sensitive(false); } else { _symbol_entry->set_text(avoid_symbol_clash( - symbol_from_filename(get_filename()).c_str()).c_str()); + symbol_from_filename(get_filename())).c_str()); _symbol_entry->set_sensitive(true); } } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index fbbe88b1..6e6667fc 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -785,7 +785,7 @@ PatchCanvas::generate_port_name( snprintf(num_buf, sizeof(num_buf), "%u", i); symbol = sym_base + "_"; symbol += num_buf; - if (!_patch->get_port(symbol)) + if (!_patch->get_port(Raul::Symbol::symbolify(symbol))) break; } @@ -832,7 +832,7 @@ PatchCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin) if (offset != 0) { std::stringstream ss; ss << symbol << "_" << offset; - symbol = ss.str(); + symbol = Raul::Symbol(ss.str()); } const URIs& uris = _app.uris(); diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index c8e72168..c770a087 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -85,10 +85,10 @@ RenameWindow::values_changed() if (symbol.length() == 0) { _message_label->set_text("Symbol must be at least 1 character"); _ok_button->property_sensitive() = false; - } else if (!Path::is_valid_name(symbol)) { + } else if (!Symbol::is_valid(symbol)) { _message_label->set_text("Symbol contains invalid characters"); _ok_button->property_sensitive() = false; - } else if (_object->symbol() != symbol && + } else if (_object->symbol().c_str() != symbol && _app->store()->object(_object->parent()->path().child(symbol))) { _message_label->set_text("An object already exists with that path"); _ok_button->property_sensitive() = false; @@ -124,7 +124,7 @@ RenameWindow::ok_clicked() const Atom& name_atom = _object->get_property(uris.lv2_name); if (Symbol::is_valid(symbol_str)) { - const Symbol& symbol(symbol_str); + const Symbol symbol(symbol_str); if (symbol != _object->symbol()) { path = _object->path().parent().child(symbol); _app->interface()->move(_object->path(), path); diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp index 16152a87..5236120b 100644 --- a/src/ingen/main.cpp +++ b/src/ingen/main.cpp @@ -160,7 +160,7 @@ main(int argc, char** argv) const Raul::Path p(path_option.get_string()); if (!p.is_root()) { parent = p.parent(); - symbol = p.symbol(); + symbol = Raul::Symbol(p.symbol()); } } else { cerr << "Invalid path given: '" << path_option << endl; diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index b8d0adbc..8407429f 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -167,7 +167,7 @@ get_port(Ingen::World* world, LOG(error) << "Port " << subject << " has no symbol" << endl; return -1; } - const Symbol port_sym = s->second.get_string(); + const Symbol port_sym(s->second.get_string()); const Path port_path = parent.child(port_sym); record = make_pair(port_path, props); @@ -330,7 +330,7 @@ parse_patch(Ingen::World* world, const Glib::ustring base_uri = model.base_uri().to_string(); - Raul::Symbol symbol = "_"; + Raul::Symbol symbol("_"); if (a_symbol) { symbol = *a_symbol; } else { diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 5ad62e7c..9e01eaf7 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -328,26 +328,27 @@ Serialiser::Impl::serialise_patch(SharedPtr<const GraphObject> patch, const URIs& uris = _world.uris(); // Always write a symbol (required by Ingen) - string symbol; + Raul::Symbol symbol("_"); GraphObject::Properties::const_iterator s = patch->properties().find(uris.lv2_symbol); if (s == patch->properties().end() || !s->second.type() == _world.forge().String || !Symbol::is_valid(s->second.get_string())) { - symbol = Glib::path_get_basename(_model->base_uri().to_c_string()); - symbol = Symbol::symbolify(symbol.substr(0, symbol.find('.'))); + const std::string base = Glib::path_get_basename( + _model->base_uri().to_c_string()); + symbol = Symbol::symbolify(base.substr(0, base.find('.'))); _model->add_statement( patch_id, Sord::Curie(world, "lv2:symbol"), - Sord::Literal(world, symbol)); + Sord::Literal(world, symbol.c_str())); } else { - symbol = s->second.get_string(); + symbol = Raul::Symbol::symbolify(s->second.get_string()); } // If the patch has no doap:name (required by LV2), use the symbol if (patch->properties().find(uris.doap_name) == patch->properties().end()) _model->add_statement(patch_id, Sord::URI(world, uris.doap_name.str()), - Sord::Literal(world, symbol)); + Sord::Literal(world, symbol.c_str())); const GraphObject::Properties props = patch->properties(Resource::INTERNAL); serialise_properties(patch_id, props); diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index bbfdbd11..349eb779 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -28,20 +28,20 @@ using namespace std; namespace Ingen { namespace Server { -DuplexPort::DuplexPort(BufferFactory& bufs, - NodeImpl* parent, - const string& name, - uint32_t index, - bool polyphonic, - uint32_t poly, - PortType type, - LV2_URID buffer_type, - const Raul::Atom& value, - size_t buffer_size, - bool is_output) - : PortImpl(bufs, parent, name, index, poly, type, buffer_type, value, buffer_size) - , InputPort(bufs, parent, name, index, poly, type, buffer_type, value, buffer_size) - , OutputPort(bufs, parent, name, index, poly, type, buffer_type, value, buffer_size) +DuplexPort::DuplexPort(BufferFactory& bufs, + NodeImpl* parent, + const Raul::Symbol& symbol, + uint32_t index, + bool polyphonic, + uint32_t poly, + PortType type, + LV2_URID buffer_type, + const Raul::Atom& value, + size_t buffer_size, + bool is_output) + : PortImpl(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) + , InputPort(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) + , OutputPort(bufs, parent, symbol, index, poly, type, buffer_type, value, buffer_size) , _is_output(is_output) { set_property(bufs.uris().ingen_polyphonic, diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index f52d1494..042f3681 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -39,17 +39,17 @@ class NodeImpl; class DuplexPort : public InputPort, public OutputPort { public: - DuplexPort(BufferFactory& bufs, - NodeImpl* parent, - const std::string& name, - uint32_t index, - bool polyphonic, - uint32_t poly, - PortType type, - LV2_URID buffer_type, - const Raul::Atom& value, - size_t buffer_size, - bool is_output); + DuplexPort(BufferFactory& bufs, + NodeImpl* parent, + const Raul::Symbol& symbol, + uint32_t index, + bool polyphonic, + uint32_t poly, + PortType type, + LV2_URID buffer_type, + const Raul::Atom& value, + size_t buffer_size, + bool is_output); virtual ~DuplexPort() {} diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index e89bb3ea..504c78bc 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -188,7 +188,7 @@ Engine::activate() // Create root patch if (!_root_patch) { _root_patch = new PatchImpl( - *this, "root", 1, NULL, _driver->sample_rate(), 1); + *this, Raul::Symbol("root"), 1, NULL, _driver->sample_rate(), 1); _root_patch->set_property( uris.rdf_type, Resource::Property(uris.ingen_Patch, Resource::INTERNAL)); diff --git a/src/server/GraphObjectImpl.hpp b/src/server/GraphObjectImpl.hpp index 45a9e979..fa9cb6b9 100644 --- a/src/server/GraphObjectImpl.hpp +++ b/src/server/GraphObjectImpl.hpp @@ -62,8 +62,11 @@ public: /** Rename */ virtual void set_path(const Raul::Path& new_path) { - _path = new_path; - _symbol = new_path.symbol(); + _path = new_path; + const char* const new_sym = new_path.symbol(); + if (new_sym[0] != '\0') { + _symbol = Raul::Symbol(new_sym); + } } const Raul::Atom& get_property(const Raul::URI& key) const; diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index 587acaf6..0f1d380b 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -42,11 +42,11 @@ InternalPlugin::InternalPlugin(URIs& uris, } NodeImpl* -InternalPlugin::instantiate(BufferFactory& bufs, - const string& name, - bool polyphonic, - PatchImpl* parent, - Engine& engine) +InternalPlugin::instantiate(BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + Engine& engine) { assert(_type == Internal); @@ -55,13 +55,13 @@ InternalPlugin::instantiate(BufferFactory& bufs, const string uri_str = uri().str(); if (uri_str == NS_INTERNALS "Controller") { - return new ControllerNode(this, bufs, name, polyphonic, parent, srate); + return new ControllerNode(this, bufs, symbol, polyphonic, parent, srate); } else if (uri_str == NS_INTERNALS "Delay") { - return new DelayNode(this, bufs, name, polyphonic, parent, srate); + return new DelayNode(this, bufs, symbol, polyphonic, parent, srate); } else if (uri_str == NS_INTERNALS "Note") { - return new NoteNode(this, bufs, name, polyphonic, parent, srate); + return new NoteNode(this, bufs, symbol, polyphonic, parent, srate); } else if (uri_str == NS_INTERNALS "Trigger") { - return new TriggerNode(this, bufs, name, polyphonic, parent, srate); + return new TriggerNode(this, bufs, symbol, polyphonic, parent, srate); } else { return NULL; } diff --git a/src/server/InternalPlugin.hpp b/src/server/InternalPlugin.hpp index 5c89e3c0..043b56cb 100644 --- a/src/server/InternalPlugin.hpp +++ b/src/server/InternalPlugin.hpp @@ -42,16 +42,16 @@ public: const std::string& uri, const std::string& symbol); - NodeImpl* instantiate(BufferFactory& bufs, - const std::string& name, - bool polyphonic, - PatchImpl* parent, - Engine& engine); + NodeImpl* instantiate(BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + Engine& engine); - const std::string symbol() const { return _symbol; } + const Raul::Symbol symbol() const { return _symbol; } private: - const std::string _symbol; + const Raul::Symbol _symbol; }; } // namespace Server diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 2a8fb03d..646a8bbf 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -49,12 +49,12 @@ namespace Server { * Object is not usable until instantiate() is called with success. * (It _will_ crash!) */ -LV2Node::LV2Node(LV2Plugin* plugin, - const string& name, - bool polyphonic, - PatchImpl* parent, - SampleRate srate) - : NodeImpl(plugin, name, polyphonic, parent, srate) +LV2Node::LV2Node(LV2Plugin* plugin, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, symbol, polyphonic, parent, srate) , _lv2_plugin(plugin) , _instances(NULL) , _prepared_instances(NULL) @@ -210,16 +210,10 @@ LV2Node::instantiate(BufferFactory& bufs) for (uint32_t j = 0; j < num_ports; ++j) { const LilvPort* id = lilv_plugin_get_port_by_index(plug, j); - // LV2 port symbols are guaranteed to be unique, valid C identifiers - const std::string port_sym = lilv_node_as_string( - lilv_port_get_symbol(plug, id)); - - if (!Raul::Symbol::is_valid(port_sym)) { - Raul::error(Raul::fmt("<%1%> port %2% has invalid symbol `%3'\n") - % _lv2_plugin->uri() % j % port_sym); - ret = false; - break; - } + /* LV2 port symbols are guaranteed to be unique, valid C identifiers, + and Lilv guarantees that lilv_port_get_symbol() is valid. */ + const Raul::Symbol port_sym( + lilv_node_as_string(lilv_port_get_symbol(plug, id))); // Get port type Raul::Atom val; @@ -313,7 +307,7 @@ LV2Node::instantiate(BufferFactory& bufs) if (port_type == PortType::UNKNOWN || direction == UNKNOWN) { Raul::error(Raul::fmt("<%1%> port %2% has unknown type or direction\n") - % _lv2_plugin->uri() % port_sym); + % _lv2_plugin->uri() % port_sym.c_str()); ret = false; break; } diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp index b83cf943..a012b87a 100644 --- a/src/server/LV2Node.hpp +++ b/src/server/LV2Node.hpp @@ -39,11 +39,11 @@ class LV2Plugin; class LV2Node : public NodeImpl { public: - LV2Node(LV2Plugin* plugin, - const std::string& name, - bool polyphonic, - PatchImpl* parent, - SampleRate srate); + LV2Node(LV2Plugin* plugin, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); ~LV2Node(); diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index c5fcd6cc..ddd58aca 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -36,35 +36,35 @@ LV2Plugin::LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri) set_property(_uris.rdf_type, _uris.lv2_Plugin); } -const string +const Raul::Symbol LV2Plugin::symbol() const { string working = uri().str(); - if (working[working.length()-1] == '/') - working = working.substr(0, working.length()-1); + if (working[working.length() - 1] == '/') + working = working.substr(0, working.length() - 1); while (working.length() > 0) { size_t last_slash = working.find_last_of("/"); const string symbol = working.substr(last_slash+1); if ( (symbol[0] >= 'a' && symbol[0] <= 'z') || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) - return Raul::Path::nameify(symbol); + return Raul::Symbol::symbolify(symbol); else working = working.substr(0, last_slash); } - return "lv2_symbol"; + return Raul::Symbol("lv2_symbol"); } NodeImpl* -LV2Plugin::instantiate(BufferFactory& bufs, - const string& name, - bool polyphonic, - PatchImpl* parent, - Engine& engine) +LV2Plugin::instantiate(BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + Engine& engine) { LV2Node* n = new LV2Node( - this, name, polyphonic, parent, engine.driver()->sample_rate()); + this, symbol, polyphonic, parent, engine.driver()->sample_rate()); if (!n->instantiate(bufs)) { delete n; diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index 71f292b7..9cf69daa 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -42,13 +42,13 @@ class LV2Plugin : public PluginImpl public: LV2Plugin(SharedPtr<LV2Info> lv2_info, const std::string& uri); - NodeImpl* instantiate(BufferFactory& bufs, - const std::string& name, - bool polyphonic, - PatchImpl* parent, - Engine& engine); + NodeImpl* instantiate(BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + Engine& engine); - const std::string symbol() const; + const Raul::Symbol symbol() const; SharedPtr<LV2Info> lv2_info() const { return _lv2_info; } diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index 35badeb6..9b1e1a1f 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -246,13 +246,13 @@ PatchImpl::num_ports_non_rt() const /** Create a port. Not realtime safe. */ PortImpl* -PatchImpl::create_port(BufferFactory& bufs, - const string& name, - PortType type, - LV2_URID buffer_type, - uint32_t buffer_size, - bool is_output, - bool polyphonic) +PatchImpl::create_port(BufferFactory& bufs, + const Raul::Symbol& symbol, + PortType type, + LV2_URID buffer_type, + uint32_t buffer_size, + bool is_output, + bool polyphonic) { if (type == PortType::UNKNOWN) { Raul::error << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl; @@ -263,7 +263,7 @@ PatchImpl::create_port(BufferFactory& bufs, if (type == PortType::CONTROL || type == PortType::CV) value = bufs.forge().make(0.0f); - return new DuplexPort(bufs, this, name, num_ports_non_rt(), polyphonic, _polyphony, + return new DuplexPort(bufs, this, symbol, num_ports_non_rt(), polyphonic, _polyphony, type, buffer_type, value, buffer_size, is_output); } @@ -275,7 +275,7 @@ PatchImpl::create_port(BufferFactory& bufs, * Realtime safe. Preprocessing thread only. */ PatchImpl::Ports::Node* -PatchImpl::remove_port(const string& symbol) +PatchImpl::remove_port(const Raul::Symbol& symbol) { ThreadManager::assert_thread(THREAD_PRE_PROCESS); diff --git a/src/server/PatchImpl.hpp b/src/server/PatchImpl.hpp index 1204eeee..ac8a80ca 100644 --- a/src/server/PatchImpl.hpp +++ b/src/server/PatchImpl.hpp @@ -106,13 +106,13 @@ public: uint32_t num_ports_non_rt() const; - PortImpl* create_port(BufferFactory& bufs, - const std::string& name, - PortType type, - LV2_URID buffer_type, - uint32_t buffer_size, - bool is_output, - bool polyphonic); + PortImpl* create_port(BufferFactory& bufs, + const Raul::Symbol& symbol, + PortType type, + LV2_URID buffer_type, + uint32_t buffer_size, + bool is_output, + bool polyphonic); typedef Raul::List<PortImpl*> Ports; @@ -126,7 +126,7 @@ public: _outputs.push_back(port); } - Ports::Node* remove_port(const std::string& name); + Ports::Node* remove_port(const Raul::Symbol& symbol); void clear_ports(); void add_edge(SharedPtr<EdgeImpl> c); diff --git a/src/server/PatchPlugin.hpp b/src/server/PatchPlugin.hpp index 860ddd78..fc5d808f 100644 --- a/src/server/PatchPlugin.hpp +++ b/src/server/PatchPlugin.hpp @@ -39,17 +39,17 @@ public: : PluginImpl(uris, Plugin::Patch, uri) {} - NodeImpl* instantiate(BufferFactory& bufs, - const std::string& name, - bool polyphonic, - PatchImpl* parent, - Engine& engine) + NodeImpl* instantiate(BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + Engine& engine) { return NULL; } - const std::string symbol() const { return "patch"; } - const std::string name() const { return "Ingen Patch"; } + const Raul::Symbol symbol() const { return Raul::Symbol("patch"); } + const std::string name() const { return "Ingen Patch"; } private: const std::string _symbol; diff --git a/src/server/PluginImpl.hpp b/src/server/PluginImpl.hpp index 1031c8e3..8ef569ab 100644 --- a/src/server/PluginImpl.hpp +++ b/src/server/PluginImpl.hpp @@ -24,6 +24,7 @@ #include "ingen/Plugin.hpp" #include "ingen/Resource.hpp" +#include "raul/Symbol.hpp" namespace Ingen { @@ -51,16 +52,16 @@ public: , _type(type) {} - virtual NodeImpl* instantiate(BufferFactory& bufs, - const std::string& name, - bool polyphonic, - PatchImpl* parent, + virtual NodeImpl* instantiate(BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, Engine& engine) = 0; - virtual const std::string symbol() const = 0; + virtual const Raul::Symbol symbol() const = 0; - Plugin::Type type() const { return _type; } - void type(Plugin::Type t) { _type = t; } + Plugin::Type type() const { return _type; } + void type(Plugin::Type t) { _type = t; } protected: Plugin::Type _type; diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index f1b65fa3..27b5ce50 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -53,6 +53,10 @@ CreateNode::pre_process() typedef Resource::Properties::const_iterator iterator; + if (_path.is_root()) { + return Event::pre_process_done(BAD_URI, _path); + } + std::string plugin_uri; const iterator t = _properties.find(uris.ingen_prototype); if (t != _properties.end() && t->second.type() == uris.forge.URI) { @@ -81,7 +85,7 @@ CreateNode::pre_process() p->second.get_bool()); if (!(_node = plugin->instantiate(*_engine.buffer_factory(), - _path.symbol(), + Raul::Symbol(_path.symbol()), polyphonic, _patch, _engine))) { diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index b29ca667..0fe613ba 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -51,11 +51,9 @@ CreatePatch::pre_process() return Event::pre_process_done(EXISTS, _path); } - const Raul::Path& path = (const Raul::Path&)_path; - - _parent = _engine.engine_store()->find_patch(path.parent()); + _parent = _engine.engine_store()->find_patch(_path.parent()); if (!_parent) { - return Event::pre_process_done(PARENT_NOT_FOUND, path.parent()); + return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } const Ingen::URIs& uris = _engine.world()->uris(); @@ -70,14 +68,15 @@ CreatePatch::pre_process() } if (int_poly < 1 || int_poly > 128) { - return Event::pre_process_done(INVALID_POLY, path); + return Event::pre_process_done(INVALID_POLY, _path); } if (int_poly == _parent->internal_poly()) { ext_poly = int_poly; } - _patch = new PatchImpl(_engine, path.symbol(), ext_poly, _parent, + const Raul::Symbol symbol((_path.is_root()) ? "root" : _path.symbol()); + _patch = new PatchImpl(_engine, symbol, ext_poly, _parent, _engine.driver()->sample_rate(), int_poly); _patch->properties().insert(_properties.begin(), _properties.end()); _patch->add_property(uris.rdf_type, uris.ingen_Patch); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index c156c13a..df9ebb6e 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -88,6 +88,10 @@ CreatePort::pre_process() if (_port_type == PortType::UNKNOWN) { return Event::pre_process_done(UNKNOWN_TYPE, _path); } + + if (_path.is_root()) { + return Event::pre_process_done(BAD_URI, _path); + } if (_engine.engine_store()->find_object(_path)) { return Event::pre_process_done(_status, _path); @@ -122,7 +126,7 @@ CreatePort::pre_process() poly_i->second.get_bool()); if (!(_patch_port = _patch->create_port( - *_engine.buffer_factory(), _path.symbol(), + *_engine.buffer_factory(), Raul::Symbol(_path.symbol()), _port_type, _buf_type, buf_size, _is_output, polyphonic))) { return Event::pre_process_done(CREATION_FAILED, _path); } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index b16a1f8d..5a88de9f 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -87,7 +87,7 @@ Delete::pre_process() if (_node && !_path.is_root()) { assert(_node->parent_patch()); - _patch_node_listnode = _node->parent_patch()->remove_node(_path.symbol()); + _patch_node_listnode = _node->parent_patch()->remove_node(Raul::Symbol(_path.symbol())); if (_patch_node_listnode) { assert(_patch_node_listnode->elem() == _node.get()); @@ -100,7 +100,7 @@ Delete::pre_process() } } else if (_port) { assert(_port->parent_patch()); - _patch_port_listnode = _port->parent_patch()->remove_port(_path.symbol()); + _patch_port_listnode = _port->parent_patch()->remove_port(Raul::Symbol(_path.symbol())); if (_patch_port_listnode) { assert(_patch_port_listnode->elem() == _port.get()); diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index a088488c..09eafa87 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -42,24 +42,24 @@ InternalPlugin* ControllerNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Controller", "controller"); } -ControllerNode::ControllerNode(InternalPlugin* plugin, - BufferFactory& bufs, - const string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate) - : NodeImpl(plugin, path, false, parent, srate) +ControllerNode::ControllerNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, symbol, false, parent, srate) , _learning(false) { const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(6); - _midi_in_port = new InputPort(bufs, this, "input", 0, 1, + _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, 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; - _param_port = new InputPort(bufs, this, "controller", 1, 1, + _param_port = new InputPort(bufs, this, Raul::Symbol("controller"), 1, 1, PortType::CONTROL, 0, bufs.forge().make(0.0f)); _param_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); _param_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f)); @@ -67,23 +67,23 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, _param_port->set_property(uris.lv2_name, bufs.forge().alloc("Controller")); _ports->at(1) = _param_port; - _log_port = new InputPort(bufs, this, "logarithmic", 2, 1, + _log_port = new InputPort(bufs, this, Raul::Symbol("logarithmic"), 2, 1, PortType::CONTROL, 0, bufs.forge().make(0.0f)); _log_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _log_port->set_property(uris.lv2_name, bufs.forge().alloc("Logarithmic")); _ports->at(2) = _log_port; - _min_port = new InputPort(bufs, this, "minimum", 3, 1, + _min_port = new InputPort(bufs, this, Raul::Symbol("minimum"), 3, 1, PortType::CONTROL, 0, bufs.forge().make(0.0f)); _min_port->set_property(uris.lv2_name, bufs.forge().alloc("Minimum")); _ports->at(3) = _min_port; - _max_port = new InputPort(bufs, this, "maximum", 4, 1, + _max_port = new InputPort(bufs, this, Raul::Symbol("maximum"), 4, 1, PortType::CONTROL, 0, bufs.forge().make(1.0f)); _max_port->set_property(uris.lv2_name, bufs.forge().alloc("Maximum")); _ports->at(4) = _max_port; - _audio_port = new OutputPort(bufs, this, "output", 5, 1, + _audio_port = new OutputPort(bufs, this, Raul::Symbol("output"), 5, 1, PortType::CV, 0, bufs.forge().make(0.0f)); _audio_port->set_property(uris.lv2_name, bufs.forge().alloc("Output")); _ports->at(5) = _audio_port; diff --git a/src/server/internals/Controller.hpp b/src/server/internals/Controller.hpp index e4717247..31e5f306 100644 --- a/src/server/internals/Controller.hpp +++ b/src/server/internals/Controller.hpp @@ -39,12 +39,12 @@ namespace Internals { class ControllerNode : public NodeImpl { public: - ControllerNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate); + ControllerNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); void process(ProcessContext& context); diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index 01a48683..f687a04e 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -53,13 +53,13 @@ InternalPlugin* DelayNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Delay", "delay"); } -DelayNode::DelayNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate) - : NodeImpl(plugin, path, polyphonic, parent, srate) +DelayNode::DelayNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, symbol, polyphonic, parent, srate) , _buffer(0) , _buffer_length(0) , _buffer_mask(0) @@ -72,7 +72,7 @@ DelayNode::DelayNode(InternalPlugin* plugin, _last_delay_time = default_delay; _delay_samples = default_delay; - _delay_port = new InputPort(bufs, this, "delay", 1, _polyphony, + _delay_port = new InputPort(bufs, this, Raul::Symbol("delay"), 1, _polyphony, PortType::CONTROL, 0, bufs.forge().make(default_delay)); _delay_port->set_property(uris.lv2_name, bufs.forge().alloc("Delay")); _delay_port->set_property(uris.lv2_default, bufs.forge().make(default_delay)); @@ -80,12 +80,12 @@ DelayNode::DelayNode(InternalPlugin* plugin, _delay_port->set_property(uris.lv2_maximum, bufs.forge().make(MAX_DELAY_SECONDS)); _ports->at(0) = _delay_port; - _in_port = new InputPort(bufs, this, "in", 0, 1, + _in_port = new InputPort(bufs, this, Raul::Symbol("in"), 0, 1, PortType::AUDIO, 0, bufs.forge().make(0.0f)); _in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); _ports->at(1) = _in_port; - _out_port = new OutputPort(bufs, this, "out", 0, 1, + _out_port = new OutputPort(bufs, this, Raul::Symbol("out"), 0, 1, PortType::AUDIO, 0, bufs.forge().make(0.0f)); _out_port->set_property(uris.lv2_name, bufs.forge().alloc("Output")); diff --git a/src/server/internals/Delay.hpp b/src/server/internals/Delay.hpp index 4609eaa0..047fa41e 100644 --- a/src/server/internals/Delay.hpp +++ b/src/server/internals/Delay.hpp @@ -35,12 +35,12 @@ namespace Internals { class DelayNode : public NodeImpl { public: - DelayNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate); + DelayNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); ~DelayNode(); diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 3970169b..d8993659 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -49,13 +49,13 @@ InternalPlugin* NoteNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Note", "note"); } -NoteNode::NoteNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate) - : NodeImpl(plugin, path, polyphonic, parent, srate) +NoteNode::NoteNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, symbol, polyphonic, parent, srate) , _voices(new Raul::Array<Voice>(_polyphony)) , _prepared_voices(NULL) , _sustain(false) @@ -63,32 +63,32 @@ NoteNode::NoteNode(InternalPlugin* plugin, const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(5); - _midi_in_port = new InputPort(bufs, this, "input", 0, 1, + _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, 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; - _freq_port = new OutputPort(bufs, this, "frequency", 1, _polyphony, + _freq_port = new OutputPort(bufs, this, Raul::Symbol("frequency"), 1, _polyphony, PortType::CV, 0, bufs.forge().make(440.0f)); _freq_port->set_property(uris.lv2_name, bufs.forge().alloc("Frequency")); _freq_port->set_property(uris.lv2_minimum, bufs.forge().make(16.0f)); _freq_port->set_property(uris.lv2_maximum, bufs.forge().make(25088.0f)); _ports->at(1) = _freq_port; - _vel_port = new OutputPort(bufs, this, "velocity", 2, _polyphony, + _vel_port = new OutputPort(bufs, this, Raul::Symbol("velocity"), 2, _polyphony, PortType::CV, 0, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_maximum, bufs.forge().make(1.0f)); _vel_port->set_property(uris.lv2_name, bufs.forge().alloc("Velocity")); _ports->at(2) = _vel_port; - _gate_port = new OutputPort(bufs, this, "gate", 3, _polyphony, + _gate_port = new OutputPort(bufs, this, Raul::Symbol("gate"), 3, _polyphony, PortType::CV, 0, bufs.forge().make(0.0f)); _gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _gate_port->set_property(uris.lv2_name, bufs.forge().alloc("Gate")); _ports->at(3) = _gate_port; - _trig_port = new OutputPort(bufs, this, "trigger", 4, _polyphony, + _trig_port = new OutputPort(bufs, this, Raul::Symbol("trigger"), 4, _polyphony, PortType::CV, 0, bufs.forge().make(0.0f)); _trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _trig_port->set_property(uris.lv2_name, bufs.forge().alloc("Trigger")); diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index ed7fd6b0..9cf07a05 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -39,12 +39,12 @@ namespace Internals { class NoteNode : public NodeImpl { public: - NoteNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate); + NoteNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); ~NoteNode(); diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 0eb0c9f1..ca37bd59 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -44,24 +44,24 @@ InternalPlugin* TriggerNode::internal_plugin(URIs& uris) { return new InternalPlugin(uris, NS_INTERNALS "Trigger", "trigger"); } -TriggerNode::TriggerNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate) - : NodeImpl(plugin, path, false, parent, srate) +TriggerNode::TriggerNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate) + : NodeImpl(plugin, symbol, false, parent, srate) , _learning(false) { const Ingen::URIs& uris = bufs.uris(); _ports = new Raul::Array<PortImpl*>(5); - _midi_in_port = new InputPort(bufs, this, "input", 0, 1, + _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, 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; - _note_port = new InputPort(bufs, this, "note", 1, 1, + _note_port = new InputPort(bufs, this, Raul::Symbol("note"), 1, 1, PortType::CONTROL, 0, bufs.forge().make(60.0f)); _note_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); _note_port->set_property(uris.lv2_maximum, bufs.forge().make(127.0f)); @@ -69,19 +69,19 @@ TriggerNode::TriggerNode(InternalPlugin* plugin, _note_port->set_property(uris.lv2_name, bufs.forge().alloc("Note")); _ports->at(1) = _note_port; - _gate_port = new OutputPort(bufs, this, "gate", 2, 1, + _gate_port = new OutputPort(bufs, this, Raul::Symbol("gate"), 2, 1, PortType::CV, 0, bufs.forge().make(0.0f)); _gate_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _gate_port->set_property(uris.lv2_name, bufs.forge().alloc("Gate")); _ports->at(2) = _gate_port; - _trig_port = new OutputPort(bufs, this, "trigger", 3, 1, + _trig_port = new OutputPort(bufs, this, Raul::Symbol("trigger"), 3, 1, PortType::CV, 0, bufs.forge().make(0.0f)); _trig_port->set_property(uris.lv2_portProperty, uris.lv2_toggled); _trig_port->set_property(uris.lv2_name, bufs.forge().alloc("Trigger")); _ports->at(3) = _trig_port; - _vel_port = new OutputPort(bufs, this, "velocity", 4, 1, + _vel_port = new OutputPort(bufs, this, Raul::Symbol("velocity"), 4, 1, PortType::CV, 0, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_minimum, bufs.forge().make(0.0f)); _vel_port->set_property(uris.lv2_maximum, bufs.forge().make(1.0f)); diff --git a/src/server/internals/Trigger.hpp b/src/server/internals/Trigger.hpp index a9a561ee..f9953718 100644 --- a/src/server/internals/Trigger.hpp +++ b/src/server/internals/Trigger.hpp @@ -42,12 +42,12 @@ namespace Internals { class TriggerNode : public NodeImpl { public: - TriggerNode(InternalPlugin* plugin, - BufferFactory& bufs, - const std::string& path, - bool polyphonic, - PatchImpl* parent, - SampleRate srate); + TriggerNode(InternalPlugin* plugin, + BufferFactory& bufs, + const Raul::Symbol& symbol, + bool polyphonic, + PatchImpl* parent, + SampleRate srate); void process(ProcessContext& context); |