Only load default state with lilv >= 0.15.0 (currently svn only) to avoid warnings.
authorDavid Robillard <d@drobilla.net>
Sun, 27 Jan 2013 21:25:34 +0000 (21:25 +0000)
committerDavid Robillard <d@drobilla.net>
Sun, 27 Jan 2013 21:25:34 +0000 (21:25 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@14013 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/lv2_plugin.cc
libs/ardour/wscript

index d464ed6f2e004f185dd21d8dd3bdce312a45e5c8..58f5844501e11b02dd9f3ac07498d8fb8e2b0fd6 100644 (file)
@@ -303,7 +303,7 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
        lilv_node_free(state_uri);
        lilv_node_free(state_iface_uri);
 
-       _features    = (LV2_Feature**)calloc(10, sizeof(LV2_Feature*));
+       _features    = (LV2_Feature**)calloc(11, sizeof(LV2_Feature*));
        _features[0] = &_instance_access_feature;
        _features[1] = &_data_access_feature;
        _features[2] = &_make_path_feature;
@@ -311,11 +311,14 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
        _features[4] = _uri_map.urid_map_feature();
        _features[5] = _uri_map.urid_unmap_feature();
        _features[6] = &_log_feature;
-       _features[7] = &_def_state_feature;
+
+       unsigned n_features = 7;
+#ifdef HAVE_NEW_LV2
+       _features[n_features++] = &_def_state_feature;
+#endif
 
        lv2_atom_forge_init(&_impl->forge, _uri_map.urid_map());
 
-       unsigned n_features = 8;
 #ifdef HAVE_NEW_LV2
        LV2_URID atom_Int = _uri_map.uri_to_id(LV2_ATOM__Int);
        LV2_Options_Option options[] = {
@@ -387,12 +390,14 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
                throw failed_constructor();
        }
 
+#ifdef HAVE_NEW_LILV
        // Load default state
        LilvState* state = lilv_state_new_from_world(
                _world.world, _uri_map.urid_map(), lilv_plugin_get_uri(_impl->plugin));
        if (state) {
                lilv_state_restore(state, _impl->instance, NULL, NULL, 0, NULL);
        }
+#endif
 
        _sample_rate = rate;
 
index c916e4390cdcc01a866b178b12807faaf7e75183..6bd69a0964ff03f7c9574bdb2aef94da61f5f15f 100644 (file)
@@ -270,6 +270,8 @@ def configure(conf):
                           atleast_version='0.2.0', mandatory=True)
         autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
                           atleast_version='0.14.0', mandatory=True)
+        autowaf.check_pkg(conf, 'lilv-0', uselib_store='NEW_LILV',
+                          atleast_version='0.15.0', mandatory=True)
         autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL',
                           atleast_version='0.6.0', mandatory=False)
         conf.define ('LV2_SUPPORT', 1)