diff options
author | David Robillard <d@drobilla.net> | 2011-04-29 02:03:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-29 02:03:23 +0000 |
commit | 8bc9aca63644d63de3ccccbb4752e79d3d3c7854 (patch) | |
tree | 7f8e4be2eab57edc3d422ad5a8d34c6ed6473b9d /src/server | |
parent | 77d22f06129e91f51e37c09c71c0917a0136dd7d (diff) | |
download | ingen-8bc9aca63644d63de3ccccbb4752e79d3d3c7854.tar.gz ingen-8bc9aca63644d63de3ccccbb4752e79d3d3c7854.tar.bz2 ingen-8bc9aca63644d63de3ccccbb4752e79d3d3c7854.zip |
Don't hide pointers behind typedefs.
Use const appropriately in API (makes it clear from the type whether objects should be freed or not).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3222 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/LV2Info.hpp | 16 | ||||
-rw-r--r-- | src/server/LV2Node.cpp | 40 | ||||
-rw-r--r-- | src/server/LV2Node.hpp | 4 | ||||
-rw-r--r-- | src/server/LV2Plugin.cpp | 4 | ||||
-rw-r--r-- | src/server/LV2Plugin.hpp | 6 | ||||
-rw-r--r-- | src/server/NodeFactory.cpp | 4 |
6 files changed, 38 insertions, 36 deletions
diff --git a/src/server/LV2Info.hpp b/src/server/LV2Info.hpp index 4f3e45f1..ff26d1f6 100644 --- a/src/server/LV2Info.hpp +++ b/src/server/LV2Info.hpp @@ -41,16 +41,16 @@ public: explicit LV2Info(Ingen::Shared::World* world); ~LV2Info(); - LilvValue input_class; - LilvValue output_class; - LilvValue control_class; - LilvValue audio_class; - LilvValue event_class; - LilvValue value_port_class; - LilvValue message_port_class; + LilvValue* input_class; + LilvValue* output_class; + LilvValue* control_class; + LilvValue* audio_class; + LilvValue* event_class; + LilvValue* value_port_class; + LilvValue* message_port_class; Ingen::Shared::World& world() { return *_world; } - LilvWorld lv2_world() { return _world->lilv_world(); } + LilvWorld* lv2_world() { return _world->lilv_world(); } private: Ingen::Shared::World* _world; diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index 04d48905..0f53b6a3 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -104,7 +104,7 @@ LV2Node::prepare_poly(BufferFactory& bufs, uint32_t poly) } if (_activated) - lilv_instance_activate((LilvInstance)(*_prepared_instances)[i].get()); + lilv_instance_activate((LilvInstance*)(*_prepared_instances)[i].get()); } return true; @@ -139,7 +139,7 @@ LV2Node::instantiate(BufferFactory& bufs) { const Ingen::Shared::LV2URIMap& uris = bufs.uris(); SharedPtr<LV2Info> info = _lv2_plugin->lv2_info(); - LilvPlugin plug = _lv2_plugin->lilv_plugin(); + const LilvPlugin* plug = _lv2_plugin->lilv_plugin(); uint32_t num_ports = lilv_plugin_get_num_ports(plug); assert(num_ports > 0); @@ -150,8 +150,8 @@ LV2Node::instantiate(BufferFactory& bufs) _features = info->world().lv2_features()->lv2_features(&info->world(), this); uint32_t port_buffer_size = 0; - LilvValue ctx_ext_uri = lilv_value_new_uri(info->lv2_world(), - LV2_CONTEXTS_URI "#MessageContext"); + LilvValue* ctx_ext_uri = lilv_value_new_uri(info->lv2_world(), + LV2_CONTEXTS_URI "#MessageContext"); for (uint32_t i = 0; i < _polyphony; ++i) { (*_instances)[i] = SharedPtr<void>( @@ -189,26 +189,26 @@ LV2Node::instantiate(BufferFactory& bufs) float* def_values = new float[num_ports]; lilv_plugin_get_port_ranges_float(plug, min_values, max_values, def_values); - LilvValue context_pred = lilv_value_new_uri(info->lv2_world(), + LilvValue* context_pred = lilv_value_new_uri(info->lv2_world(), "http://lv2plug.in/ns/ext/contexts#context"); - LilvValue default_pred = lilv_value_new_uri(info->lv2_world(), + LilvValue* default_pred = lilv_value_new_uri(info->lv2_world(), "http://lv2plug.in/ns/lv2core#default"); - LilvValue min_size_pred = lilv_value_new_uri(info->lv2_world(), + LilvValue* min_size_pred = lilv_value_new_uri(info->lv2_world(), "http://lv2plug.in/ns/ext/resize-port#minimumSize"); - LilvValue port_property_pred = lilv_value_new_uri(info->lv2_world(), + LilvValue* port_property_pred = lilv_value_new_uri(info->lv2_world(), "http://lv2plug.in/ns/lv2core#portProperty"); - LilvValue supports_pred = lilv_value_new_uri(info->lv2_world(), + LilvValue* supports_pred = lilv_value_new_uri(info->lv2_world(), "http://lv2plug.in/ns/ext/atom#supports"); //LilvValue as_large_as_pred = lilv_value_new_uri(info->lv2_world(), // "http://lv2plug.in/ns/ext/resize-port#asLargeAs"); for (uint32_t j = 0; j < num_ports; ++j) { - LilvPort id = lilv_plugin_get_port_by_index(plug, j); + const LilvPort* id = lilv_plugin_get_port_by_index(plug, j); // LV2 port symbols are guaranteed to be unique, valid C identifiers port_name = lilv_value_as_string(lilv_port_get_symbol(plug, id)); @@ -242,9 +242,9 @@ LV2Node::instantiate(BufferFactory& bufs) if (data_type == PortType::VALUE || data_type == PortType::MESSAGE) { // Get default value, and its length - LilvValues defaults = lilv_port_get_value(plug, id, default_pred); + LilvValues* defaults = lilv_port_get_value(plug, id, default_pred); LILV_FOREACH(values, i, defaults) { - LilvValue d = lilv_values_get(defaults, i); + const LilvValue* d = lilv_values_get(defaults, i); if (lilv_value_is_string(d)) { const char* str_val = lilv_value_as_string(d); const size_t str_val_len = strlen(str_val); @@ -254,9 +254,9 @@ LV2Node::instantiate(BufferFactory& bufs) } // Get minimum size, if set in data - LilvValues sizes = lilv_port_get_value(plug, id, min_size_pred); + LilvValues* sizes = lilv_port_get_value(plug, id, min_size_pred); LILV_FOREACH(values, i, sizes) { - LilvValue d = lilv_values_get(sizes, i); + const LilvValue* d = lilv_values_get(sizes, i); if (lilv_value_is_int(d)) { size_t size_val = lilv_value_as_int(d); port_buffer_size = size_val; @@ -296,26 +296,26 @@ LV2Node::instantiate(BufferFactory& bufs) } // Set lv2:portProperty properties - LilvValues properties = lilv_port_get_value(plug, id, port_property_pred); + LilvValues* properties = lilv_port_get_value(plug, id, port_property_pred); LILV_FOREACH(values, i, properties) { - LilvValue p = lilv_values_get(properties, i); + const LilvValue* p = lilv_values_get(properties, i); if (lilv_value_is_uri(p)) { port->set_property(uris.lv2_portProperty, Raul::URI(lilv_value_as_uri(p))); } } // Set atom:supports properties - LilvValues types = lilv_port_get_value(plug, id, supports_pred); + LilvValues* types = lilv_port_get_value(plug, id, supports_pred); LILV_FOREACH(values, i, types) { - LilvValue type = lilv_values_get(types, i); + const LilvValue* type = lilv_values_get(types, i); if (lilv_value_is_uri(type)) { port->add_property(uris.atom_supports, Raul::URI(lilv_value_as_uri(type))); } } - LilvValues contexts = lilv_port_get_value(plug, id, context_pred); + LilvValues* contexts = lilv_port_get_value(plug, id, context_pred); LILV_FOREACH(values, i, contexts) { - LilvValue c = lilv_values_get(contexts, i); + const LilvValue* c = lilv_values_get(contexts, i); const char* context = lilv_value_as_string(c); if (!strcmp(LV2_CONTEXTS_URI "#MessageContext", context)) { if (!_message_funcs) { diff --git a/src/server/LV2Node.hpp b/src/server/LV2Node.hpp index 29a9d717..81a6113d 100644 --- a/src/server/LV2Node.hpp +++ b/src/server/LV2Node.hpp @@ -62,7 +62,9 @@ public: IntrusivePtr<Buffer> buf, SampleCount offset); protected: - inline LilvInstance instance(uint32_t voice) { return (LilvInstance)(*_instances)[voice].get(); } + inline LilvInstance* instance(uint32_t voice) { + return (LilvInstance*)(*_instances)[voice].get(); + } typedef Raul::Array< SharedPtr<void> > Instances; diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index 75476fa4..b9768f23 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -86,7 +86,7 @@ LV2Plugin::instantiate(BufferFactory& bufs, } void -LV2Plugin::lilv_plugin(LilvPlugin p) +LV2Plugin::lilv_plugin(const LilvPlugin* p) { _lilv_plugin = p; } @@ -96,7 +96,7 @@ LV2Plugin::library_path() const { static const std::string empty_string; if (_library_path.empty()) { - LilvValue v = lilv_plugin_get_library_uri(_lilv_plugin); + const LilvValue* v = lilv_plugin_get_library_uri(_lilv_plugin); if (v) { _library_path = lilv_uri_to_path(lilv_value_as_uri(v)); } else { diff --git a/src/server/LV2Plugin.hpp b/src/server/LV2Plugin.hpp index 127300cf..6e25c671 100644 --- a/src/server/LV2Plugin.hpp +++ b/src/server/LV2Plugin.hpp @@ -61,11 +61,11 @@ public: const std::string& library_path() const; - LilvPlugin lilv_plugin() const { return _lilv_plugin; } - void lilv_plugin(LilvPlugin p); + const LilvPlugin* lilv_plugin() const { return _lilv_plugin; } + void lilv_plugin(const LilvPlugin* p); private: - LilvPlugin _lilv_plugin; + const LilvPlugin* _lilv_plugin; SharedPtr<LV2Info> _lv2_info; }; diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index 90e1a84e..611f98ea 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -127,10 +127,10 @@ NodeFactory::load_internal_plugins() void NodeFactory::load_lv2_plugins() { - LilvPlugins plugins = lilv_world_get_all_plugins(_world->lilv_world()); + const LilvPlugins* plugins = lilv_world_get_all_plugins(_world->lilv_world()); LILV_FOREACH(plugins, i, plugins) { - LilvPlugin lv2_plug = lilv_plugins_get(plugins, i); + const LilvPlugin* lv2_plug = lilv_plugins_get(plugins, i); const string uri(lilv_value_as_uri(lilv_plugin_get_uri(lv2_plug))); |