summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-09 18:12:07 +0000
committerDavid Robillard <d@drobilla.net>2011-03-09 18:12:07 +0000
commit7703427f6832cb3195580fda0ab506e7c2948032 (patch)
tree14cc6c96302cd0902dcf9ed1120798c6d31acbb2 /src
parent2edb1283923b3c9b31d289342c74688975cb45fa (diff)
downloadingen-7703427f6832cb3195580fda0ab506e7c2948032.tar.gz
ingen-7703427f6832cb3195580fda0ab506e7c2948032.tar.bz2
ingen-7703427f6832cb3195580fda0ab506e7c2948032.zip
Update for new SLV2 API.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3058 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/client/PluginModel.cpp6
-rw-r--r--src/engine/LV2Node.cpp24
-rw-r--r--src/engine/NodeFactory.cpp9
-rw-r--r--src/gui/NodeMenu.cpp14
-rw-r--r--src/gui/PatchCanvas.cpp4
5 files changed, 26 insertions, 31 deletions
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 3bc97369..8e826368 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -105,8 +105,8 @@ PluginModel::get_property(const URI& key) const
SLV2Value lv2_pred = slv2_value_new_uri(_slv2_world, key.str().c_str());
SLV2Values values = slv2_plugin_get_value(_slv2_plugin, lv2_pred);
slv2_value_free(lv2_pred);
- for (unsigned i = 0; i < slv2_values_size(values); ++i) {
- SLV2Value val = slv2_values_get_at(values, i);
+ SLV2_FOREACH(i, values) {
+ SLV2Value val = slv2_values_get(values, i);
if (slv2_value_is_uri(val)) {
ret = set_property(key, Atom(Atom::URI, slv2_value_as_uri(val)));
break;
@@ -232,7 +232,7 @@ PluginModel::get_lv2_icon_path(SLV2Plugin plugin)
SLV2Values paths = slv2_plugin_get_value(plugin, svg_icon_pred);
if (slv2_values_size(paths) > 0) {
- SLV2Value value = slv2_values_get_at(paths, 0);
+ SLV2Value value = slv2_values_get_first(paths);
if (slv2_value_is_uri(value))
result = slv2_uri_to_path(slv2_value_as_string(value));
slv2_values_free(paths);
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index 35da06ba..b6109d7f 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -249,8 +249,8 @@ LV2Node::instantiate(BufferFactory& bufs)
if (data_type == PortType::VALUE || data_type == PortType::MESSAGE) {
// Get default value, and its length
SLV2Values defaults = slv2_port_get_value(plug, id, default_pred);
- for (uint32_t i = 0; i < slv2_values_size(defaults); ++i) {
- SLV2Value d = slv2_values_get_at(defaults, i);
+ SLV2_FOREACH(i, defaults) {
+ SLV2Value d = slv2_values_get(defaults, i);
if (slv2_value_is_string(d)) {
const char* str_val = slv2_value_as_string(d);
const size_t str_val_len = strlen(str_val);
@@ -261,8 +261,8 @@ LV2Node::instantiate(BufferFactory& bufs)
// Get minimum size, if set in data
SLV2Values sizes = slv2_port_get_value(plug, id, min_size_pred);
- for (uint32_t i = 0; i < slv2_values_size(sizes); ++i) {
- SLV2Value d = slv2_values_get_at(sizes, i);
+ SLV2_FOREACH(i, sizes) {
+ SLV2Value d = slv2_values_get(sizes, i);
if (slv2_value_is_int(d)) {
size_t size_val = slv2_value_as_int(d);
port_buffer_size = size_val;
@@ -303,8 +303,8 @@ LV2Node::instantiate(BufferFactory& bufs)
// Set lv2:portProperty properties
SLV2Values properties = slv2_port_get_value(plug, id, port_property_pred);
- for (uint32_t i = 0; i < slv2_values_size(properties); ++i) {
- SLV2Value p = slv2_values_get_at(properties, i);
+ SLV2_FOREACH(i, properties) {
+ SLV2Value p = slv2_values_get(properties, i);
if (slv2_value_is_uri(p)) {
port->set_property(uris.lv2_portProperty, Raul::URI(slv2_value_as_uri(p)));
}
@@ -312,16 +312,16 @@ LV2Node::instantiate(BufferFactory& bufs)
// Set atom:supports properties
SLV2Values types = slv2_port_get_value(plug, id, supports_pred);
- for (uint32_t i = 0; i < slv2_values_size(types); ++i) {
- SLV2Value type = slv2_values_get_at(types, i);
+ SLV2_FOREACH(i, types) {
+ SLV2Value type = slv2_values_get(types, i);
if (slv2_value_is_uri(type)) {
port->add_property(uris.atom_supports, Raul::URI(slv2_value_as_uri(type)));
}
}
SLV2Values contexts = slv2_port_get_value(plug, id, context_pred);
- for (uint32_t i = 0; i < slv2_values_size(contexts); ++i) {
- SLV2Value c = slv2_values_get_at(contexts, i);
+ SLV2_FOREACH(i, contexts) {
+ SLV2Value c = slv2_values_get(contexts, i);
const char* context = slv2_value_as_string(c);
if (!strcmp(LV2_CONTEXTS_URI "#MessageContext", context)) {
if (!_message_funcs) {
@@ -331,8 +331,8 @@ LV2Node::instantiate(BufferFactory& bufs)
port->set_context(Context::MESSAGE);
} else {
warn << _lv2_plugin->uri() << " port " << i << " has unknown context "
- << slv2_value_as_string(slv2_values_get_at(contexts, i))
- << endl;
+ << slv2_value_as_string(c)
+ << endl;
}
}
diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp
index 08584c81..266a0271 100644
--- a/src/engine/NodeFactory.cpp
+++ b/src/engine/NodeFactory.cpp
@@ -124,23 +124,18 @@ NodeFactory::load_lv2_plugins()
{
SLV2Plugins plugins = slv2_world_get_all_plugins(_world->slv2_world());
- for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) {
-
- SLV2Plugin lv2_plug = slv2_plugins_get_at(plugins, i);
+ SLV2_FOREACH(i, plugins) {
+ SLV2Plugin lv2_plug = slv2_plugins_get(plugins, i);
const string uri(slv2_value_as_uri(slv2_plugin_get_uri(lv2_plug)));
-#ifndef NDEBUG
assert(_plugins.find(uri) == _plugins.end());
-#endif
LV2Plugin* const plugin = new LV2Plugin(_lv2_info, uri);
plugin->slv2_plugin(lv2_plug);
_plugins.insert(make_pair(uri, plugin));
}
-
- slv2_plugins_free(_world->slv2_world(), plugins);
}
#endif // HAVE_SLV2
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index b65a7e1f..806282fb 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -99,12 +99,12 @@ NodeMenu::init(SharedPtr<NodeModel> node)
if (presets) {
_presets_menu = Gtk::manage(new Gtk::Menu());
- for (unsigned i = 0; i < slv2_values_size(presets); ++i) {
- SLV2Value uri = slv2_values_get_at(presets, i);
+ SLV2_FOREACH(i, presets) {
+ SLV2Value uri = slv2_values_get(presets, i);
SLV2Values titles = slv2_plugin_get_value_for_subject(
plugin->slv2_plugin(), uri, title_pred);
if (titles) {
- SLV2Value title = slv2_values_get_at(titles, 0);
+ SLV2Value title = slv2_values_get_first(titles);
_presets_menu->items().push_back(
Gtk::Menu_Helpers::MenuElem(
slv2_value_as_string(title),
@@ -203,15 +203,15 @@ NodeMenu::on_preset_activated(const std::string& uri)
subject,
port_pred);
App::instance().engine()->bundle_begin();
- for (unsigned i = 0; i < slv2_values_size(ports); ++i) {
- SLV2Value uri = slv2_values_get_at(ports, i);
+ SLV2_FOREACH(i, ports) {
+ SLV2Value uri = slv2_values_get(ports, i);
SLV2Values values = slv2_plugin_get_value_for_subject(
plugin->slv2_plugin(), uri, value_pred);
SLV2Values symbols = slv2_plugin_get_value_for_subject(
plugin->slv2_plugin(), uri, symbol_pred);
if (values && symbols) {
- SLV2Value val = slv2_values_get_at(values, 0);
- SLV2Value sym = slv2_values_get_at(symbols, 0);
+ SLV2Value val = slv2_values_get_first(values);
+ SLV2Value sym = slv2_values_get_first(symbols);
App::instance().engine()->set_property(
node->path().base() + slv2_value_as_string(sym),
App::instance().uris().ingen_value,
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 52702b30..8f76e281 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -249,8 +249,8 @@ PatchCanvas::build_plugin_menu()
SLV2PluginClasses classes = slv2_world_get_plugin_classes(PluginModel::slv2_world());
LV2Children children;
- for (unsigned i = 0; i < slv2_plugin_classes_size(classes); ++i) {
- SLV2PluginClass c = slv2_plugin_classes_get_at(classes, i);
+ SLV2_FOREACH(i, classes) {
+ SLV2PluginClass c = slv2_plugin_classes_get(classes, i);
SLV2Value p = slv2_plugin_class_get_parent_uri(c);
if (!p)
p = slv2_plugin_class_get_uri(lv2_plugin);